aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgthreadedrenderloop.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <[email protected]>2014-02-20 16:14:45 +0100
committerThe Qt Project <[email protected]>2014-02-21 16:29:07 +0100
commitbbf1ec42e5875a6e8145211348e509690a30d0a5 (patch)
treeb2a50ccea52dcff9bb5e13e3ffad914eed45ff2f /src/quick/scenegraph/qsgthreadedrenderloop.cpp
parent3eb56ecb7776fa106d1fb6e43355e2c1bf5c1d0c (diff)
Add an error signal to QQuickWindow
When nothing is connected to this signal, an error will be printed or, in case of Windows, a message box will be shown. If there is something connected, it is up to the application to handle the error. [ChangeLog] Added a new sceneGraphError() signal to QQuickWindow which applications can use to detect errors like OpenGL context creation failures and react in their own custom ways. Task-number: QTBUG-36138 Change-Id: I33b1e5e0e3f25872af67c5bb5ae937e3470b25f3 Reviewed-by: Friedemann Kleint <[email protected]>
Diffstat (limited to 'src/quick/scenegraph/qsgthreadedrenderloop.cpp')
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index ddf724b89f..7b5f161174 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -914,7 +914,17 @@ void QSGThreadedRenderLoop::handleExposure(Window *w)
if (!w->thread->gl->create()) {
delete w->thread->gl;
w->thread->gl = 0;
- qWarning("QtQuick: failed to create OpenGL context");
+ QString formatStr;
+ QDebug(&formatStr) << w->window->requestedFormat();
+ QString contextType = QLatin1String(QOpenGLFunctions::isES() ? "EGL" : "OpenGL");
+ const char *msg = QT_TRANSLATE_NOOP("QSGThreadedRenderLoop",
+ "Failed to create %1 context for format %2");
+ QString translatedMsg = tr(msg).arg(contextType).arg(formatStr);
+ QString nonTranslatedMsg = QString(QLatin1String(msg)).arg(contextType).arg(formatStr);
+ bool signalEmitted = QQuickWindowPrivate::get(w->window)->emitError(QQuickWindow::ContextNotAvailable,
+ translatedMsg);
+ if (!signalEmitted)
+ qFatal("%s", qPrintable(nonTranslatedMsg));
return;
}