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 Class Reference

Windows screen. More...

#include <qwindowsscreen.h>

+ Inheritance diagram for QWindowsScreen:
+ Collaboration diagram for QWindowsScreen:

Public Types

using CursorPtr = QScopedPointer<QPlatformCursor>
 
- Public Types inherited from QPlatformScreen
enum  SubpixelAntialiasingType {
  Subpixel_None , Subpixel_RGB , Subpixel_BGR , Subpixel_VRGB ,
  Subpixel_VBGR
}
 
enum  PowerState { PowerStateOn , PowerStateStandby , PowerStateSuspend , PowerStateOff }
 

Public Member Functions

 QWindowsScreen (const QWindowsScreenData &data)
 
QRect geometry () const override
 Reimplement in subclass to return the pixel geometry of the screen.
 
QRect availableGeometry () const override
 Reimplement in subclass to return the pixel geometry of the available space This normally is the desktop screen minus the task manager, global menubar etc.
 
int depth () const override
 Reimplement in subclass to return current depth of the screen.
 
QImage::Format format () const override
 Reimplement in subclass to return the image format which corresponds to the screen format.
 
QSizeF physicalSize () const override
 Reimplement this function in subclass to return the physical size of the screen, in millimeters.
 
QDpi logicalDpi () const override
 Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen.
 
QDpi logicalBaseDpi () const override
 Reimplement to return the base logical DPI for the platform.
 
qreal devicePixelRatio () const override
 Reimplement this function in subclass to return the device pixel ratio for the screen.
 
qreal refreshRate () const override
 Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz.
 
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.
 
QString serialNumber () const override
 Reimplement this function in subclass to return the serial number of this screen.
 
Qt::ScreenOrientation orientation () const override
 Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation.
 
QList< QPlatformScreen * > virtualSiblings () const override
 Determine siblings in a virtual desktop system.
 
QWindowtopLevelAt (const QPoint &point) const override
 Find a top level window taking the flags of ChildWindowFromPointEx.
 
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.
 
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.
 
HMONITOR handle () const override
 
QPlatformCursorcursor () const override
 Reimplement this function in subclass to return the cursor of the screen.
 
const CursorPtrcursorPtr () const
 
const QWindowsScreenDatadata () const
 
- Public Member Functions inherited from QPlatformScreen
 QPlatformScreen ()
 
virtual ~QPlatformScreen ()
 
virtual bool isPlaceholder () const
 
virtual QColorSpace colorSpace () const
 
virtual Qt::ScreenOrientation nativeOrientation () const
 Reimplement this function in subclass to return the native orientation of the screen, e.g.
 
QWindowList windows () const
 Return all windows residing on this screen.
 
const QPlatformScreenscreenForPosition (const QPoint &point) const
 Find the sibling screen corresponding to globalPos.
 
QScreenscreen () const
 
virtual PowerState powerState () const
 Returns the current power state.
 
virtual void setPowerState (PowerState state)
 Sets the power state for this screen.
 
virtual QList< Modemodes () const
 Reimplement this function in subclass to return the list of modes for this screen.
 
virtual int currentMode () const
 Reimplement this function in subclass to return the index of the current mode from the modes list.
 
virtual int preferredMode () const
 Reimplement this function in subclass to return the preferred mode index from the modes list.
 

Static Public Member Functions

static QWindowwindowAt (const QPoint &point, unsigned flags)
 
static Qt::ScreenOrientation orientationPreference ()
 
static bool setOrientationPreference (Qt::ScreenOrientation o)
 
static QRect virtualGeometry (const QPlatformScreen *screen)
 
- Static Public Member Functions inherited from QPlatformScreen
static QPlatformScreenplatformScreenForWindow (const QWindow *window)
 
static int angleBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b)
 
static QTransform transformBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target)
 
static QRect mapBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect)
 
static QDpi overrideDpi (const QDpi &in)
 

Static Public Attributes

static int baseDpi = 96
 

Additional Inherited Members

- Protected Member Functions inherited from QPlatformScreen
void resizeMaximizedWindows ()
 Convenience method to resize all the maximized and fullscreen windows of this platform screen.
 
- Protected Attributes inherited from QPlatformScreen
QScopedPointer< QPlatformScreenPrivated_ptr
 

Detailed Description

Windows screen.

See also
QWindowsScreenManager

Definition at line 44 of file qwindowsscreen.h.

Member Typedef Documentation

◆ CursorPtr

Constructor & Destructor Documentation

◆ QWindowsScreen()

QWindowsScreen::QWindowsScreen ( const QWindowsScreenData & data)
explicit

Definition at line 406 of file qwindowsscreen.cpp.

Member Function Documentation

◆ availableGeometry()

QRect QWindowsScreen::availableGeometry ( ) const
inlineoverridevirtual

Reimplement in subclass to return the pixel geometry of the available space This normally is the desktop screen minus the task manager, global menubar etc.

