diff options
author | Bea Lam <bea.lam@nokia.com> | 2009-11-11 02:27:29 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2009-11-11 02:27:29 (GMT) |
commit | 22fe9474b01c577337e43416666a8f90d0ad6064 (patch) | |
tree | f55624c92fc63db9e9fbba43c07ce5f9df59a25b /src/declarative | |
parent | b8b5ad641a5977651e61b5e572918f90248d8851 (diff) | |
parent | b6b0b5d7f211e10beb76711fcecdf068af34fdfd (diff) | |
download | Qt-22fe9474b01c577337e43416666a8f90d0ad6064.zip Qt-22fe9474b01c577337e43416666a8f90d0ad6064.tar.gz Qt-22fe9474b01c577337e43416666a8f90d0ad6064.tar.bz2 |
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/extra/extra.pri | 3 | ||||
-rw-r--r-- | src/declarative/graphicsitems/graphicsitems.pri | 3 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp (renamed from src/declarative/extra/qmlgraphicsanimatedimageitem.cpp) | 71 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h (renamed from src/declarative/extra/qmlgraphicsanimatedimageitem_p.h) | 19 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h (renamed from src/declarative/extra/qmlgraphicsanimatedimageitem_p_p.h) | 6 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicspainteditem.cpp | 20 | ||||
-rw-r--r-- | src/declarative/util/qmlspringfollow.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qmlspringfollow_p.h | 1 |
8 files changed, 67 insertions, 58 deletions
diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri index 78272a9..85ff6ea 100644 --- a/src/declarative/extra/extra.pri +++ b/src/declarative/extra/extra.pri @@ -2,7 +2,6 @@ SOURCES += \ extra/qnumberformat.cpp \ extra/qmlnumberformatter.cpp \ extra/qmldatetimeformatter.cpp \ - extra/qmlgraphicsanimatedimageitem.cpp \ extra/qmlbehavior.cpp \ extra/qmlfontloader.cpp @@ -10,8 +9,6 @@ HEADERS += \ extra/qnumberformat_p.h \ extra/qmlnumberformatter_p.h \ extra/qmldatetimeformatter_p.h \ - extra/qmlgraphicsanimatedimageitem_p.h \ - extra/qmlgraphicsanimatedimageitem_p_p.h \ extra/qmlbehavior_p.h \ extra/qmlfontloader_p.h diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index 3c4e39a..ef10e51 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -14,6 +14,8 @@ HEADERS += \ graphicsitems/qmlgraphicsimage_p_p.h \ graphicsitems/qmlgraphicsborderimage_p_p.h \ graphicsitems/qmlgraphicsimagebase_p_p.h \ + graphicsitems/qmlgraphicsanimatedimage_p.h \ + graphicsitems/qmlgraphicsanimatedimage_p_p.h \ graphicsitems/qmlgraphicsitem.h \ graphicsitems/qmlgraphicsitem_p.h \ graphicsitems/qmlgraphicsfocuspanel_p.h \ @@ -55,6 +57,7 @@ SOURCES += \ graphicsitems/qmlgraphicsimage.cpp \ graphicsitems/qmlgraphicsborderimage.cpp \ graphicsitems/qmlgraphicsimagebase.cpp \ + graphicsitems/qmlgraphicsanimatedimage.cpp \ graphicsitems/qmlgraphicspainteditem.cpp \ graphicsitems/qmlgraphicsitem.cpp \ graphicsitems/qmlgraphicsfocuspanel.cpp \ diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp b/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp index 2405bde..db28134 100644 --- a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp @@ -41,20 +41,20 @@ #include <QMovie> #include <QtDeclarative/qmlengine.h> -#include "qmlgraphicsanimatedimageitem_p.h" -#include "qmlgraphicsanimatedimageitem_p_p.h" +#include "qmlgraphicsanimatedimage_p.h" +#include "qmlgraphicsanimatedimage_p_p.h" #include <QNetworkRequest> #include <QNetworkReply> QT_BEGIN_NAMESPACE /*! - \class QmlGraphicsAnimatedImageItem + \class QmlGraphicsAnimatedImage \internal */ /*! - \qmlclass AnimatedImage QFxAnimatedImageItem + \qmlclass AnimatedImage QmlGraphicsAnimatedImage \inherits Image This item provides for playing animations stored as images containing a series of frames, @@ -76,21 +76,16 @@ Item { \endqml \endtable */ -QML_DEFINE_TYPE(Qt,4,6,AnimatedImage,QmlGraphicsAnimatedImageItem) +QML_DEFINE_TYPE(Qt,4,6,AnimatedImage,QmlGraphicsAnimatedImage) -QmlGraphicsAnimatedImageItem::QmlGraphicsAnimatedImageItem(QmlGraphicsItem *parent) - : QmlGraphicsImage(*(new QmlGraphicsAnimatedImageItemPrivate), parent) +QmlGraphicsAnimatedImage::QmlGraphicsAnimatedImage(QmlGraphicsItem *parent) + : QmlGraphicsImage(*(new QmlGraphicsAnimatedImagePrivate), parent) { } -QmlGraphicsAnimatedImageItem::QmlGraphicsAnimatedImageItem(QmlGraphicsAnimatedImageItemPrivate &dd, QmlGraphicsItem *parent) - : QmlGraphicsImage(dd, parent) +QmlGraphicsAnimatedImage::~QmlGraphicsAnimatedImage() { -} - -QmlGraphicsAnimatedImageItem::~QmlGraphicsAnimatedImageItem() -{ - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); delete d->_movie; } @@ -100,17 +95,17 @@ QmlGraphicsAnimatedImageItem::~QmlGraphicsAnimatedImageItem() Defaults to false, and can be set to true when you want to pause. */ -bool QmlGraphicsAnimatedImageItem::isPaused() const +bool QmlGraphicsAnimatedImage::isPaused() const { - Q_D(const QmlGraphicsAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImage); if(!d->_movie) return false; return d->_movie->state()==QMovie::Paused; } -void QmlGraphicsAnimatedImageItem::setPaused(bool pause) +void QmlGraphicsAnimatedImage::setPaused(bool pause) { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); if(pause == d->paused) return; d->paused = pause; @@ -124,17 +119,17 @@ void QmlGraphicsAnimatedImageItem::setPaused(bool pause) Defaults to true, so as to start playing immediately. */ -bool QmlGraphicsAnimatedImageItem::isPlaying() const +bool QmlGraphicsAnimatedImage::isPlaying() const { - Q_D(const QmlGraphicsAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImage); if (!d->_movie) return false; return d->_movie->state()!=QMovie::NotRunning; } -void QmlGraphicsAnimatedImageItem::setPlaying(bool play) +void QmlGraphicsAnimatedImage::setPlaying(bool play) { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); if(play == d->playing) return; d->playing = play; @@ -154,17 +149,17 @@ void QmlGraphicsAnimatedImageItem::setPlaying(bool play) allow other things to animate at the same time as the image. frameCount is the number of frames in the animation. For some animation formats, frameCount is unknown and set to zero. */ -int QmlGraphicsAnimatedImageItem::currentFrame() const +int QmlGraphicsAnimatedImage::currentFrame() const { - Q_D(const QmlGraphicsAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImage); if (!d->_movie) return d->preset_currentframe; return d->_movie->currentFrameNumber(); } -void QmlGraphicsAnimatedImageItem::setCurrentFrame(int frame) +void QmlGraphicsAnimatedImage::setCurrentFrame(int frame) { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); if (!d->_movie) { d->preset_currentframe = frame; return; @@ -172,9 +167,9 @@ void QmlGraphicsAnimatedImageItem::setCurrentFrame(int frame) d->_movie->jumpToFrame(frame); } -int QmlGraphicsAnimatedImageItem::frameCount() const +int QmlGraphicsAnimatedImage::frameCount() const { - Q_D(const QmlGraphicsAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImage); if (!d->_movie) return 0; return d->_movie->frameCount(); @@ -188,9 +183,9 @@ static QString toLocalFileOrQrc(const QUrl& url) return r; } -void QmlGraphicsAnimatedImageItem::setSource(const QUrl &url) +void QmlGraphicsAnimatedImage::setSource(const QUrl &url) { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); if (url == d->url) return; @@ -249,9 +244,9 @@ void QmlGraphicsAnimatedImageItem::setSource(const QUrl &url) emit statusChanged(d->status); } -void QmlGraphicsAnimatedImageItem::movieRequestFinished() +void QmlGraphicsAnimatedImage::movieRequestFinished() { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); d->_movie = new QMovie(d->reply); if (!d->_movie->isValid()){ qWarning() << "Error Reading Animated Image File " << d->url; @@ -275,16 +270,16 @@ void QmlGraphicsAnimatedImageItem::movieRequestFinished() d->setPixmap(d->_movie->currentPixmap()); } -void QmlGraphicsAnimatedImageItem::movieUpdate() +void QmlGraphicsAnimatedImage::movieUpdate() { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); d->setPixmap(d->_movie->currentPixmap()); emit frameChanged(); } -void QmlGraphicsAnimatedImageItem::playingStatusChanged() +void QmlGraphicsAnimatedImage::playingStatusChanged() { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); if((d->_movie->state() != QMovie::NotRunning) != d->playing){ d->playing = (d->_movie->state() != QMovie::NotRunning); emit playingChanged(); @@ -295,9 +290,9 @@ void QmlGraphicsAnimatedImageItem::playingStatusChanged() } } -void QmlGraphicsAnimatedImageItem::componentComplete() +void QmlGraphicsAnimatedImage::componentComplete() { - Q_D(QmlGraphicsAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImage); setCurrentFrame(d->preset_currentframe); d->preset_currentframe = 0; } diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem_p.h b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h index b581ea3..79daa0f 100644 --- a/src/declarative/extra/qmlgraphicsanimatedimageitem_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSANIMATEDIMAGEITEM_H -#define QMLGRAPHICSANIMATEDIMAGEITEM_H +#ifndef QMLGRAPHICSANIMATEDIMAGE_H +#define QMLGRAPHICSANIMATEDIMAGE_H #include <private/qmlgraphicsimage_p.h> @@ -51,9 +51,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QMovie; -class QmlGraphicsAnimatedImageItemPrivate; +class QmlGraphicsAnimatedImagePrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImageItem : public QmlGraphicsImage +class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImage : public QmlGraphicsImage { Q_OBJECT @@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImageItem : public QmlGraphicsImag Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged) Q_PROPERTY(int frameCount READ frameCount) public: - QmlGraphicsAnimatedImageItem(QmlGraphicsItem *parent=0); - ~QmlGraphicsAnimatedImageItem(); + QmlGraphicsAnimatedImage(QmlGraphicsItem *parent=0); + ~QmlGraphicsAnimatedImage(); bool isPlaying() const; void setPlaying(bool play); @@ -90,17 +90,16 @@ private Q_SLOTS: void playingStatusChanged(); protected: - QmlGraphicsAnimatedImageItem(QmlGraphicsAnimatedImageItemPrivate &dd, QmlGraphicsItem *parent); void componentComplete(); private: - Q_DISABLE_COPY(QmlGraphicsAnimatedImageItem) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsAnimatedImageItem) + Q_DISABLE_COPY(QmlGraphicsAnimatedImage) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsAnimatedImage) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsAnimatedImageItem) +QML_DECLARE_TYPE(QmlGraphicsAnimatedImage) QT_END_HEADER diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem_p_p.h b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h index 2256b9b..c24afa0 100644 --- a/src/declarative/extra/qmlgraphicsanimatedimageitem_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h @@ -60,12 +60,12 @@ QT_BEGIN_NAMESPACE class QMovie; class QNetworkReply; -class QmlGraphicsAnimatedImageItemPrivate : public QmlGraphicsImagePrivate +class QmlGraphicsAnimatedImagePrivate : public QmlGraphicsImagePrivate { - Q_DECLARE_PUBLIC(QmlGraphicsAnimatedImageItem) + Q_DECLARE_PUBLIC(QmlGraphicsAnimatedImage) public: - QmlGraphicsAnimatedImageItemPrivate() + QmlGraphicsAnimatedImagePrivate() : playing(true), paused(false), preset_currentframe(0), _movie(0), reply(0) { } diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp index 2c849c8..b1b1210 100644 --- a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp @@ -49,6 +49,7 @@ #include <QApplication> #include <QGraphicsSceneMouseEvent> #include <QPainter> +#include <QPaintEngine> QT_BEGIN_NAMESPACE @@ -209,9 +210,24 @@ void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem * ++inpaint; - const QRect clip = p->clipRegion().boundingRect(); + const QTransform &x = p->deviceTransform(); + QTransform xinv = x.inverted(); + QRegion effectiveClip; + QRegion sysClip = p->paintEngine()->systemClip(); + if (xinv.type() <= QTransform::TxScale && sysClip.numRects() < 5) { + // simple transform, region gets no more complicated... + effectiveClip = xinv.map(sysClip); + } else { + // do not make complicated regions... + effectiveClip = xinv.mapRect(sysClip.boundingRect()); + } + + QRegion topaint = p->clipRegion(); + if (topaint.isEmpty()) + topaint = effectiveClip; + else + topaint &= effectiveClip; - QRegion topaint(clip); topaint &= content; QRegion uncached(content); p->setRenderHints(QPainter::SmoothPixmapTransform, d->smooth); diff --git a/src/declarative/util/qmlspringfollow.cpp b/src/declarative/util/qmlspringfollow.cpp index 4a7c8b3..d6961b0 100644 --- a/src/declarative/util/qmlspringfollow.cpp +++ b/src/declarative/util/qmlspringfollow.cpp @@ -55,7 +55,7 @@ class QmlSpringFollowPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QmlSpringFollow) public: QmlSpringFollowPrivate() - : sourceValue(0), maxVelocity(0), lastTime(0) + : currentValue(0), sourceValue(0), maxVelocity(0), lastTime(0) , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01) , modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {} diff --git a/src/declarative/util/qmlspringfollow_p.h b/src/declarative/util/qmlspringfollow_p.h index b81539a..b7989e4 100644 --- a/src/declarative/util/qmlspringfollow_p.h +++ b/src/declarative/util/qmlspringfollow_p.h @@ -64,7 +64,6 @@ class Q_DECLARATIVE_EXPORT QmlSpringFollow : public QObject, Q_PROPERTY(qreal spring READ spring WRITE setSpring) Q_PROPERTY(qreal damping READ damping WRITE setDamping) Q_PROPERTY(qreal epsilon READ epsilon WRITE setEpsilon) - Q_PROPERTY(qreal modulus READ modulus WRITE setModulus) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) Q_PROPERTY(qreal value READ value NOTIFY valueChanged) Q_PROPERTY(qreal modulus READ modulus WRITE setModulus NOTIFY modulusChanged) |