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.
Use the create method of QWidget.
HWND main_window = ...
...
QWidget *w = new QWidget();
w->create((WinId)main_window);
您是否尝试过Qt / MFC迁移框架中的QWinWidget
类?
How about fromWinId https://doc-snapshots.qt.io/qt6-dev/qwindow.html#fromWinId
Creates a local representation of a window created by another process or by using native libraries below Qt.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.