Reimplemented from QPlatformScreen.

Definition at line 54 of file qwindowsscreen.h.

References QWindowsScreenData::availableGeometry.

◆ cursor()

QPlatformCursor * QWindowsScreen::cursor ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the cursor of the screen.

The default implementation returns \nullptr.

Reimplemented from QPlatformScreen.

Definition at line 82 of file qwindowsscreen.h.

References QScopedPointer< T, Cleanup >::data().

+ Here is the call graph for this function:

◆ cursorPtr()

const CursorPtr & QWindowsScreen::cursorPtr ( ) const
inline

Definition at line 83 of file qwindowsscreen.h.

◆ data()

const QWindowsScreenData & QWindowsScreen::data ( ) const
inline

Definition at line 88 of file qwindowsscreen.h.

◆ depth()

int QWindowsScreen::depth ( ) const
inlineoverridevirtual

Reimplement in subclass to return current depth of the screen.

Implements QPlatformScreen.

Definition at line 55 of file qwindowsscreen.h.

References QWindowsScreenData::depth.

◆ devicePixelRatio()

qreal QWindowsScreen::devicePixelRatio ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the device pixel ratio for the screen.

This is the ratio between physical pixels and the device-independent pixels of the windowing system. The default implementation returns 1.0.

See also
QPlatformWindow::devicePixelRatio()

Reimplemented from QPlatformScreen.

Definition at line 60 of file qwindowsscreen.h.

◆ format()

QImage::Format QWindowsScreen::format ( ) const
inlineoverridevirtual

Reimplement in subclass to return the image format which corresponds to the screen format.

Implements QPlatformScreen.

Definition at line 56 of file qwindowsscreen.h.

References QWindowsScreenData::format.

◆ geometry()

QRect QWindowsScreen::geometry ( ) const
inlineoverridevirtual

Reimplement in subclass to return the pixel geometry of the screen.

Implements QPlatformScreen.

Definition at line 53 of file qwindowsscreen.h.

References QWindowsScreenData::geometry.

Referenced by grabWindow().

+ Here is the caller graph for this function:

◆ grabWindow()

QPixmap QWindowsScreen::grabWindow ( WId window,
int x,
int y,
int width,
int height ) const
overridevirtual

This function is called when Qt needs to be able to grab the content of a window.

Returns the content of the window specified with the WId handle within the boundaries of QRect(x,y,width,height).

Reimplemented from QPlatformScreen.

Definition at line 421 of file qwindowsscreen.cpp.

References geometry(), QSize::height(), pixmap, qt_pixmapFromWinHBITMAP(), QRect::size(), QSize::width(), window(), QRect::x(), and QRect::y().

+ Here is the call graph for this function:

◆ handle()

HMONITOR QWindowsScreen::handle ( ) const
override
Returns
The underlying HWMONITOR of the screen.

Definition at line 563 of file qwindowsscreen.cpp.

References QWindowsScreenData::hMonitor.

◆ handleChanges()

◆ logicalBaseDpi()

QDpi QWindowsScreen::logicalBaseDpi ( ) const
inlineoverridevirtual

Reimplement to return the base logical DPI for the platform.

This DPI value should correspond to a standard-DPI (1x) display. The default implementation returns 96.

QtGui will use this value (together with logicalDpi) to compute the scale factor when high-DPI scaling is enabled, as follows: factor = logicalDPI / baseDPI

Reimplemented from QPlatformScreen.

Definition at line 59 of file qwindowsscreen.h.

References baseDpi.

◆ logicalDpi()

QDpi QWindowsScreen::logicalDpi ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen.

The logical dots per inch metrics are used by Qt to scale the user interface.

The default implementation returns logicalBaseDpi(), which results in a UI scale factor of 1.0.

See also
physicalSize

Reimplemented from QPlatformScreen.

Definition at line 58 of file qwindowsscreen.h.

References QWindowsScreenData::dpi.

◆ manufacturer()

QString QWindowsScreen::manufacturer ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the manufacturer of this screen.

The default implementation returns an empty string.

Since
5.9

Reimplemented from QPlatformScreen.

Definition at line 63 of file qwindowsscreen.h.

References QWindowsScreenData::manufacturer.

◆ model()

QString QWindowsScreen::model ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the model of this screen.

The default implementation returns an empty string.

Since
5.9

Reimplemented from QPlatformScreen.

Definition at line 64 of file qwindowsscreen.h.

References QWindowsScreenData::model.

◆ name()

QString QWindowsScreen::name ( ) const
overridevirtual

Reimplemented from QPlatformScreen.

Definition at line 414 of file qwindowsscreen.cpp.

References arg, QWindowsScreenData::deviceIndex, QWindowsScreenData::name, and QString::number().

+ Here is the call graph for this function:

◆ orientation()

Qt::ScreenOrientation QWindowsScreen::orientation ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation.

