Qt:Документация 4.3.2/qdesktopwidget

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QDesktopWidget Class Reference
[модуль QtGui ]

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

 #include <QDesktopWidget>

Inherits QWidget.

[править] Открытые функции

  • 201 открытых функций унаследованных от QWidget
  • 29 открытых функций унаследованных от QObject
  • 12 открытых функций унаследованных от QPaintDevice

[править] Сигналы

  • 1 сигнал унаследованный от QWidget
  • 1 сигнал унаследованный от QObject

[править] Дополнительные унаследованные члены

  • 56 свойства унаследованных от QWidget
  • 1 свойство унаследованное от QObject
  • 19 открытых слотов унаследованных от QWidget
  • 1 открытый слот унаследованный от QObject
  • 4 статических открытых члена унаследованных от QWidget
  • 5 статических открытых члена унаследованных от QObject
  • 38 защищенных функций унаследованных от QWidget
  • 7 защищенных функций унаследованных от QObject
  • 1 защищенная функция унаследованна от QPaintDevice
  • 1 защищенный слот унаследованный от QWidget

[править] Подробное описание

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

Systems with more than one graphics card and monitor can manage the physical screen space available either as multiple desktops, or as a large virtual desktop, which usually has the size of the bounding rectangle of all the screens (see isVirtualDesktop()). For an application, one of the available screens is the primary screen, i.e. the screen where the main widget resides (see primaryScreen()). All windows opened in the context of the application should be constrained to the boundaries of the primary screen; for example, it would be inconvenient if a dialog box popped up on a different screen, or split over two screens.

The QDesktopWidget provides information about the geometry of the available screens with screenGeometry(). The number of screens available is returned by numScreens(). The screen number that a particular point or widget is located in is returned by screenNumber().

Widgets provided by Qt use this class, for example, to place tooltips, menus and dialog boxes according to the parent or application widget.

Applications can use this class to save window positions, or to place child widgets on one screen.

Файл:Qdesktopwidget.png

In the illustration above, Application One's primary screen is screen 0, and App Two's primary screen is screen 1.

See also QApplication and QX11Info::appRootWindow().


[править] Описание функций-членов

[править]
QDesktopWidget::QDesktopWidget ()

Creates the desktop widget.

If the system supports a virtual desktop, this widget will have the size of the virtual desktop; otherwise this widget will have the size of the primary screen.

Instead of using QDesktopWidget directly, use QApplication::desktop().

[править]
QDesktopWidget::~QDesktopWidget ()

Destroy the object and free allocated resources.

[править]
const QRect QDesktopWidget::availableGeometry ( int screen = -1 ) const

Returns the available geometry of the screen with index screen. What is available will be subrect of screenGeometry() based on what the platform decides is available (for example excludes the dock and menu bar on Mac OS X, or the task bar on Windows).

See also screenNumber() and screenGeometry().

[править]
const QRect QDesktopWidget::availableGeometry ( const QWidget * widget ) const

This is an overloaded member function, provided for convenience.

Returns the available geometry of the screen which contains widget.

See also screenGeometry().

[править]
const QRect QDesktopWidget::availableGeometry ( const QPoint & p ) const

This is an overloaded member function, provided for convenience.

Returns the available geometry of the screen which contains p.

See also screenGeometry().

[править]
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 number of available screens.

See also primaryScreen().

[править]
int QDesktopWidget::primaryScreen () const

Returns the index of the primary screen.

See also numScreens().

[править]
void QDesktopWidget::resized ( int screen ) [signal]

This signal is emitted when the size of screen changes.

[править]
QWidget * QDesktopWidget::screen ( int screen = -1 )

Returns a widget that represents the screen with index screen.

If the system uses a virtual desktop, the returned widget will have the geometry of the entire virtual desktop; i.e., bounding every screen.

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

[править]
const QRect QDesktopWidget::screenGeometry ( int screen = -1 ) const

Returns the geometry of the screen with index screen.

See also screenNumber().

[править]
const QRect QDesktopWidget::screenGeometry ( const QWidget * widget ) const

This is an overloaded member function, provided for convenience.

Returns the geometry of the screen which contains widget.

[править]
const QRect QDesktopWidget::screenGeometry ( const QPoint & p ) const

This is an overloaded member function, provided for convenience.

Returns the geometry of the screen which contains p.

[править]
int QDesktopWidget::screenNumber ( const QWidget * widget = 0 ) const

Returns the index of the screen that contains the largest part of widget, or -1 if the widget not on a screen.

See also primaryScreen().

[править]
int QDesktopWidget::screenNumber ( const QPoint & point ) const

This is an overloaded member function, provided for convenience.

Returns the index of the screen that contains the point, or the screen which is the shortest distance from the point.

See also primaryScreen().

[править]
void QDesktopWidget::workAreaResized ( int screen ) [signal]

This signal is emitted when the work area available on screen changes.


Copyright © 2007 Trolltech Trademarks
Qt 4.3.2