summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicseffect.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicseffect.h53
-rw-r--r--src/gui/graphicsview/qgraphicseffect_p.h13
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp4
5 files changed, 37 insertions, 48 deletions
diff --git a/src/gui/graphicsview/qgraphicseffect.cpp b/src/gui/graphicsview/qgraphicseffect.cpp
index d98ea3c..ef7341a 100644
--- a/src/gui/graphicsview/qgraphicseffect.cpp
+++ b/src/gui/graphicsview/qgraphicseffect.cpp
@@ -44,9 +44,8 @@
#ifndef QT_NO_GRAPHICSVIEW
#include <QtGui/qimage.h>
-#include <QtGui/qgraphicsitem.h>
-#include <QtGui/qgraphicsscene.h>
#include <QtGui/qpainter.h>
+#include <QtCore/qrect.h>
/*
diff --git a/src/gui/graphicsview/qgraphicseffect.h b/src/gui/graphicsview/qgraphicseffect.h
index 9714d3e..8cf80b9 100644
--- a/src/gui/graphicsview/qgraphicseffect.h
+++ b/src/gui/graphicsview/qgraphicseffect.h
@@ -43,18 +43,7 @@
#define QGRAPHICSEFFECT_H
#include <QtCore/qobject.h>
-#include <QtCore/qglobal.h>
#include <QtCore/qpoint.h>
-#include <QtCore/qvariant.h>
-#include <QtGui/qtransform.h>
-#include <QtGui/qcolor.h>
-
-QT_FORWARD_DECLARE_CLASS(QGraphicsItem);
-QT_FORWARD_DECLARE_CLASS(QStyleOptionGraphicsItem);
-QT_FORWARD_DECLARE_CLASS(QPainter);
-QT_FORWARD_DECLARE_CLASS(QPixmap);
-QT_FORWARD_DECLARE_CLASS(QWidget);
-QT_FORWARD_DECLARE_CLASS(QPixmapColorizeFilter);
QT_BEGIN_HEADER
@@ -64,8 +53,14 @@ QT_MODULE(Gui)
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
-class QGraphicsEffectSourcePrivate;
+class QGraphicsItem;
class QStyleOption;
+class QColor;
+class QPainter;
+class QRectF;
+class QPixmap;
+
+class QGraphicsEffectSourcePrivate;
class Q_GUI_EXPORT QGraphicsEffectSource : public QObject
{
Q_OBJECT
@@ -73,9 +68,11 @@ public:
~QGraphicsEffectSource();
const QGraphicsItem *graphicsItem() const;
const QStyleOption *styleOption() const;
+
+ bool isPixmap() const;
void draw(QPainter *painter);
void update();
- bool isPixmap() const;
+
QRectF boundingRect(Qt::CoordinateSystem coordinateSystem = Qt::LogicalCoordinates) const;
QPixmap pixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates, QPoint *offset = 0) const;
@@ -99,15 +96,18 @@ class Q_GUI_EXPORT QGraphicsEffect : public QObject
public:
QGraphicsEffect();
virtual ~QGraphicsEffect();
+
+ virtual QRectF boundingRectFor(const QRectF &rect) const;
QRectF boundingRect() const;
void setSourcePixmap(const QPixmap &pixmap);
QPixmap sourcePixmap() const;
bool hasSourcePixmap() const;
- virtual QRectF boundingRectFor(const QRectF &rect) const;
- bool isEnabled() const;
+
QGraphicsEffectSource *source() const;
+ bool isEnabled() const;
+
public Q_SLOTS:
void setEnabled(bool enable);
@@ -187,8 +187,6 @@ public:
int blurRadius() const;
void setBlurRadius(int blurRadius);
- // QRectF boundingRect() const;
-
protected:
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *painter, QGraphicsEffectSource *source);
@@ -211,8 +209,6 @@ public:
qreal opacity() const;
void setOpacity(qreal opacity);
- // QRectF boundingRect() const;
-
protected:
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *painter, QGraphicsEffectSource *source);
@@ -238,8 +234,6 @@ public:
qreal frameOpacity() const;
void setFrameOpacity(qreal opacity);
- // QRectF boundingRect() const;
-
protected:
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *painter, QGraphicsEffectSource *source);
@@ -258,8 +252,10 @@ public:
QPointF shadowOffset() const;
void setShadowOffset(const QPointF &ofs);
- inline void setShadowOffset(qreal dx, qreal dy) { setShadowOffset(QPointF(dx, dy)); }
- inline void setShadowOffset(qreal d) { setShadowOffset(QPointF(d, d)); }
+ inline void setShadowOffset(qreal dx, qreal dy)
+ { setShadowOffset(QPointF(dx, dy)); }
+ inline void setShadowOffset(qreal d)
+ { setShadowOffset(QPointF(d, d)); }
int blurRadius() const;
void setBlurRadius(int blurRadius);
@@ -267,8 +263,6 @@ public:
qreal opacity() const;
void setOpacity(qreal opacity);
- // QRectF boundingRect() const;
-
protected:
QRectF boundingRectFor(const QRectF &rect) const;
void draw(QPainter *painter, QGraphicsEffectSource *source);
@@ -278,15 +272,6 @@ private:
Q_DISABLE_COPY(QGraphicsShadowEffect)
};
-Q_DECLARE_METATYPE(QGraphicsEffect *)
-Q_DECLARE_METATYPE(QGraphicsGrayscaleEffect *)
-Q_DECLARE_METATYPE(QGraphicsColorizeEffect *)
-Q_DECLARE_METATYPE(QGraphicsPixelizeEffect *)
-Q_DECLARE_METATYPE(QGraphicsBlurEffect *)
-Q_DECLARE_METATYPE(QGraphicsBloomEffect *)
-Q_DECLARE_METATYPE(QGraphicsFrameEffect *)
-Q_DECLARE_METATYPE(QGraphicsShadowEffect *)
-
#endif // QT_NO_GRAPHICSVIEW
QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicseffect_p.h b/src/gui/graphicsview/qgraphicseffect_p.h
index 6a0bb3f..2d4a5ee 100644
--- a/src/gui/graphicsview/qgraphicseffect_p.h
+++ b/src/gui/graphicsview/qgraphicseffect_p.h
@@ -54,13 +54,20 @@
//
#include "qgraphicseffect.h"
+
+#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+
#include <private/qobject_p.h>
#include <private/qpixmapfilter_p.h>
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#include <QtCore/qrect.h>
+#include <QtCore/qpoint.h>
+#include <QtGui/qcolor.h>
QT_BEGIN_NAMESPACE
+class QPainter;
+
class QGraphicsEffectSourcePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QGraphicsEffectSource)
@@ -85,7 +92,7 @@ class QGraphicsEffectPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QGraphicsEffect)
public:
QGraphicsEffectPrivate() : source(0), hasSourcePixmap(0), isEnabled(1) {}
- QGraphicsEffectSource *source;
+
inline void setGraphicsEffectSource(QGraphicsEffectSource *newSource)
{
if (source) {
@@ -95,6 +102,8 @@ public:
source = newSource;
q_func()->sourceChanged(newSource);
}
+
+ QGraphicsEffectSource *source;
QRectF boundingRect;
QPixmap sourcePixmap;
quint32 hasSourcePixmap : 1;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 392fdaa..223c747 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1016,10 +1016,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
*/
void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect)
{
- // if (!dirtyChildrenBoundingRect) {
- // *rect |= x->mapRect(childrenBoundingRect);
- // return;
- // }
+ if (!dirtyChildrenBoundingRect) {
+ *rect |= x->mapRect(childrenBoundingRect);
+ return;
+ }
for (int i = 0; i < children.size(); ++i) {
QGraphicsItem *child = children.at(i);
@@ -3845,8 +3845,8 @@ void QGraphicsItem::setZValue(qreal z)
*/
QRectF QGraphicsItem::childrenBoundingRect() const
{
- // if (!d_ptr->dirtyChildrenBoundingRect)
- // return d_ptr->childrenBoundingRect;
+ if (!d_ptr->dirtyChildrenBoundingRect)
+ return d_ptr->childrenBoundingRect;
QRectF childRect;
QTransform x;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 9ce02a2..7b02883 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4304,10 +4304,6 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
ENSURE_TRANSFORM_PTR;
if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) {
- if (item->type() == 7) {
- item->d_ptr->graphicsEffect->setSourcePixmap(static_cast<QGraphicsPixmapItem*>(item)
- ->pixmap());
- }
ENSURE_TRANSFORM_PTR;
QGraphicsItemPaintInfo info(viewTransform, transformPtr, exposedRegion, widget, &styleOptionTmp,
painter, opacity, wasDirtyParentSceneTransform, drawItem);