Obsolete Members for QApplication

QApplication 类的以下成员已被废弃。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议不要在新代码中使用它们。

静态公共成员

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

成员函数文档

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

自 6.0 起,此函数已被废弃。我们强烈建议不要在新代码中使用它。

请改用QFontMetricsF(qApp->font())。

返回应用程序字体的显示(屏幕)字体度量值。有关 `QFontMetrics ` 与 `QFontMetricsF` 之间差异的更多信息,请参阅 `QFontMetrics` 的详细说明。

另请参阅 font()、setFont()、QWidget::fontMetrics() 和QPainter::fontMetrics()。

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

自 6.5 版本起,此函数已被废弃。我们强烈建议不要在新代码中使用它。

请改用 `QWidget::activateWindow()`。

在响应系统事件时,将活动窗口设置为active 控件。该函数由平台特定的事件处理程序调用。

警告:此 函数不会将键盘焦点设置为活动控件。请改用 `QWidget::activateWindow()`。

该函数会设置activeWindow()和focusWidget()属性,并向所有相关控件发送相应的WindowActivate/WindowDeactivate 和FocusIn/FocusOut 事件。随后,该窗口将以活动状态进行重绘(例如,行编辑框中的光标将闪烁),并且启用工具提示功能。

另请参阅 activeWindow() 和QWidget::activateWindow()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.