From 93dc459f488f866db79ede1f27ef739a243764e4 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sun, 9 Jul 2017 08:47:10 +0200 Subject: Convert features.graphicseffect to QT_[REQUIRE_]CONFIG Change-Id: I1bb96088b2e9f2a2cfab5fceeebebe94fa6bb3a6 Reviewed-by: Oswald Buddenhagen --- src/widgets/graphicsview/qgraphicsitem.cpp | 42 +++++++++++++++-------------- src/widgets/graphicsview/qgraphicsitem.h | 6 ++--- src/widgets/graphicsview/qgraphicsitem_p.h | 15 +++++------ src/widgets/graphicsview/qgraphicsscene.cpp | 7 ++--- src/widgets/graphicsview/qgraphicsscene_p.h | 8 +++--- 5 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src/widgets/graphicsview') diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 3ce9c835db..239a110119 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -756,7 +756,9 @@ #include #include #include +#if QT_CONFIG(graphicseffect) #include +#endif #include #include @@ -1558,9 +1560,9 @@ QGraphicsItem::~QGraphicsItem() setParentItem(0); } -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) delete d_ptr->graphicsEffect; -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) if (d_ptr->transformData) { for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) { QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i); @@ -2383,9 +2385,9 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, if (c) c->purge(); if (scene) { -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) invalidateParentGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true); } } @@ -2832,11 +2834,11 @@ void QGraphicsItem::setOpacity(qreal opacity) // Update. if (d_ptr->scene) { -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) d_ptr->invalidateParentGraphicsEffectsRecursively(); if (!(d_ptr->flags & ItemDoesntPropagateOpacityToChildren)) d_ptr->invalidateChildGraphicsEffectsRecursively(QGraphicsItemPrivate::OpacityChanged); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, /*force=*/false, @@ -2854,7 +2856,7 @@ void QGraphicsItem::setOpacity(qreal opacity) \since 4.6 */ -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) QGraphicsEffect *QGraphicsItem::graphicsEffect() const { return d_ptr->graphicsEffect; @@ -2896,11 +2898,11 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) prepareGeometryChange(); } } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively() { -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) QGraphicsItemPrivate *itemPrivate = this; do { // parent chain already notified? @@ -2923,7 +2925,7 @@ void QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively() */ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const { -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) Q_Q(const QGraphicsItem); QGraphicsEffect *effect = graphicsEffect; if (scene && effect && effect->isEnabled()) { @@ -2939,7 +2941,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const } return q->mapRectFromScene(sceneEffectRect); } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) return rect; } @@ -2955,7 +2957,7 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(const QRectF &rect) const */ QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectItem) const { -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) Q_Q(const QGraphicsItem); QRectF brect = effectiveBoundingRect(q_ptr->boundingRect()); if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren @@ -2980,10 +2982,10 @@ QRectF QGraphicsItemPrivate::effectiveBoundingRect(QGraphicsItem *topMostEffectI } return brect; -#else //QT_NO_GRAPHICSEFFECT +#else //QT_CONFIG(graphicseffect) Q_UNUSED(topMostEffectItem); return q_ptr->boundingRect(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) } @@ -5485,7 +5487,7 @@ int QGraphicsItemPrivate::depth() const /*! \internal */ -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) void QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively() { QGraphicsItemPrivate *itemPrivate = this; @@ -5516,7 +5518,7 @@ void QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(QGraphicsIt childPrivate->invalidateChildGraphicsEffectsRecursively(reason); } } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) /*! \internal @@ -5798,9 +5800,9 @@ void QGraphicsItem::update(const QRectF &rect) return; // Make sure we notify effects about invalidated source. -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) d_ptr->invalidateParentGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) if (CacheMode(d_ptr->cacheMode) != NoCache) { // Invalidate cache. @@ -11225,7 +11227,7 @@ int QGraphicsItemGroup::type() const return Type; } -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const { const bool deviceCoordinates = (system == Qt::DeviceCoordinates); @@ -11366,7 +11368,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP return pixmap; } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) #ifndef QT_NO_DEBUG_STREAM static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item) diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index 36f8aac124..35e3d544e9 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -228,11 +228,11 @@ public: qreal effectiveOpacity() const; void setOpacity(qreal opacity); -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) // Effect QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) Qt::MouseButtons acceptedMouseButtons() const; void setAcceptedMouseButtons(Qt::MouseButtons buttons); @@ -550,7 +550,7 @@ class Q_WIDGETS_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect) #endif Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty children READ childrenList DESIGNABLE false NOTIFY childrenChanged) diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h index c88236d6e8..5c4523f9ed 100644 --- a/src/widgets/graphicsview/qgraphicsitem_p.h +++ b/src/widgets/graphicsview/qgraphicsitem_p.h @@ -59,9 +59,6 @@ #include "qgraphicstransform.h" #include -#include -#include - #include #if !defined(QT_NO_GRAPHICSVIEW) @@ -217,13 +214,13 @@ public: bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; virtual void transformChanged() {} int depth() const; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) enum InvalidateReason { OpacityChanged }; void invalidateParentGraphicsEffectsRecursively(); void invalidateChildGraphicsEffectsRecursively(InvalidateReason reason); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) void invalidateDepthRecursively(); void resolveDepth(); void addChild(QGraphicsItem *child); @@ -590,7 +587,7 @@ struct QGraphicsItemPaintInfo quint32 drawItem : 1; }; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: @@ -650,7 +647,7 @@ public: QGraphicsItemPaintInfo *info; QTransform lastEffectTransform; }; -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) /*! Returns \c true if \a item1 is on top of \a item2. @@ -784,7 +781,7 @@ inline bool QGraphicsItemPrivate::insertionOrder(QGraphicsItem *a, QGraphicsItem inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect) { QGraphicsItemPrivate *parentp = this; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (updateBoundingRect && parentp->graphicsEffect && !parentp->inSetPosHelper) { parentp->notifyInvalidated = 1; static_cast(parentp->graphicsEffect->d_func() @@ -800,7 +797,7 @@ inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect) // ### Only do this if the parent's effect applies to the entire subtree. parentp->notifyBoundingRectChanged = 1; } -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (parentp->graphicsEffect) { if (updateBoundingRect) { static_cast(parentp->graphicsEffect->d_func() diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 35f6298a8a..db41fc3eb9 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -243,10 +243,11 @@ #include #include #include -#include #include #include +#if QT_CONFIG(graphicseffect) #include +#endif #include #include @@ -4810,7 +4811,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * if (itemHasChildren && itemClipsChildrenToShape) ENSURE_TRANSFORM_PTR; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) { ENSURE_TRANSFORM_PTR; QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp, @@ -4847,7 +4848,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * painter->setWorldTransform(restoreTransform); sourced->info = 0; } else -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) { draw(item, painter, viewTransform, transformPtr, exposedRegion, widget, opacity, effectTransform, wasDirtyParentSceneTransform, drawItem); diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h index 795676878b..c52770501f 100644 --- a/src/widgets/graphicsview/qgraphicsscene_p.h +++ b/src/widgets/graphicsview/qgraphicsscene_p.h @@ -249,7 +249,7 @@ public: item->d_ptr->fullUpdatePending = 0; item->d_ptr->ignoreVisible = 0; item->d_ptr->ignoreOpacity = 0; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) QGraphicsEffect::ChangeFlags flags; if (item->d_ptr->notifyBoundingRectChanged) { flags |= QGraphicsEffect::SourceBoundingRectChanged; @@ -259,15 +259,15 @@ public: flags |= QGraphicsEffect::SourceInvalidated; item->d_ptr->notifyInvalidated = 0; } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) if (recursive) { for (int i = 0; i < item->d_ptr->children.size(); ++i) resetDirtyItem(item->d_ptr->children.at(i), recursive); } -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (flags && item->d_ptr->graphicsEffect) item->d_ptr->graphicsEffect->sourceChanged(flags); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) } inline void ensureSortedTopLevelItems() -- cgit v1.2.3