Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QScreen Class

The QScreen class is used to query screen properties. More...

 #include <QScreen>

Inherits: QObject.

This class was introduced in Qt 5.0.

Properties

  • 1 property inherited from QObject

Public Functions

int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const
QRect availableGeometry() const
QSize availableSize() const
QRect availableVirtualGeometry() const
QSize availableVirtualSize() const
int depth() const
QRect geometry() const
QPixmap grabWindow(WId window, int x, int y, int w, int h)
QPlatformScreen * handle() const
bool isLandscape(Qt::ScreenOrientation o) const
bool isPortrait(Qt::ScreenOrientation o) const
qreal logicalDotsPerInch() const
qreal logicalDotsPerInchX() const
qreal logicalDotsPerInchY() const
QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect & rect) const
QString name() const
Qt::ScreenOrientation orientation() const
qreal physicalDotsPerInch() const
qreal physicalDotsPerInchX() const
qreal physicalDotsPerInchY() const
QSizeF physicalSize() const
Qt::ScreenOrientation primaryOrientation() const
qreal refreshRate() const
QSize size() const
QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect & target) const
QRect virtualGeometry() const
QList<QScreen *> virtualSiblings() const
QSize virtualSize() const
  • 31 public functions inherited from QObject

Signals

void availableGeometryChanged(const QRect & rect)
void availableSizeChanged(const QSize & size)
void geometryChanged(const QRect & geometry)
void logicalDotsPerInchChanged(qreal dpi)
void logicalDotsPerInchXChanged(qreal dpi)
void logicalDotsPerInchYChanged(qreal dpi)
void orientationChanged(Qt::ScreenOrientation orientation)
void physicalDotsPerInchChanged(qreal dpi)
void physicalDotsPerInchXChanged(qreal dpi)
void physicalDotsPerInchYChanged(qreal dpi)
void primaryOrientationChanged(Qt::ScreenOrientation orientation)
void refreshRateChanged(qreal refreshRate)
void sizeChanged(const QSize & size)

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QScreen class is used to query screen properties.

A note on logical vs physical dots per inch: physical DPI is based on the actual physical pixel sizes when available, and is useful for print preview and other cases where it's desirable to know the exact physical dimensions of screen displayed contents.

Logical dots per inch are used to convert font and user interface elements from point sizes to pixel sizes, and might be different from the physical dots per inch. The logical dots per inch are sometimes user-settable in the desktop environment's settings panel, to let the user globally control UI and font sizes in different applications.

Property Documentation

availableGeometry : const QRect

This property holds the screen's available geometry in pixels.

The available geometry is the geometry excluding window manager reserved areas such as task bars and system menus.

Access functions:

QRect availableGeometry() const

Notifier signal:

void availableGeometryChanged(const QRect & rect)

availableSize : const QSize

This property holds the screen's available size in pixels.

The available size is the size excluding window manager reserved areas such as task bars and system menus.

Access functions:

QSize availableSize() const

Notifier signal:

void availableSizeChanged(const QSize & size)

depth : const int

This property holds the color depth of the screen.

Access functions:

int depth() const

geometry : const QRect

This property holds the screen's geometry in pixels.

As an example this might return QRect(0, 0, 1280, 1024), or in a virtual desktop setting QRect(1280, 0, 1280, 1024).

Access functions:

QRect geometry() const

Notifier signal:

void geometryChanged(const QRect & geometry)

logicalDotsPerInch : const qreal

This property holds the number of logical dots or pixels per inch.

This value can be used to convert font point sizes to pixel sizes.

This is a convenience property that's simply the average of the logicalDotsPerInchX and logicalDotsPerInchY properties.

Access functions:

qreal logicalDotsPerInch() const

Notifier signal:

void logicalDotsPerInchChanged(qreal dpi)

See also logicalDotsPerInchX() and logicalDotsPerInchY().

logicalDotsPerInchX : const qreal

This property holds the number of logical dots or pixels per inch in the horizontal direction.

This value is used to convert font point sizes to pixel sizes.

Access functions:

qreal logicalDotsPerInchX() const

Notifier signal:

void logicalDotsPerInchXChanged(qreal dpi)

See also logicalDotsPerInchY().

logicalDotsPerInchY : const qreal

This property holds the number of logical dots or pixels per inch in the vertical direction.

This value is used to convert font point sizes to pixel sizes.

Access functions:

qreal logicalDotsPerInchY() const

Notifier signal:

void logicalDotsPerInchYChanged(qreal dpi)

See also logicalDotsPerInchX().

name : const QString

This property holds a user presentable string representing the screen.

For example, on X11 these correspond to the XRandr screen names, typically "VGA1", "HDMI1", etc.

Access functions:

QString name() const

orientation : const Qt::ScreenOrientation

This property holds the screen orientation.

The screen orientation represents the physical orientation of the display. For example, the screen orientation of a mobile device will change based on the device is being held, and a desktop display might be rotated so that it's in portrait mode.

Qt::PrimaryOrientation is never returned.

Access functions:

Qt::ScreenOrientation orientation() const

Notifier signal:

void orientationChanged(Qt::ScreenOrientation orientation)

See also primaryOrientation() and orientationChanged().

