Qt 4.8
Public Functions | Static Public Functions | Public Variables | List of all members
QDesktopWidgetImplementation Class Reference

#include <qdesktopwidget_mac_p.h>

Public Functions

QRect availableRect (int screenIndex) const
 
void onResize ()
 
 QDesktopWidgetImplementation ()
 
QRect screenRect (int screenIndex) const
 
 ~QDesktopWidgetImplementation ()
 

Static Public Functions

static QDesktopWidgetImplementationinstance ()
 

Public Variables

int appScreen
 
QVector< QRectFavailableRects
 
int screenCount
 
QVector< QRectFscreenRects
 

Detailed Description

Definition at line 57 of file qdesktopwidget_mac_p.h.

Constructors and Destructors

◆ QDesktopWidgetImplementation()

QDesktopWidgetImplementation::QDesktopWidgetImplementation ( )

Definition at line 99 of file qdesktopwidget_mac.mm.

◆ ~QDesktopWidgetImplementation()

QDesktopWidgetImplementation::~QDesktopWidgetImplementation ( )

Definition at line 105 of file qdesktopwidget_mac.mm.

106 {
107 }

Functions

◆ availableRect()

QRect QDesktopWidgetImplementation::availableRect ( int  screenIndex) const

Definition at line 114 of file qdesktopwidget_mac.mm.

115 {
116  if (screenIndex < 0 || screenIndex >= screenCount)
117  screenIndex = appScreen;
118 
119  return availableRects[screenIndex].toRect();
120 }

◆ instance()

QDesktopWidgetImplementation * QDesktopWidgetImplementation::instance ( )
static

Definition at line 109 of file qdesktopwidget_mac.mm.

Referenced by QApplicationPrivate::globalEventProcessor().

110 {
111  return qdesktopWidgetImplementation();
112 }

◆ onResize()

void QDesktopWidgetImplementation::onResize ( )

Definition at line 130 of file qdesktopwidget_mac.mm.

Referenced by QApplicationPrivate::globalEventProcessor(), and QDesktopWidget::resizeEvent().

131 {
133  NSArray *displays = [NSScreen screens];
134  screenCount = [displays count];
135 
136  screenRects.clear();
138  NSRect primaryRect = [[displays objectAtIndex:0] frame];
139  for (int i = 0; i<screenCount; i++) {
140  NSRect r = [[displays objectAtIndex:i] frame];
141  int flippedY = - r.origin.y + // account for position offset and
142  primaryRect.size.height - r.size.height; // height difference.
143  screenRects.append(QRectF(r.origin.x, flippedY,
144  r.size.width, r.size.height));
145 
146  r = [[displays objectAtIndex:i] visibleFrame];
147  flippedY = - r.origin.y + // account for position offset and
148  primaryRect.size.height - r.size.height; // height difference.
149  availableRects.append(QRectF(r.origin.x, flippedY,
150  r.size.width, r.size.height));
151  }
152 }
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
Definition: qvector.h:347
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573

◆ screenRect()

QRect QDesktopWidgetImplementation::screenRect ( int  screenIndex) const

Definition at line 122 of file qdesktopwidget_mac.mm.

Referenced by QDesktopWidget::screenNumber().

123 {
124  if (screenIndex < 0 || screenIndex >= screenCount)
125  screenIndex = appScreen;
126 
127  return screenRects[screenIndex].toRect();
128 }

Properties

◆ appScreen

int QDesktopWidgetImplementation::appScreen

Definition at line 64 of file qdesktopwidget_mac_p.h.

Referenced by availableRect(), QDesktopWidget::screenNumber(), and screenRect().

◆ availableRects

QVector<QRectF> QDesktopWidgetImplementation::availableRects

Definition at line 67 of file qdesktopwidget_mac_p.h.

Referenced by availableRect(), onResize(), and QDesktopWidget::resizeEvent().

◆ screenCount

int QDesktopWidgetImplementation::screenCount

◆ screenRects

QVector<QRectF> QDesktopWidgetImplementation::screenRects

Definition at line 68 of file qdesktopwidget_mac_p.h.

Referenced by onResize(), QDesktopWidget::resizeEvent(), and screenRect().


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