Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsscreen.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWINDOWSSCREEN_H
5#define QWINDOWSSCREEN_H
6
7#include "qtwindowsglobal.h"
8
9#include <QtCore/qlist.h>
10#include <QtCore/qscopedpointer.h>
11#include <qpa/qplatformscreen.h>
12#include <QtGui/qscreen_platform.h>
13
15
43
45{
46public:
47#ifndef QT_NO_CURSOR
48 using CursorPtr = QScopedPointer<QPlatformCursor>;
49#endif
50
51 explicit QWindowsScreen(const QWindowsScreenData &data);
52
53 QRect geometry() const override { return m_data.geometry; }
54 QRect availableGeometry() const override { return m_data.availableGeometry; }
55 int depth() const override { return m_data.depth; }
56 QImage::Format format() const override { return m_data.format; }
57 QSizeF physicalSize() const override { return m_data.physicalSizeMM; }
58 QDpi logicalDpi() const override { return m_data.dpi; }
59 QDpi logicalBaseDpi() const override { return QDpi(baseDpi, baseDpi); }
60 qreal devicePixelRatio() const override { return 1.0; }
61 qreal refreshRate() const override { return m_data.refreshRateHz; }
62 QString name() const override;
63 QString manufacturer() const override { return m_data.manufacturer; }
64 QString model() const override { return m_data.model; }
65 QString serialNumber() const override { return m_data.serialNumber; }
66 Qt::ScreenOrientation orientation() const override { return m_data.orientation; }
67 QList<QPlatformScreen *> virtualSiblings() const override;
68 QWindow *topLevelAt(const QPoint &point) const override;
69 static QWindow *windowAt(const QPoint &point, unsigned flags);
70
71 QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const override;
73
76
77 inline void handleChanges(const QWindowsScreenData &newData);
78
79 HMONITOR handle() const override;
80
81#ifndef QT_NO_CURSOR
82 QPlatformCursor *cursor() const override { return m_cursor.data(); }
83 const CursorPtr &cursorPtr() const { return m_cursor; }
84#else
85 QPlatformCursor *cursor() const { return 0; }
86#endif // !QT_NO_CURSOR
87
88 const QWindowsScreenData &data() const { return m_data; }
89
91 static inline int baseDpi = 96;
92
93private:
94 QWindowsScreenData m_data;
95#ifndef QT_NO_CURSOR
96 const CursorPtr m_cursor;
97#endif
98};
99
101{
102 Q_DISABLE_COPY_MOVE(QWindowsScreenManager)
103public:
104 using WindowsScreenList = QList<QWindowsScreen *>;
105
107 void initialize();
108 void destroyWindow();
110
111 void clearScreens();
112
113 bool handleScreenChanges();
114 const WindowsScreenList &screens() const { return m_screens; }
115
116 const QWindowsScreen *screenAtDp(const QPoint &p) const;
117 const QWindowsScreen *screenForHwnd(HWND hwnd) const;
118
119 static bool isSingleScreen();
120
121private:
122 void removeScreen(int index);
123
124 HWND m_displayChangeObserver = nullptr;
125 WindowsScreenList m_screens;
126};
127
129
130#endif // QWINDOWSSCREEN_H
Format
The following image formats are available in Qt.
Definition qimage.h:41
@ Format_ARGB32_Premultiplied
Definition qimage.h:48
Native interface to a screen.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QPlatformCursor class provides information about pointer device events (movement,...
The QPlatformScreen class provides an abstraction for visual displays.
QScreen * screen() const
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
T * data() const noexcept
Returns the value of the pointer referenced by this object.
\inmodule QtCore
Definition qsize.h:208
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtGui
Definition qwindow.h:63
Manages a list of QWindowsScreen.
bool handleScreenChanges()
Synchronizes the screen list, adds new screens, removes deleted ones and propagates resolution change...
QList< QWindowsScreen * > WindowsScreenList
const QWindowsScreen * screenForHwnd(HWND hwnd) const
const QWindowsScreen * screenAtDp(const QPoint &p) const
const WindowsScreenList & screens() const
Windows screen.
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
QString serialNumber() const override
Reimplement this function in subclass to return the serial number of this screen.
static QWindow * windowAt(const QPoint &point, unsigned flags)
QDpi logicalDpi() const override
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
QList< QPlatformScreen * > virtualSiblings() const override
Determine siblings in a virtual desktop system.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
QWindowsScreen(const QWindowsScreenData &data)
QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const override
This function is called when Qt needs to be able to grab the content of a window.
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
qreal devicePixelRatio() const override
Reimplement this function in subclass to return the device pixel ratio for the screen.
const CursorPtr & cursorPtr() const
QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override
Queries ClearType settings to check the pixel layout.
void handleChanges(const QWindowsScreenData &newData)
Notify QWindowSystemInterface about changes of a screen and synchronize data.
static bool setOrientationPreference(Qt::ScreenOrientation o)
static int baseDpi
static QRect virtualGeometry(const QPlatformScreen *screen)
QRect availableGeometry() const override
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
QString name() const override
QString manufacturer() const override
Reimplement this function in subclass to return the manufacturer of this screen.
QString model() const override
Reimplement this function in subclass to return the model of this screen.
QWindow * topLevelAt(const QPoint &point) const override
Find a top level window taking the flags of ChildWindowFromPointEx.
QDpi logicalBaseDpi() const override
Reimplement to return the base logical DPI for the platform.
HMONITOR handle() const override
int depth() const override
Reimplement in subclass to return current depth of the screen.
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
const QWindowsScreenData & data() const
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
static Qt::ScreenOrientation orientationPreference()
Combined button and popup list for selecting options.
ScreenOrientation
Definition qnamespace.h:271
@ LandscapeOrientation
Definition qnamespace.h:274
QPair< qreal, qreal > QDpi
GLint GLenum GLsizei GLsizei GLsizei depth
GLuint index
[2]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLbitfield flags
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat p
[1]
double qreal
Definition qtypes.h:187
aWidget window() -> setWindowTitle("New Window Title")
[2]
Qt::ScreenOrientation orientation
QImage::Format format
std::optional< int > deviceIndex