Question

With wxWidgets I use the following code:

HWND main_window = ...
...
wxWindow *w = new wxWindow();
wxWindow *window = w->CreateWindowFromHWND(0, (WXHWND) main_window);

How do I do the same thing in Qt? The HWND is the handle of the window I want as the parent window for the new QtWidget.

Was it helpful?

Solution

Use the create method of QWidget.

HWND main_window = ...
...
QWidget *w = new QWidget();
w->create((WinId)main_window);

OTHER TIPS

Have you tried the QWinWidget class from the Qt/MFC Migration Framework?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top