summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-03-30 14:56:41 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-03-30 14:56:41 (GMT)
commit87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3 (patch)
treef8b8c24056d54e19937dea1b0301af558597726a /src/gui/graphicsview
parent09ce407aaa4a00013a606bf0011faf6cbc654c72 (diff)
parent00f7426f3906361fb5addb36e428648eee5e2983 (diff)
downloadQt-87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3.zip
Qt-87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3.tar.gz
Qt-87f66d52e362de003a9f2cdaafbfbe3ba4e5fbc3.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Conflicts: doc/src/modules.qdoc mkspecs/common/symbian/symbian.conf src/gui/graphicsview/qgraphicswidget.h src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtGuiu.def
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp160
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h16
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h14
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp429
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h19
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp36
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.h2
9 files changed, 461 insertions, 219 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 1b707b0..450dea7 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -381,7 +381,9 @@
\value ItemSendsGeometryChanges The item enables itemChange()
notifications for ItemPositionChange, ItemPositionHasChanged,
- ItemMatrixChange, ItemTransformChange, and ItemTransformHasChanged. For
+ ItemMatrixChange, ItemTransformChange, ItemTransformHasChanged,
+ ItemRotationChange, ItemRotationHasChanged, ItemScaleChange, ItemScaleHasChanged,
+ ItemTransformOriginPointChange, and ItemTransformOriginPointHasChanged. For
performance reasons, these notifications are disabled by default. You must
enable this flag to receive notifications for position and transform
changes. This flag was introduced in Qt 4.6.
@@ -475,6 +477,52 @@
(same as transform()), and QGraphicsItem ignores the return value for this
notification (i.e., a read-only notification).
+ \value ItemRotationChange The item's rotation property changes. This
+ notification is sent if the ItemSendsGeometryChanges flag is enabled, and
+ when the item's rotation property changes (i.e., as a result of calling
+ setRotation()). The value argument is the new rotation (i.e., a double);
+ to get the old rotation, call rotation(). Do not call setRotation() in
+ itemChange() as this notification is delivered; instead, you can return
+ the new rotation from itemChange().
+
+ \value ItemRotationHasChanged The item's rotation property has changed.
+ This notification is sent if the ItemSendsGeometryChanges flag is enabled,
+ and after the item's rotation property has changed. The value argument is
+ the new rotation (i.e., a double), and QGraphicsItem ignores the return
+ value for this notification (i.e., a read-only notification). Do not call
+ setRotation() in itemChange() as this notification is delivered.
+
+ \value ItemScaleChange The item's scale property changes. This notification
+ is sent if the ItemSendsGeometryChanges flag is enabled, and when the item's
+ scale property changes (i.e., as a result of calling setScale()). The value
+ argument is the new scale (i.e., a double); to get the old scale, call
+ scale(). Do not call setScale() in itemChange() as this notification is
+ delivered; instead, you can return the new scale from itemChange().
+
+ \value ItemScaleHasChanged The item's scale property has changed. This
+ notification is sent if the ItemSendsGeometryChanges flag is enabled, and
+ after the item's scale property has changed. The value argument is the new
+ scale (i.e., a double), and QGraphicsItem ignores the return value for this
+ notification (i.e., a read-only notification). Do not call setScale() in
+ itemChange() as this notification is delivered.
+
+ \value ItemTransformOriginPointChange The item's transform origin point
+ property changes. This notification is sent if the ItemSendsGeometryChanges
+ flag is enabled, and when the item's transform origin point property changes
+ (i.e., as a result of calling setTransformOriginPoint()). The value argument
+ is the new origin point (i.e., a QPointF); to get the old origin point, call
+ transformOriginPoint(). Do not call setTransformOriginPoint() in itemChange()
+ as this notification is delivered; instead, you can return the new transform
+ origin point from itemChange().
+
+ \value ItemTransformOriginPointHasChanged The item's transform origin point
+ property has changed. This notification is sent if the ItemSendsGeometryChanges
+ flag is enabled, and after the item's transform origin point property has
+ changed. The value argument is the new origin point (i.e., a QPointF), and
+ QGraphicsItem ignores the return value for this notification (i.e., a read-only
+ notification). Do not call setTransformOriginPoint() in itemChange() as this
+ notification is delivered.
+
\value ItemSelectedChange The item's selected state changes. If the item is
presently selected, it will become unselected, and vice verca. The value
argument is the new selected state (i.e., true or false). Do not call
@@ -673,6 +721,7 @@
#include <QtCore/qtimer.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvarlengtharray.h>
+#include <QtCore/qnumeric.h>
#include <QtGui/qapplication.h>
#include <QtGui/qbitmap.h>
#include <QtGui/qpainter.h>
@@ -3484,7 +3533,10 @@ void QGraphicsItem::setX(qreal x)
if (d_ptr->inDestructor)
return;
- d_ptr->setPosHelper(QPointF(x, d_ptr->pos.y()));
+ if (qIsNaN(x))
+ return;
+
+ setPos(QPointF(x, d_ptr->pos.y()));
}
/*!
@@ -3508,7 +3560,10 @@ void QGraphicsItem::setY(qreal y)
if (d_ptr->inDestructor)
return;
- d_ptr->setPosHelper(QPointF(d_ptr->pos.x(), y));
+ if (qIsNaN(y))
+ return;
+
+ setPos(QPointF(d_ptr->pos.x(), y));
}
/*!
@@ -3576,7 +3631,7 @@ void QGraphicsItem::setPos(const QPointF &pos)
return;
// Update and repositition.
- if (!(d_ptr->flags & ItemSendsGeometryChanges)) {
+ if (!(d_ptr->flags & ItemSendsGeometryChanges) && !(d_ptr->flags & ItemSendsScenePositionChanges)) {
d_ptr->setPosHelper(pos);
return;
}
@@ -3721,12 +3776,28 @@ qreal QGraphicsItem::rotation() const
void QGraphicsItem::setRotation(qreal angle)
{
prepareGeometryChange();
+ qreal newRotation = angle;
+
+ if (d_ptr->flags & ItemSendsGeometryChanges) {
+ // Notify the item that the rotation is changing.
+ const QVariant newRotationVariant(itemChange(ItemRotationChange, angle));
+ newRotation = newRotationVariant.toReal();
+ }
+
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->rotation = angle;
+
+ if (d_ptr->transformData->rotation == newRotation)
+ return;
+
+ d_ptr->transformData->rotation = newRotation;
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
+ // Send post-notification.
+ if (d_ptr->flags & ItemSendsGeometryChanges)
+ itemChange(ItemRotationHasChanged, newRotation);
+
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->rotationChanged();
}
@@ -3769,12 +3840,28 @@ qreal QGraphicsItem::scale() const
void QGraphicsItem::setScale(qreal factor)
{
prepareGeometryChange();
+ qreal newScale = factor;
+
+ if (d_ptr->flags & ItemSendsGeometryChanges) {
+ // Notify the item that the scale is changing.
+ const QVariant newScaleVariant(itemChange(ItemScaleChange, factor));
+ newScale = newScaleVariant.toReal();
+ }
+
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->scale = factor;
+
+ if (d_ptr->transformData->scale == newScale)
+ return;
+
+ d_ptr->transformData->scale = newScale;
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
+ // Send post-notification.
+ if (d_ptr->flags & ItemSendsGeometryChanges)
+ itemChange(ItemScaleHasChanged, newScale);
+
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->scaleChanged();
}
@@ -3837,6 +3924,22 @@ void QGraphicsItem::setTransformations(const QList<QGraphicsTransform *> &transf
/*!
\internal
*/
+void QGraphicsItemPrivate::prependGraphicsTransform(QGraphicsTransform *t)
+{
+ if (!transformData)
+ transformData = new QGraphicsItemPrivate::TransformData;
+ if (!transformData->graphicsTransforms.contains(t))
+ transformData->graphicsTransforms.prepend(t);
+
+ Q_Q(QGraphicsItem);
+ t->d_func()->setItem(q);
+ transformData->onlyTransform = false;
+ dirtySceneTransform = 1;
+}
+
+/*!
+ \internal
+*/
void QGraphicsItemPrivate::appendGraphicsTransform(QGraphicsTransform *t)
{
if (!transformData)
@@ -3876,12 +3979,31 @@ QPointF QGraphicsItem::transformOriginPoint() const
void QGraphicsItem::setTransformOriginPoint(const QPointF &origin)
{
prepareGeometryChange();
+ QPointF newOrigin = origin;
+
+ if (d_ptr->flags & ItemSendsGeometryChanges) {
+ // Notify the item that the origin point is changing.
+ const QVariant newOriginVariant(itemChange(ItemTransformOriginPointChange,
+ qVariantFromValue<QPointF>(origin)));
+ newOrigin = newOriginVariant.toPointF();
+ }
+
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xOrigin = origin.x();
- d_ptr->transformData->yOrigin = origin.y();
+
+ if (d_ptr->transformData->xOrigin == newOrigin.x()
+ && d_ptr->transformData->yOrigin == newOrigin.y()) {
+ return;
+ }
+
+ d_ptr->transformData->xOrigin = newOrigin.x();
+ d_ptr->transformData->yOrigin = newOrigin.y();
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
+
+ // Send post-notification.
+ if (d_ptr->flags & ItemSendsGeometryChanges)
+ itemChange(ItemTransformOriginPointHasChanged, qVariantFromValue<QPointF>(newOrigin));
}
/*!
@@ -11038,7 +11160,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
// Item coordinates with info.
QTransform newEffectTransform = info->transformPtr->inverted();
newEffectTransform *= effectTransform;
- scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, info->exposedRegion,
+ scened->draw(item, &pixmapPainter, info->viewTransform, info->transformPtr, 0,
info->widget, info->opacity, &newEffectTransform, info->wasDirtySceneTransform,
info->drawItem);
}
@@ -11174,6 +11296,24 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change)
case QGraphicsItem::ItemScenePositionHasChanged:
str = "ItemScenePositionHasChanged";
break;
+ case QGraphicsItem::ItemRotationChange:
+ str = "ItemRotationChange";
+ break;
+ case QGraphicsItem::ItemRotationHasChanged:
+ str = "ItemRotationHasChanged";
+ break;
+ case QGraphicsItem::ItemScaleChange:
+ str = "ItemScaleChange";
+ break;
+ case QGraphicsItem::ItemScaleHasChanged:
+ str = "ItemScaleHasChanged";
+ break;
+ case QGraphicsItem::ItemTransformOriginPointChange:
+ str = "ItemTransformOriginPointChange";
+ break;
+ case QGraphicsItem::ItemTransformOriginPointHasChanged:
+ str = "ItemTransformOriginPointHasChanged";
+ break;
}
debug << str;
return debug;
@@ -11243,7 +11383,7 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags)
{
debug << '(';
bool f = false;
- for (int i = 0; i < 16; ++i) {
+ for (int i = 0; i < 17; ++i) {
if (flags & (1 << i)) {
if (f)
debug << '|';
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 5023f60..2c45b62 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -139,7 +139,13 @@ public:
ItemZValueHasChanged,
ItemOpacityChange,
ItemOpacityHasChanged,
- ItemScenePositionHasChanged
+ ItemScenePositionHasChanged,
+ ItemRotationChange,
+ ItemRotationHasChanged,
+ ItemScaleChange,
+ ItemScaleHasChanged,
+ ItemTransformOriginPointChange,
+ ItemTransformOriginPointHasChanged
};
enum CacheMode {
@@ -540,10 +546,10 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
- Q_PROPERTY(QPointF pos READ pos WRITE setPos)
- Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
- Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
- Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged)
+ Q_PROPERTY(QPointF pos READ pos WRITE setPos FINAL)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL)
+ Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged FINAL)
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)
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index eb5fac7..73b8f04 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -213,8 +213,8 @@ public:
needSortChildren(0),
allChildrenDirty(0),
fullUpdatePending(0),
- flags(0),
dirtyChildrenBoundingRect(1),
+ flags(0),
paintedViewBoundingRectsNeedRepaint(0),
dirtySceneTransform(1),
geometryChanged(1),
@@ -277,6 +277,7 @@ public:
virtual void setPosHelper(const QPointF &pos);
void setTransformHelper(const QTransform &transform);
+ void prependGraphicsTransform(QGraphicsTransform *t);
void appendGraphicsTransform(QGraphicsTransform *t);
void setVisibleHelper(bool newVisible, bool explicitly, bool update = true);
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
@@ -543,11 +544,11 @@ public:
quint32 inSetPosHelper : 1;
quint32 needSortChildren : 1;
quint32 allChildrenDirty : 1;
+ quint32 fullUpdatePending : 1;
+ quint32 dirtyChildrenBoundingRect : 1;
// Packed 32 bits
- quint32 fullUpdatePending : 1;
quint32 flags : 17;
- quint32 dirtyChildrenBoundingRect : 1;
quint32 paintedViewBoundingRectsNeedRepaint : 1;
quint32 dirtySceneTransform : 1;
quint32 geometryChanged : 1;
@@ -561,10 +562,10 @@ public:
quint32 sceneTransformTranslateOnly : 1;
quint32 notifyBoundingRectChanged : 1;
quint32 notifyInvalidated : 1;
-
- // New 32 bits
quint32 mouseSetsFocus : 1;
quint32 explicitActivate : 1;
+
+ // New 32 bits
quint32 wantsActive : 1;
quint32 holesInSiblingIndex : 1;
quint32 sequentialOrdering : 1;
@@ -572,6 +573,7 @@ public:
quint32 scenePosDescendants : 1;
quint32 pendingPolish : 1;
quint32 mayHaveChildWithGraphicsEffect : 1;
+ quint32 padding : 25;
// Optional stacking order
int globalStackingOrder;
@@ -677,7 +679,7 @@ public:
return item->type() == QGraphicsPixmapItem::Type
&& !(item->flags() & QGraphicsItem::ItemIsSelectable)
&& item->d_ptr->children.size() == 0;
- //|| (item->d_ptr->isObject && qobject_cast<QmlGraphicsImage *>(q_func()));
+ //|| (item->d_ptr->isObject && qobject_cast<QDeclarativeImage *>(q_func()));
}
inline const QStyleOption *styleOption() const
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 6a9eb29..9722683 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -554,6 +554,8 @@ void QGraphicsLinearLayout::dump(int indent) const
d->orientation == Qt::Horizontal ? "Horizontal" : "Vertical");
d->engine.dump(indent + 1);
}
+#else
+ Q_UNUSED(indent);
#endif
}
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 6581727..4b612f4 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -228,6 +228,7 @@
#include <QtCore/qstack.h>
#include <QtCore/qtimer.h>
#include <QtCore/qvarlengtharray.h>
+#include <QtCore/QMetaMethod>
#include <QtGui/qapplication.h>
#include <QtGui/qdesktopwidget.h>
#include <QtGui/qevent.h>
@@ -277,8 +278,6 @@ static void _q_hoverFromMouseEvent(QGraphicsSceneHoverEvent *hover, const QGraph
hover->setAccepted(mouseEvent->isAccepted());
}
-int QGraphicsScenePrivate::changedSignalIndex;
-
/*!
\internal
*/
@@ -329,9 +328,10 @@ void QGraphicsScenePrivate::init()
index = new QGraphicsSceneBspTreeIndex(q);
// Keep this index so we can check for connected slots later on.
- if (!changedSignalIndex) {
- changedSignalIndex = signalIndex("changed(QList<QRectF>)");
- }
+ changedSignalIndex = signalIndex("changed(QList<QRectF>)");
+ processDirtyItemsIndex = q->metaObject()->indexOfSlot("_q_processDirtyItems()");
+ polishItemsIndex = q->metaObject()->indexOfSlot("_q_polishItems()");
+
qApp->d_func()->scene_list.append(q);
q->update();
}
@@ -693,6 +693,18 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
--selectionChanging;
if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize)
emit q->selectionChanged();
+
+ QHash<QGesture *, QGraphicsObject *>::iterator it;
+ for (it = gestureTargets.begin(); it != gestureTargets.end();) {
+ if (it.value() == item)
+ it = gestureTargets.erase(it);
+ else
+ ++it;
+ }
+ QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item);
+ cachedTargetItems.removeOne(dummy);
+ cachedItemGestures.remove(dummy);
+ cachedAlreadyDeliveredGestures.remove(dummy);
}
/*!
@@ -2525,8 +2537,10 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
return;
}
- if (d->unpolishedItems.isEmpty())
- QMetaObject::invokeMethod(this, "_q_polishItems", Qt::QueuedConnection);
+ if (d->unpolishedItems.isEmpty()) {
+ QMetaMethod method = metaObject()->method(d->polishItemsIndex);
+ method.invoke(this, Qt::QueuedConnection);
+ }
d->unpolishedItems.append(item);
item->d_ptr->pendingPolish = true;
@@ -4239,6 +4253,8 @@ static void _q_paintItem(QGraphicsItem *item, QPainter *painter,
widgetItem->paintWindowFrame(painter, option, widget);
if (painterStateProtection)
painter->restore();
+ } else if (widgetItem->autoFillBackground()) {
+ painter->fillRect(option->exposedRect, widgetItem->palette().window());
}
widgetItem->paint(painter, option, widget);
@@ -4704,7 +4720,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (item->d_ptr->graphicsEffect && item->d_ptr->graphicsEffect->isEnabled()) {
ENSURE_TRANSFORM_PTR;
QGraphicsItemPaintInfo info(viewTransform, transformPtr, effectTransform, exposedRegion, widget, &styleOptionTmp,
- painter, opacity, wasDirtyParentSceneTransform, drawItem);
+ painter, opacity, wasDirtyParentSceneTransform, itemHasContents && !itemIsFullyTransparent);
QGraphicsEffectSource *source = item->d_ptr->graphicsEffect->d_func()->source;
QGraphicsItemEffectSourcePrivate *sourced = static_cast<QGraphicsItemEffectSourcePrivate *>
(source->d_func());
@@ -4870,7 +4886,9 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
return;
if (!processDirtyItemsEmitted) {
- QMetaObject::invokeMethod(q_ptr, "_q_processDirtyItems", Qt::QueuedConnection);
+ QMetaMethod method = q_ptr->metaObject()->method(processDirtyItemsIndex);
+ method.invoke(q_ptr, Qt::QueuedConnection);
+// QMetaObject::invokeMethod(q_ptr, "_q_processDirtyItems", Qt::QueuedConnection);
processDirtyItemsEmitted = true;
}
@@ -5892,45 +5910,51 @@ void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel)
dispatchHoverEvent(&hoverEvent);
}
-void QGraphicsScenePrivate::getGestureTargets(const QSet<QGesture *> &gestures,
- QWidget *viewport,
- QMap<Qt::GestureType, QGesture *> *conflictedGestures,
- QList<QList<QGraphicsObject *> > *conflictedItems,
- QHash<QGesture *, QGraphicsObject *> *normalGestures)
+void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures,
+ Qt::GestureFlag flag,
+ QHash<QGraphicsObject *, QSet<QGesture *> > *targets,
+ QSet<QGraphicsObject *> *itemsSet,
+ QSet<QGesture *> *normal,
+ QSet<QGesture *> *conflicts)
{
+ QSet<QGesture *> normalGestures; // that are not in conflicted state.
foreach (QGesture *gesture, gestures) {
- Qt::GestureType gestureType = gesture->gestureType();
- if (gesture->hasHotSpot()) {
- QPoint screenPos = gesture->hotSpot().toPoint();
- QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport);
- QList<QGraphicsObject *> result;
- for (int j = 0; j < items.size(); ++j) {
- QGraphicsItem *item = items.at(j);
+ if (!gesture->hasHotSpot())
+ continue;
+ const Qt::GestureType gestureType = gesture->gestureType();
+ QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0);
+ for (int j = 0; j < items.size(); ++j) {
+ QGraphicsItem *item = items.at(j);
- // Check if the item is blocked by a modal panel and use it as
- // a target instead of this item.
- (void) item->isBlockedByModalPanel(&item);
+ // Check if the item is blocked by a modal panel and use it as
+ // a target instead of this item.
+ (void) item->isBlockedByModalPanel(&item);
- if (QGraphicsObject *itemobj = item->toGraphicsObject()) {
- QGraphicsItemPrivate *d = item->d_func();
- if (d->gestureContext.contains(gestureType)) {
- result.append(itemobj);
+ if (QGraphicsObject *itemobj = item->toGraphicsObject()) {
+ QGraphicsItemPrivate *d = item->QGraphicsItem::d_func();
+ QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it =
+ d->gestureContext.find(gestureType);
+ if (it != d->gestureContext.end() && (!flag || (it.value() & flag))) {
+ if (normalGestures.contains(gesture)) {
+ normalGestures.remove(gesture);
+ if (conflicts)
+ conflicts->insert(gesture);
+ } else {
+ normalGestures.insert(gesture);
}
+ if (targets)
+ (*targets)[itemobj].insert(gesture);
+ if (itemsSet)
+ (*itemsSet).insert(itemobj);
}
- // Don't propagate through panels.
- if (item->isPanel())
- break;
- }
- DEBUG() << "QGraphicsScenePrivate::getGestureTargets:"
- << gesture << result;
- if (result.size() == 1) {
- normalGestures->insert(gesture, result.first());
- } else if (!result.isEmpty()) {
- conflictedGestures->insert(gestureType, gesture);
- conflictedItems->append(result);
}
+ // Don't propagate through panels.
+ if (item->isPanel())
+ break;
}
}
+ if (normal)
+ *normal = normalGestures;
}
void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
@@ -5938,200 +5962,220 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
QWidget *viewport = event->widget();
if (!viewport)
return;
+ QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(viewport->parent());
+ if (!graphicsView)
+ return;
+
QList<QGesture *> allGestures = event->gestures();
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "Delivering gestures:" << allGestures;
-
- typedef QHash<QGraphicsObject *, QList<QGesture *> > GesturesPerItem;
- GesturesPerItem gesturesPerItem;
+ << "Gestures:" << allGestures;
QSet<QGesture *> startedGestures;
+ QPoint delta = viewport->mapFromGlobal(QPoint());
+ QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y())
+ * graphicsView->viewportTransform().inverted();
foreach (QGesture *gesture, allGestures) {
+ // cache scene coordinates of the hot spot
+ if (gesture->hasHotSpot()) {
+ gesture->d_func()->sceneHotSpot = toScene.map(gesture->hotSpot());
+ } else {
+ gesture->d_func()->sceneHotSpot = QPointF();
+ }
+
QGraphicsObject *target = gestureTargets.value(gesture, 0);
if (!target) {
// when we are not in started mode but don't have a target
// then the only one interested in gesture is the view/scene
if (gesture->state() == Qt::GestureStarted)
startedGestures.insert(gesture);
- } else {
- gesturesPerItem[target].append(gesture);
}
}
- QMap<Qt::GestureType, QGesture *> conflictedGestures;
- QList<QList<QGraphicsObject *> > conflictedItems;
- QHash<QGesture *, QGraphicsObject *> normalGestures;
- getGestureTargets(startedGestures, viewport, &conflictedGestures, &conflictedItems,
- &normalGestures);
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "Conflicting gestures:" << conflictedGestures.values() << conflictedItems;
- Q_ASSERT((conflictedGestures.isEmpty() && conflictedItems.isEmpty()) ||
- (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty()));
-
- // gestures that were sent as override events, but no one accepted them
- QHash<QGesture *, QGraphicsObject *> ignoredConflictedGestures;
-
- // deliver conflicted gestures as override events first
- while (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty()) {
- // get the topmost item to deliver the override event
- Q_ASSERT(!conflictedItems.isEmpty());
- Q_ASSERT(!conflictedItems.first().isEmpty());
- QGraphicsObject *topmost = conflictedItems.first().first();
- for (int i = 1; i < conflictedItems.size(); ++i) {
- QGraphicsObject *item = conflictedItems.at(i).first();
- if (qt_closestItemFirst(item, topmost)) {
- topmost = item;
- }
- }
- // get a list of gestures to send to the item
- QList<Qt::GestureType> grabbedGestures =
- topmost->QGraphicsItem::d_func()->gestureContext.keys();
- QList<QGesture *> gestures;
- for (int i = 0; i < grabbedGestures.size(); ++i) {
- if (QGesture *g = conflictedGestures.value(grabbedGestures.at(i), 0)) {
- gestures.append(g);
- if (!ignoredConflictedGestures.contains(g))
- ignoredConflictedGestures.insert(g, topmost);
- }
- }
-
- // send gesture override to the topmost item
- QGestureEvent ev(gestures);
- ev.t = QEvent::GestureOverride;
- ev.setWidget(event->widget());
- // mark event and individual gestures as ignored
- ev.ignore();
- foreach(QGesture *g, gestures)
- ev.setAccepted(g, false);
+ if (!startedGestures.isEmpty()) {
+ QSet<QGesture *> normalGestures; // that have just one target
+ QSet<QGesture *> conflictedGestures; // that have multiple possible targets
+ gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0,
+ &normalGestures, &conflictedGestures);
+ cachedTargetItems = cachedItemGestures.keys();
+ qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "delivering override to"
- << topmost << gestures;
- sendEvent(topmost, &ev);
- // mark all accepted gestures to deliver them as normal gesture events
- foreach (QGesture *g, gestures) {
- if (ev.isAccepted() || ev.isAccepted(g)) {
- conflictedGestures.remove(g->gestureType());
- gestureTargets.remove(g);
- // add the gesture to the list of normal delivered gestures
- normalGestures.insert(g, topmost);
+ << "Normal gestures:" << normalGestures
+ << "Conflicting gestures:" << conflictedGestures;
+
+ // deliver conflicted gestures as override events AND remember
+ // initial gesture targets
+ if (!conflictedGestures.isEmpty()) {
+ for (int i = 0; i < cachedTargetItems.size(); ++i) {
+ QWeakPointer<QGraphicsObject> item = cachedTargetItems.at(i);
+
+ // get gestures to deliver to the current item
+ QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data());
+ if (gestures.isEmpty())
+ continue;
+
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "override was accepted:"
- << g << topmost;
- ignoredConflictedGestures.remove(g);
+ << "delivering override to"
+ << item.data() << gestures;
+ // send gesture override
+ QGestureEvent ev(gestures.toList());
+ ev.t = QEvent::GestureOverride;
+ ev.setWidget(event->widget());
+ // mark event and individual gestures as ignored
+ ev.ignore();
+ foreach(QGesture *g, gestures)
+ ev.setAccepted(g, false);
+ sendEvent(item.data(), &ev);
+ // mark all accepted gestures to deliver them as normal gesture events
+ foreach (QGesture *g, gestures) {
+ if (ev.isAccepted() || ev.isAccepted(g)) {
+ conflictedGestures.remove(g);
+ // mark the item as a gesture target
+ if (item)
+ gestureTargets.insert(g, item.data());
+ DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
+ << "override was accepted:"
+ << g << item.data();
+ }
+ // remember the first item that received the override event
+ // as it most likely become a target if noone else accepts
+ // the override event
+ if (!gestureTargets.contains(g) && item)
+ gestureTargets.insert(g, item.data());
+
+ }
+ if (conflictedGestures.isEmpty())
+ break;
}
}
- // remove the item that we've already delivered from the list
- for (int i = 0; i < conflictedItems.size(); ) {
- QList<QGraphicsObject *> &items = conflictedItems[i];
- if (items.first() == topmost) {
- items.removeFirst();
- if (items.isEmpty()) {
- conflictedItems.removeAt(i);
- continue;
+ // remember the initial target item for each gesture that was not in
+ // the conflicted state.
+ if (!normalGestures.isEmpty()) {
+ for (int i = 0; i < cachedTargetItems.size() && !normalGestures.isEmpty(); ++i) {
+ QGraphicsObject *item = cachedTargetItems.at(i);
+
+ // get gestures to deliver to the current item
+ foreach (QGesture *g, cachedItemGestures.value(item)) {
+ if (!gestureTargets.contains(g)) {
+ gestureTargets.insert(g, item);
+ normalGestures.remove(g);
+ }
}
}
- ++i;
}
}
- // put back those started gestures that are not in the conflicted state
- // and remember their targets
- QHash<QGesture *, QGraphicsObject *>::const_iterator it = normalGestures.begin(),
- e = normalGestures.end();
- for (; it != e; ++it) {
- QGesture *g = it.key();
- QGraphicsObject *receiver = it.value();
- Q_ASSERT(!gestureTargets.contains(g));
- gestureTargets.insert(g, receiver);
- gesturesPerItem[receiver].append(g);
- }
- it = ignoredConflictedGestures.begin();
- e = ignoredConflictedGestures.end();
- for (; it != e; ++it) {
- QGesture *g = it.key();
- QGraphicsObject *receiver = it.value();
- Q_ASSERT(!gestureTargets.contains(g));
- gestureTargets.insert(g, receiver);
- gesturesPerItem[receiver].append(g);
- }
-
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "Started gestures:" << normalGestures.keys()
- << "All gestures:" << gesturesPerItem.values();
-
- // deliver all events
- QList<QGesture *> alreadyIgnoredGestures;
- QHash<QGraphicsObject *, QSet<QGesture *> > itemIgnoredGestures;
- QList<QGraphicsObject *> targetItems = gesturesPerItem.keys();
- qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst);
- for (int i = 0; i < targetItems.size(); ++i) {
- QGraphicsObject *item = targetItems.at(i);
- QList<QGesture *> gestures = gesturesPerItem.value(item);
- // remove gestures that were already delivered once and were ignored
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "already ignored gestures for item"
- << item << ":" << itemIgnoredGestures.value(item);
-
- if (itemIgnoredGestures.contains(item)) // don't deliver twice to the same item
- continue;
- QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func();
- foreach(QGesture *g, alreadyIgnoredGestures) {
- QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit =
- gid->gestureContext.find(g->gestureType());
- bool deliver = contextit != gid->gestureContext.end() &&
- (g->state() == Qt::GestureStarted ||
- (contextit.value() & Qt::ReceivePartialGestures));
- if (deliver)
- gestures += g;
+ // deliver all gesture events
+ QSet<QGesture *> undeliveredGestures;
+ QSet<QGesture *> parentPropagatedGestures;
+ foreach (QGesture *gesture, allGestures) {
+ if (QGraphicsObject *target = gestureTargets.value(gesture, 0)) {
+ cachedItemGestures[target].insert(gesture);
+ cachedTargetItems.append(target);
+ undeliveredGestures.insert(gesture);
+ QGraphicsItemPrivate *d = target->QGraphicsItem::d_func();
+ const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType());
+ if (flags & Qt::IgnoredGesturesPropagateToParent)
+ parentPropagatedGestures.insert(gesture);
+ } else {
+ DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
+ << "no target for" << gesture << "at"
+ << gesture->hotSpot() << gesture->d_func()->sceneHotSpot;
}
+ }
+ qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
+ for (int i = 0; i < cachedTargetItems.size(); ++i) {
+ QWeakPointer<QGraphicsObject> receiver = cachedTargetItems.at(i);
+ QSet<QGesture *> gestures =
+ undeliveredGestures & cachedItemGestures.value(receiver.data());
+ gestures -= cachedAlreadyDeliveredGestures.value(receiver.data());
+
if (gestures.isEmpty())
continue;
+
+ cachedAlreadyDeliveredGestures[receiver.data()] += gestures;
+ const bool isPanel = receiver.data()->isPanel();
+
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
<< "delivering to"
- << item << gestures;
- QGestureEvent ev(gestures);
+ << receiver.data() << gestures;
+ QGestureEvent ev(gestures.toList());
ev.setWidget(event->widget());
- sendEvent(item, &ev);
+ sendEvent(receiver.data(), &ev);
QSet<QGesture *> ignoredGestures;
foreach (QGesture *g, gestures) {
if (!ev.isAccepted() && !ev.isAccepted(g)) {
- ignoredGestures.insert(g);
+ // if the gesture was ignored by its target, we will update the
+ // targetItems list with a possible target items (items that
+ // want to receive partial gestures).
+ // ### wont' work if the target was destroyed in the event
+ // we will just stop delivering it.
+ if (receiver && receiver.data() == gestureTargets.value(g, 0))
+ ignoredGestures.insert(g);
} else {
- if (g->state() == Qt::GestureStarted)
- gestureTargets[g] = item;
+ if (receiver && g->state() == Qt::GestureStarted) {
+ // someone accepted the propagated initial GestureStarted
+ // event, let it be the new target for all following events.
+ gestureTargets[g] = receiver.data();
+ }
+ undeliveredGestures.remove(g);
}
}
- if (!ignoredGestures.isEmpty()) {
- // get a list of items under the (current) hotspot of each ignored
- // gesture and start delivery again from the beginning
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "item has ignored the event, will propagate."
- << item << ignoredGestures;
- itemIgnoredGestures[item] += ignoredGestures;
- QMap<Qt::GestureType, QGesture *> conflictedGestures;
- QList<QList<QGraphicsObject *> > itemsForConflictedGestures;
- QHash<QGesture *, QGraphicsObject *> normalGestures;
- getGestureTargets(ignoredGestures, viewport,
- &conflictedGestures, &itemsForConflictedGestures,
- &normalGestures);
- QSet<QGraphicsObject *> itemsSet = targetItems.toSet();
- for (int k = 0; k < itemsForConflictedGestures.size(); ++k)
- itemsSet += itemsForConflictedGestures.at(k).toSet();
- targetItems = itemsSet.toList();
- qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst);
- alreadyIgnoredGestures = conflictedGestures.values();
+ if (undeliveredGestures.isEmpty())
+ break;
+
+ // ignoredGestures list is only filled when delivering to the gesture
+ // target item, so it is safe to assume item == target.
+ if (!ignoredGestures.isEmpty() && !isPanel) {
+ // look for new potential targets for gestures that were ignored
+ // and should be propagated.
+
+ QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet();
+
+ if (receiver) {
+ // first if the gesture should be propagated to parents only
+ for (QSet<QGesture *>::iterator it = ignoredGestures.begin();
+ it != ignoredGestures.end();) {
+ if (parentPropagatedGestures.contains(*it)) {
+ QGesture *gesture = *it;
+ const Qt::GestureType gestureType = gesture->gestureType();
+ QGraphicsItem *item = receiver.data();
+ while (item) {
+ if (QGraphicsObject *obj = item->toGraphicsObject()) {
+ if (item->d_func()->gestureContext.contains(gestureType)) {
+ targetsSet.insert(obj);
+ cachedItemGestures[obj].insert(gesture);
+ }
+ }
+ if (item->isPanel())
+ break;
+ item = item->parentItem();
+ }
+
+ it = ignoredGestures.erase(it);
+ continue;
+ }
+ ++it;
+ }
+ }
+
+ gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures,
+ &cachedItemGestures, &targetsSet, 0, 0);
+
+ cachedTargetItems = targetsSet.toList();
+ qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "new targets:" << targetItems;
+ << "new targets:" << cachedTargetItems;
i = -1; // start delivery again
continue;
}
}
+
foreach (QGesture *g, startedGestures) {
if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) {
DEBUG() << "lets try to cancel some";
// find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them
- cancelGesturesForChildren(g, event->widget());
+ cancelGesturesForChildren(g);
}
}
@@ -6146,9 +6190,13 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
break;
}
}
+
+ cachedTargetItems.clear();
+ cachedItemGestures.clear();
+ cachedAlreadyDeliveredGestures.clear();
}
-void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidget *viewport)
+void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
{
Q_ASSERT(original);
QGraphicsItem *originalItem = gestureTargets.value(original);
@@ -6204,8 +6252,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidge
if (!g->hasHotSpot())
continue;
- QPoint screenPos = g->hotSpot().toPoint();
- QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport);
+ QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0);
for (int j = 0; j < items.size(); ++j) {
QGraphicsObject *item = items.at(j)->toGraphicsObject();
if (!item)
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 04ffe0f..11e250e 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -87,7 +87,9 @@ public:
static QGraphicsScenePrivate *get(QGraphicsScene *q);
- static int changedSignalIndex;
+ int changedSignalIndex;
+ int processDirtyItemsIndex;
+ int polishItemsIndex;
QGraphicsScene::ItemIndexMethod indexMethod;
QGraphicsSceneIndex *index;
@@ -294,13 +296,18 @@ public:
bool allItemsIgnoreTouchEvents;
void enableTouchEventsOnViews();
+ QList<QGraphicsObject *> cachedTargetItems;
+ QHash<QGraphicsObject *, QSet<QGesture *> > cachedItemGestures;
+ QHash<QGraphicsObject *, QSet<QGesture *> > cachedAlreadyDeliveredGestures;
QHash<QGesture *, QGraphicsObject *> gestureTargets;
void gestureEventHandler(QGestureEvent *event);
- void getGestureTargets(const QSet<QGesture *> &gestures, QWidget *viewport,
- QMap<Qt::GestureType, QGesture *> *conflictedGestures,
- QList<QList<QGraphicsObject *> > *conflictedItems,
- QHash<QGesture *, QGraphicsObject *> *normalGestures);
- void cancelGesturesForChildren(QGesture *original, QWidget *viewport);
+ void gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures,
+ Qt::GestureFlag flag,
+ QHash<QGraphicsObject *, QSet<QGesture *> > *targets,
+ QSet<QGraphicsObject *> *itemsSet = 0,
+ QSet<QGesture *> *normal = 0,
+ QSet<QGesture *> *conflicts = 0);
+ void cancelGesturesForChildren(QGesture *original);
void updateInputMethodSensitivityInViews();
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index 9d3edcb..729837a 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -65,7 +65,7 @@
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate
+class Q_GUI_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QGraphicsView)
public:
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 654a432..8e439be 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -408,6 +408,12 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
}
/*!
+ \fn QGraphicsWidget::geometryChanged()
+
+ This signal gets emitted whenever the geometry is changed in setGeometry().
+*/
+
+/*!
\fn QRectF QGraphicsWidget::rect() const
Returns the item's local rect as a QRectF. This function is equivalent
@@ -980,6 +986,36 @@ void QGraphicsWidget::setPalette(const QPalette &palette)
}
/*!
+ \property QGraphicsWidget::autoFillBackground
+ \brief whether the widget background is filled automatically
+ \since 4.7
+
+ If enabled, this property will cause Qt to fill the background of the
+ widget before invoking the paint() method. The color used is defined by the
+ QPalette::Window color role from the widget's \l{QPalette}{palette}.
+
+ In addition, Windows are always filled with QPalette::Window, unless the
+ WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set.
+
+ By default, this property is false.
+
+ \sa Qt::WA_OpaquePaintEvent, Qt::WA_NoSystemBackground,
+*/
+bool QGraphicsWidget::autoFillBackground() const
+{
+ Q_D(const QGraphicsWidget);
+ return d->autoFillBackground;
+}
+void QGraphicsWidget::setAutoFillBackground(bool enabled)
+{
+ Q_D(QGraphicsWidget);
+ if (d->autoFillBackground != enabled) {
+ d->autoFillBackground = enabled;
+ update();
+ }
+}
+
+/*!
If this widget is currently managed by a layout, this function notifies
the layout that the widget's size hints have changed and the layout
may need to resize and reposition the widget accordingly.
diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h
index f34a755..7116a23 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.h
+++ b/src/gui/graphicsview/qgraphicswidget_p.h
@@ -80,6 +80,7 @@ public:
inSetGeometry(0),
polished(0),
inSetPos(0),
+ autoFillBackground(0),
focusPolicy(Qt::NoFocus),
focusNext(0),
focusPrev(0),
@@ -181,6 +182,7 @@ public:
quint32 inSetGeometry : 1;
quint32 polished: 1;
quint32 inSetPos : 1;
+ quint32 autoFillBackground : 1;
// Focus
Qt::FocusPolicy focusPolicy;