From 7c254024f32ab783385718dea08829c5e0c82408 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 9 Feb 2019 14:44:43 +0100 Subject: QtWidgets: compile with QT_DISABLE_DEPRECATED_BEFORE=0x050d00 Don't call or implement functions which are not available when compiling with QT_DISABLE_DEPRECATED_BEFORE=0x050d00 Change-Id: If427e20774b358dc16fa1c7d7ba8c0feba3e144b Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qdialog.cpp | 2 ++ src/widgets/graphicsview/qgraphicsscene.h | 2 ++ src/widgets/kernel/qapplication.cpp | 2 ++ src/widgets/kernel/qdesktopwidget.cpp | 24 ++++++++++++++++++++---- src/widgets/kernel/qdesktopwidget.h | 2 ++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index efd2c2ffea..3c49016e2c 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -779,7 +779,9 @@ void QDialog::setVisible(bool visible) return; QWidget::setVisible(visible); +#if QT_DEPRECATED_SINCE(5, 13) showExtension(d->doShowExtension); +#endif QWidget *fw = window()->focusWidget(); if (!fw) fw = this; diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index 71b8fc3013..3cc00ead08 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -103,7 +103,9 @@ class Q_WIDGETS_EXPORT QGraphicsScene : public QObject Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) Q_PROPERTY(QPalette palette READ palette WRITE setPalette) Q_PROPERTY(QFont font READ font WRITE setFont) +#if QT_DEPRECATED_SINCE(5, 13) Q_PROPERTY(bool sortCacheEnabled READ isSortCacheEnabled WRITE setSortCacheEnabled) +#endif Q_PROPERTY(bool stickyFocus READ stickyFocus WRITE setStickyFocus) Q_PROPERTY(qreal minimumRenderSize READ minimumRenderSize WRITE setMinimumRenderSize) Q_PROPERTY(bool focusOnTouch READ focusOnTouch WRITE setFocusOnTouch) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3594b5c902..7c44bfe39d 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1243,6 +1243,7 @@ QStyle* QApplication::setStyle(const QString& style) return s; } +#if QT_DEPRECATED_SINCE(5, 8) /*! Returns the color specification. \obsolete @@ -1317,6 +1318,7 @@ void QApplication::setColorSpec(int spec) { Q_UNUSED(spec) } +#endif /*! \property QApplication::globalStrut diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 5fb7882932..d17c7eb36c 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -176,26 +176,32 @@ void QDesktopWidgetPrivate::_q_updateScreens() // Notice that we trigger screenCountChanged even if a screen was removed and another one added, // in which case the total number of screens did not change. This is the only way for applications // to notice that a screen was swapped out against another one. +#if QT_DEPRECATED_SINCE(5, 11) QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED emit q->screenCountChanged(targetLength); QT_WARNING_POP +#endif } +#if QT_DEPRECATED_SINCE(5, 11) foreach (int changedScreen, changedScreens) QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED emit q->resized(changedScreen); QT_WARNING_POP +#endif } void QDesktopWidgetPrivate::_q_availableGeometryChanged() { +#if QT_DEPRECATED_SINCE(5, 11) Q_Q(QDesktopWidget); if (QScreen *screen = qobject_cast(q->sender())) QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED emit q->workAreaResized(QGuiApplication::screens().indexOf(screen)); QT_WARNING_POP +#endif } QDesktopWidget::QDesktopWidget() @@ -212,10 +218,12 @@ QDesktopWidget::~QDesktopWidget() { } +#if QT_DEPRECATED_SINCE(5, 11) bool QDesktopWidget::isVirtualDesktop() const { return QDesktopWidgetPrivate::isVirtualDesktop(); } +#endif bool QDesktopWidgetPrivate::isVirtualDesktop() { @@ -242,24 +250,27 @@ int QDesktopWidgetPrivate::height() return geometry().height(); } +#if QT_DEPRECATED_SINCE(5, 11) int QDesktopWidget::primaryScreen() const { return QDesktopWidgetPrivate::primaryScreen(); } +#endif int QDesktopWidgetPrivate::primaryScreen() { return 0; } -int QDesktopWidget::numScreens() const +int QDesktopWidgetPrivate::numScreens() { - return QDesktopWidgetPrivate::numScreens(); + return qMax(QGuiApplication::screens().size(), 1); } -int QDesktopWidgetPrivate::numScreens() +#if QT_DEPRECATED_SINCE(5, 11) +int QDesktopWidget::numScreens() const { - return qMax(QGuiApplication::screens().size(), 1); + return QDesktopWidgetPrivate::numScreens(); } QWidget *QDesktopWidget::screen(int screen) @@ -274,6 +285,7 @@ const QRect QDesktopWidget::availableGeometry(int screenNo) const { return QDesktopWidgetPrivate::availableGeometry(screenNo); } +#endif const QRect QDesktopWidgetPrivate::availableGeometry(int screenNo) { @@ -281,10 +293,12 @@ const QRect QDesktopWidgetPrivate::availableGeometry(int screenNo) return screen ? screen->availableGeometry() : QRect(); } +#if QT_DEPRECATED_SINCE(5, 11) const QRect QDesktopWidget::screenGeometry(int screenNo) const { return QDesktopWidgetPrivate::screenGeometry(screenNo); } +#endif const QRect QDesktopWidgetPrivate::screenGeometry(int screenNo) { @@ -344,10 +358,12 @@ int QDesktopWidgetPrivate::screenNumber(const QWidget *w) return allScreens.indexOf(widgetScreen); } +#if QT_DEPRECATED_SINCE(5, 11) int QDesktopWidget::screenNumber(const QPoint &p) const { return QDesktopWidgetPrivate::screenNumber(p); } +#endif int QDesktopWidgetPrivate::screenNumber(const QPoint &p) { diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h index f986f0db20..e5c587984f 100644 --- a/src/widgets/kernel/qdesktopwidget.h +++ b/src/widgets/kernel/qdesktopwidget.h @@ -52,9 +52,11 @@ class QDesktopWidgetPrivate; class Q_WIDGETS_EXPORT QDesktopWidget : public QWidget { Q_OBJECT +#if QT_DEPRECATED_SINCE(5, 11) Q_PROPERTY(bool virtualDesktop READ isVirtualDesktop) Q_PROPERTY(int screenCount READ screenCount NOTIFY screenCountChanged) Q_PROPERTY(int primaryScreen READ primaryScreen NOTIFY primaryScreenChanged) +#endif public: QDesktopWidget(); ~QDesktopWidget(); -- cgit v1.2.3