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/effects/qgraphicseffect.cpp | 3 --- src/widgets/effects/qgraphicseffect.h | 6 ++--- src/widgets/effects/qgraphicseffect_p.h | 5 ++-- src/widgets/effects/qpixmapfilter.cpp | 3 --- src/widgets/effects/qpixmapfilter_p.h | 5 ++-- 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 +++--- src/widgets/kernel/qapplication.cpp | 1 + src/widgets/kernel/qwidget.cpp | 34 ++++++++++++----------- src/widgets/kernel/qwidget.h | 4 +-- src/widgets/kernel/qwidget_p.h | 14 +++++----- src/widgets/kernel/qwidgetbackingstore.cpp | 18 +++++++------ src/widgets/kernel/qwidgetbackingstore_p.h | 4 +-- src/widgets/widgets.pro | 4 ++- 17 files changed, 89 insertions(+), 90 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp index 4d1d1e9896..028010d3dd 100644 --- a/src/widgets/effects/qgraphicseffect.cpp +++ b/src/widgets/effects/qgraphicseffect.cpp @@ -114,7 +114,6 @@ #include #include -#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE QGraphicsEffectPrivate::~QGraphicsEffectPrivate() @@ -1237,5 +1236,3 @@ QT_END_NAMESPACE #include "moc_qgraphicseffect.cpp" #include "moc_qgraphicseffect_p.cpp" - -#endif //QT_NO_GRAPHICSEFFECT diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h index 8e07e51dca..78d025ded5 100644 --- a/src/widgets/effects/qgraphicseffect.h +++ b/src/widgets/effects/qgraphicseffect.h @@ -47,9 +47,9 @@ #include #include -#ifndef QT_NO_GRAPHICSEFFECT -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(graphicseffect); +QT_BEGIN_NAMESPACE class QGraphicsItem; class QStyleOption; @@ -279,7 +279,5 @@ private: QT_END_NAMESPACE -#endif //QT_NO_GRAPHICSEFFECT - #endif // QGRAPHICSEFFECT_H diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h index 12bdbfe6fc..c5c7ff5900 100644 --- a/src/widgets/effects/qgraphicseffect_p.h +++ b/src/widgets/effects/qgraphicseffect_p.h @@ -59,7 +59,8 @@ #include #include -#ifndef QT_NO_GRAPHICSEFFECT +QT_REQUIRE_CONFIG(graphicseffect); + QT_BEGIN_NAMESPACE class QGraphicsEffectSourcePrivate; @@ -226,6 +227,4 @@ public: QT_END_NAMESPACE -#endif //QT_NO_GRAPHICSEFFECT #endif // QGRAPHICSEFFECT_P_H - diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 999e551af4..9d70825b0e 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -54,7 +54,6 @@ #include "private/qmemrotate_p.h" #include "private/qdrawhelper_p.h" -#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE class QPixmapFilterPrivate : public QObjectPrivate @@ -1353,5 +1352,3 @@ void QPixmapDropShadowFilter::draw(QPainter *p, QT_END_NAMESPACE #include "moc_qpixmapfilter_p.cpp" - -#endif //QT_NO_GRAPHICSEFFECT diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h index b9af3ae916..399a835142 100644 --- a/src/widgets/effects/qpixmapfilter_p.h +++ b/src/widgets/effects/qpixmapfilter_p.h @@ -56,9 +56,9 @@ #include #include -#ifndef QT_NO_GRAPHICSEFFECT -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(graphicseffect); +QT_BEGIN_NAMESPACE class QPainter; class QPlatformPixmap; @@ -187,5 +187,4 @@ public: QT_END_NAMESPACE -#endif //QT_NO_GRAPHICSEFFECT #endif // QPIXMAPFILTER_H 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() diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6536da4e90..d2f4161297 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -51,6 +51,7 @@ #include "qhash.h" #include "qset.h" #include "qlayout.h" +#include "qpixmapcache.h" #include "qstyle.h" #include "qstyleoption.h" #include "qstylefactory.h" diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index f1319d9cda..6440ed0173 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -84,7 +84,9 @@ #include #include +#if QT_CONFIG(graphicseffect) #include +#endif #include #include #if 0 // Used to be included in Qt4 for Q_WS_MAC @@ -2115,7 +2117,7 @@ void QWidgetPrivate::setSystemClip(QPaintDevice *paintDevice, const QRegion ® paintEngine->d_func()->systemClip = scaleTransform.map(region); } -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) void QWidgetPrivate::invalidateGraphicsEffectsRecursively() { Q_Q(QWidget); @@ -2130,7 +2132,7 @@ void QWidgetPrivate::invalidateGraphicsEffectsRecursively() w = w->parentWidget(); } while (w); } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) void QWidgetPrivate::setDirtyOpaqueRegion() { @@ -2138,9 +2140,9 @@ void QWidgetPrivate::setDirtyOpaqueRegion() dirtyOpaqueChildren = true; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) invalidateGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) if (q->isWindow()) return; @@ -2294,12 +2296,12 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion ®ion) const const QWidget *w = q; QPoint offset; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (graphicsEffect) { w = q->parentWidget(); offset -= data.crect.topLeft(); } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) while (w) { const QWidgetPrivate *wd = w->d_func(); @@ -2332,13 +2334,13 @@ void QWidgetPrivate::updateIsOpaque() // hw: todo: only needed if opacity actually changed setDirtyOpaqueRegion(); -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (graphicsEffect) { // ### We should probably add QGraphicsEffect::isOpaque at some point. setOpaque(false); return; } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) Q_Q(QWidget); #if 0 // Used to be included in Qt4 for Q_WS_X11 @@ -5299,13 +5301,13 @@ QPixmap QWidget::grab(const QRect &rectangle) \sa setGraphicsEffect() */ -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) QGraphicsEffect *QWidget::graphicsEffect() const { Q_D(const QWidget); return d->graphicsEffect; } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) /*! @@ -5329,7 +5331,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const \sa graphicsEffect() */ -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) void QWidget::setGraphicsEffect(QGraphicsEffect *effect) { Q_D(QWidget); @@ -5353,7 +5355,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect) d->updateIsOpaque(); } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) bool QWidgetPrivate::isAboutToShow() const { @@ -5505,7 +5507,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP bool onScreen = paintOnScreen(); Q_Q(QWidget); -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (graphicsEffect && graphicsEffect->isEnabled()) { QGraphicsEffectSource *source = graphicsEffect->d_func()->source; QWidgetEffectSourcePrivate *sourced = static_cast @@ -5541,7 +5543,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP return; } } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) const bool alsoOnScreen = flags & DrawPaintOnScreen; const bool recursive = flags & DrawRecursive; @@ -5848,7 +5850,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis } } -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const { if (system != Qt::DeviceCoordinates) @@ -5923,7 +5925,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren); return pixmap; } -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) #ifndef QT_NO_GRAPHICSVIEW /*! diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 87a841c729..3b0678d349 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -347,10 +347,10 @@ public: Q_INVOKABLE QPixmap grab(const QRect &rectangle = QRect(QPoint(0, 0), QSize(-1, -1))); -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) #ifndef QT_NO_GESTURES void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index da3e9bd2f6..e2affa802c 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -64,7 +64,9 @@ #include "QtWidgets/qsizepolicy.h" #include "QtWidgets/qstyle.h" #include "QtWidgets/qapplication.h" +#if QT_CONFIG(graphicseffect) #include +#endif #include "QtWidgets/qgraphicsproxywidget.h" #include "QtWidgets/qgraphicsscene.h" #include "QtWidgets/qgraphicsview.h" @@ -418,9 +420,9 @@ public: void setOpaque(bool opaque); void updateIsTranslucent(); bool paintOnScreen() const; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) void invalidateGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) const QRegion &getOpaqueChildren() const; void setDirtyOpaqueRegion(); @@ -589,10 +591,10 @@ public: inline QRect effectiveRectFor(const QRect &rect) const { -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (graphicsEffect && graphicsEffect->isEnabled()) return graphicsEffect->boundingRectFor(rect).toAlignedRect(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) return rect; } @@ -882,7 +884,7 @@ struct QWidgetPaintContext QPainter *painter; }; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: @@ -935,7 +937,7 @@ public: QTransform lastEffectTransform; bool updateDueToGraphicsEffect; }; -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) inline QWExtra *QWidgetPrivate::extraData() const { diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 781ad9600d..2f4bcd6370 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -53,7 +53,9 @@ #include #include #include +#if QT_CONFIG(graphicseffect) #include +#endif #include #include @@ -522,9 +524,9 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rgn.isEmpty()); -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) widget->d_func()->invalidateGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { @@ -563,11 +565,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, if (bufferState == BufferInvalid) { const bool eventAlreadyPosted = !dirty.isEmpty() || updateRequestSent; -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (widget->d_func()->graphicsEffect) dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); else -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) dirty += rgn.translated(offset); if (!eventAlreadyPosted || updateTime == UpdateNow) sendUpdateRequest(tlw, updateTime); @@ -582,11 +584,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, if (widget->d_func()->inDirtyList) { if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) { -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (widget->d_func()->graphicsEffect) widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); else -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) widget->d_func()->dirty += rgn; } } else { @@ -614,9 +616,9 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rect.isEmpty()); -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) widget->d_func()->invalidateGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index 16b36423a6..fa51cb71de 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -176,11 +176,11 @@ private: { if (widget && !widget->d_func()->inDirtyList && !widget->data->in_destructor) { QWidgetPrivate *widgetPrivate = widget->d_func(); -#ifndef QT_NO_GRAPHICSEFFECT +#if QT_CONFIG(graphicseffect) if (widgetPrivate->graphicsEffect) widgetPrivate->dirty = widgetPrivate->effectiveRectFor(rgn.boundingRect()); else -#endif //QT_NO_GRAPHICSEFFECT +#endif // QT_CONFIG(graphicseffect) widgetPrivate->dirty = rgn; dirtyWidgets.append(widget); widgetPrivate->inDirtyList = true; diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index e4f7640a10..22bdf08408 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -23,8 +23,10 @@ include(itemviews/itemviews.pri) include(graphicsview/graphicsview.pri) include(util/util.pri) include(statemachine/statemachine.pri) -include(effects/effects.pri) +qtConfig(graphicseffect) { + include(effects/effects.pri) +} QMAKE_LIBS += $$QMAKE_LIBS_GUI -- cgit v1.2.3