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/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 ++-- 6 files changed, 41 insertions(+), 34 deletions(-) (limited to 'src/widgets/kernel') 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; -- cgit v1.2.3