Skip to content

Commit

Permalink
Remove the GL/ANGLE-ish QQuickWindowPrivate::contextCreationFailureMe…
Browse files Browse the repository at this point in the history
…ssage

Not called in practice anymore, remove the corresponding condition in
the basic render loop as well.

Change-Id: I22d6091c900ce36665b9e7f6dc91cc9276528ff6
Reviewed-by: Andy Nichols <[email protected]>
  • Loading branch information
alpqr committed Jun 16, 2020
1 parent dd8e9f3 commit 538374d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 43 deletions.
29 changes: 0 additions & 29 deletions src/quick/items/qquickwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3496,35 +3496,6 @@ bool QQuickWindowPrivate::isRenderable() const
return ((q->isExposed() && q->isVisible())) && q->geometry().isValid();
}

void QQuickWindowPrivate::contextCreationFailureMessage(const QSurfaceFormat &format,
QString *translatedMessage,
QString *untranslatedMessage)
{
const QString contextType = QLatin1String("OpenGL");
QString formatStr;
QDebug(&formatStr) << format;
#if defined(Q_OS_WIN32)
const bool isDebug = QLibraryInfo::isDebugBuild();
const QString eglLibName = QLatin1String(isDebug ? "libEGLd.dll" : "libEGL.dll");
const QString glesLibName = QLatin1String(isDebug ? "libGLESv2d.dll" : "libGLESv2.dll");
//: %1 Context type (Open GL, EGL), %2 format, ANGLE %3, %4 library names
const char msg[] = QT_TRANSLATE_NOOP("QQuickWindow",
"Failed to create %1 context for format %2.\n"
"This is most likely caused by not having the necessary graphics drivers installed.\n\n"
"Install a driver providing OpenGL 2.0 or higher, or, if this is not possible, "
"make sure the ANGLE Open GL ES 2.0 emulation libraries (%3, %4 and d3dcompiler_*.dll) "
"are available in the application executable's directory or in a location listed in PATH.");
*translatedMessage = QQuickWindow::tr(msg).arg(contextType, formatStr, eglLibName, glesLibName);
*untranslatedMessage = QString::fromLatin1(msg).arg(contextType, formatStr, eglLibName, glesLibName);
#else // Q_OS_WIN32
//: %1 Context type (Open GL, EGL), %2 format specification
const char msg[] = QT_TRANSLATE_NOOP("QQuickWindow",
"Failed to create %1 context for format %2");
*translatedMessage = QQuickWindow::tr(msg).arg(contextType, formatStr);
*untranslatedMessage = QString::fromLatin1(msg).arg(contextType, formatStr);
#endif // !Q_OS_WIN32
}

void QQuickWindowPrivate::rhiCreationFailureMessage(const QString &backendName,
QString *translatedMessage,
QString *untranslatedMessage)
Expand Down
3 changes: 0 additions & 3 deletions src/quick/items/qquickwindow_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,6 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWindowPrivate
static void data_replace(QQmlListProperty<QObject> *, int, QObject *);
static void data_removeLast(QQmlListProperty<QObject> *);

static void contextCreationFailureMessage(const QSurfaceFormat &format,
QString *translatedMessage,
QString *untranslatedMessage);
static void rhiCreationFailureMessage(const QString &backendName,
QString *translatedMessage,
QString *untranslatedMessage);
Expand Down
12 changes: 3 additions & 9 deletions src/quick/scenegraph/qsgrenderloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,9 @@ void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window)
{
QString translatedMessage;
QString untranslatedMessage;
if (QSGRhiSupport::instance()->isRhiEnabled()) {
QQuickWindowPrivate::rhiCreationFailureMessage(QSGRhiSupport::instance()->rhiBackendName(),
&translatedMessage,
&untranslatedMessage);
} else {
QQuickWindowPrivate::contextCreationFailureMessage(window->requestedFormat(),
&translatedMessage,
&untranslatedMessage);
}
QQuickWindowPrivate::rhiCreationFailureMessage(QSGRhiSupport::instance()->rhiBackendName(),
&translatedMessage,
&untranslatedMessage);
// If there is a slot connected to the error signal, emit it and leave it to
// the application to do something with the message. If nothing is connected,
// show a message on our own and terminate.
Expand Down
4 changes: 2 additions & 2 deletions src/quickwidgets/qquickwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,13 +906,13 @@ QSize QQuickWidgetPrivate::rootObjectSize() const
return rootObjectSize;
}

void QQuickWidgetPrivate::handleContextCreationFailure(const QSurfaceFormat &format)
void QQuickWidgetPrivate::handleContextCreationFailure(const QSurfaceFormat &)
{
Q_Q(QQuickWidget);

QString translatedMessage;
QString untranslatedMessage;
QQuickWindowPrivate::contextCreationFailureMessage(format, &translatedMessage, &untranslatedMessage);
QQuickWindowPrivate::rhiCreationFailureMessage(QLatin1String("OpenGL"), &translatedMessage, &untranslatedMessage);

static const QMetaMethod errorSignal = QMetaMethod::fromSignal(&QQuickWidget::sceneGraphError);
const bool signalConnected = q->isSignalConnected(errorSignal);
Expand Down

0 comments on commit 538374d

Please sign in to comment.