diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index d620feb7107..882b71753e2 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -48,6 +48,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -103,7 +104,7 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) // Check if all channels are don't care if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) { // Set colour channels based on depth of window's screen - QQnxScreen *screen = static_cast(QQnxScreen::screens().first()); + QQnxScreen *screen = static_cast(glContext->screen()->handle()); int depth = screen->depth(); if (depth == 32) { // SCREEN_FORMAT_RGBA8888 diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index cf45d062bd5..e0fff0cd6ab 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -121,8 +121,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) qFatal("QQnxWindow: failed to set window swap interval, errno=%d", errno); } - // Assign the window to the primary display (this is the default specified by screen). - setScreen(QQnxScreen::primaryDisplay()); + setScreen(static_cast(window->screen()->handle())); // Add the window to the root of the hierarchy QQnxScreen::addWindow(this);