diff options
Diffstat (limited to 'src/gui/kernel/qscreen.cpp')
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index abf8c4569c..83641e7676 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -360,8 +360,11 @@ QList<QScreen *> QScreen::virtualSiblings() const const QList<QPlatformScreen *> platformScreens = d->platformScreen->virtualSiblings(); QList<QScreen *> screens; screens.reserve(platformScreens.size()); - for (QPlatformScreen *platformScreen : platformScreens) - screens << platformScreen->screen(); + for (QPlatformScreen *platformScreen : platformScreens) { + // Only consider platform screens that have been added + if (auto *knownScreen = platformScreen->screen()) + screens << knownScreen; + } return screens; } @@ -458,8 +461,8 @@ Qt::ScreenOrientation QScreen::orientation() const \property QScreen::refreshRate \brief the approximate vertical refresh rate of the screen in Hz - \warning Avoid using the screen's refresh rate to drive animations - via a timer such as QTimer. Instead use QWindow::requestUpdate(). + \warning Avoid using the screen's refresh rate to drive animations via a + timer such as QChronoTimer. Instead use QWindow::requestUpdate(). \sa QWindow::requestUpdate() */ @@ -700,8 +703,23 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height) result.setDevicePixelRatio(result.devicePixelRatio() * factor); return result; } + +/*! + \fn template <typename QNativeInterface> QNativeInterface *QScreen::nativeInterface() const + + Returns a native interface of the given type for the screen. + + This function provides access to platform specific functionality + of QScreen, as defined in the QNativeInterface namespace: + + \annotatedlist native-interfaces-qscreen + + If the requested interface is not available a \nullptr is returned. + */ + void *QScreen::resolveInterface(const char *name, int revision) const { + using namespace QNativeInterface; using namespace QNativeInterface::Private; auto *platformScreen = handle(); @@ -729,7 +747,7 @@ void *QScreen::resolveInterface(const char *name, int revision) const QT_NATIVE_INTERFACE_RETURN_IF(QAndroidScreen, platformScreen); #endif -#if defined(Q_OS_UNIX) +#if QT_CONFIG(wayland) QT_NATIVE_INTERFACE_RETURN_IF(QWaylandScreen, platformScreen); #endif |