diff options
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 102 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.h | 11 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem_p.h | 9 |
3 files changed, 7 insertions, 115 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index edf61e4..35f3b71 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -308,12 +308,6 @@ void QFxContents::setItem(QFxItem *item) */ /*! - \fn void QFxItem::scaleChanged() - - This signal is emitted when the scale of the item changes. -*/ - -/*! \fn void QFxItem::stateChanged(const QString &state) This signal is emitted when the \a state of the item changes. @@ -1334,29 +1328,6 @@ void QFxItem::setBaselineOffset(qreal offset) */ /*! - \property QFxItem::rotation - This property holds the rotation of the item in degrees. - - This specifies how many degrees to rotate the item around its transformOrigin. - The default rotation is 0 degrees (i.e. not rotated at all). -*/ -qreal QFxItem::rotation() const -{ - Q_D(const QFxItem); - return d->_rotation; -} - -void QFxItem::setRotation(qreal rotation) -{ - Q_D(QFxItem); - if (d->_rotation == rotation) - return; - d->_rotation = rotation; - setTransform(d->transform); - emit rotationChanged(); -} - -/*! \qmlproperty real Item::scale This property holds the scale of the item. @@ -1393,21 +1364,6 @@ void QFxItem::setRotation(qreal rotation) */ /*! - \property QFxItem::scale - This property holds the scale of the item. - - A scale of less than 1 means the item will be displayed smaller than - normal, and a scale of greater than 1 means the item will be - displayed larger than normal. A negative scale means the item will - be mirrored. - - By default, items are displayed at a scale of 1 (i.e. at their - normal size). - - Scaling is from the item's transformOrigin. -*/ - -/*! \qmlproperty real Item::opacity The opacity of the item. Opacity is specified as a number between 0 @@ -1837,7 +1793,7 @@ QFxItemPrivate::AnchorLines::AnchorLines(QFxItem *q) baseline.anchorLine = QFxAnchorLine::Baseline; } -QPointF QFxItemPrivate::transformOrigin() const +QPointF QFxItemPrivate::computeTransformOrigin() const { Q_Q(const QFxItem); @@ -1980,14 +1936,14 @@ void QFxItem::setTransformOrigin(TransformOrigin origin) Q_D(QFxItem); if (origin != d->origin) { d->origin = origin; - update(); + QPointF to = d->computeTransformOrigin(); + QGraphicsItem::setTransformOrigin(to.x(), to.y()); } } QPointF QFxItem::transformOriginPoint() const { - Q_D(const QFxItem); - return d->transformOrigin(); + return QGraphicsItem::transformOrigin(); } qreal QFxItem::width() const @@ -2080,61 +2036,11 @@ bool QFxItem::heightValid() const return d->heightValid; } -qreal QFxItem::scale() const -{ - Q_D(const QFxItem); - return d->scale; -} - -void QFxItem::setScale(qreal s) -{ - Q_D(QFxItem); - if (d->scale == s) - return; - - d->scale = s; - setTransform(d->transform); - - emit scaleChanged(); -} - QRect QFxItem::itemBoundingRect() { return boundingRect().toAlignedRect(); } -QTransform QFxItem::transform() const -{ - Q_D(const QFxItem); - return d->transform; -} - -//### optimize (perhaps cache scale and rot transforms, and have dirty flags) -//### we rely on there not being an "if (d->transform == m) return;" check -void QFxItem::setTransform(const QTransform &m) -{ - Q_D(QFxItem); - d->transform = m; - QTransform scaleTransform, rotTransform; - if (d->scale != 1) { - QPointF to = transformOriginPoint(); - if (to.x() != 0. || to.y() != 0.) - scaleTransform.translate(to.x(), to.y()); - scaleTransform.scale(d->scale, d->scale); - if (to.x() != 0. || to.y() != 0.) - scaleTransform.translate(-to.x(), -to.y()); - } - if (d->_rotation != 0) { - QPointF to = d->transformOrigin(); - if (to.x() != 0. || to.y() != 0.) - rotTransform.translate(to.x(), to.y()); - rotTransform.rotate(d->_rotation); - if (to.x() != 0. || to.y() != 0.) - rotTransform.translate(-to.x(), -to.y()); - } - QGraphicsItem::setTransform(scaleTransform * rotTransform * d->transform); -} - QFxItem *QFxItem::mouseGrabberItem() const { QGraphicsScene *s = scene(); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index c444507..3047713 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -142,8 +142,6 @@ 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) // ## 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) @@ -205,12 +203,6 @@ public: qreal baselineOffset() const; void setBaselineOffset(qreal); - qreal rotation() const; - void setRotation(qreal); - - qreal scale() const; - void setScale(qreal); - QList<QFxTransform *> *transform(); bool isClassComplete() const; @@ -245,9 +237,6 @@ public: QRectF boundingRect() const; virtual void paintContents(QPainter &); - QTransform transform() const; // ### remove me - void setTransform(const QTransform &); // ### remove me - QFxItem *mouseGrabberItem() const; virtual bool hasFocus() const; diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 08d2e4a..7bdd382 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -76,13 +76,13 @@ class QFxItemPrivate : public QGraphicsItemPrivate public: QFxItemPrivate() : _anchors(0), _contents(0), qmlItem(0), _qmlcomp(0), - _baselineOffset(0), _rotation(0.), + _baselineOffset(0), _classComplete(true), _componentComplete(true), _keepMouse(false), _anchorLines(0), _stateGroup(0), canvas(0), origin(QFxItem::TopLeft), options(QFxItem::NoOption), widthValid(false), heightValid(false), width(0), height(0), - paintmargin(0), scale(1) + paintmargin(0) {} ~QFxItemPrivate() { delete _anchors; } @@ -149,7 +149,6 @@ public: QList<QmlComponent*> _qmlnewcomp; QmlNullableValue<qreal> _baselineOffset; - float _rotation; bool _classComplete:1; bool _componentComplete:1; @@ -189,10 +188,8 @@ public: qreal width; qreal height; qreal paintmargin; - qreal scale; - QPointF transformOrigin() const; - QTransform transform; + QPointF computeTransformOrigin() const; void gvRemoveMouseFilter(); void gvAddMouseFilter(); |