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
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
 
bool requestUpdate ()
 
void deliverUpdateRequests ()
 
bool isRunningDisplayLink () const
 
- 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 22 of file qcocoascreen.h.

Constructor & Destructor Documentation

◆ ~QCocoaScreen()

QCocoaScreen::~QCocoaScreen ( )

Definition at line 189 of file qcocoascreen.mm.

References Q_ASSERT_X, and QPlatformScreen::screen().

+ Here is the call graph for this function:

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 31 of file qcocoascreen.h.

Referenced by QCocoaMenu::showPopup().

+ Here is the caller graph for this function:

◆ colorSpace()

QColorSpace QCocoaScreen::colorSpace ( ) const
inlineoverridevirtual

Reimplemented from QPlatformScreen.

Definition at line 34 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 40 of file qcocoascreen.h.

◆ deliverUpdateRequests()

void QCocoaScreen::deliverUpdateRequests ( )

Definition at line 404 of file qcocoascreen.mm.

References QGuiApplication::allWindows(), QList< T >::at(), deliverUpdateRequests(), QBasicAtomicInteger< T >::fetchAndStoreRelaxed(), i, QSurface::MetalSurface, pool, qCDebug, qCWarning, qDeferredDebug, qEnvironmentVariableIsSet(), QPlatformScreen::screen(), QList< T >::size(), QSurface::VulkanSurface, window(), and QPlatformScreen::windows().

Referenced by deliverUpdateRequests(), and requestUpdate().

+ Here is the call graph for this function:
+ Here is the caller 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 32 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 35 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 33 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 30 of file qcocoascreen.h.

Referenced by grabWindow().

+ Here is the caller graph for this function:

◆ get() [1/3]

QCocoaScreen * QCocoaScreen::get ( CFUUIDRef uuid)
static

Definition at line 761 of file qcocoascreen.mm.

References QScreen::handle(), Q_ASSERT, QPlatformScreen::screen(), and QGuiApplication::screens().

+ Here is the call graph for this function:

◆ get() [2/3]

QCocoaScreen * QCocoaScreen::get ( CGDirectDisplayID displayId)
static

Definition at line 750 of file qcocoascreen.mm.

References QScreen::handle(), QPlatformScreen::screen(), and QGuiApplication::screens().

+ Here is the call graph for this function:

◆ get() [3/3]

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

Definition at line 735 of file qcocoascreen.mm.

References get(), and qCWarning.

Referenced by QCocoaWindow::createNSWindow(), and get().

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

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

References dpr(), QPainter::drawPixmap(), QPixmap::fromImage(), geometry(), i, QRect::intersected(), mapFromNative(), nativeScreenForDisplayId(), painter, pixmap, position(), qCDebug, qMax(), qt_mac_toQImage(), Qt::transparent, and view.

+ Here is the call graph for this function:

◆ isRunningDisplayLink()

bool QCocoaScreen::isRunningDisplayLink ( ) const

Definition at line 513 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 37 of file qcocoascreen.h.

◆ mapFromNative() [1/2]

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

Definition at line 808 of file qcocoascreen.mm.

References QScreen::geometry, pos, Q_ASSERT, qt_mac_flip(), and QPlatformScreen::screen().

Referenced by QCocoaWindow::geometry(), grabWindow(), QCocoaWindow::handleGeometryChange(), QCocoaCursor::pos(), and QCocoaWindow::setupPopupMonitor().

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

◆ mapFromNative() [2/2]

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

Definition at line 814 of file qcocoascreen.mm.

References QScreen::geometry, Q_ASSERT, qt_mac_flip(), rect, and QPlatformScreen::screen().

+ Here is the call graph for this function:

◆ mapToNative() [1/2]

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

Definition at line 796 of file qcocoascreen.mm.

References QScreen::geometry, pos, Q_ASSERT, qt_mac_flip(), and QPlatformScreen::screen().

Referenced by QCocoaWindow::createNSWindow(), and QCocoaWindow::setCocoaGeometry().

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

◆ mapToNative() [2/2]

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

Definition at line 802 of file qcocoascreen.mm.

References QScreen::geometry, Q_ASSERT, qt_mac_flip(), rect, and QPlatformScreen::screen().

+ Here is the call graph for this function:

◆ name()

QString QCocoaScreen::name ( ) const
inlineoverridevirtual

Reimplemented from QPlatformScreen.

Definition at line 39 of file qcocoascreen.h.

◆ nativeScreen()

NSScreen * QCocoaScreen::nativeScreen ( ) const

Definition at line 788 of file qcocoascreen.mm.

References nativeScreenForDisplayId().

+ Here is the call graph for this function:

◆ nativeScreenForDisplayId()

NSScreen * QCocoaScreen::nativeScreenForDisplayId ( CGDirectDisplayID displayId)
static

Definition at line 779 of file qcocoascreen.mm.

References QPlatformScreen::screen().

Referenced by grabWindow(), and nativeScreen().

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

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

References Qt::InvertedLandscapeOrientation, Qt::InvertedPortraitOrientation, Qt::LandscapeOrientation, QPlatformScreen::orientation(), and Qt::PortraitOrientation.

+ Here is the call graph for this function:

◆ 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 36 of file qcocoascreen.h.

◆ primaryScreen()

QCocoaScreen * QCocoaScreen::primaryScreen ( )
static

The screen used as a reference for global window geometry.

Definition at line 716 of file qcocoascreen.mm.

References QScreen::handle(), and QGuiApplication::primaryScreen.

+ Here is the call graph for this function:

◆ 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 38 of file qcocoascreen.h.

◆ requestUpdate()

bool QCocoaScreen::requestUpdate ( )

Definition at line 298 of file qcocoascreen.mm.

References deliverUpdateRequests(), Q_ASSERT, Q_UNUSED, qCDebug, qCWarning, and queue.

Referenced by QCocoaWindow::requestUpdate().

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

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

References QPlatformScreen::Subpixel_None, QPlatformScreen::Subpixel_RGB, and QPlatformScreen::subpixelAntialiasingTypeHint().

+ Here is the call graph for this function:

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

References qnsview_cast(), QHighDpi::toNativeLocalPosition(), QHighDpi::toNativePixels(), window(), and QPlatformWindow::window().

+ Here is the call graph for this function:

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

References QScreen::handle(), QPlatformScreen::screen(), and QGuiApplication::screens().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 821 of file qcocoascreen.mm.

◆ QCocoaIntegration

friend class QCocoaIntegration
friend

Definition at line 100 of file qcocoascreen.h.

◆ QCocoaWindow

friend class QCocoaWindow
friend

Definition at line 101 of file qcocoascreen.h.


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