【发布时间】:2014-12-23 09:17:16
【问题描述】:
首先,对不起我的英语。
我用QT写了一个FireBreath插件,插件可以正常显示。
但是当我点击插件窗口中的一个按钮时,什么都没有发生。所有的小部件都是这样的。
但是当我调整浏览器大小时,那个按钮发生了变化。
我是否忘记了 QT 中的一些事件处理或窗口更新操作?
感谢您的建议!
在onPluginReady()函数中创建的QApplication。
void MediaPlayerPlugin::onPluginReady()
{
static int argc=0;
static char **argv={ 0 };
new QApplication(argc, argv);
}
QWidget 是插件窗口的子类(注意:m_player 是 QWidget 子类)。
bool MediaPlayerPlugin::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *pluginWindow)
{
FB::PluginWindowWin* wnd = reinterpret_cast<FB::PluginWindowWin*>(pluginWindow);
HWND hwnd = wnd->getHWND();
m_player = new MediaPlayer();
HWND childHwnd = (HWND)m_player->winId();
LONG oldLong = GetWindowLong(hwnd, GWL_STYLE);
::SetWindowLong(hwnd, GWL_STYLE, oldLong | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
::SetWindowLong(childHwnd, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
::SetParent(childHwnd, hwnd);
FB::Rect pos = wnd->getWindowPosition();
m_player->setGeometry(pos.left,pos.top,pos.right-pos.left,pos.bottom-pos.top);
m_player->show();
return true;
}
【问题讨论】:
标签: qt plugins firebreath