From cc36ce673545131047595c79ded1f465ec601780 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 22 May 2013 10:35:27 +0200 Subject: Disable textureinthread example when threaded gl is not available. Task-number: QTBUG-30077 Change-Id: I8b6e4b8a33819fe84c843e85d863b582cfd69439 Reviewed-by: Friedemann Kleint --- .../quick/scenegraph/textureinthread/error.qml | 49 ++++++++++++++++++++++ examples/quick/scenegraph/textureinthread/main.cpp | 12 +++++- .../scenegraph/textureinthread/textureinthread.pro | 6 ++- .../scenegraph/textureinthread/textureinthread.qrc | 3 +- 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 examples/quick/scenegraph/textureinthread/error.qml (limited to 'examples/quick/scenegraph/textureinthread') diff --git a/examples/quick/scenegraph/textureinthread/error.qml b/examples/quick/scenegraph/textureinthread/error.qml new file mode 100644 index 0000000000..1dbd576ef7 --- /dev/null +++ b/examples/quick/scenegraph/textureinthread/error.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Text { + width: 400 + height: 100 + text: 'Platform does not support threaded OpenGL needed by this example.' + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter +} diff --git a/examples/quick/scenegraph/textureinthread/main.cpp b/examples/quick/scenegraph/textureinthread/main.cpp index 3286055496..801f1891b9 100644 --- a/examples/quick/scenegraph/textureinthread/main.cpp +++ b/examples/quick/scenegraph/textureinthread/main.cpp @@ -42,6 +42,9 @@ #include +#include +#include + #include #include "threadrenderer.h" @@ -50,6 +53,13 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); + if (!QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ThreadedOpenGL)) { + QQuickView view; + view.setSource(QUrl("qrc:///scenegraph/textureinthread/error.qml")); + view.show(); + return app.exec(); + } + qmlRegisterType("SceneGraphRendering", 1, 0, "Renderer"); int execReturn = 0; @@ -63,7 +73,7 @@ int main(int argc, char **argv) view.setPersistentSceneGraph(true); view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl("qrc:///scenegraph/textureinsgnode/main.qml")); + view.setSource(QUrl("qrc:///scenegraph/textureinthread/main.qml")); view.show(); execReturn = app.exec(); diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.pro b/examples/quick/scenegraph/textureinthread/textureinthread.pro index b48c2a1863..7f5fbb76e9 100644 --- a/examples/quick/scenegraph/textureinthread/textureinthread.pro +++ b/examples/quick/scenegraph/textureinthread/textureinthread.pro @@ -1,5 +1,8 @@ QT += quick +# To make threaded gl check... +QT += core-private gui-private + HEADERS += threadrenderer.h SOURCES += threadrenderer.cpp main.cpp @@ -13,4 +16,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/textureinthread INSTALLS += target OTHER_FILES += \ - main.qml + main.qml \ + error.qml diff --git a/examples/quick/scenegraph/textureinthread/textureinthread.qrc b/examples/quick/scenegraph/textureinthread/textureinthread.qrc index 9ecf0ada1c..66eb53b736 100644 --- a/examples/quick/scenegraph/textureinthread/textureinthread.qrc +++ b/examples/quick/scenegraph/textureinthread/textureinthread.qrc @@ -1,5 +1,6 @@ - + main.qml + error.qml -- cgit v1.2.3