From c10a1c8f14c519024cdc6f0ee3fae64263979635 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 21 Apr 2016 08:25:23 +0200 Subject: QApplication: Deprecate ColorSpec, setColorSpec() and colorSpec(). The code did not have any effect even (already in Qt 4). Deprecate functions and mark as \obsolete. Change-Id: I8d85d9ee8f089f489af6263b33f7c2866e65096a Reviewed-by: Marc Mutz --- .../doc/snippets/code/src_gui_kernel_qapplication.cpp | 1 + src/widgets/kernel/qapplication.cpp | 15 ++++++++------- src/widgets/kernel/qapplication.h | 6 ++++-- src/widgets/kernel/qapplication_p.h | 1 - 4 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp index c39a0d83bb..a907a0421f 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp @@ -77,6 +77,7 @@ QApplication::setStyle(QStyleFactory::create("Fusion")); //! [1] +// ### fixme: Qt 6: Remove [2] //! [2] int main(int argc, char *argv[]) { diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 0c7934ceaf..f901f6fb16 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -337,8 +337,10 @@ void QApplicationPrivate::createEventDispatcher() \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings */ +// ### fixme: Qt 6: Remove ColorSpec and accessors. /*! \enum QApplication::ColorSpec + \obsolete \value NormalColor the default color allocation policy \value CustomColor the same as NormalColor for X11; allocates colors @@ -395,8 +397,6 @@ QString QApplicationPrivate::styleSheet; // default application styles #endif QPointer QApplicationPrivate::leaveAfterRelease = 0; -int QApplicationPrivate::app_cspec = QApplication::NormalColor; - QPalette *QApplicationPrivate::sys_pal = 0; // default system palette QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer @@ -1275,17 +1275,21 @@ QStyle* QApplication::setStyle(const QString& style) /*! Returns the color specification. + \obsolete \sa QApplication::setColorSpec() */ int QApplication::colorSpec() { - return QApplicationPrivate::app_cspec; + return QApplication::NormalColor; } /*! Sets the color specification for the application to \a spec. + \obsolete + + This call has no effect. The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color @@ -1341,10 +1345,7 @@ int QApplication::colorSpec() void QApplication::setColorSpec(int spec) { - if (Q_UNLIKELY(qApp)) - qWarning("QApplication::setColorSpec: This function must be " - "called before the QApplication object is created"); - QApplicationPrivate::app_cspec = spec; + Q_UNUSED(spec) } /*! diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index db690a3539..52f44759f4 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -98,8 +98,10 @@ public: static void setStyle(QStyle*); static QStyle *setStyle(const QString&); enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 }; - static int colorSpec(); - static void setColorSpec(int); +#if QT_DEPRECATED_SINCE(5, 8) + QT_DEPRECATED static int colorSpec(); + QT_DEPRECATED static void setColorSpec(int); +#endif // QT_DEPRECATED_SINCE(5, 8) #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {} #endif diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 34da6586fa..8aab3bfae4 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -183,7 +183,6 @@ public: static QWidgetList *popupWidgets; static QStyle *app_style; static bool overrides_native_style; - static int app_cspec; static QPalette *sys_pal; static QPalette *set_pal; -- cgit v1.2.3