Polish the HelloWindow example.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Mon, 28 Nov 2011 10:32:39 +0000 (11:32 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 28 Nov 2011 14:08:01 +0000 (15:08 +0100)
- Add window menu (enabling the close button on Windows)
- Query threaded Open GL capability.

Change-Id: I938f154e242dba584e2f597ac44294ab5d3b7141
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
examples/opengl/hellowindow/hellowindow.cpp
examples/opengl/hellowindow/hellowindow.pro
examples/opengl/hellowindow/main.cpp

index 2cd3f8a..2903ddd 100644 (file)
@@ -62,7 +62,7 @@ HelloWindow::HelloWindow(Renderer *renderer)
     , m_renderer(renderer)
 {
     setSurfaceType(QWindow::OpenGLSurface);
-    setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+    setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
 
     setGeometry(QRect(10, 10, 640, 480));
 
index 555dc83..dc72442 100644 (file)
@@ -5,7 +5,7 @@
 TEMPLATE = app
 DEPENDPATH += .
 INCLUDEPATH += .
-
+QT += gui-private core-private
 # Input
 HEADERS += hellowindow.h
 SOURCES += hellowindow.cpp main.cpp
index 7d454f6..4a11aa1 100644 (file)
@@ -39,6 +39,8 @@
 ****************************************************************************/
 
 #include <QGuiApplication>
+#include <QPlatformIntegration>
+#include <private/qguiapplication_p.h>
 #include <QScreen>
 #include <QThread>
 
@@ -48,7 +50,9 @@ int main(int argc, char **argv)
 {
     QGuiApplication app(argc, argv);
 
-    bool multipleWindows = !QGuiApplication::arguments().contains(QLatin1String("--single"));
+    const bool multipleWindows =
+        QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)
+        && !QGuiApplication::arguments().contains(QLatin1String("--single"));
 
     QScreen *screen = QGuiApplication::primaryScreen();