Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QCocoaScreen Class Reference

#include <qcocoascreen.h>

Inheritance diagram for QCocoaScreen:
Collaboration diagram for QCocoaScreen:

Public Member Functions

 ~QCocoaScreen ()
QPixmap grabWindow (WId window, int x, int y, int width, int height) const override
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.
QColorSpace colorSpace () const override
qreal devicePixelRatio () const override
 Reimplement this function in subclass to return the device pixel ratio for the screen.
QSizeF physicalSize () const override
 Reimplement this function in subclass to return the physical size of the screen, in millimeters.
QDpi logicalBaseDpi () const override
 Reimplement to return the base logical DPI for the platform.
qreal refreshRate () const override
 Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz.
QString name () const override
QPlatformCursorcursor () const override
 Reimplement this function in subclass to return the cursor of the screen.
QWindowtopLevelAt (const QPoint &point) const override
 Return the given top level window for a given position.
QList< QPlatformScreen * > virtualSiblings () const override
 Returns a list of all the platform screens that are part of the same virtual desktop.
QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint () const override
 Returns a hint about this screen's subpixel layout structure.
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.
NSScreen * nativeScreen () const override
bool requestUpdate ()
void deliverUpdateRequests ()
Public Member Functions inherited from QPlatformScreen
 QPlatformScreen ()
virtual ~QPlatformScreen ()
virtual bool isPlaceholder () const
virtual QDpi logicalDpi () const
 Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen.
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 QString manufacturer () const
 Reimplement this function in subclass to return the manufacturer of this screen.
virtual QString model () const
 Reimplement this function in subclass to return the model of this screen.
virtual QString serialNumber () const
 Reimplement this function in subclass to return the serial number of this screen.
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 NSScreen * nativeScreenForDisplayId (CGDirectDisplayID displayId)
static QCocoaScreenprimaryScreen ()
 The screen used as a reference for global window geometry.
static QCocoaScreenget (NSScreen *nsScreen)
static QCocoaScreenget (CGDirectDisplayID displayId)
static QCocoaScreenget (CFUUIDRef uuid)
static CGPoint mapToNative (const QPointF &pos, QCocoaScreen *screen=QCocoaScreen::primaryScreen())
static CGRect mapToNative (const QRectF &rect, QCocoaScreen *screen=QCocoaScreen::primaryScreen())
static QPointF mapFromNative (CGPoint pos, QCocoaScreen *screen=QCocoaScreen::primaryScreen())
static QRectF mapFromNative (CGRect rect, QCocoaScreen *screen=QCocoaScreen::primaryScreen())
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)

Friends

class QCocoaIntegration
class QCocoaWindow
QDebug operator<< (QDebug debug, const QCocoaScreen *screen)

Additional Inherited Members

Public Types inherited from QPlatformScreen
enum  SubpixelAntialiasingType {
  Subpixel_None , Subpixel_RGB , Subpixel_BGR , Subpixel_VRGB ,
  Subpixel_VBGR
}
enum  PowerState { PowerStateOn , PowerStateStandby , PowerStateSuspend , PowerStateOff }
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

Definition at line 23 of file qcocoascreen.h.

Constructor & Destructor Documentation

◆ ~QCocoaScreen()

QCocoaScreen::~QCocoaScreen ( )

Definition at line 194 of file qcocoascreen.mm.

Member Function Documentation

◆ availableGeometry()

QRect QCocoaScreen::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 32 of file qcocoascreen.h.

◆ colorSpace()

QColorSpace QCocoaScreen::colorSpace ( ) const
inlineoverridevirtual

Reimplemented from QPlatformScreen.

Definition at line 35 of file qcocoascreen.h.

◆ cursor()

QPlatformCursor * QCocoaScreen::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 41 of file qcocoascreen.h.

◆ deliverUpdateRequests()

void QCocoaScreen::deliverUpdateRequests ( )

Definition at line 378 of file qcocoascreen.mm.

References DeferredDebugHelper::debug, and DeferredDebugHelper::flushOutput().

Here is the call graph for this function:

◆ depth()

int QCocoaScreen::depth ( ) const
inlineoverridevirtual

Reimplement in subclass to return current depth of the screen.

Implements QPlatformScreen.

Definition at line 33 of file qcocoascreen.h.

◆ devicePixelRatio()

qreal QCocoaScreen::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 36 of file qcocoascreen.h.

◆ format()

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

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

Implements QPlatformScreen.

Definition at line 34 of file qcocoascreen.h.

◆ geometry()

QRect QCocoaScreen::geometry ( ) const
inlineoverridevirtual

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

