diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-10-13 15:54:23 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-10-14 08:19:29 +0000 |
commit | 6a35e77ef3f4eae80ca49937c680836eb4acdbe6 (patch) | |
tree | 12462105731748d75d1fa1b7b45daf586b402413 /src/widgets/styles | |
parent | dcf7da7c93c0d974bfb72ffa677a1d26fb9be5e0 (diff) |
Change confusing Q_DEAD_CODE_FROM_QT4_FOO define
Commit c5db8fc74 changed all instances of Q_WS_FOO to have the prefix
Q_DEAD_CODE_FROM_QT4 instead, to make it clearer when reading the code
that the code in question was a left-over from Qt4, when we used
Q_WS_ defines instead of Q_OS_ defines.
This worked well for cases of #ifdef Q_DEAD_CODE_FROM_QT4, but less so
for cases of #ifndef Q_DEAD_CODE_FROM_QT4, where the code was actually
unconditionally included.
To make this even clearer, the defines have been replaced by checks for
1 or 0, with a comment describing how the code used to look in Qt4. The
use of constants in the check also makes it easier for editors to parse
the condition and show visually that the code is defined out.
Change-Id: I152070d87334df7259b417cd5e17d7b7950379b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qpixmapstyle.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qstylefactory.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h index fdc22794b4..459784c538 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -134,7 +134,7 @@ private: friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); }; -#endif // Q_DEAD_CODE_FROM_QT4_MAC +#endif QT_END_NAMESPACE diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index ee5fd704dc..b51860045d 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -108,7 +108,7 @@ QPixmapStyle::~QPixmapStyle() void QPixmapStyle::polish(QApplication *application) { QCommonStyle::polish(application); -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) +#if 0 // Used to be included in Qt4 for Q_WS_WIN QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false); #endif } @@ -170,7 +170,7 @@ void QPixmapStyle::polish(QWidget *widget) frame->setContentsMargins(pix.margins.left(), desc.margins.top(), pix.margins.right(), desc.margins.bottom()); frame->setAttribute(Qt::WA_TranslucentBackground); -#ifdef Q_DEAD_CODE_FROM_QT4_WIN +#if 0 // Used to be included in Qt4 for Q_WS_WIN // FramelessWindowHint is needed on windows to make // WA_TranslucentBackground work properly frame->setWindowFlags(widget->windowFlags() | Qt::FramelessWindowHint); diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index bb849c148f..09cccff4e8 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -131,7 +131,7 @@ QStyle *QStyleFactory::create(const QString& key) #ifndef QT_NO_STYLE_MAC if (style.startsWith(QLatin1String("macintosh"))) { ret = new QMacStyle; -# ifdef Q_DEAD_CODE_FROM_QT4_MAC +# if 0 // Used to be included in Qt4 for Q_WS_MAC if (style == QLatin1String("macintosh")) style += QLatin1String(" (aqua)"); # endif @@ -184,7 +184,7 @@ QStringList QStyleFactory::keys() #endif #ifndef QT_NO_STYLE_MAC QString mstyle = QLatin1String("Macintosh"); -# ifdef Q_DEAD_CODE_FROM_QT4_MAC +# if 0 // Used to be included in Qt4 for Q_WS_MAC mstyle += QLatin1String(" (aqua)"); # endif if (!list.contains(mstyle)) diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 71cf2fb267..83739655af 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -199,7 +199,7 @@ void QStyleOption::init(const QWidget *widget) state |= QStyle::State_Active; if (widget->isWindow()) state |= QStyle::State_Window; -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#if 0 // Used to be included in Qt4 for Q_WS_MAC extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget)) state &= ~QStyle::State_Enabled; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index b214dae154..8e77ae0e44 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5045,7 +5045,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0); return subRule.boxSize(subRule.adjustSize(sz)); } -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#if 0 // Used to be included in Qt4 for Q_WS_MAC if (baseStyle()->inherits("QMacStyle")) { //adjust the size after the call to the style because the mac style ignore the size arguments anyway. //this might cause the (max-){width,height} property to include the native style border while they should not. |