From 67e613963dddf2ecef7f26a4fea0c7709a211c49 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 28 Nov 2011 11:32:39 +0100 Subject: Polish the HelloWindow example. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add window menu (enabling the close button on Windows) - Query threaded Open GL capability. Change-Id: I938f154e242dba584e2f597ac44294ab5d3b7141 Reviewed-by: Samuel Rødal --- examples/opengl/hellowindow/hellowindow.cpp | 2 +- examples/opengl/hellowindow/hellowindow.pro | 2 +- examples/opengl/hellowindow/main.cpp | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'examples/opengl/hellowindow') diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 2cd3f8a1d3..2903ddd743 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -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)); diff --git a/examples/opengl/hellowindow/hellowindow.pro b/examples/opengl/hellowindow/hellowindow.pro index 555dc83574..dc724421f5 100644 --- a/examples/opengl/hellowindow/hellowindow.pro +++ b/examples/opengl/hellowindow/hellowindow.pro @@ -5,7 +5,7 @@ TEMPLATE = app DEPENDPATH += . INCLUDEPATH += . - +QT += gui-private core-private # Input HEADERS += hellowindow.h SOURCES += hellowindow.cpp main.cpp diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp index 7d454f65a6..4a11aa1c7a 100644 --- a/examples/opengl/hellowindow/main.cpp +++ b/examples/opengl/hellowindow/main.cpp @@ -39,6 +39,8 @@ ****************************************************************************/ #include +#include +#include #include #include @@ -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(); -- cgit v1.2.3