com.trolltech.qt.gui
Class QDesktopWidget

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.gui.QWidget
                      extended by com.trolltech.qt.gui.QDesktopWidget
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QDesktopWidget
extends 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.


In the illustration above, Application One's primary screen is screen 0, and App Two's primary screen is screen 1. Note:QDesktopWidget inherits the QWidget properties, width() and height(), which specify the size of the desktop. However, for desktops with multiple screens, the size of the desktop is the union of all the screen sizes, so width() and height() should not be used for computing the size of a widget to be placed on one of the screens. The correct width and height values are obtained using availableGeometry() or screenGeometry() for a particular screen.

See also:
QApplication, and QX11Info::appRootWindow().


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 QSignalEmitter.Signal1 resized
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 workAreaResized
          This signal takes 1 generic argument(s).
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QDesktopWidget()
          Creates the desktop widget.
 
Method Summary
 QRect availableGeometry()
          Returns the available geometry of the screen with index screen.
 QRect availableGeometry(int screen)
          Returns the available geometry of the screen with index screen.
 QRect availableGeometry(QPoint point)
          This is an overloaded member function, provided for convenience.
 QRect availableGeometry(QWidget widget)
          This is an overloaded member function, provided for convenience.
 boolean isVirtualDesktop()
          Returns true if the system manages the available screens in a virtual desktop; otherwise returns false.
 int numScreens()
          Returns the number of available screens.
 int primaryScreen()
          Returns the index of the primary screen.
 QWidget screen()
          Returns a widget that represents the screen with index screen (a value of -1 means the default screen).
 QWidget screen(int screen)
          Returns a widget that represents the screen with index screen (a value of -1 means the default screen).
 QRect screenGeometry()
          Returns the geometry of the screen with index screen.
 QRect screenGeometry(int screen)
          Returns the geometry of the screen with index screen.
 QRect screenGeometry(QPoint point)
          This is an overloaded member function, provided for convenience.
 QRect screenGeometry(QWidget widget)
          This is an overloaded member function, provided for convenience.
 int screenNumber()
          Returns the index of the screen that contains the largest part of widget, or -1 if the widget not on a screen.
 int screenNumber(QPoint arg__1)
          This is an overloaded member function, provided for convenience.
 int screenNumber(QWidget widget)
          Returns the index of the screen that contains the largest part of widget, or -1 if the widget not on a screen.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, graphicsProxyWidget, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

resized

public final QSignalEmitter.Signal1 resized

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: screen)>:

This signal is emitted when the size of screen changes.


workAreaResized

public final QSignalEmitter.Signal1 workAreaResized

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: screen)>:

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

Constructor Detail

QDesktopWidget

public 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().

Method Detail

availableGeometry

public final QRect availableGeometry(QPoint point)
This is an overloaded member function, provided for convenience.

Returns the available geometry of the screen which contains p.

See also:
screenGeometry().


availableGeometry

public final QRect availableGeometry(QWidget widget)
This is an overloaded member function, provided for convenience.

Returns the available geometry of the screen which contains widget.

See also:
screenGeometry().


availableGeometry

public final QRect availableGeometry()
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). The default screen is used if screen is -1.

See also:
screenNumber(), and screenGeometry().


availableGeometry

public final QRect availableGeometry(int screen)
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). The default screen is used if screen is -1.

See also:
screenNumber(), and screenGeometry().


isVirtualDesktop

public final boolean isVirtualDesktop()
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.


numScreens

public final int numScreens()
Returns the number of available screens.

See also:
primaryScreen().


primaryScreen

public final int primaryScreen()
Returns the index of the primary screen.

See also:
numScreens().


screen

public final QWidget screen()
Returns a widget that represents the screen with index screen (a value of -1 means the default 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().


screen

public final QWidget screen(int screen)
Returns a widget that represents the screen with index screen (a value of -1 means the default 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().


screenGeometry

public final QRect screenGeometry(QPoint point)
This is an overloaded member function, provided for convenience.

Returns the geometry of the screen which contains p.


screenGeometry

public final QRect screenGeometry(QWidget widget)
This is an overloaded member function, provided for convenience.

Returns the geometry of the screen which contains widget.


screenGeometry

public final QRect screenGeometry()
Returns the geometry of the screen with index screen. The default screen is used if screen is -1.

See also:
screenNumber().


screenGeometry

public final QRect screenGeometry(int screen)
Returns the geometry of the screen with index screen. The default screen is used if screen is -1.

See also:
screenNumber().


screenNumber

public final int screenNumber(QPoint arg__1)
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().


screenNumber

public final int screenNumber()
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().


screenNumber

public final int screenNumber(QWidget widget)
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().