aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-05-22 10:35:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-22 12:39:38 +0200
commitcc36ce673545131047595c79ded1f465ec601780 (patch)
treedbed4e83f3d2d90e7a982334719d56295ab84ed7 /examples/quick/scenegraph
parent8f429765966be3040c1ae872c8d28e938956e251 (diff)
Disable textureinthread example when threaded gl is not available.
Task-number: QTBUG-30077 Change-Id: I8b6e4b8a33819fe84c843e85d863b582cfd69439 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'examples/quick/scenegraph')
-rw-r--r--examples/quick/scenegraph/textureinthread/error.qml49
-rw-r--r--examples/quick/scenegraph/textureinthread/main.cpp12
-rw-r--r--examples/quick/scenegraph/textureinthread/textureinthread.pro6
-rw-r--r--examples/quick/scenegraph/textureinthread/textureinthread.qrc3
4 files changed, 67 insertions, 3 deletions
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 <QGuiApplication>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformintegration.h>
+
#include <QtQuick/QQuickView>
#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<ThreadRenderer>("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 @@
<RCC>
- <qresource prefix="/scenegraph/textureinsgnode">
+ <qresource prefix="/scenegraph/textureinthread">
<file>main.qml</file>
+ <file>error.qml</file>
</qresource>
</RCC>