The default implementation returns Qt::PrimaryOrientation.

Reimplemented from QPlatformScreen.

Definition at line 66 of file qwindowsscreen.h.

References QWindowsScreenData::orientation.

◆ orientationPreference()

Qt::ScreenOrientation QWindowsScreen::orientationPreference ( )
static

Definition at line 601 of file qwindowsscreen.cpp.

References Qt::InvertedLandscapeOrientation, Qt::InvertedPortraitOrientation, Qt::LandscapeOrientation, orientationPreference(), Qt::PortraitOrientation, and Qt::PrimaryOrientation.

Referenced by orientationPreference(), and setOrientationPreference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ physicalSize()

QSizeF QWindowsScreen::physicalSize ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the physical size of the screen, in millimeters.

The physical size represents the actual physical dimensions of the display.

The default implementation takes the pixel size of the screen, considers a resolution of 100 dots per inch, and returns the calculated physical size. A device with a screen that has different resolutions will need to be supported by a suitable reimplementation of this function.

See also
logcalDpi

Reimplemented from QPlatformScreen.

Definition at line 57 of file qwindowsscreen.h.

References QWindowsScreenData::physicalSizeMM.

◆ refreshRate()

qreal QWindowsScreen::refreshRate ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz.

The default returns 60, a sensible default for modern displays.

Reimplemented from QPlatformScreen.

Definition at line 61 of file qwindowsscreen.h.

References QWindowsScreenData::refreshRateHz.

◆ serialNumber()

QString QWindowsScreen::serialNumber ( ) const
inlineoverridevirtual

Reimplement this function in subclass to return the serial number of this screen.

The default implementation returns an empty string.

Since
5.9

Reimplemented from QPlatformScreen.

Definition at line 65 of file qwindowsscreen.h.

References QWindowsScreenData::serialNumber.

◆ setOrientationPreference()

bool QWindowsScreen::setOrientationPreference ( Qt::ScreenOrientation o)
static

Definition at line 577 of file qwindowsscreen.cpp.

References Qt::InvertedLandscapeOrientation, Qt::InvertedPortraitOrientation, Qt::LandscapeOrientation, o, orientationPreference(), Qt::PortraitOrientation, and Qt::PrimaryOrientation.

+ Here is the call graph for this function:

◆ subpixelAntialiasingTypeHint()

QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint ( ) const
overridevirtual

Queries ClearType settings to check the pixel layout.

Reimplemented from QPlatformScreen.

Definition at line 629 of file qwindowsscreen.cpp.

References QSettings::NativeFormat, settings, QPlatformScreen::Subpixel_BGR, QPlatformScreen::Subpixel_None, QPlatformScreen::Subpixel_RGB, QPlatformScreen::subpixelAntialiasingTypeHint(), QVariant::toInt(), and QSettings::value().

+ Here is the call graph for this function:

◆ topLevelAt()

QWindow * QWindowsScreen::topLevelAt ( const QPoint & point) const
overridevirtual

Find a top level window taking the flags of ChildWindowFromPointEx.

Reimplemented from QPlatformScreen.

Definition at line 473 of file qwindowsscreen.cpp.

References child, qCDebug, QWindowsWindow::topLevelOf(), QWindowsContext::verbose, and windowAt().

+ Here is the call graph for this function:

◆ virtualGeometry()

QRect QWindowsScreen::virtualGeometry ( const QPlatformScreen * screen)
static

Definition at line 568 of file qwindowsscreen.cpp.

References QPlatformScreen::screen(), and QScreen::virtualSiblings().

Referenced by QWindowsTabletSupport::translateTabletPacketEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtualSiblings()

QList< QPlatformScreen * > QWindowsScreen::virtualSiblings ( ) const
overridevirtual

Determine siblings in a virtual desktop system.

Self is by definition a sibling, else collect all screens within virtual desktop.

Reimplemented from QPlatformScreen.

Definition at line 501 of file qwindowsscreen.cpp.

References QWindowsScreenData::flags, QWindowsContext::instance(), QPlatformScreen::screen(), and QWindowsScreenData::VirtualDesktop.

+ Here is the call graph for this function:

◆ windowAt()

QWindow * QWindowsScreen::windowAt ( const QPoint & point,
unsigned flags )
static

Definition at line 483 of file qwindowsscreen.cpp.

References QWindowsContext::instance(), qCDebug, and QWindowsContext::verbose.

Referenced by getWindowUnderPointer(), redirectWheelEvent(), topLevelAt(), QWindowsMouseHandler::translateMouseEvent(), and QWindowsTabletSupport::translateTabletPacketEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ baseDpi

int QWindowsScreen::baseDpi = 96
inlinestatic

Definition at line 91 of file qwindowsscreen.h.

Referenced by QWindowsWindow::dpiRelativeScale(), and logicalBaseDpi().


The documentation for this class was generated from the following files: