From aa46924b3165e87ae195964fd18396829673bca7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 21 Jul 2009 08:50:00 +0200 Subject: First round of cleanups for QFxItem Removed some methods that are already implemented in QGraphicsItem/Object. --- src/declarative/fx/qfxflickable.cpp | 2 +- src/declarative/fx/qfxitem.cpp | 101 ---------------------------------- src/declarative/fx/qfxitem.h | 61 ++++++++------------ src/declarative/fx/qfxitem_p.h | 5 +- src/declarative/fx/qfxpainteditem.cpp | 6 +- src/declarative/fx/qfxpathview.cpp | 4 +- src/gui/graphicsview/qgraphicsitem.h | 4 +- 7 files changed, 33 insertions(+), 150 deletions(-) diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 24f6d72..1db6e8b 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -1019,7 +1019,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxFlickable); QGraphicsSceneMouseEvent mouseEvent(event->type()); - QRectF myRect = mapToScene(QRectF(0, 0, width(), height())); + QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect(); QFxItem *grabber = static_cast(mouseGrabberItem()); if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { mouseEvent.setAccepted(false); diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index c439032..90595ff 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -349,22 +349,6 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::visibleChanged() - - This signal is emitted when the visibility of the item changes. - - \sa setVisible() -*/ - -/*! - \fn void QFxItem::opacityChanged() - - This signal is emitted when the opacity of the item changes. - - \sa opacity(), setOpacity() -*/ - -/*! \fn void QFxItem::parentChanged() This signal is emitted when the parent of the item changes. @@ -1068,14 +1052,6 @@ void QFxItem::keyReleaseEvent(QKeyEvent *event) } /*! - Returns the bounding rectangle of the item in scene coordinates. -*/ -QRectF QFxItem::sceneBoundingRect() const -{ - return QRectF(mapToScene(QPointF(0,0)), QSize(width(), height())); -} - -/*! \qmlproperty string Item::id This property holds the identifier for the item. @@ -1503,26 +1479,6 @@ void QFxItem::setRotation(qreal rotation) */ /*! - \property QFxItem::opacity - - The opacity of the item. Opacity is specified as a number between 0 - (fully transparent) and 1 (fully opaque). The default is 1. - - Opacity is an \e inherited attribute. That is, the opacity is - also applied individually to child items. -*/ - -void QFxItem::setOpacity(qreal v) -{ - if (v == opacity()) - return; - - QGraphicsItem::setOpacity(v); - - emit opacityChanged(); -} - -/*! Returns a value indicating whether the mouse should remain with this item. */ @@ -1775,43 +1731,6 @@ QList *QFxItem::transform() return &(d->_transform); } -/*! - Returns true if the item is visible; otherwise returns false. - - An item is considered visible if its opacity is not 0. -*/ -bool QFxItem::isVisible() const -{ - Q_D(const QFxItem); - return d->visible; -} - -/*! - \property QFxItem::visible - - This property specifies whether the item is visible or invisible. - - Setting visibility to false sets opacity to 0. Setting the - visibility to true restores the opacity to its previous value. - - \sa isVisible() -*/ -void QFxItem::setVisible(bool visible) -{ - Q_D(QFxItem); - if (visible == d->visible) - return; - - d->visible = visible; - if (visible) - setOpacity(d->visibleOp); - else { - d->visibleOp = opacity(); - setOpacity(0); - } - - emit visibleChanged(); -} /*! \internal */ @@ -2281,26 +2200,6 @@ QRect QFxItem::itemBoundingRect() return boundingRect().toAlignedRect(); } -QPointF QFxItem::mapFromScene(const QPointF &p) const -{ - return QGraphicsItem::mapFromScene(p); -} - -QRectF QFxItem::mapFromScene(const QRectF &r) const -{ - return QGraphicsItem::mapFromScene(r).boundingRect(); -} - -QPointF QFxItem::mapToScene(const QPointF &p) const -{ - return QGraphicsItem::mapToScene(p); -} - -QRectF QFxItem::mapToScene(const QRectF &r) const -{ - return QGraphicsItem::mapToScene(r).boundingRect(); -} - QTransform QFxItem::transform() const { Q_D(const QFxItem); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 53992d3..ddd3752 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -100,7 +100,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_INTERFACES(QmlParserStatus) Q_PROPERTY(QFxItem * parent READ itemParent WRITE setItemParent NOTIFY parentChanged DESIGNABLE false FINAL) - Q_PROPERTY(QString id READ id WRITE setId) + Q_PROPERTY(QString id READ id WRITE setId) // ### remove Q_PROPERTY(QmlList* children READ children DESIGNABLE false) Q_PROPERTY(QmlList* resources READ resources DESIGNABLE false) Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) @@ -109,9 +109,9 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(QmlList* states READ states DESIGNABLE false) Q_PROPERTY(QmlList* transitions READ transitions DESIGNABLE false) Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) - Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged) - Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged) - Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) + Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged) // ### name? Move to own class? + Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged) // ### see above + Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) // ### use method in QGO Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) Q_PROPERTY(qreal z READ z WRITE setZ FINAL) Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL) @@ -124,15 +124,13 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL) Q_PROPERTY(QFxAnchorLine baseline READ baseline CONSTANT FINAL) Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) - Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) - Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) - Q_PROPERTY(bool clip READ clip WRITE setClip) + Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) // ## remove me + Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) // ### remove me + Q_PROPERTY(bool clip READ clip WRITE setClip) // ### move to QGI/QGO, NOTIFY Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL) Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL) - Q_PROPERTY(QList* transform READ transform) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) - Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) + Q_PROPERTY(QList* transform READ transform) // ## QGI/QGO + Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) // movbe to QGI Q_ENUMS(TransformOrigin) Q_CLASSINFO("DefaultProperty", "data") @@ -160,11 +158,11 @@ public: QFxItem(QFxItem *parent = 0); virtual ~QFxItem(); - QFxItem *itemParent() const; + QFxItem *itemParent() const; // ### remove me QFxItem *parentItem() const; - void setItemParent(QFxItem *parent); + void setItemParent(QFxItem *parent); // ## setParentItem - QString id() const; + QString id() const; // ### remove me void setId(const QString &); QmlList *data(); @@ -199,21 +197,14 @@ public: qreal scale() const; void setScale(qreal); - void setOpacity(qreal); - QList *transform(); - bool isVisible() const; - void setVisible(bool); - - virtual QString propertyInfo() const; + virtual QString propertyInfo() const; // ### unused, remove me bool isClassComplete() const; bool isComponentComplete() const; - QRectF sceneBoundingRect() const; - - void updateTransform(); + void updateTransform(); // ### private! bool keepMouseGrab() const; void setKeepMouseGrab(bool); @@ -231,13 +222,13 @@ public: qreal width() const; void setWidth(qreal); void setImplicitWidth(qreal); - bool widthValid() const; + bool widthValid() const; // ### better name? qreal height() const; void setHeight(qreal); void setImplicitHeight(qreal); - bool heightValid() const; + bool heightValid() const; // ### better name? - QPointF scenePos() const; + QPointF scenePos() const; // ### remove me TransformOrigin transformOrigin() const; void setTransformOrigin(TransformOrigin); @@ -245,19 +236,14 @@ public: void setParent(QFxItem *); - QRect itemBoundingRect(); + QRect itemBoundingRect(); // ### remove me void setPaintMargin(qreal margin); QRectF boundingRect() const; virtual void paintContents(QPainter &); - QPointF mapFromScene(const QPointF &) const; - QRectF mapFromScene(const QRectF &) const; - QPointF mapToScene(const QPointF &) const; - QRectF mapToScene(const QRectF &) const; - - QTransform transform() const; - void setTransform(const QTransform &); + QTransform transform() const; // ### remove me + void setTransform(const QTransform &); // ### remove me QFxItem *mouseGrabberItem() const; @@ -268,7 +254,7 @@ public: bool hasActiveFocus() const; - static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont()); + static QPixmap string(const QString &, const QColor & = Qt::black, const QFont & = QFont()); // ### remove me, make private for now QVariant inputMethodQuery(Qt::InputMethodQuery query) const; //### for KeyProxy @@ -289,8 +275,6 @@ Q_SIGNALS: void keyRelease(QFxKeyEvent *event); void rotationChanged(); void scaleChanged(); - void opacityChanged(); - void visibleChanged(); void qmlChanged(); void newChildCreated(const QString &url, QScriptValue); @@ -323,6 +307,7 @@ protected: QFxItem(QFxItemPrivate &dd, QFxItem *parent = 0); private: + // ### public? QFxAnchorLine left() const; QFxAnchorLine right() const; QFxAnchorLine horizontalCenter() const; @@ -331,6 +316,7 @@ private: QFxAnchorLine verticalCenter() const; QFxAnchorLine baseline() const; + // ### move to d-pointer void init(QFxItem *parent); friend class QmlStatePrivate; friend class QFxAnchors; @@ -340,6 +326,7 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QFxItem::Options) +// ### move to QGO template T qobject_cast(QGraphicsItem *item) { diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index eddeb9b..1242703 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -76,7 +76,7 @@ public: : _anchors(0), _contents(0), qmlItem(0), _qmlcomp(0), _baselineOffset(0), _rotation(0.), _classComplete(true), _componentComplete(true), _keepMouse(false), - visible(true), _anchorLines(0), visibleOp(1), + _anchorLines(0), _stateGroup(0), canvas(0), origin(QFxItem::TopLeft), options(QFxItem::NoOption), widthValid(false), heightValid(false), width(0), height(0), @@ -151,7 +151,6 @@ public: bool _classComplete:1; bool _componentComplete:1; bool _keepMouse:1; - bool visible:1; QmlChildren _qmlChildren; @@ -173,8 +172,6 @@ public: return _anchorLines; } - float visibleOp; - QmlStateGroup *states(); QmlStateGroup *_stateGroup; diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp index 7ff3361..a4055eb 100644 --- a/src/declarative/fx/qfxpainteditem.cpp +++ b/src/declarative/fx/qfxpainteditem.cpp @@ -224,11 +224,11 @@ void QFxPaintedItem::paintContents(QPainter &p) p.setRenderHints(QPainter::SmoothPixmapTransform, true); QRectF clipf = p.clipRegion().boundingRect(); if (clipf.isEmpty()) - clipf = mapToScene(content); // ### Inefficient: Maps toScene and then fromScene + clipf = mapToScene(content).boundingRect(); // ### Inefficient: Maps toScene and then fromScene else - clipf = mapToScene(clipf); + clipf = mapToScene(clipf).boundingRect(); - const QRect clip = mapFromScene(clipf).toRect(); + const QRect clip = mapFromScene(clipf).boundingRect().toRect(); QRegion topaint(clip); topaint &= content; diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 3c61050..47364d0 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -411,7 +411,7 @@ void QFxPathView::mousePressEvent(QGraphicsSceneMouseEvent *event) int idx = 0; for (; idx < d->items.count(); ++idx) { QRectF rect = d->items.at(idx)->boundingRect(); - rect = d->items.at(idx)->mapToScene(rect); + rect = d->items.at(idx)->mapToScene(rect).boundingRect(); if (rect.contains(scenePoint)) break; } @@ -495,7 +495,7 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxPathView); QGraphicsSceneMouseEvent mouseEvent(event->type()); - QRectF myRect = mapToScene(QRectF(0, 0, width(), height())); + QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect(); QFxItem *grabber = static_cast(mouseGrabberItem()); if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { mouseEvent.setAccepted(false); diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 7240eaa..6012053 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -510,9 +510,9 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_OBJECT Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) Q_PROPERTY(QString id READ objectName WRITE setObjectName) - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + 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) + 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) -- cgit v0.12 From 0e1c97f5835ace6ce52ef6a1ae23f8e4463ba742 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 22 Jul 2009 07:28:24 +0200 Subject: More cleanups in QFxItem Remove the pos, x and y properties and use the ones in QGraphicsObject instead --- src/declarative/fx/qfxitem.cpp | 45 ---------------------------------- src/declarative/fx/qfxitem.h | 14 +++-------- src/declarative/fx/qfxitem_p.h | 8 ++++++ src/gui/graphicsview/qgraphicsitem_p.h | 2 +- 4 files changed, 13 insertions(+), 56 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 90595ff..66a2d99 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1974,14 +1974,6 @@ void QFxItem::parentChanged(QFxItem *, QFxItem *) } /*! - Returns the item's (0, 0) point relative to its parent. - */ -QPointF QFxItem::pos() const -{ - return QPointF(x(),y()); -} - -/*! Returns the item's (0, 0) point mapped to scene coordinates. */ QPointF QFxItem::scenePos() const @@ -2037,32 +2029,6 @@ qreal QFxItem::z() const return zValue(); } -void QFxItem::setX(qreal x) -{ - if (x == this->x()) - return; - - qreal oldX = this->x(); - - QGraphicsItem::setPos(x, y()); - - geometryChanged(QRectF(this->x(), y(), width(), height()), - QRectF(oldX, y(), width(), height())); -} - -void QFxItem::setY(qreal y) -{ - if (y == this->y()) - return; - - qreal oldY = this->y(); - - QGraphicsItem::setPos(x(), y); - - geometryChanged(QRectF(x(), this->y(), width(), height()), - QRectF(x(), oldY, width(), height())); -} - void QFxItem::setZ(qreal z) { if (z == this->z()) @@ -2166,17 +2132,6 @@ bool QFxItem::heightValid() const return d->heightValid; } -void QFxItem::setPos(const QPointF &point) -{ - qreal oldX = x(); - qreal oldY = y(); - - QGraphicsItem::setPos(point); - - geometryChanged(QRectF(x(), y(), width(), height()), - QRectF(oldX, oldY, width(), height())); -} - qreal QFxItem::scale() const { Q_D(const QFxItem); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index ddd3752..4d96076 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -111,9 +111,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged) // ### name? Move to own class? Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged) // ### see above - Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) // ### use method in QGO - Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) - Q_PROPERTY(qreal z READ z WRITE setZ FINAL) + Q_PROPERTY(qreal z READ z WRITE setZ FINAL) // ### use method in QGO Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL) Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged FINAL) Q_PROPERTY(QFxAnchorLine left READ left CONSTANT FINAL) @@ -130,11 +128,11 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL) Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL) Q_PROPERTY(QList* transform READ transform) // ## QGI/QGO - Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) // movbe to QGI + Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) // ### move to QGI Q_ENUMS(TransformOrigin) Q_CLASSINFO("DefaultProperty", "data") - typedef QHash QmlChildren; + typedef QHash QmlChildren; // ### public: enum Option { NoOption = 0x00000000, @@ -213,11 +211,7 @@ public: void setOptions(Options, bool set = true); qreal z() const; - QPointF pos() const; - void setX(qreal); - void setY(qreal); - virtual void setZ(qreal); - void setPos(const QPointF &); + void setZ(qreal); qreal width() const; void setWidth(qreal); diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 1242703..1615ad8 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -205,6 +205,14 @@ public: QGraphicsItemPrivate::setFocusItemForArea(b); q->focusChanged(b); } + + virtual void setPosHelper(const QPointF &pos) + { + Q_Q(QFxItem); + QRectF oldGeometry(this->pos.x(), this->pos.y(), width, height); + QGraphicsItemPrivate::setPosHelper(pos); + q->geometryChanged(QRectF(this->pos.x(), this->pos.y(), width, height), oldGeometry); + } }; QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index d14ae7f..9e30f54 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -199,7 +199,7 @@ public: virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const; static bool movableAncestorIsSelected(const QGraphicsItem *item); - void setPosHelper(const QPointF &pos); + virtual void setPosHelper(const QPointF &pos); void setTransformHelper(const QTransform &transform); void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true); -- cgit v0.12 From 8dc527a3837c937630c8bbbab034b8bc84d496fb Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 22 Jul 2009 07:50:23 +0200 Subject: Remove an unused method in QFxItem propertyInfo was not used by anything, let's just get rid of it. --- src/declarative/extra/qfxparticles.cpp | 6 ------ src/declarative/extra/qfxparticles.h | 2 -- src/declarative/fx/qfximage.cpp | 6 ------ src/declarative/fx/qfximage.h | 1 - src/declarative/fx/qfxitem.cpp | 7 ------- src/declarative/fx/qfxitem.h | 2 -- src/declarative/fx/qfxtext.cpp | 6 ------ src/declarative/fx/qfxtext.h | 2 -- src/declarative/fx/qfxtextedit.cpp | 9 --------- src/declarative/fx/qfxtextedit.h | 2 -- src/declarative/fx/qfxwebview.cpp | 5 ----- src/declarative/fx/qfxwebview.h | 2 -- 12 files changed, 50 deletions(-) diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index 08d38ba..a7b01dd 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -1041,12 +1041,6 @@ void QFxParticles::setMotion(QFxParticleMotion *motion) d->motion = motion; } -QString QFxParticles::propertyInfo() const -{ - Q_D(const QFxParticles); - return d->url.toString(); -} - void QFxParticlesPainter::updateSize() { const int parentX = parentItem()->x(); diff --git a/src/declarative/extra/qfxparticles.h b/src/declarative/extra/qfxparticles.h index 9f085cd..2574f7f 100644 --- a/src/declarative/extra/qfxparticles.h +++ b/src/declarative/extra/qfxparticles.h @@ -203,8 +203,6 @@ public: QFxParticleMotion *motion() const; void setMotion(QFxParticleMotion *); - virtual QString propertyInfo() const; - void paintContents(QPainter &p); protected: diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 69030d2..7445606 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -388,12 +388,6 @@ void QFxImage::paintContents(QPainter &p) } } -QString QFxImage::propertyInfo() const -{ - Q_D(const QFxImage); - return d->url.toString(); -} - /*! \qmlproperty enum Image::status diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h index 7b3445c..9c0dde8 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -91,7 +91,6 @@ public: QUrl source() const; virtual void setSource(const QUrl &url); - virtual QString propertyInfo() const; void paintContents(QPainter &painter); Q_SIGNALS: diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 66a2d99..354e4cc 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1732,13 +1732,6 @@ QList *QFxItem::transform() } -/*! \internal -*/ -QString QFxItem::propertyInfo() const -{ - return QString(); -} - /*! Creates a new child of the given component \a type. The newChildCreated() signal will be emitted when and if the child is diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 4d96076..0dcf852 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -197,8 +197,6 @@ public: QList *transform(); - virtual QString propertyInfo() const; // ### unused, remove me - bool isClassComplete() const; bool isComponentComplete() const; diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 2bae53f..3d36bf3 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -575,12 +575,6 @@ void QFxTextPrivate::updateSize() // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); -QString QFxText::propertyInfo() const -{ - Q_D(const QFxText); - return QChar(QLatin1Char('\"')) + d->text + QChar(QLatin1Char('\"')); -} - void QFxTextPrivate::drawOutline() { QPixmap img = QPixmap(imgCache.size()); diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index b7ec333..a02b76b 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -125,8 +125,6 @@ public: bool smoothTransform() const; void setSmoothTransform(bool); - virtual QString propertyInfo() const; - void paintContents(QPainter &p); virtual void componentComplete(); diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index f9cde7c..4a8085b 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -679,15 +679,6 @@ void QFxTextEdit::geometryChanged(const QRectF &newGeometry, } /*! - \internal -*/ -QString QFxTextEdit::propertyInfo() const -{ - Q_D(const QFxTextEdit); - return QChar(QLatin1Char('\"')) + d->text + QChar(QLatin1Char('\"')); -} - -/*! Ensures any delayed caching or data loading the class needs to performed is complete. */ diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index 77fac29..132b474 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -161,8 +161,6 @@ public: qreal textMargin() const; void setTextMargin(qreal margin); - virtual QString propertyInfo() const; - virtual void componentComplete(); /* FROM EDIT */ diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 42b8d2c..6c23198 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -507,11 +507,6 @@ void QFxWebView::drawContents(QPainter *p, const QRect &r) page()->mainFrame()->render(p,r); } -QString QFxWebView::propertyInfo() const -{ - return page()->mainFrame()->url().toString(); -} - static QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) { QEvent::Type t; diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index ab20281..7f22439 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -139,8 +139,6 @@ public: QAction *forwardAction() const; QAction *stopAction() const; - virtual QString propertyInfo() const; - QWebPage *page() const; void setPage(QWebPage *page); -- cgit v0.12 From d5f46ae26ee0cd4a3ccdde526f011b3bdd884abc Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 22 Jul 2009 08:56:48 +0200 Subject: unify z-value handling in graphics and fx items. Add a ItemNegativeZStacksBehindParent flag to QGraphicsItem to get the behavior we need in QFxItems. Removed the z property in QFxItems. --- src/declarative/extra/qfxflowview.cpp | 6 +++--- src/declarative/fx/qfxgridview.cpp | 2 +- src/declarative/fx/qfxitem.cpp | 18 ------------------ src/declarative/fx/qfxitem.h | 4 ---- src/declarative/fx/qfxitem_p.h | 5 +++-- src/declarative/fx/qfxlistview.cpp | 2 +- src/declarative/fx/qfxpathview.cpp | 8 ++++---- src/gui/graphicsview/qgraphicsitem.cpp | 11 +++++++++++ src/gui/graphicsview/qgraphicsitem.h | 3 ++- src/gui/graphicsview/qgraphicsitem_p.h | 4 ++-- 10 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp index 1676512..e1200c7 100644 --- a/src/declarative/extra/qfxflowview.cpp +++ b/src/declarative/extra/qfxflowview.cpp @@ -132,7 +132,7 @@ void QFxFlowView::refresh() for (int ii = 0; ii < m_model->count(); ++ii) { if (QFxItem *item = m_model->item(ii)) { item->setParent(this); - item->setZ(0); + item->setZValue(0); m_items << item; } } @@ -296,7 +296,7 @@ void QFxFlowView::mousePressEvent(QGraphicsSceneMouseEvent *event) if (r.contains(event->pos())) { m_dragItem = item; - m_dragItem->setZ(1); + m_dragItem->setZValue(1); m_dragOffset = r.topLeft() - event->pos(); event->accept(); return; @@ -316,7 +316,7 @@ void QFxFlowView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event); if (m_dragItem) { - m_dragItem->setZ(0); + m_dragItem->setZValue(0); clearTimeLine(); diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 3c80e98..9528af7 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -356,7 +356,7 @@ FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) listItem->index = modelIndex; // complete model->completeItem(); - listItem->item->setZ(modelIndex + 1); + listItem->item->setZValue(modelIndex + 1); listItem->item->setParent(q->viewport()); } requestedIndex = 0; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 354e4cc..42ff436 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -2017,24 +2017,6 @@ QPointF QFxItem::transformOriginPoint() const return d->transformOrigin(); } -qreal QFxItem::z() const -{ - return zValue(); -} - -void QFxItem::setZ(qreal z) -{ - if (z == this->z()) - return; - - if (z < 0) - setFlag(QGraphicsItem::ItemStacksBehindParent, true); - else - setFlag(QGraphicsItem::ItemStacksBehindParent, false); - - setZValue(z); -} - qreal QFxItem::width() const { Q_D(const QFxItem); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 0dcf852..8e0916e 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -111,7 +111,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(QUrl qml READ qml WRITE setQml NOTIFY qmlChanged) // ### name? Move to own class? Q_PROPERTY(QFxItem *qmlItem READ qmlItem NOTIFY qmlChanged) // ### see above - Q_PROPERTY(qreal z READ z WRITE setZ FINAL) // ### use method in QGO Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL) Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged FINAL) Q_PROPERTY(QFxAnchorLine left READ left CONSTANT FINAL) @@ -208,9 +207,6 @@ public: Options options() const; void setOptions(Options, bool set = true); - qreal z() const; - void setZ(qreal); - qreal width() const; void setWidth(qreal); void setImplicitWidth(qreal); diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 1615ad8..ec45d6e 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -93,8 +93,9 @@ public: q->setItemParent(parent); _baselineOffset.invalidate(); q->setAcceptedMouseButtons(Qt::NoButton); - q->setFlag(QGraphicsItem::ItemHasNoContents, true); - q->setFlag(QGraphicsItem::ItemIsFocusable, true); + q->setFlags(QGraphicsItem::ItemHasNoContents | + QGraphicsItem::ItemIsFocusable | + QGraphicsItem::ItemNegativeZStacksBehindParent); mouseSetsFocus = false; } diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 50564fb..3515b78 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -423,7 +423,7 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex) } // complete model->completeItem(); - listItem->item->setZ(modelIndex + 1); + listItem->item->setZValue(modelIndex + 1); listItem->item->setParent(q->viewport()); if (orient == Qt::Vertical) QObject::connect(listItem->item, SIGNAL(heightChanged()), q, SLOT(itemResized())); diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 47364d0..4f6fddd 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -581,7 +581,7 @@ void QFxPathViewPrivate::regenerate() return; } items.append(item); - item->setZ(i); + item->setZValue(i); } q->refill(); } @@ -639,7 +639,7 @@ void QFxPathView::refill() d->firstIndex %= d->model->count(); int index = (d->firstIndex + d->items.count())%d->model->count(); d->items << d->getItem(index); - d->items.last()->setZ(wrapIndex); + d->items.last()->setZValue(wrapIndex); d->pathOffset++; d->pathOffset=d->pathOffset % d->items.count(); } @@ -652,7 +652,7 @@ void QFxPathView::refill() if (d->firstIndex < 0) d->firstIndex = d->model->count() - 1; d->items.prepend(d->getItem(d->firstIndex)); - d->items.first()->setZ(d->firstIndex); + d->items.first()->setZValue(d->firstIndex); d->pathOffset--; if (d->pathOffset < 0) d->pathOffset = d->items.count() - 1; @@ -675,7 +675,7 @@ void QFxPathView::itemsInserted(int modelIndex, int count) if (d->pathItems == -1) { for (int i = 0; i < count; ++i) { QFxItem *item = d->getItem(modelIndex + i); - item->setZ(modelIndex + i); + item->setZValue(modelIndex + i); d->items.insert(modelIndex + i, item); } refill(); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 916724c..638f20f 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -327,6 +327,10 @@ \value ItemAcceptsInputMethod The item supports input methods typically used for Asian languages. This flag was introduced in Qt 4.6. + + \value ItemNegativeZStacksBehindParent The item automatically stacks + it's parent if it's z-value is negative. + This flag was introduced in Qt 4.6. */ /*! @@ -3726,6 +3730,13 @@ void QGraphicsItem::setZValue(qreal z) itemChange(ItemZValueHasChanged, newZVariant); + if(d_ptr->flags & ItemNegativeZStacksBehindParent) { + if (z < 0) + setFlag(QGraphicsItem::ItemStacksBehindParent, true); + else + setFlag(QGraphicsItem::ItemStacksBehindParent, false); + } + if (d_ptr->isObject) emit static_cast(this)->zChanged(); } diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 6012053..ba7b5ef 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -100,7 +100,8 @@ public: ItemUsesExtendedStyleOption = 0x200, ItemHasNoContents = 0x400, ItemSendsGeometryChanges = 0x800, - ItemAcceptsInputMethod = 0x1000 + ItemAcceptsInputMethod = 0x1000, + ItemNegativeZStacksBehindParent = 0x2000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 9e30f54..ba24806 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -449,7 +449,7 @@ public: // New 32 bits quint32 fullUpdatePending : 1; - quint32 flags : 13; + quint32 flags : 14; quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; @@ -466,7 +466,7 @@ public: quint32 isFocusItemForArea : 1; quint32 hasActiveFocus : 1; quint32 mouseSetsFocus : 1; - quint32 unused : 2; // feel free to use + quint32 unused : 1; // feel free to use // Optional stacking order int globalStackingOrder; -- cgit v0.12 From 7fd162fe2d38882ae81f6a7b7cf6a313764fdf0e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 22 Jul 2009 09:03:13 +0200 Subject: remove the id property in QFxItem id's are handled by QML directly; the id property here is not actually used anymore. --- src/declarative/fx/qfxitem.cpp | 28 ---------------------------- src/declarative/fx/qfxitem.h | 4 ---- 2 files changed, 32 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 42ff436..212496c 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1068,34 +1068,6 @@ void QFxItem::keyReleaseEvent(QKeyEvent *event) */ /*! - \property QFxItem::id - This property holds the identifier for the item. - - The identifier can be used in bindings and other expressions to - refer to the item. For example: - - \qml - Text { id: myText; ... } - Text { text: myText.text } - \endqml - - The identifier is available throughout the \l {components}{component} - where it is declared. The identifier must be unique in thecomponent. -*/ -QString QFxItem::id() const -{ - Q_D(const QFxItem); - return d->_id; -} - -void QFxItem::setId(const QString &id) -{ - Q_D(QFxItem); - setObjectName(id); - d->_id = id; -} - -/*! \internal */ QFxAnchorLine QFxItem::left() const diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 8e0916e..6e735b3 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -100,7 +100,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_INTERFACES(QmlParserStatus) Q_PROPERTY(QFxItem * parent READ itemParent WRITE setItemParent NOTIFY parentChanged DESIGNABLE false FINAL) - Q_PROPERTY(QString id READ id WRITE setId) // ### remove Q_PROPERTY(QmlList* children READ children DESIGNABLE false) Q_PROPERTY(QmlList* resources READ resources DESIGNABLE false) Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) @@ -159,9 +158,6 @@ public: QFxItem *parentItem() const; void setItemParent(QFxItem *parent); // ## setParentItem - QString id() const; // ### remove me - void setId(const QString &); - QmlList *data(); QmlList *children(); QmlList *resources(); -- cgit v0.12 From 56195216c52b28dc05eb6b2944f0fac01a222fdf Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Jul 2009 10:06:33 +1000 Subject: Minor header cleanup. --- src/declarative/fx/qfximage.h | 1 + src/declarative/fx/qfxitem.h | 2 -- src/declarative/fx/qfxitem_p.h | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h index 9c0dde8..4b6e700 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -43,6 +43,7 @@ #define QFXIMAGE_H #include +#include #include diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 6e735b3..e3f371e 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -48,9 +48,7 @@ #include #include #include -#include #include -#include #include #include diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index ec45d6e..029b8b0 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -54,6 +54,7 @@ // #include +#include #include #include #include -- cgit v0.12 From 0c1ab1a6a6652299ca28e60cad9b7f39017160e3 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Jul 2009 10:30:05 +1000 Subject: Fix State when handling. --- src/declarative/qml/qmlbinding.cpp | 2 +- src/declarative/qml/qmlbinding.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index 57c1187..431dd66 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -52,7 +52,7 @@ Q_DECLARE_METATYPE(QList); QT_BEGIN_NAMESPACE -DEFINE_BOOL_CONFIG_OPTION(scriptWarnings, QML_SCRIPT_WARNINGS); +QML_DEFINE_NOCREATE_TYPE(QmlBinding); QmlBindingPrivate::QmlBindingPrivate() : inited(false), updating(false), enabled(true), mePtr(0) diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h index 5f6d6f4..c2182d5 100644 --- a/src/declarative/qml/qmlbinding.h +++ b/src/declarative/qml/qmlbinding.h @@ -54,7 +54,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QmlExpression; class QmlContext; class QmlBindingPrivate; class Q_DECLARATIVE_EXPORT QmlBinding : public QmlExpression @@ -84,10 +83,10 @@ private: Q_DECLARE_PRIVATE(QmlBinding) }; -Q_DECLARE_METATYPE(QmlBinding*); - QT_END_NAMESPACE +QML_DECLARE_TYPE(QmlBinding); + QT_END_HEADER #endif // QMLBINDING_H -- cgit v0.12 From af965934e6dbf8f581b1f9e241a08a9b2128472a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Jul 2009 11:13:24 +1000 Subject: Fix possible crash in XmlListModel. --- src/declarative/extra/qmlxmllistmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index 91ad538..1321f41 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -616,6 +616,7 @@ void QmlXmlListModel::requestFinished() { Q_D(QmlXmlListModel); if (d->reply->error() != QNetworkReply::NoError) { + disconnect(d->reply, 0, this, 0); d->reply->deleteLater(); d->reply = 0; d->status = Error; @@ -623,6 +624,7 @@ void QmlXmlListModel::requestFinished() d->status = Idle; QByteArray data = d->reply->readAll(); d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects); + disconnect(d->reply, 0, this, 0); d->reply->deleteLater(); d->reply = 0; } -- cgit v0.12 From e823da3a9a09a2982b553f4c8dbe82acb87e8f29 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Jul 2009 12:06:07 +1000 Subject: Stricter matching for ParentChangeAction. --- src/declarative/util/qmlanimation.cpp | 4 +++- src/declarative/util/qmlstate.cpp | 8 ++++---- src/declarative/util/qmlstate.h | 2 +- src/declarative/util/qmlstateoperations.cpp | 6 ++++++ src/declarative/util/qmlstateoperations.h | 3 ++- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 7d9e30f..1ea6575 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -1153,7 +1153,9 @@ void QmlParentChangeAction::transition(QmlStateActions &actions, Action &action = actions[ii]; //### should we still use target to filter? - if (action.event /*&& action.event->name() == d->parentChange*/) { //### + //### still need type-specific matching + if (action.event + && action.event->typeName() == QLatin1String("ParentChange")) { Action myAction = action; data->reverse = action.reverseEvent; data->actions << myAction; diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index 2c44c86..1aa7ffe 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -74,7 +74,7 @@ ActionEvent::~ActionEvent() { } -QString ActionEvent::name() const +QString ActionEvent::typeName() const { return QString(); } @@ -360,13 +360,13 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever if (action.event) { if (!action.event->isReversable()) continue; - for (jj = 0; jj < d->revertList.count(); ++jj) { + /*for (jj = 0; jj < d->revertList.count(); ++jj) { ActionEvent *event = d->revertList.at(jj).event; - if (event && event->name() == action.event->name()) { + if (event && event->typeName() == action.event->typeName()) { found = true; break; } - } + }*/ //### not a close enough match } else { action.fromBinding = action.property.binding(); diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h index 1c0d67f..e453446 100644 --- a/src/declarative/util/qmlstate.h +++ b/src/declarative/util/qmlstate.h @@ -83,7 +83,7 @@ class ActionEvent { public: virtual ~ActionEvent(); - virtual QString name() const; + virtual QString typeName() const; virtual void execute(); virtual bool isReversable(); virtual void reverse(); diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index dc7fef6..3e114d2 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -142,6 +142,7 @@ QFxItem *QmlParentChange::object() const Q_D(const QmlParentChange); return d->target; } + void QmlParentChange::setObject(QFxItem *target) { Q_D(QmlParentChange); @@ -196,6 +197,11 @@ void QmlParentChange::reverse() d->doChange(d->origParent); } +QString QmlParentChange::typeName() const +{ + return QLatin1String("ParentChange"); +} + class QmlRunScriptPrivate : public QObjectPrivate { public: diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h index acbe05e..67cd1cf 100644 --- a/src/declarative/util/qmlstateoperations.h +++ b/src/declarative/util/qmlstateoperations.h @@ -74,6 +74,7 @@ public: virtual void execute(); virtual bool isReversable(); virtual void reverse(); + virtual QString typeName() const; }; class QmlRunScriptPrivate; @@ -94,7 +95,7 @@ public: QString script() const; void setScript(const QString &); - virtual QString name() const; + QString name() const; void setName(const QString &); virtual void execute(); -- cgit v0.12