a0ec35d5f2
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>
33 lines
653 B
C++
33 lines
653 B
C++
// Copyright (C) 2017 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
#include <QApplication>
|
|
#include <QDebug>
|
|
#include <QWindow>
|
|
|
|
#include "window.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QApplication app(argc, argv);
|
|
|
|
QStringList args = app.arguments();
|
|
|
|
WId winId = 0;
|
|
if (args.count() > 1) {
|
|
bool ok;
|
|
winId = args[1].toUInt(&ok);
|
|
Q_ASSERT(ok);
|
|
}
|
|
|
|
Window window;
|
|
|
|
QWindow *foreign = QWindow::fromWinId(winId);
|
|
Q_ASSERT(foreign != 0);
|
|
|
|
window.windowHandle()->setParent(foreign);
|
|
window.show();
|
|
|
|
return app.exec();
|
|
}
|