diff --git a/examples/qpa/windows/main.cpp b/examples/qpa/windows/main.cpp index 2e03d1d57b..da189ab447 100644 --- a/examples/qpa/windows/main.cpp +++ b/examples/qpa/windows/main.cpp @@ -41,35 +41,47 @@ #include #include #include +#include #include "window.h" int main(int argc, char **argv) { + typedef QSharedPointer WindowPtr; + QGuiApplication app(argc, argv); Window a; + a.setFramePos(QPoint(10, 10)); + a.setWindowTitle(QStringLiteral("Window A")); + a.setObjectName(a.windowTitle()); a.setVisible(true); Window b; + b.setFramePos(QPoint(100, 100)); + b.setWindowTitle(QStringLiteral("Window B")); + b.setObjectName(b.windowTitle()); b.setVisible(true); Window child(&b); + child.setObjectName(QStringLiteral("ChildOfB")); child.setVisible(true); // create one window on each additional screen as well QList screens = app.screens(); + QList windows; foreach (QScreen *screen, screens) { if (screen == app.primaryScreen()) continue; - Window *window = new Window(screen); + WindowPtr window(new Window(screen)); QRect geometry = window->geometry(); geometry.moveCenter(screen->availableGeometry().center()); window->setGeometry(geometry); window->setVisible(true); window->setWindowTitle(screen->name()); + window->setObjectName(window->windowTitle()); + windows.push_back(window); } - return app.exec(); } diff --git a/examples/qpa/windows/window.cpp b/examples/qpa/windows/window.cpp index 664f74b651..a9f29274ac 100644 --- a/examples/qpa/windows/window.cpp +++ b/examples/qpa/windows/window.cpp @@ -73,10 +73,13 @@ void Window::initialize() if (parent()) setGeometry(QRect(160, 120, 320, 240)); else { - setGeometry(QRect(10, 10, 640, 480)); + setWindowFlags(windowFlags() | Qt::WindowTitleHint | Qt::WindowSystemMenuHint + | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + const QSize baseSize = QSize(640, 480); + setGeometry(QRect(geometry().topLeft(), baseSize)); setSizeIncrement(QSize(10, 10)); - setBaseSize(QSize(640, 480)); + setBaseSize(baseSize); setMinimumSize(QSize(240, 160)); setMaximumSize(QSize(800, 600)); }