diff options
author | Piotr Mikolajczyk <piotr.mikolajczyk@qt.io> | 2022-12-06 11:44:45 +0100 |
---|---|---|
committer | Piotr Mikolajczyk <piotr.mikolajczyk@qt.io> | 2022-12-09 16:16:48 +0100 |
commit | 4f0272befb23a68ea5d9de371a1522b0df9df24f (patch) | |
tree | a933b359ed150601b9d92921c68a0865ea405c64 /src/plugins/platforms/android | |
parent | d4eb5d11104bb823e56cf173e29f9d205320581f (diff) |
Add possibility to retrieve displayId for Android
When handling multiple screens in Android system it is needed
to have the information about the display's Id. This patch
provides this possibility.
Task-number: QTBUG-105325
Change-Id: Id91aeaa59b17d5a098b672e220a5182b97320703
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/android')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformscreen.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformscreen.h | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index 1c867f435d..451a8d84cb 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -82,6 +82,7 @@ QAndroidPlatformScreen::QAndroidPlatformScreen(const QJniObject &displayObject) m_size = QSize(displayObject.callMethod<jint>("getWidth"), displayObject.callMethod<jint>("getHeight")); m_name = displayObject.callObjectMethod<jstring>("getName").toString(); m_refreshRate = displayObject.callMethod<jfloat>("getRefreshRate"); + m_displayId = displayObject.callMethod<jint>("getDisplayId"); if (QNativeInterface::QAndroidApplication::sdkVersion() >= 23) { const QJniObject currentMode = displayObject.callObjectMethod<QtJniTypes::DisplayMode>("getMode"); @@ -271,6 +272,11 @@ void QAndroidPlatformScreen::setSizeParameters(const QSize &physicalSize, const } } +int QAndroidPlatformScreen::displayId() const +{ + return m_displayId; +} + void QAndroidPlatformScreen::setRefreshRate(qreal refreshRate) { if (refreshRate == m_refreshRate) diff --git a/src/plugins/platforms/android/qandroidplatformscreen.h b/src/plugins/platforms/android/qandroidplatformscreen.h index 390bda0416..076530613b 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.h +++ b/src/plugins/platforms/android/qandroidplatformscreen.h @@ -13,6 +13,7 @@ #include <QWaitCondition> #include <QtCore/QJniObject> #include <qpa/qplatformscreen.h> +#include <qpa/qplatformscreen_p.h> #include <android/native_window.h> @@ -20,7 +21,9 @@ QT_BEGIN_NAMESPACE class QAndroidPlatformWindow; -class QAndroidPlatformScreen: public QObject, public QPlatformScreen, public AndroidSurfaceClient +class QAndroidPlatformScreen: public QObject, + public QPlatformScreen, public AndroidSurfaceClient, + public QNativeInterface::Private::QAndroidScreen { Q_OBJECT public: @@ -50,6 +53,7 @@ public: void scheduleUpdate(); void topWindowChanged(QWindow *w); int rasterSurfaces(); + int displayId() const override; public slots: void setDirty(const QRect &rect); @@ -77,6 +81,7 @@ protected: QString m_name; QList<Mode> m_modes; int m_currentMode = 0; + int m_displayId = -1; private: QDpi logicalDpi() const override; |