summaryrefslogtreecommitdiffstats
path: root/tests/manual/xembed/qt-client-widget/main.cpp
blob: bd8b05b05431a5dbc1f06b7b5fd470fc1051e196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#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();
}