Implements QPlatformScreen.

Definition at line 31 of file qcocoascreen.h.

◆ get() [1/3]

QCocoaScreen * QCocoaScreen::get ( CFUUIDRef uuid)
static

Definition at line 772 of file qcocoascreen.mm.

◆ get() [2/3]

QCocoaScreen * QCocoaScreen::get ( CGDirectDisplayID displayId)
static

Definition at line 761 of file qcocoascreen.mm.

◆ get() [3/3]

QCocoaScreen * QCocoaScreen::get ( NSScreen * nsScreen)
static

Definition at line 746 of file qcocoascreen.mm.

◆ grabWindow()

QPixmap QCocoaScreen::grabWindow ( WId view,
int x,
int y,
int width,
int height ) const
overridevirtual

Coordinates are in screen coordinates if view is 0, otherwise they are in view coordinates.

Reimplemented from QPlatformScreen.

Definition at line 601 of file qcocoascreen.mm.

◆ logicalBaseDpi()

QDpi QCocoaScreen::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 38 of file qcocoascreen.h.

◆ mapFromNative() [1/2]

QPointF QCocoaScreen::mapFromNative ( CGPoint pos,
QCocoaScreen * screen = QCocoaScreen::primaryScreen() )
static

Definition at line 819 of file qcocoascreen.mm.

◆ mapFromNative() [2/2]

QRectF QCocoaScreen::mapFromNative ( CGRect rect,
QCocoaScreen * screen = QCocoaScreen::primaryScreen() )
static

Definition at line 825 of file qcocoascreen.mm.

◆ mapToNative() [1/2]

CGPoint QCocoaScreen::mapToNative ( const QPointF & pos,
QCocoaScreen * screen = QCocoaScreen::primaryScreen() )
static

Definition at line 807 of file qcocoascreen.mm.

◆ mapToNative() [2/2]

CGRect QCocoaScreen::mapToNative ( const QRectF & rect,
QCocoaScreen * screen = QCocoaScreen::primaryScreen() )
static

Definition at line 813 of file qcocoascreen.mm.

◆ name()

QString QCocoaScreen::name ( ) const
inlineoverridevirtual

Reimplemented from QPlatformScreen.

Definition at line 40 of file qcocoascreen.h.

◆ nativeScreen()

NSScreen * QCocoaScreen::nativeScreen ( ) const
override
Returns
the underlying NSScreen of this QScreen.

Definition at line 799 of file qcocoascreen.mm.

◆ nativeScreenForDisplayId()

NSScreen * QCocoaScreen::nativeScreenForDisplayId ( CGDirectDisplayID displayId)
static

Definition at line 790 of file qcocoascreen.mm.

◆ orientation()

Qt::ScreenOrientation QCocoaScreen::orientation ( ) const
overridevirtual

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 541 of file qcocoascreen.mm.

◆ physicalSize()

QSizeF QCocoaScreen::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 37 of file qcocoascreen.h.

◆ primaryScreen()

QCocoaScreen * QCocoaScreen::primaryScreen ( )
static

The screen used as a reference for global window geometry.

Definition at line 727 of file qcocoascreen.mm.

◆ refreshRate()

qreal QCocoaScreen::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 39 of file qcocoascreen.h.

◆ requestUpdate()

bool QCocoaScreen::requestUpdate ( )

Definition at line 267 of file qcocoascreen.mm.

◆ subpixelAntialiasingTypeHint()

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

Returns a hint about this screen's subpixel layout structure.

The default implementation queries the {QT_SUBPIXEL_AA_TYPE} env variable. This is just a hint because most platforms don't have a way to retrieve the correct value from hardware and instead rely on font configurations.

Reimplemented from QPlatformScreen.

Definition at line 531 of file qcocoascreen.mm.

◆ topLevelAt()

QWindow * QCocoaScreen::topLevelAt ( const QPoint & pos) const
overridevirtual

Return 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 pos

Reimplemented from QPlatformScreen.

Definition at line 554 of file qcocoascreen.mm.

◆ virtualSiblings()

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

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.

Reimplemented from QPlatformScreen.

Definition at line 735 of file qcocoascreen.mm.

◆ operator<<

QDebug operator<< ( QDebug debug,
const QCocoaScreen * screen )
friend

Definition at line 832 of file qcocoascreen.mm.

◆ QCocoaIntegration

friend class QCocoaIntegration
friend

Definition at line 105 of file qcocoascreen.h.

◆ QCocoaWindow

friend class QCocoaWindow
friend

Definition at line 106 of file qcocoascreen.h.


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