Classes - Annotated - Tree - Functions - Home - Structure

QDesktopWidget Class Reference

The QDesktopWidget class provides an API to access the screen information on multi-head systems. More...

#include <qdesktopwidget.h>

Inherits QWidget.

List of all member functions.

Public Members


Detailed Description

The QDesktopWidget class provides an API to access the screen information on multi-head systems.

Systems with more than one graphics card and monitor can manage the screen space available either as multiple desktops, or as a big virtual desktop, which usually has the size of the bounding rectangle of all screens.

For an application, one of the available screens is the primary screen - e.g. the screen where the main widget resides. All windows opened in the context of this application have to be constrained to the boundaries of this screen - it would be awkward if e.g. a dialog box would open up on a different screen, or in the middle of two screens.

The QDesktopWidget provides the information about the geometry of the available screens. Widgets provided by Qt use this class to place e.g. tooltips, menus or dialog boxes according to the parent- or application widget.

Applications can use this class to e.g. save window positions, or to align child widgets to one screen.


Member Function Documentation

QDesktopWidget::QDesktopWidget ()

Creates the desktop widget. If the system supports a virtual desktop, this widget will have the size of the virtual desktop. Otherwise it represents the primary screen.

QDesktopWidget::~QDesktopWidget ()

Destroy the object and free allocated resources.

bool QDesktopWidget::isVirtualDesktop () const

Returns TRUE if the system manages the available screens in a virtual desktop, otherwise returns FALSE.

For virtual desktops, screen will always return the same widget. The size of the virtual desktop is the size of this desktop widget.

int QDesktopWidget::numScreens () const

Returns the total number of available screens.

See also primaryScreen().

int QDesktopWidget::primaryScreen () const

Returns the index of the primary screen.

See also numScreens().

QWidget * QDesktopWidget::screen ( int screen = -1 )

Returns a widget that represents the screen with index screen. This widget can be used to draw directly on the desktop, using an unclipped painter like this:


  QPainter paint( QApplication::desktop()->screen( 0 ), TRUE );
  paint.draw...
  ...
  paint.end();

  

If the system uses a virtual desktop, the returned widget will have the geometry of the desktop for every screen.

See also primaryScreen(), numScreens() and isVirtualDesktop().

const QRect & QDesktopWidget::screenGeometry ( int screen = -1 ) const

Returns the geometry of the display with index screen.

See also screenNumber().

int QDesktopWidget::screenNumber ( QWidget * widget = 0 ) const

Returns the index of the screen that contains the biggest part of widget.

See also primaryScreen().

int QDesktopWidget::screenNumber ( const QPoint & point ) const

Returns the index of the screen that contains point.

See also primaryScreen().


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.


Copyright © 2000 TrolltechTrademarks
Qt version main-beta1