summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPier Luigi Fiorini <pierluigi.fiorini@gmail.com>2016-12-13 20:23:55 +0100
committerPier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>2017-01-16 07:46:39 +0000
commitabb47fc6803a3246b67ca6c8357f34ebd0b3e9cc (patch)
tree25de33d8bca4d8c7c542e77433a96adf7a9bbf69 /src
parent3b0cd132225504f36bc355f239cde95a9bac0985 (diff)
Add screen product information
Add new methods to QPlatformScreen that platform plugins can reimplement in order to provide more information such as vendor, model and serial number. Expose that information as QScreen properties. A use-case for this feature is a Wayland compositor that maps screens to Wayland outputs hence it needs to replicate the information. This information can also be added to the diagnostic output of qtdiag. [ChangeLog][QtGui][QScreen] Add manufacturer, model and serialNumber properties. Change-Id: Ia6945f41023340602ef9d618e0d833a0c1825ab3 Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformscreen.cpp39
-rw-r--r--src/gui/kernel/qplatformscreen.h4
-rw-r--r--src/gui/kernel/qscreen.cpp36
-rw-r--r--src/gui/kernel/qscreen.h7
4 files changed, 86 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index 1d519e84f9..bbe984bebe 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -280,6 +280,45 @@ QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window
}
/*!
+ Reimplement this function in subclass to return the manufacturer
+ of this screen.
+
+ The default implementation returns an empty string.
+
+ \since 5.9
+*/
+QString QPlatformScreen::manufacturer() const
+{
+ return QString();
+}
+
+/*!
+ Reimplement this function in subclass to return the model
+ of this screen.
+
+ The default implementation returns an empty string.
+
+ \since 5.9
+*/
+QString QPlatformScreen::model() const
+{
+ return QString();
+}
+
+/*!
+ Reimplement this function in subclass to return the serial number
+ of this screen.
+
+ The default implementation returns an empty string.
+
+ \since 5.9
+*/
+QString QPlatformScreen::serialNumber() const
+{
+ return QString();
+}
+
+/*!
\class QPlatformScreen
\since 4.8
\internal
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index 2d3cbaf170..aa32917b6c 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -129,6 +129,10 @@ public:
virtual QString name() const { return QString(); }
+ virtual QString manufacturer() const;
+ virtual QString model() const;
+ virtual QString serialNumber() const;
+
virtual QPlatformCursor *cursor() const;
virtual SubpixelAntialiasingType subpixelAntialiasingTypeHint() const;
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 1dd8fb5e67..96f75f37eb 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -161,6 +161,42 @@ QString QScreen::name() const
}
/*!
+ \property QScreen::manufacturer
+ \brief the manufacturer of the screen
+
+ \since 5.9
+*/
+QString QScreen::manufacturer() const
+{
+ Q_D(const QScreen);
+ return d->platformScreen->manufacturer();
+}
+
+/*!
+ \property QScreen::model
+ \brief the model of the screen
+
+ \since 5.9
+*/
+QString QScreen::model() const
+{
+ Q_D(const QScreen);
+ return d->platformScreen->model();
+}
+
+/*!
+ \property QScreen::serialNumber
+ \brief the serial number of the screen
+
+ \since 5.9
+*/
+QString QScreen::serialNumber() const
+{
+ Q_D(const QScreen);
+ return d->platformScreen->serialNumber();
+}
+
+/*!
\property QScreen::depth
\brief the color depth of the screen
*/
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 98e35aff43..8c9b16e08e 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -69,6 +69,9 @@ class Q_GUI_EXPORT QScreen : public QObject
Q_DECLARE_PRIVATE(QScreen)
Q_PROPERTY(QString name READ name CONSTANT)
+ Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
+ Q_PROPERTY(QString model READ model CONSTANT)
+ Q_PROPERTY(QString serialNumber READ serialNumber CONSTANT)
Q_PROPERTY(int depth READ depth CONSTANT)
Q_PROPERTY(QSize size READ size NOTIFY geometryChanged)
Q_PROPERTY(QSize availableSize READ availableSize NOTIFY availableGeometryChanged)
@@ -97,6 +100,10 @@ public:
QString name() const;
+ QString manufacturer() const;
+ QString model() const;
+ QString serialNumber() const;
+
int depth() const;
QSize size() const;