- Qt 6.11
- Qt Widgets
- C++ Classes
- QApplication
- Qt 6.11.0 Reference Documentation

# Obsolete Members for QApplication

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

## Static Public Members

`(deprecated in 6.0)` QFontMetrics | fontMetrics()
`(deprecated in 6.5)` void | setActiveWindow(QWidget *active)

## Member Function Documentation

### `[static, deprecated in 6.0]` QFontMetrics QApplication::fontMetrics()

This function is deprecated since 6.0. We strongly advise against using it in new code.

Use QFontMetricsF(qApp->font()) instead.

Returns display (screen) font metrics for the application font. For more information about the difference between QFontMetrics and QFontMetricsF, see the detailed description of QFontMetrics.

See also font(), setFont(), QWidget::fontMetrics(), and QPainter::fontMetrics().

### `[static, deprecated in 6.5]` void QApplication::setActiveWindow(QWidget *active)

This function is deprecated since 6.5. We strongly advise against using it in new code.

Use QWidget::activateWindow() instead.

Sets the active window to the active widget in response to a system event. The function is called from the platform specific event handlers.

Warning: This function does not set the keyboard focus to the active widget. Call QWidget::activateWindow() instead.

It sets the activeWindow() and focusWidget() attributes and sends proper WindowActivate/WindowDeactivate and FocusIn/FocusOut events to all appropriate widgets. The window will then be painted in active state (e.g. cursors in line edits will blink), and it will have tool tips enabled.

See also activeWindow() and QWidget::activateWindow().