diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/gui/kernel/qplatformintegration.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/gui/kernel/qplatformintegration.cpp')
-rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 82 |
1 files changed, 3 insertions, 79 deletions
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 6e285a8fa5..490cfc6178 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -291,7 +291,7 @@ QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::Pix platform implementation is responsible for querying the configuriation from the provided native context. - Returns a pointer to a QPlatformOpenGLContext instance or \c NULL if the context could + Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could not be created. \sa QOpenGLContext @@ -350,7 +350,7 @@ void QPlatformIntegration::destroy() /*! Returns the platforms input context. - The default implementation returns 0, implying no input method support. + The default implementation returns \nullptr, implying no input method support. */ QPlatformInputContext *QPlatformIntegration::inputContext() const { @@ -462,82 +462,6 @@ QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const return QList<int>(); } -/*! - Should be called by the implementation whenever a new screen is added. - - The first screen added will be the primary screen, used for default-created - windows, GL contexts, and other resources unless otherwise specified. - - This adds the screen to QGuiApplication::screens(), and emits the - QGuiApplication::screenAdded() signal. - - The screen should be deleted by calling QPlatformIntegration::destroyScreen(). -*/ -void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary) -{ - QScreen *screen = new QScreen(ps); - - if (isPrimary) { - QGuiApplicationPrivate::screen_list.prepend(screen); - } else { - QGuiApplicationPrivate::screen_list.append(screen); - } - emit qGuiApp->screenAdded(screen); - - if (isPrimary) - emit qGuiApp->primaryScreenChanged(screen); -} - -/*! - Just removes the screen, call destroyScreen instead. - - \sa destroyScreen() -*/ - -void QPlatformIntegration::removeScreen(QScreen *screen) -{ - const bool wasPrimary = (!QGuiApplicationPrivate::screen_list.isEmpty() && QGuiApplicationPrivate::screen_list.at(0) == screen); - QGuiApplicationPrivate::screen_list.removeOne(screen); - - if (wasPrimary && qGuiApp && !QGuiApplicationPrivate::screen_list.isEmpty()) - emit qGuiApp->primaryScreenChanged(QGuiApplicationPrivate::screen_list.at(0)); -} - -/*! - Should be called by the implementation whenever a screen is removed. - - This removes the screen from QGuiApplication::screens(), and deletes it. - - Failing to call this and manually deleting the QPlatformScreen instead may - lead to a crash due to a pure virtual call. -*/ -void QPlatformIntegration::destroyScreen(QPlatformScreen *screen) -{ - QScreen *qScreen = screen->screen(); - removeScreen(qScreen); - delete qScreen; - delete screen; -} - -/*! - Should be called whenever the primary screen changes. - - When the screen specified as primary changes, this method will notify - QGuiApplication and emit the QGuiApplication::primaryScreenChanged signal. - */ - -void QPlatformIntegration::setPrimaryScreen(QPlatformScreen *newPrimary) -{ - QScreen* newPrimaryScreen = newPrimary->screen(); - int idx = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen); - Q_ASSERT(idx >= 0); - if (idx == 0) - return; - - QGuiApplicationPrivate::screen_list.swap(0, idx); - emit qGuiApp->primaryScreenChanged(newPrimaryScreen); -} - QStringList QPlatformIntegration::themeNames() const { return QStringList(); @@ -642,7 +566,7 @@ void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const pointer to the instance for which a platform-specific backend needs to be created. - Returns a pointer to a QPlatformOpenGLContext instance or \c NULL if the context could + Returns a pointer to a QPlatformOpenGLContext instance or \nullptr if the context could not be created. \sa QVulkanInstance |