File indexing completed on 2024-11-10 04:58:10

0001 /*
0002     SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
0003     SPDX-FileCopyrightText: 2022 Ilya Fedin <fedin-ilja2010@ya.ru>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #include <QtWidgets>
0009 
0010 int main(int argc, char *argv[])
0011 {
0012     QApplication app(argc, argv);
0013     QWidget window1(nullptr, Qt::Window);
0014     window1.setWindowTitle("Window 1");
0015     window1.setLayout(new QVBoxLayout);
0016     QPushButton p("Raise the Window 2");
0017     window1.layout()->addWidget(&p);
0018     window1.show();
0019 
0020     QWidget window2(nullptr, Qt::Window);
0021     window2.setWindowTitle("Window 2");
0022     window2.show();
0023 
0024     QObject::connect(&p, &QPushButton::clicked, window2.windowHandle(), &QWindow::requestActivate);
0025 
0026     return app.exec();
0027 }