CopperSpice API  1.9.1
QPlatformScreen Class Referenceabstract

Provides an abstraction for visual displays. More...

Public Methods

 QPlatformScreen ()
 
virtual ~QPlatformScreen ()
 
virtual QRect availableGeometry () const
 
virtual QPlatformCursorcursor () const
 
virtual int depth () const = 0
 
QRect deviceIndependentGeometry () const
 
virtual qreal devicePixelRatio () const
 
virtual QImage::Format format () const = 0
 
virtual QRect geometry () const = 0
 
virtual QPixmap grabWindow (WId window, int x, int y, int width, int height) const
 
virtual QDpi logicalDpi () const
 
virtual QString name () const
 
virtual Qt::ScreenOrientation nativeOrientation () const
 
virtual Qt::ScreenOrientation orientation () const
 
virtual QSizeF physicalSize () const
 
virtual qreal pixelDensity () const
 
virtual PowerState powerState () const
 
virtual qreal refreshRate () const
 
QScreenscreen () const
 
const QPlatformScreen * screenForPosition (const QPoint &point) const
 
virtual void setOrientationUpdateMask (Qt::ScreenOrientations mask)
 
virtual void setPowerState (PowerState state)
 
virtual SubpixelAntialiasingType subpixelAntialiasingTypeHint () const
 
virtual QWindowtopLevelWindowAt (const QPoint &point) const
 
virtual QList< QPlatformScreen * > virtualSiblings () const
 

Static Public Methods

static int angleBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b)
 
static QRect mapBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect)
 
static QPlatformScreen * platformScreenForWindow (const QWindow *window)
 
static QTransform transformBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target)
 

Protected Methods

void resizeMaximizedWindows ()
 

Detailed Description

Some systems have support for retrieving information about the attached displays. Use QPlatformScreen to query the display. QPlatformScreen is also used by the public api QDesktopWidget for information about the desktop.

CopperSpice uses the physicalSize() method to calculate the dpi when converting point sizes to pixels sizes. However, on some systems the operating system does not report an accurate physical size.

Constructor & Destructor Documentation

QPlatformScreen::QPlatformScreen ( )

Constructs a new QPlatformScreen.

QPlatformScreen::~QPlatformScreen ( )
virtual

Destroys the current QPlatformScreen.

Method Documentation

int QPlatformScreen::angleBetween ( Qt::ScreenOrientation  a,
Qt::ScreenOrientation  b 
)
static

Additional documentation pending.

QRect QPlatformScreen::availableGeometry ( ) const
inlinevirtual

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.

QPlatformCursor * QPlatformScreen::cursor ( ) const
virtual

Reimplement this function in subclass to return the cursor of the screen. The default implementation returns a nullptr.

int QPlatformScreen::depth ( ) const
pure virtual

Reimplement in subclass to return current depth of the screen.

QRect QPlatformScreen::deviceIndependentGeometry ( ) const

Additional documentation pending.

qreal QPlatformScreen::devicePixelRatio ( ) const
virtual

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(), QPlatformScreen::pixelDensity()
QImage::Format QPlatformScreen::format ( ) const
pure virtual

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

QRect QPlatformScreen::geometry ( ) const
pure virtual

Reimplement in subclass to return the pixel geometry of the screen

QPixmap QPlatformScreen::grabWindow ( WId  window,
int  x,
int  y,
int  width,
int  height 
) const
virtual

This method is called when CopperSpice needs 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).

QDpi QPlatformScreen::logicalDpi ( ) const
virtual

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 QFont to convert point sizes to pixel sizes. The default implementation uses the screen pixel size and physical size to compute the metrics.

See also
physicalSize
QRect QPlatformScreen::mapBetween ( Qt::ScreenOrientation  a,
Qt::ScreenOrientation  b,
const QRect rect 
)
static

Additional documentation pending.

QString QPlatformScreen::name ( ) const
inlinevirtual

Additional documentation pending.

Qt::ScreenOrientation QPlatformScreen::nativeOrientation ( ) const
virtual

Reimplement this method in a subclass to return the native orientation of the screen, e.g. the orientation where the logo sticker of the device appears the right way up.

The default implementation returns Qt::PrimaryOrientation.

Qt::ScreenOrientation QPlatformScreen::orientation ( ) const
virtual

Reimplement this method in a 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.

QSizeF QPlatformScreen::physicalSize ( ) const
virtual

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
logicalDpi
qreal QPlatformScreen::pixelDensity ( ) const
virtual

Reimplement this function in subclass to return the pixel density of the screen. This is the scale factor needed to make a low DPI application usable on this screen. The default implementation returns 1.0.

Returning something else than 1.0 from this function causes CopperSpice to apply the scale factor to the application's coordinate system. This is different from devicePixelRatio, which reports a scale factor already applied by the windowing system. A platform plugin typically implements one (or none) of these two functions.

See also
QPlatformWindow::devicePixelRatio()
QPlatformScreen * QPlatformScreen::platformScreenForWindow ( const QWindow window)
static

Additional documentation pending.

QPlatformScreen::PowerState QPlatformScreen::powerState ( ) const
virtual

Returns the current power state. The default implementation always returns PowerStateOn.

qreal QPlatformScreen::refreshRate ( ) const
virtual

Reimplement in subclass to return the vertical refresh rate of the screen, in Hz. The default returns 60, a sensible default for modern displays.

void QPlatformScreen::resizeMaximizedWindows ( )
protected

Convenience method to resize all the maximized and fullscreen windows of this platform screen.

QScreen * QPlatformScreen::screen ( ) const

Additional documentation pending.

const QPlatformScreen * QPlatformScreen::screenForPosition ( const QPoint point) const

Find the sibling screen corresponding to point. Returns this screen if no suitable screen is found at the position.

void QPlatformScreen::setOrientationUpdateMask ( Qt::ScreenOrientations  mask)
virtual

Reimplement in subclass to filter out unneeded screen orientation updates.

The orientations will anyway be filtered before QScreen::orientationChanged() is emitted, but the mask can be used by the platform plugin for example to prevent having to have an accelerometer sensor running all the time, or to improve the reported values. As an example of the latter, in case of only Landscape | InvertedLandscape being set in the mask, on a platform that gets its orientation readings from an accelerometer sensor embedded in a handheld device, the platform can report transitions between the two even when the device is held in an orientation that's closer to portrait.

By default the orientation update mask is empty, so unless this function has been called with a non-empty mask the platform does not need to report any orientation updates through QWindowSystemInterface::handleScreenOrientationChange().

void QPlatformScreen::setPowerState ( PowerState  state)
virtual

Sets the state for this screen.

QPlatformScreen::SubpixelAntialiasingType QPlatformScreen::subpixelAntialiasingTypeHint ( ) const
virtual

Returns a hint about this screen's subpixel layout structure. The default implementation queries the QT_SUBPIXEL_AA_TYPE environment variable. This is just a hint because most platforms do not have a way to retrieve the correct value from hardware and instead rely on font configurations.

QWindow * QPlatformScreen::topLevelWindowAt ( const QPoint point) const
virtual

Returns the given top level window for a given position. Default implementation retrieves a list of all top level windows and finds the first window which contains point.

QTransform QPlatformScreen::transformBetween ( Qt::ScreenOrientation  a,
Qt::ScreenOrientation  b,
const QRect target 
)
static

Additional documentation pending.

QList< QPlatformScreen * > QPlatformScreen::virtualSiblings ( ) const
virtual

Returns a list of all the platform screens that are part of the same virtual desktop. Screens part of the same virtual desktop share a common coordinate system, and windows can be freely moved between them.