diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-05-29 14:04:59 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-09 07:30:03 (GMT) |
commit | e5ffaeb4bc9b76a96fdddb31460d4acdc564ae3c (patch) | |
tree | 069aca3a05e1fd21bd45902fb55bd8161bffb0cc /src/gui/graphicsview | |
parent | 5d54c09085979431831297f0e63f39c73f884d20 (diff) | |
download | Qt-e5ffaeb4bc9b76a96fdddb31460d4acdc564ae3c.zip Qt-e5ffaeb4bc9b76a96fdddb31460d4acdc564ae3c.tar.gz Qt-e5ffaeb4bc9b76a96fdddb31460d4acdc564ae3c.tar.bz2 |
Experimental change - disable itemChange notifications for move and transform.
This change is only to test how much of an impact the itemChange
mechanism has on performance. It's easy to revert later on.
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 9159381..0b06613 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#define QGRAPHICSITEM_NO_ITEMCHANGE + /*! \class QGraphicsItem \brief The QGraphicsItem class is the base class for all graphical @@ -2036,8 +2038,12 @@ qreal QGraphicsItem::effectiveOpacity() const void QGraphicsItem::setOpacity(qreal opacity) { // Notify change. +#ifndef QGRAPHICSITEM_NO_ITEMCHANGE const QVariant newOpacityVariant(itemChange(ItemOpacityChange, double(opacity))); qreal newOpacity = newOpacityVariant.toDouble(); +#else + qreal newOpacity = opacity; +#endif // Normalize. newOpacity = qBound<qreal>(0.0, newOpacity, 1.0); @@ -2049,7 +2055,9 @@ void QGraphicsItem::setOpacity(qreal opacity) d_ptr->opacity = newOpacity; // Notify change. +#ifndef QGRAPHICSITEM_NO_ITEMCHANGE itemChange(ItemOpacityHasChanged, newOpacity); +#endif // Update. if (d_ptr->scene) @@ -2499,10 +2507,14 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos) return; // Notify the item that the position is changing. +#ifndef QGRAPHICSITEM_NO_ITEMCHANGE const QVariant newPosVariant(q->itemChange(QGraphicsItem::ItemPositionChange, pos)); QPointF newPos = newPosVariant.toPointF(); if (newPos == this->pos) return; +#else + QPointF newPos = pos; +#endif // Update and repositition. inSetPosHelper = 1; @@ -2512,7 +2524,9 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos) this->pos = newPos; // Send post-notification. +#ifndef QGRAPHICSITEM_NO_ITEMCHANGE q->itemChange(QGraphicsItem::ItemPositionHasChanged, newPosVariant); +#endif inSetPosHelper = 0; } @@ -2874,18 +2888,22 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine) return; // Notify the item that the transformation matrix is changing. +#ifndef QGRAPHICSITEM_NO_ITEMCHANGE const QVariant newTransformVariant(itemChange(ItemTransformChange, qVariantFromValue<QTransform>(newTransform))); newTransform = qVariantValue<QTransform>(newTransformVariant); if (*d_ptr->transform == newTransform) return; +#endif // Update and set the new transformation. prepareGeometryChange(); *d_ptr->transform = newTransform; // Send post-notification. +#ifndef QGRAPHICSITEM_NO_ITEMCHANGE itemChange(ItemTransformHasChanged, newTransformVariant); +#endif } /*! |