physicalDotsPerInch : const qreal

This property holds the number of physical dots or pixels per inch.

This value represents the pixel density on the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate.

This is a convenience property that's simply the average of the physicalDotsPerInchX and physicalDotsPerInchY properties.

Access functions:

qreal physicalDotsPerInch() const

Notifier signal:

void physicalDotsPerInchChanged(qreal dpi)

See also physicalDotsPerInchX() and physicalDotsPerInchY().

physicalDotsPerInchX : const qreal

This property holds the number of physical dots or pixels per inch in the horizontal direction.

This value represents the actual horizontal pixel density on the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate.

Access functions:

qreal physicalDotsPerInchX() const

Notifier signal:

void physicalDotsPerInchXChanged(qreal dpi)

See also physicalDotsPerInchY().

physicalDotsPerInchY : const qreal

This property holds the number of physical dots or pixels per inch in the vertical direction.

This value represents the actual vertical pixel density on the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate.

Access functions:

qreal physicalDotsPerInchY() const

Notifier signal:

void physicalDotsPerInchYChanged(qreal dpi)

See also physicalDotsPerInchX().

physicalSize : const QSizeF

This property holds the screen's physical size (in millimeters).

The physical size represents the actual physical dimensions of the screen's display.

Depending on what information the underlying system provides the value might not be entirely accurate.

Access functions:

QSizeF physicalSize() const

primaryOrientation : const Qt::ScreenOrientation

This property holds the primary screen orientation.

The primary screen orientation is Qt::LandscapeOrientation if the screen geometry's width is greater than or equal to its height, or Qt::PortraitOrientation otherwise.

Access functions:

Qt::ScreenOrientation orientation() const

Notifier signal:

void primaryOrientationChanged(Qt::ScreenOrientation orientation)

See also primaryOrientationChanged().

refreshRate : const qreal

This property holds the approximate vertical refresh rate of the screen in Hz.

Access functions:

qreal refreshRate() const

Notifier signal:

void refreshRateChanged(qreal refreshRate)

size : const QSize

This property holds the pixel resolution of the screen.

Access functions:

QSize size() const

Notifier signal:

void sizeChanged(const QSize & size)

Member Function Documentation

int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const

Convenience function to compute the angle of rotation to get from rotation a to rotation b.

The result will be 0, 90, 180, or 270.

Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().

QRect QScreen::availableVirtualGeometry() const

QSize QScreen::availableVirtualSize() const

QPixmap QScreen::grabWindow(WId window, int x, int y, int w, int h)

Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by QRect(x, y, width, height).

The arguments (x, y) specify the offset in the window, whereas (width, height) specify the area to be copied. If width is negative, the function copies everything to the right border of the window. If height is negative, the function copies everything to the bottom of the window.

The window system identifier (WId) can be retrieved using the QWidget::winId() function. The rationale for using a window identifier and not a QWidget, is to enable grabbing of windows that are not part of the application, window system frames, and so on.

The grabWindow() function grabs pixels from the screen, not from the window, i.e. if there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too. The mouse cursor is generally not grabbed.

Note on X11 that if the given window doesn't have the same depth as the root window, and another window partially or entirely obscures the one you grab, you will not get pixels from the overlying window. The contents of the obscured areas in the pixmap will be undefined and uninitialized.

On Windows Vista and above grabbing a layered window, which is created by setting the Qt::WA_TranslucentBackground attribute, will not work. Instead grabbing the desktop widget should work.

Warning: In general, grabbing an area outside the screen is not safe. This depends on the underlying window system.

QPlatformScreen * QScreen::handle() const

Get the platform screen handle.

bool QScreen::isLandscape(Qt::ScreenOrientation o) const

Convenience function to check if a screen orientation is either landscape or inverted landscape.

Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().

bool QScreen::isPortrait(Qt::ScreenOrientation o) const

Convenience function to check if a screen orientation is either portrait or inverted portrait.

Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().

QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect & rect) const

Maps the rect between two screen orientations.

This will flip the x and y dimensions of the rectangle if orientation is Qt::PortraitOrientation or Qt::InvertedPortraitOrientation and orientation is Qt::LandscapeOrientation or Qt::InvertedLandscapeOrientation, or vice versa.

Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().

Qt::ScreenOrientation QScreen::primaryOrientation() const

QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect & target) const

Convenience function to compute a transform that maps from the coordinate system defined by orientation a into the coordinate system defined by orientation b and target dimensions target.

Example, a is Qt::Landscape, b is Qt::Portrait, and target is QRect(0, 0, w, h) the resulting transform will be such that the point QPoint(0, 0) is mapped to QPoint(0, w), and QPoint(h, w) is mapped to QPoint(0, h). Thus, the landscape coordinate system QRect(0, 0, h, w) is mapped (with a 90 degree rotation) into the portrait coordinate system QRect(0, 0, w, h).

Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().

QRect QScreen::virtualGeometry() const

QList<QScreen *> QScreen::virtualSiblings() const

Get the screen's virtual siblings.

The virtual siblings are the screen instances sharing the same virtual desktop. They share a common coordinate system, and windows can freely be moved or positioned across them without having to be re-created.

QSize QScreen::virtualSize() const

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web