- Qt 5.15
- Qt Widgets
- C++ Classes
- QDesktopWidget
- Qt 5.15.15 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.

## Properties

- `(obsolete)` primaryScreen : const int
- `(obsolete)` screenCount : const int
- `(obsolete)` virtualDesktop : const bool

## Public Functions

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

## Signals

`(obsolete)` void | primaryScreenChanged()
`(obsolete)` void | resized(int screen)
`(obsolete)` void | screenCountChanged(int newCount)
`(obsolete)` void | workAreaResized(int screen)

## Property Documentation

### primaryScreen : const int

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

This property holds the index of the screen that is configured to be the primary screen on the system.

Use QGuiApplication::primaryScreen() instead.

Access functions:

int | primaryScreen() const

Notifier signal:

void | primaryScreenChanged()

### screenCount : const int

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

This property holds the number of screens currently available on the system.

Use QGuiApplication::screens() instead.

This property was introduced in Qt 4.6.

Access functions:

int | screenCount() const

Notifier signal:

void | screenCountChanged(int newCount)

### virtualDesktop : const bool

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

if the system manages the available screens in a virtual desktop.

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

Use QScreen::virtualSiblings() of primary screen instead.

Access functions:

bool | isVirtualDesktop() 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.

Note: Notifier signal for property primaryScreen.

This function was introduced in Qt 5.6.

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.

Note: Notifier signal for property screenCount.

This function was introduced in Qt 4.6.

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.