From eed5514eaf03c04f1b93d0899789841b8488d9a6 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 13 Oct 2020 21:04:45 +0200 Subject: Mark QApplication::fontMetrics as obsolete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It returns the QFontMetrics of the desktop widget, so just for the default screen. Any usage of it is probably wrong, esp since code should use QFontMetricsF instead. Change-Id: I0b4b85a74a2c9b6cc023ffda0b2b399f9fc3c1c4 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qapplication.cpp | 3 +++ src/widgets/kernel/qapplication.h | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index be37182ccd..41b3dd9aca 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1559,7 +1559,9 @@ QWidget *QApplication::activeWindow() return QApplicationPrivate::active_window; } +#if QT_DEPRECATED_SINCE(6,0) /*! + \obsolete Use the QFontMetricsF constructor instead Returns display (screen) font metrics for the application font. \sa font(), setFont(), QWidget::fontMetrics(), QPainter::fontMetrics() @@ -1569,6 +1571,7 @@ QFontMetrics QApplication::fontMetrics() { return QApplicationPrivate::desktop()->fontMetrics(); } +#endif bool QApplicationPrivate::tryCloseAllWidgetWindows(QWindowList *processedWindows) { diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 52304c637a..f5645b0a11 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -100,7 +100,11 @@ public: static QFont font(const QWidget*); static QFont font(const char *className); static void setFont(const QFont &, const char* className = nullptr); + +#if QT_DEPRECATED_SINCE(6,0) + QT_DEPRECATED_VERSION_X_6_0("Use the QFontMetricsF constructor instead.") static QFontMetrics fontMetrics(); +#endif static QWidgetList allWidgets(); static QWidgetList topLevelWidgets(); -- cgit v1.2.3