tests: make xembed/qt-client-widget better

See also QX11EmbedWidget::QX11EmbedWidget() in src/gui/kernel/qx11embed_x11.cpp in qt4.

https: //github.com/qt/qt/blob/4.8/src/gui/kernel/qx11embed_x11.cpp#L475-L477

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I47504a2d8f3e33c367f092d01ee5d7e1b16b5106
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Liang Qi 2022-07-04 13:34:19 +02:00
parent aef55501bc
commit a0ec35d5f2
2 changed files with 5 additions and 1 deletions

View File

@ -21,12 +21,12 @@ int main(int argc, char *argv[])
}
Window window;
window.show();
QWindow *foreign = QWindow::fromWinId(winId);
Q_ASSERT(foreign != 0);
window.windowHandle()->setParent(foreign);
window.show();
return app.exec();
}

View File

@ -7,6 +7,10 @@
Window::Window()
{
setAttribute(Qt::WA_NativeWindow);
setAttribute(Qt::WA_DontCreateNativeAncestors);
createWinId();
QGroupBox *echoGroup = new QGroupBox(tr("Echo"));
QLabel *echoLabel = new QLabel(tr("Mode:"));