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/graphicsview | |
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/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 2 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 4 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 4 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview_p.h | 4 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget.cpp | 2 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget_p.cpp | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 5492862287..6124796073 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -7492,7 +7492,7 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints) */ void QGraphicsItem::updateMicroFocus() { -#if !defined(QT_NO_IM) && defined(Q_DEAD_CODE_FROM_QT4_X11) +#if !defined(QT_NO_IM) && 0 /* Used to be included in Qt4 for Q_WS_X11 */ if (QWidget *fw = QApplication::focusWidget()) { if (scene()) { for (int i = 0 ; i < scene()->views().count() ; ++i) { diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 5b46eb35be..e6726285d9 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4160,7 +4160,7 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) wheelEvent->scenePos(), wheelEvent->widget()); -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#if 0 // Used to be included in Qt4 for Q_WS_MAC // On Mac, ignore the event if the first item under the mouse is not the last opened // popup (or one of its descendant) if (!d->popupWidgets.isEmpty() && !wheelCandidates.isEmpty() && wheelCandidates.first() != d->popupWidgets.back() && !d->popupWidgets.back()->isAncestorOf(wheelCandidates.first())) { @@ -4399,7 +4399,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte // Render directly, using no cache. if (cacheMode == QGraphicsItem::NoCache -#ifdef Q_DEAD_CODE_FROM_QT4_X11 +#if 0 // Used to be included in Qt4 for Q_WS_X11 || !X11->use_xrender #endif ) { diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 3f7d2d1cd1..41f5eddd99 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -3490,7 +3490,7 @@ void QGraphicsView::paintEvent(QPaintEvent *event) // Draw background if ((d->cacheMode & CacheBackground) -#ifdef Q_DEAD_CODE_FROM_QT4_X11 +#if 0 // Used to be included in Qt4 for Q_WS_X11 && X11->use_xrender #endif ) { @@ -3689,7 +3689,7 @@ void QGraphicsView::scrollContentsBy(int dx, int dy) d->updateLastCenterPoint(); if ((d->cacheMode & CacheBackground) -#ifdef Q_DEAD_CODE_FROM_QT4_X11 +#if 0 // Used to be included in Qt4 for Q_WS_X11 && X11->use_xrender #endif ) { diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h index 9065650216..10103a1809 100644 --- a/src/widgets/graphicsview/qgraphicsview_p.h +++ b/src/widgets/graphicsview/qgraphicsview_p.h @@ -184,7 +184,7 @@ public: inline void dispatchPendingUpdateRequests() { -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#if 0 // Used to be included in Qt4 for Q_WS_MAC // QWidget::update() works slightly different on the Mac without the raster engine; // it's not part of our backing store so it needs special threatment. if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) { @@ -195,7 +195,7 @@ public: extern void qt_mac_dispatchPendingUpdateRequests(QWidget *); qt_mac_dispatchPendingUpdateRequests(viewport->window()); } else -#endif // !Q_DEAD_CODE_FROM_QT4_MAC +#endif { if (qt_widget_private(viewport)->paintOnScreen()) QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index e1ba3759e0..d153915ae6 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -708,7 +708,7 @@ void QGraphicsWidget::initStyleOption(QStyleOption *option) const option->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 QGraphicsWidget *w); //qwidget_mac.cpp if (!(option->state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget)) option->state &= ~QStyle::State_Enabled; diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index faf1a4c49a..4beb64a254 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -52,7 +52,7 @@ #include <QtWidgets/qstyleoption.h> #include <QtWidgets/QStyleOptionTitleBar> #include <QtWidgets/QGraphicsSceneMouseEvent> -#if defined(Q_DEAD_CODE_FROM_QT4_MAC) && !defined(QT_NO_STYLE_MAC) +#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC) # include <private/qmacstyle_mac_p.h> #endif @@ -704,7 +704,7 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent case Qt::TitleBarArea: windowData->buttonRect = q->style()->subControlRect( QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#if 0 // Used to be included in Qt4 for Q_WS_MAC // On mac we should hover if we are in the 'area' of the buttons windowData->buttonRect |= q->style()->subControlRect( QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMinButton, 0); |