First of all,sorry for my english.
I wrote a FireBreath plugin with QT and the plugin can show normally.
But when I click a button in the plugin window,nothing happened.And all widgets like this.
But that button changed when I resize the browser.
Am i forgot some event-handling or window-updating operations in QT?
Thanks for any advice!
The QApplication
created in onPluginReady()
function.
void MediaPlayerPlugin::onPluginReady()
{
static int argc=0;
static char **argv={ 0 };
new QApplication(argc, argv);
}
And the QWidget
is a child of the plugin window(note:the m_player
is a QWidget
subclass).
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;
}
My guess would be that QApplication is going to essentially take over the process it is running in, which is a problem when you are running as a plugin. You don't own the process -- you don't get to decide any of the interesting details.
Short answer is that if there is a way to do this, I've not found it. One instance where I needed to do something similar I ended up launching the QApplication executable as a separate process and communicated with it via STDIN/STDOUT.