diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-07-27 04:45:50 (GMT) |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2009-07-29 03:47:20 (GMT) |
commit | d53f55357ed9581b02088dff95fbe955412f476d (patch) | |
tree | 235e6467ed32d59f5bbd9b78c3a0e5e109c2f004 /src/declarative/fx/qfxitem.cpp | |
parent | b44728b41ccc24b272f49e878cd28b29430aad57 (diff) | |
download | Qt-d53f55357ed9581b02088dff95fbe955412f476d.zip Qt-d53f55357ed9581b02088dff95fbe955412f476d.tar.gz Qt-d53f55357ed9581b02088dff95fbe955412f476d.tar.bz2 |
make QFxItem use QGraphicsTransform
removed all the QFxTransform code and converted
QFxItem::transform to use a QmlList instead of a
QList.
Diffstat (limited to 'src/declarative/fx/qfxitem.cpp')
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 81 |
1 files changed, 55 insertions, 26 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 009e192..efdd4fc 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -48,6 +48,7 @@ #include <QGraphicsSceneMouseEvent> #include <QtScript/qscriptengine.h> #include <private/qfxperf_p.h> +#include <QtGui/qgraphicstransform.h> #include <QtDeclarative/qmlengine.h> #include <private/qmlengine_p.h> @@ -55,7 +56,6 @@ #include "qlistmodelinterface.h" #include "qfxanchors_p.h" -#include "qfxtransform.h" #include "qfxscalegrid.h" #include "qfxview.h" #include "qmlstategroup.h" @@ -74,6 +74,12 @@ QT_BEGIN_NAMESPACE QML_DEFINE_NOCREATE_TYPE(QFxContents) QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Item,QFxItem) +QML_DEFINE_NOCREATE_TYPE(QGraphicsTransform); +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Scale,QGraphicsScale) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Axis,QGraphicsAxis) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation3D,QGraphicsRotation3D) + /*! \group group_animation \title Animation @@ -633,6 +639,50 @@ void QFxItemPrivate::children_clear() // ### } + +void QFxItemPrivate::transform_removeAt(int i) +{ + if (!transformData) + return; + transformData->graphicsTransforms.removeAt(i); + dirtySceneTransform = 1; +} + +int QFxItemPrivate::transform_count() const +{ + return transformData ? transformData->graphicsTransforms.size() : 0; +} + +void QFxItemPrivate::transform_append(QGraphicsTransform *item) +{ + if (!transformData) + transformData = new QGraphicsItemPrivate::TransformData; + if (!transformData->graphicsTransforms.contains(item)) + transformData->graphicsTransforms.append(item); + transformData->onlyTransform = false; + dirtySceneTransform = 1; +} + +void QFxItemPrivate::transform_insert(int, QGraphicsTransform *) +{ + // ### +} + +QGraphicsTransform *QFxItemPrivate::transform_at(int idx) const +{ + if (!transformData) + return 0; + return transformData->graphicsTransforms.at(idx); +} + +void QFxItemPrivate::transform_clear() +{ + if (!transformData) + return; + transformData->graphicsTransforms.clear(); + dirtySceneTransform = 1; +} + /*! \qmlproperty list<Object> Item::data \default @@ -1652,17 +1702,14 @@ void QFxItem::setState(const QString &state) /*! \property QFxItem::transform - This property holds the list of transformations to apply. - - For more information see \l Transform. + This property holds a list of transformations set on the item. */ -QList<QFxTransform *> *QFxItem::transform() +QmlList<QGraphicsTransform *>* QFxItem::transform() { Q_D(QFxItem); - return &(d->_transform); + return &(d->transform); } - /*! Creates a new child of the given component \a type. The newChildCreated() signal will be emitted when and if the child is @@ -1733,25 +1780,6 @@ void QFxItem::componentComplete() d->_stateGroup->componentComplete(); if (d->_anchors) d->anchors()->d_func()->updateOnComplete(); - if (!d->_transform.isEmpty()) - updateTransform(); -} - -/*! - \internal -*/ -void QFxItem::updateTransform() -{ - Q_D(QFxItem); - QTransform trans; - for (int ii = d->_transform.count() - 1; ii >= 0; --ii) { - QFxTransform *a = d->_transform.at(ii); - if (!a->isIdentity()) - trans = a->transform() * trans; - } - - setTransform(trans); - transformChanged(trans); } /*! @@ -1759,6 +1787,7 @@ void QFxItem::updateTransform() */ void QFxItem::transformChanged(const QTransform &) { + // ### FIXME } QmlStateGroup *QFxItemPrivate::states() |