PDA

View Full Version : Reparenting widget to Win32 application



RThaden
23rd February 2009, 18:21
Hi all,

I hope, somebody can help me with this:

I have a Qt application which should be integrated into a Win32 application as a plugin. I just have to export a window handle and set some callbacks. Seems easy.
What I do is:



Application app(argc, argv);
MainWdg* widget = new MainWdg();
widget->show();

QWidget* wdg = app.activeWindow();
QMyThread* t = new QMyThread(wdg);
t->moveToThread(t);
t->start();
QObject::connect(t, SIGNAL(finished()), &app, SLOT(quit()) );


and in run()


QMyThread::run() {
HANDLE hwnd=wdg->winId();
//inform Server to embed the console in its panel
ExportWindowHandle(hwnd);
exec();
}


The ExportWindowHandle function just does SetParent with the hwnd and reparents my window with the frame window in the "server app".

What happens is: the window is nicely integrated into the server app, but I am not able to use the buttons with the mouse. I have drop-down lists in my window, which I can drop down by the mouse, but the lists appear at a different position. I, however, can use keyboard shortcuts and I can set a focus to a button with the mouse and then press space.
What's going wrong here? Do I miss something?

Thanks in advance for any clue...

Rainer