Qt 5.13 | Qt Widgets | C++ Classes | QDesktopWidget

Qt 5.13.2 Reference Documentation

# Obsolete Members for QDesktopWidget

The following members of class QDesktopWidget are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(obsolete)` const QRect | availableGeometry(int screen = -1) const
`(obsolete)` const QRect | availableGeometry(const QPoint &p) const
`(obsolete)` int | numScreens() const
`(obsolete)` QWidget * | screen(int screen = -1)
`(obsolete)` const QRect | screenGeometry(int screen = -1) const
`(obsolete)` const QRect | screenGeometry(const QPoint &p) const
`(obsolete)` int | screenNumber(const QPoint &point) const

## Member Function Documentation

### `[signal]` void QDesktopWidget::primaryScreenChanged()

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This signal is emitted whenever the primary screen changes.

Note: This doesn't mean the QDesktopWidget::primaryScreen index will necessarily be different, but now it will refer to the new primary screen.

Use QGuiApplication::primaryScreenChanged() instead.

This function was introduced in Qt 5.6.

Note: Notifier signal for property primaryScreen.

See also primaryScreen and screenGeometry().

### `[signal]` void QDesktopWidget::resized(int screen)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This signal is emitted when the size of screen changes.

Use QScreen::geometryChanged() instead.

### `[signal]` void QDesktopWidget::screenCountChanged(int newCount)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This signal is emitted when the number of screens changes to newCount.

Use QGuiApplication::screenAdded and QGuiApplication::screenRemoved() instead.

This function was introduced in Qt 4.6.

Note: Notifier signal for property screenCount.

See also screenCount.

### `[signal]` void QDesktopWidget::workAreaResized(int screen)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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

Use QScreen::availableGeometryChanged() instead.

### const QRect QDesktopWidget::availableGeometry(int screen = -1) const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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 macOS, or the task bar on Windows). The default screen is used if screen is -1.

Use QGuiApplication::screens() instead.

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

### const QRect QDesktopWidget::availableGeometry(const QPoint &p) const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This is an overloaded function.

Returns the available geometry of the screen which contains p.

Use QGuiApplication::screenAt() instead.

See also screenGeometry().

### int QDesktopWidget::numScreens() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the number of available screens.

Use QGuiApplication::screens() instead.

See also primaryScreen.

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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.

Use QScreen instead.

See also primaryScreen, screenCount, and virtualDesktop.

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the geometry of the screen with index screen. The default screen is used if screen is -1.

Use QGuiApplication::screens() instead.

See also screenNumber().

### const QRect QDesktopWidget::screenGeometry(const QPoint &p) const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This is an overloaded function.

Returns the geometry of the screen which contains p.

Use QGuiApplication::screenAt() instead.

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This is an overloaded function.

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

Use QGuiApplication::screenAt() instead.

See also primaryScreen.