Qt Jambi Home

com.trolltech.qt.gui
Class QDesktopWidget

java.lang.Object
  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.

Managing Multiple Screens

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

See Also:
QApplication, 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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 QSignalEmitter.Signal1<java.lang.Integer> resized
          This signal is emitted when the size of arg__1 changes.
 QSignalEmitter.Signal1<java.lang.Integer> workAreaResized
          This signal is emitted when the work area available on arg__1 changes.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QDesktopWidget()
          Creates the desktop widget.
 
Method Summary
 QRect availableGeometry()
          Equivalent to availableGeometry(-1).
 QRect availableGeometry(int screen)
          Returns the available geometry of the screen with index screen.
 QRect availableGeometry(QPoint point)
          Returns the available geometry of the screen which contains point.
 QRect availableGeometry(QWidget widget)
          Returns the available geometry of the screen which contains widget.
static QDesktopWidget fromNativePointer(QNativePointer nativePointer)
          This function returns the QDesktopWidget instance pointed to by nativePointer
 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.
protected  void resizeEvent(QResizeEvent e)
          This function is reimplemented for internal reasons.
 QWidget screen()
          Equivalent to screen(-1).
 QWidget screen(int screen)
          Returns a widget that represents the screen with index screen.
 QRect screenGeometry()
          Equivalent to screenGeometry(-1).
 QRect screenGeometry(int screen)
          Returns the geometry of the screen with index screen.
 QRect screenGeometry(QPoint point)
          Returns the geometry of the screen which contains point.
 QRect screenGeometry(QWidget widget)
          Returns the geometry of the screen which contains widget.
 int screenNumber()
          Equivalent to screenNumber(0).
 int screenNumber(QPoint arg__1)
          Returns the index of the screen that contains the arg__1, or the screen which is the shortest distance from the arg__1.
 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, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensurePolished, enterEvent, event, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, 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, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, 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, 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, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

resized

public final QSignalEmitter.Signal1<java.lang.Integer> resized

This signal is emitted when the size of arg__1 changes.

Compatible Slot Signatures:
void mySlot(int arg__1)
void mySlot()


workAreaResized

public final QSignalEmitter.Signal1<java.lang.Integer> workAreaResized

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

Compatible Slot Signatures:
void mySlot(int arg__1)
void mySlot()

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)

Returns the available geometry of the screen which contains point.

See Also:
screenGeometry

availableGeometry

public final QRect availableGeometry()

Equivalent to availableGeometry(-1).


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

See Also:
screenNumber, screenGeometry

availableGeometry

public final QRect availableGeometry(QWidget widget)

Returns the available geometry of the screen which contains widget.

See Also:
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()

Equivalent to screen(-1).


screen

public final QWidget screen(int screen)

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, isVirtualDesktop

screenGeometry

public final QRect screenGeometry(QPoint point)

Returns the geometry of the screen which contains point.


screenGeometry

public final QRect screenGeometry()

Equivalent to screenGeometry(-1).


screenGeometry

public final QRect screenGeometry(int screen)

Returns the geometry of the screen with index screen.

See Also:
screenNumber

screenGeometry

public final QRect screenGeometry(QWidget widget)

Returns the geometry of the screen which contains widget.


screenNumber

public final int screenNumber(QPoint arg__1)

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

See Also:
primaryScreen

screenNumber

public final int screenNumber()

Equivalent to screenNumber(0).


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

resizeEvent

protected void resizeEvent(QResizeEvent e)

This function is reimplemented for internal reasons.

Overrides:
resizeEvent in class QWidget
See Also:
moveEvent, event, resize, QResizeEvent, paintEvent, Example

fromNativePointer

public static QDesktopWidget fromNativePointer(QNativePointer nativePointer)
This function returns the QDesktopWidget instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

Qt Jambi Home