8#include <qpa/qplatformscreen.h>
9#include <qpa/qplatformscreen_p.h>
11#include <QtCore/QDebug>
12#include <QtCore/private/qobject_p.h>
45 d->platformScreen = platformScreen;
46 platformScreen->d_func()->
screen =
this;
52 if (
d->refreshRate < 1.0)
53 d->refreshRate = 60.0;
56 d->updatePrimaryOrientation();
75 "QScreens should be removed via QWindowSystemInterface::handleScreenRemoved()");
86 return d->platformScreen;
103 return d->platformScreen->name();
115 return d->platformScreen->manufacturer();
127 return d->platformScreen->model();
139 return d->platformScreen->serialNumber();
149 return d->platformScreen->depth();
159 return d->geometry.size();
235 return d->logicalDpi.first;
251 return d->logicalDpi.second;
270 return (dpi.first + dpi.second) *
qreal(0.5);
304 return d->platformScreen->physicalSize();
317 return d->availableGeometry.size();
347 return d->availableGeometry;
365 if (
auto *knownScreen = platformScreen->
screen())
366 screens << knownScreen;
457 return d->orientation;
472 return d->refreshRate;
491 return d->primaryOrientation;
508 return d->platformScreen->nativeOrientation();
632 for (
QScreen *sibling : siblings) {
633 if (sibling->geometry().contains(point))
688 if (!platformScreen) {
706void *QScreen::resolveInterface(
const char *
name,
int revision)
const
710 auto *platformScreen =
handle();
723#if defined(Q_OS_WEBOS)
727#if defined(Q_OS_WIN32)
731#if defined(Q_OS_ANDROID)
735#if defined(Q_OS_UNIX)
742#ifndef QT_NO_DEBUG_STREAM
750 if (
debug.verbosity() > 2) {
752 debug <<
", primary";
792 const auto logicalDotsPerInch =
QDpi{
796 if (logicalDotsPerInch != initialState.logicalDpi)
800 const auto geometryChanged =
geometry != initialState.geometry;
805 const auto availableGeometryChanged =
availableGeometry != initialState.availableGeometry;
806 if (availableGeometryChanged)
809 if (geometryChanged || availableGeometryChanged) {
811 for (
QScreen* sibling : siblings)
812 emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
815 if (geometryChanged) {
826#include "moc_qscreen.cpp"
static QList< QScreen * > screen_list
QScreen * primaryScreen
the primary (or default) screen of the application.
static qreal factor(C *context)
static QDpi logicalDpi(const QScreen *screen)
qsizetype size() const noexcept
void reserve(qsizetype size)
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
void setDevicePixelRatio(qreal scaleFactor)
Sets the device pixel ratio for the pixmap.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int width() const noexcept
Returns the width of the rectangle.
UpdateEmitter(QScreen *screen)
void updatePrimaryOrientation()
The QScreen class is used to query screen properties. \inmodule QtGui.
QSize availableVirtualSize
the available size of the virtual desktop to which this screen belongs
qreal logicalDotsPerInchY
the number of logical dots or pixels per inch in the vertical direction
qreal devicePixelRatio
the screen's ratio between physical pixels and device-independent pixels
QString model
the model of the screen
bool isPortrait(Qt::ScreenOrientation orientation) const
Convenience function that returns true if o is either portrait or inverted portrait; otherwise return...
bool isLandscape(Qt::ScreenOrientation orientation) const
Convenience function that returns true if o is either landscape or inverted landscape; otherwise retu...
int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const
Convenience function to compute the angle of rotation to get from rotation a to rotation b.
Qt::ScreenOrientation nativeOrientation
the native screen orientation
QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const
Convenience function to compute a transform that maps from the coordinate system defined by orientati...
qreal logicalDotsPerInchX
the number of logical dots or pixels per inch in the horizontal direction
QList< QScreen * > virtualSiblings() const
Get the screen's virtual siblings.
QRect availableGeometry
the screen's available geometry in pixels
QSizeF physicalSize
the screen's physical size (in millimeters)
QRect geometry
the screen's geometry in pixels
QPixmap grabWindow(WId window=0, int x=0, int y=0, int w=-1, int h=-1)
Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by Q...
qreal refreshRate
the approximate vertical refresh rate of the screen in Hz
qreal physicalDotsPerInchY
the number of physical dots or pixels per inch in the vertical direction
QSize size
the pixel resolution of the screen
Qt::ScreenOrientation primaryOrientation
the primary screen orientation
QRect virtualGeometry
the pixel geometry of the virtual desktop to which this screen belongs
QSize virtualSize
the pixel size of the virtual desktop to which this screen belongs
void logicalDotsPerInchChanged(qreal dpi)
void availableGeometryChanged(const QRect &geometry)
int depth
the color depth of the screen
void geometryChanged(const QRect &geometry)
QString manufacturer
the manufacturer of the screen
Qt::ScreenOrientation orientation
the screen orientation
QString name
a user presentable string representing the screen
QSize availableSize
the screen's available size in pixels
qreal logicalDotsPerInch
the number of logical dots or pixels per inch
qreal physicalDotsPerInchX
the number of physical dots or pixels per inch in the horizontal direction
QString serialNumber
the serial number of the screen
void primaryOrientationChanged(Qt::ScreenOrientation orientation)
This signal is emitted when the primary orientation of the screen changes with orientation as an argu...
QScreen * virtualSiblingAt(QPoint point)
Returns the screen at point within the set of \l QScreen::virtualSiblings(), or nullptr if outside of...
~QScreen()
Destroys the screen.
void physicalDotsPerInchChanged(qreal dpi)
QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const
Maps the rect between two screen orientations.
QPlatformScreen * handle() const
Get the platform screen handle.
QRect availableVirtualGeometry
the available geometry of the virtual desktop to which this screen belongs
qreal physicalDotsPerInch
the number of physical dots or pixels per inch
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
T toNative(const T &value, qreal scaleFactor, QPoint origin=QPoint(0, 0))
T fromNative(const T &value, qreal scaleFactor, QPoint origin=QPoint(0, 0))
Combined button and popup list for selecting options.
@ InvertedLandscapeOrientation
@ InvertedPortraitOrientation
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
QPair< qreal, qreal > QDpi
#define QT_NATIVE_INTERFACE_RETURN_IF(NativeInterface, baseType)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
#define Q_ASSERT_X(cond, x, msg)
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QScreen *screen)
QPlatformScreen * platformScreen
Qt::ScreenOrientation primaryOrientation