From 45cc1ea534640cb492bd00405bf8fcd5dbfbcf5c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 30 Oct 2009 14:15:22 +1000 Subject: Rename QFx classes to QmlGraphics --- doc/src/declarative/measuring-performance.qdoc | 6 +- doc/src/declarative/qtprogrammers.qdoc | 10 +- src/declarative/3rdparty/qlistmodelinterface.cpp | 4 +- src/declarative/extra/qfxanimatedimageitem.cpp | 60 +- src/declarative/extra/qfxanimatedimageitem.h | 18 +- src/declarative/extra/qfxanimatedimageitem_p.h | 6 +- src/declarative/extra/qfxintegermodel.cpp | 28 +- src/declarative/extra/qfxintegermodel.h | 12 +- src/declarative/extra/qfxparticles.cpp | 318 ++++----- src/declarative/extra/qfxparticles.h | 74 +- src/declarative/fx/qfxanchors.cpp | 392 +++++----- src/declarative/fx/qfxanchors.h | 76 +- src/declarative/fx/qfxanchors_p.h | 50 +- src/declarative/fx/qfxborderimage.cpp | 80 +-- src/declarative/fx/qfxborderimage.h | 26 +- src/declarative/fx/qfxborderimage_p.h | 24 +- src/declarative/fx/qfxevents.cpp | 12 +- src/declarative/fx/qfxevents_p.h | 14 +- src/declarative/fx/qfxflickable.cpp | 352 ++++----- src/declarative/fx/qfxflickable.h | 30 +- src/declarative/fx/qfxflickable_p.h | 24 +- src/declarative/fx/qfxflipable.cpp | 68 +- src/declarative/fx/qfxflipable.h | 26 +- src/declarative/fx/qfxfocuspanel.cpp | 14 +- src/declarative/fx/qfxfocuspanel.h | 10 +- src/declarative/fx/qfxfocusscope.cpp | 10 +- src/declarative/fx/qfxfocusscope.h | 8 +- src/declarative/fx/qfxgraphicsobjectcontainer.cpp | 52 +- src/declarative/fx/qfxgraphicsobjectcontainer.h | 12 +- src/declarative/fx/qfxgridview.cpp | 376 +++++----- src/declarative/fx/qfxgridview.h | 28 +- src/declarative/fx/qfximage.cpp | 40 +- src/declarative/fx/qfximage.h | 16 +- src/declarative/fx/qfximage_p.h | 10 +- src/declarative/fx/qfximagebase.cpp | 44 +- src/declarative/fx/qfximagebase.h | 14 +- src/declarative/fx/qfximagebase_p.h | 10 +- src/declarative/fx/qfxitem.cpp | 792 ++++++++++----------- src/declarative/fx/qfxitem.h | 70 +- src/declarative/fx/qfxitem_p.h | 76 +- src/declarative/fx/qfxlayoutitem.cpp | 16 +- src/declarative/fx/qfxlayoutitem.h | 8 +- src/declarative/fx/qfxlistview.cpp | 488 ++++++------- src/declarative/fx/qfxlistview.h | 28 +- src/declarative/fx/qfxloader.cpp | 80 +-- src/declarative/fx/qfxloader.h | 18 +- src/declarative/fx/qfxloader_p.h | 12 +- src/declarative/fx/qfxmouseregion.cpp | 168 ++--- src/declarative/fx/qfxmouseregion.h | 52 +- src/declarative/fx/qfxmouseregion_p.h | 12 +- src/declarative/fx/qfxpainteditem.cpp | 78 +- src/declarative/fx/qfxpainteditem.h | 16 +- src/declarative/fx/qfxpainteditem_p.h | 6 +- src/declarative/fx/qfxpath.cpp | 194 ++--- src/declarative/fx/qfxpath.h | 62 +- src/declarative/fx/qfxpath_p.h | 10 +- src/declarative/fx/qfxpathview.cpp | 232 +++--- src/declarative/fx/qfxpathview.h | 30 +- src/declarative/fx/qfxpathview_p.h | 34 +- src/declarative/fx/qfxpixmapcache.cpp | 28 +- src/declarative/fx/qfxpixmapcache.h | 4 +- src/declarative/fx/qfxpositioners.cpp | 168 ++--- src/declarative/fx/qfxpositioners.h | 52 +- src/declarative/fx/qfxpositioners_p.h | 24 +- src/declarative/fx/qfxrect.cpp | 100 +-- src/declarative/fx/qfxrect.h | 52 +- src/declarative/fx/qfxrect_p.h | 24 +- src/declarative/fx/qfxrepeater.cpp | 88 +-- src/declarative/fx/qfxrepeater.h | 16 +- src/declarative/fx/qfxrepeater_p.h | 14 +- src/declarative/fx/qfxscalegrid.cpp | 54 +- src/declarative/fx/qfxscalegrid_p.h | 28 +- src/declarative/fx/qfxtext.cpp | 178 ++--- src/declarative/fx/qfxtext.h | 16 +- src/declarative/fx/qfxtext_p.h | 22 +- src/declarative/fx/qfxtextedit.cpp | 314 ++++---- src/declarative/fx/qfxtextedit.h | 14 +- src/declarative/fx/qfxtextedit_p.h | 18 +- src/declarative/fx/qfxtextinput.cpp | 246 +++---- src/declarative/fx/qfxtextinput.h | 14 +- src/declarative/fx/qfxtextinput_p.h | 18 +- src/declarative/fx/qfxvisualitemmodel.cpp | 338 ++++----- src/declarative/fx/qfxvisualitemmodel.h | 78 +- src/declarative/fx/qfxwebview.cpp | 328 ++++----- src/declarative/fx/qfxwebview.h | 48 +- src/declarative/qml/qmlbinding.cpp | 2 +- src/declarative/qml/qmlboundsignal.cpp | 4 +- src/declarative/qml/qmlcompiler.cpp | 2 +- src/declarative/qml/qmlcomponent.cpp | 4 +- src/declarative/qml/qmldom.cpp | 2 +- src/declarative/qml/qmlengine.cpp | 4 +- src/declarative/qml/qmlexpression.cpp | 6 +- src/declarative/qml/qmlscriptparser.cpp | 2 +- src/declarative/util/qfxglobal.h | 6 +- src/declarative/util/qfxperf.cpp | 16 +- src/declarative/util/qfxperf_p.h | 6 +- src/declarative/util/qmlanimation.cpp | 18 +- src/declarative/util/qmlanimation.h | 14 +- src/declarative/util/qmlanimation_p.h | 4 +- src/declarative/util/qmlstategroup.cpp | 2 +- src/declarative/util/qmlstateoperations.cpp | 164 ++--- src/declarative/util/qmlstateoperations.h | 60 +- src/declarative/util/qmltimer.cpp | 2 +- src/declarative/util/qmlview.cpp | 22 +- src/declarative/util/qmlview.h | 6 +- src/gui/graphicsview/qgraphicsitem_p.h | 2 +- tests/auto/declarative/anchors/tst_anchors.cpp | 84 +-- .../animatedimage/tst_animatedimage.cpp | 8 +- .../auto/declarative/animations/tst_animations.cpp | 22 +- tests/auto/declarative/behaviors/tst_behaviors.cpp | 30 +- tests/auto/declarative/layouts/tst_layouts.cpp | 66 +- tests/auto/declarative/listview/tst_listview.cpp | 108 +-- tests/auto/declarative/pathview/tst_pathview.cpp | 52 +- tests/auto/declarative/qfxloader/tst_qfxloader.cpp | 16 +- .../qfxpixmapcache/tst_qfxpixmapcache.cpp | 22 +- tests/auto/declarative/qfxtext/tst_qfxtext.cpp | 62 +- .../declarative/qfxtextedit/tst_qfxtextedit.cpp | 52 +- .../declarative/qfxtextinput/tst_qfxtextinput.cpp | 42 +- .../auto/declarative/qfxwebview/tst_qfxwebview.cpp | 4 +- .../declarative/qmllanguage/tst_qmllanguage.cpp | 28 +- .../qmlpropertymap/tst_qmlpropertymap.cpp | 2 +- tests/auto/declarative/repeater/tst_repeater.cpp | 28 +- tests/auto/declarative/sql/tst_sql.cpp | 2 +- tests/auto/declarative/states/tst_states.cpp | 22 +- tests/benchmarks/qmlpainting/tst_qmlpainting.cpp | 6 +- tools/qdoc3/htmlgenerator.cpp | 4 +- tools/qmlviewer/qfxtester.cpp | 48 +- tools/qmlviewer/qfxtester.h | 32 +- tools/qmlviewer/qmlviewer.cpp | 2 +- tools/qmlviewer/qmlviewer.h | 6 +- 130 files changed, 4108 insertions(+), 4108 deletions(-) diff --git a/doc/src/declarative/measuring-performance.qdoc b/doc/src/declarative/measuring-performance.qdoc index 01e7b03..bd1b0eb 100644 --- a/doc/src/declarative/measuring-performance.qdoc +++ b/doc/src/declarative/measuring-performance.qdoc @@ -71,14 +71,14 @@ Q_DEFINE_PERFORMANCE_METRIC(TextSize, "Text Size Calculation"); You could then use this category in the code: \code -void QFxText::updateSize() +void QmlGraphicsText::updateSize() { - QFxPerfTimer perf; + QmlPerfTimer perf; ... } \endcode -Because there is no cost for a QFxPerfTimer when Q_ENABLE_PERFORMANCE_LOG is not defined, this line can persist in the code and be used to help detect performance bottlenecks and regressions. See the QPerformanceLog documentation for more information on this performance framework. +Because there is no cost for a QmlPerfTimer when Q_ENABLE_PERFORMANCE_LOG is not defined, this line can persist in the code and be used to help detect performance bottlenecks and regressions. See the QPerformanceLog documentation for more information on this performance framework. \section1 FPS Measurements diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc index 4c28255..6892005 100644 --- a/doc/src/declarative/qtprogrammers.qdoc +++ b/doc/src/declarative/qtprogrammers.qdoc @@ -84,14 +84,14 @@ QML Items also serve these purposes. Each is considered separately below. \section2 Simple Widgets -The most important rule to remember while implementing a new QFxItem in C++ +The most important rule to remember while implementing a new QmlGraphicsItem in C++ is that it should not contain any look and feel policies - leave that to the QML usage of the item. As an example, imagine you wanted a reusable Button item. If you therefore -decided to write a QFxItem subclass to implement a button, +decided to write a QmlGraphicsItem subclass to implement a button, just as QToolButton subclasses QWidget for this purpose, following the rule above, your -\c QFxButton would not have any appearance - just the notions of enabled, triggering, etc. +\c QmlGraphicsButton would not have any appearance - just the notions of enabled, triggering, etc. But there is already an object in Qt that does this: QAction. @@ -103,8 +103,8 @@ The look and feel of an action - the appearance of the button, the transition be and exactly how it respond to mouse, key, or touch input, should all be left for definition in QML. -It is illustrative to note that QFxTextEdit is built upon QTextControl, -QFxWebView is built upon QWebPage, and ListView uses QListModelInterface, +It is illustrative to note that QmlGraphicsTextEdit is built upon QTextControl, +QmlGraphicsWebView is built upon QWebPage, and ListView uses QListModelInterface, just as QTextEdit, QWebView, and QListView are built upon those same UI-agnostic components. diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/3rdparty/qlistmodelinterface.cpp index 4213ff2..b47ed8b 100644 --- a/src/declarative/3rdparty/qlistmodelinterface.cpp +++ b/src/declarative/3rdparty/qlistmodelinterface.cpp @@ -46,11 +46,11 @@ QT_BEGIN_NAMESPACE /*! \internal \class QListModelInterface - \brief The QListModelInterface class can be subclassed to provide C++ models to QFx Views + \brief The QListModelInterface class can be subclassed to provide C++ models to QmlGraphics Views This class is comprised primarily of pure virtual functions which you must implement in a subclass. You can then use the subclass - as a model for a QFx view, such as a QFxListView. + as a model for a QmlGraphics view, such as a QmlGraphicsListView. */ /*! \fn QListModelInterface::QListModelInterface(QObject *parent) diff --git a/src/declarative/extra/qfxanimatedimageitem.cpp b/src/declarative/extra/qfxanimatedimageitem.cpp index 5a491e0..8a6046e 100644 --- a/src/declarative/extra/qfxanimatedimageitem.cpp +++ b/src/declarative/extra/qfxanimatedimageitem.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE /*! - \class QFxAnimatedImageItem + \class QmlGraphicsAnimatedImageItem \internal */ @@ -77,21 +77,21 @@ Item { \endqml \endtable */ -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,AnimatedImage,QFxAnimatedImageItem) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,AnimatedImage,QmlGraphicsAnimatedImageItem) -QFxAnimatedImageItem::QFxAnimatedImageItem(QFxItem *parent) - : QFxImage(*(new QFxAnimatedImageItemPrivate), parent) +QmlGraphicsAnimatedImageItem::QmlGraphicsAnimatedImageItem(QmlGraphicsItem *parent) + : QmlGraphicsImage(*(new QmlGraphicsAnimatedImageItemPrivate), parent) { } -QFxAnimatedImageItem::QFxAnimatedImageItem(QFxAnimatedImageItemPrivate &dd, QFxItem *parent) - : QFxImage(dd, parent) +QmlGraphicsAnimatedImageItem::QmlGraphicsAnimatedImageItem(QmlGraphicsAnimatedImageItemPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsImage(dd, parent) { } -QFxAnimatedImageItem::~QFxAnimatedImageItem() +QmlGraphicsAnimatedImageItem::~QmlGraphicsAnimatedImageItem() { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); delete d->_movie; } @@ -101,17 +101,17 @@ QFxAnimatedImageItem::~QFxAnimatedImageItem() Defaults to false, and can be set to true when you want to pause. */ -bool QFxAnimatedImageItem::isPaused() const +bool QmlGraphicsAnimatedImageItem::isPaused() const { - Q_D(const QFxAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImageItem); if(!d->_movie) return false; return d->_movie->state()==QMovie::Paused; } -void QFxAnimatedImageItem::setPaused(bool pause) +void QmlGraphicsAnimatedImageItem::setPaused(bool pause) { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); if(pause == d->paused) return; d->paused = pause; @@ -125,17 +125,17 @@ void QFxAnimatedImageItem::setPaused(bool pause) Defaults to true, so as to start playing immediately. */ -bool QFxAnimatedImageItem::isPlaying() const +bool QmlGraphicsAnimatedImageItem::isPlaying() const { - Q_D(const QFxAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImageItem); if (!d->_movie) return false; return d->_movie->state()!=QMovie::NotRunning; } -void QFxAnimatedImageItem::setPlaying(bool play) +void QmlGraphicsAnimatedImageItem::setPlaying(bool play) { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); if(play == d->playing) return; d->playing = play; @@ -155,33 +155,33 @@ void QFxAnimatedImageItem::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 QFxAnimatedImageItem::currentFrame() const +int QmlGraphicsAnimatedImageItem::currentFrame() const { - Q_D(const QFxAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImageItem); if (!d->_movie) return -1; return d->_movie->currentFrameNumber(); } -void QFxAnimatedImageItem::setCurrentFrame(int frame) +void QmlGraphicsAnimatedImageItem::setCurrentFrame(int frame) { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); if (!d->_movie) return; d->_movie->jumpToFrame(frame); } -int QFxAnimatedImageItem::frameCount() const +int QmlGraphicsAnimatedImageItem::frameCount() const { - Q_D(const QFxAnimatedImageItem); + Q_D(const QmlGraphicsAnimatedImageItem); if (!d->_movie) return 0; return d->_movie->frameCount(); } -void QFxAnimatedImageItem::setSource(const QUrl &url) +void QmlGraphicsAnimatedImageItem::setSource(const QUrl &url) { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); if (url == d->url) return; @@ -209,9 +209,9 @@ void QFxAnimatedImageItem::setSource(const QUrl &url) emit statusChanged(d->status); } -void QFxAnimatedImageItem::movieRequestFinished() +void QmlGraphicsAnimatedImageItem::movieRequestFinished() { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); d->_movie = new QMovie(d->reply); if (!d->_movie->isValid()){ qWarning() << "Error Reading Animated Image File " << d->url; @@ -233,16 +233,16 @@ void QFxAnimatedImageItem::movieRequestFinished() setPixmap(d->_movie->currentPixmap()); } -void QFxAnimatedImageItem::movieUpdate() +void QmlGraphicsAnimatedImageItem::movieUpdate() { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); setPixmap(d->_movie->currentPixmap()); emit frameChanged(); } -void QFxAnimatedImageItem::playingStatusChanged() +void QmlGraphicsAnimatedImageItem::playingStatusChanged() { - Q_D(QFxAnimatedImageItem); + Q_D(QmlGraphicsAnimatedImageItem); if((d->_movie->state() != QMovie::NotRunning) != d->playing){ d->playing = (d->_movie->state() != QMovie::NotRunning); emit playingChanged(); diff --git a/src/declarative/extra/qfxanimatedimageitem.h b/src/declarative/extra/qfxanimatedimageitem.h index 4002a3f..782f920 100644 --- a/src/declarative/extra/qfxanimatedimageitem.h +++ b/src/declarative/extra/qfxanimatedimageitem.h @@ -51,9 +51,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QMovie; -class QFxAnimatedImageItemPrivate; +class QmlGraphicsAnimatedImageItemPrivate; -class Q_DECLARATIVE_EXPORT QFxAnimatedImageItem : public QFxImage +class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImageItem : public QmlGraphicsImage { Q_OBJECT @@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QFxAnimatedImageItem : public QFxImage Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged) Q_PROPERTY(int frameCount READ frameCount) public: - QFxAnimatedImageItem(QFxItem *parent=0); - ~QFxAnimatedImageItem(); + QmlGraphicsAnimatedImageItem(QmlGraphicsItem *parent=0); + ~QmlGraphicsAnimatedImageItem(); bool isPlaying() const; void setPlaying(bool play); @@ -76,7 +76,7 @@ public: int frameCount() const; - // Extends QFxImage's src property*/ + // Extends QmlGraphicsImage's src property*/ virtual void setSource(const QUrl&); Q_SIGNALS: @@ -90,16 +90,16 @@ private Q_SLOTS: void playingStatusChanged(); protected: - QFxAnimatedImageItem(QFxAnimatedImageItemPrivate &dd, QFxItem *parent); + QmlGraphicsAnimatedImageItem(QmlGraphicsAnimatedImageItemPrivate &dd, QmlGraphicsItem *parent); private: - Q_DISABLE_COPY(QFxAnimatedImageItem) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxAnimatedImageItem) + Q_DISABLE_COPY(QmlGraphicsAnimatedImageItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsAnimatedImageItem) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxAnimatedImageItem) +QML_DECLARE_TYPE(QmlGraphicsAnimatedImageItem) QT_END_HEADER diff --git a/src/declarative/extra/qfxanimatedimageitem_p.h b/src/declarative/extra/qfxanimatedimageitem_p.h index 56252ca..e61c488 100644 --- a/src/declarative/extra/qfxanimatedimageitem_p.h +++ b/src/declarative/extra/qfxanimatedimageitem_p.h @@ -60,12 +60,12 @@ QT_BEGIN_NAMESPACE class QMovie; class QNetworkReply; -class QFxAnimatedImageItemPrivate : public QFxImagePrivate +class QmlGraphicsAnimatedImageItemPrivate : public QmlGraphicsImagePrivate { - Q_DECLARE_PUBLIC(QFxAnimatedImageItem) + Q_DECLARE_PUBLIC(QmlGraphicsAnimatedImageItem) public: - QFxAnimatedImageItemPrivate() + QmlGraphicsAnimatedImageItemPrivate() : playing(true), paused(false), _movie(0), reply(0) { } diff --git a/src/declarative/extra/qfxintegermodel.cpp b/src/declarative/extra/qfxintegermodel.cpp index 3cd46d7..496cd3e 100644 --- a/src/declarative/extra/qfxintegermodel.cpp +++ b/src/declarative/extra/qfxintegermodel.cpp @@ -43,53 +43,53 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,IntegerModel,QFxIntegerModel) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,IntegerModel,QmlGraphicsIntegerModel) -class QFxIntegerModelPrivate +class QmlGraphicsIntegerModelPrivate { public: - QFxIntegerModelPrivate() : minimum(0), maximum(0) {} + QmlGraphicsIntegerModelPrivate() : minimum(0), maximum(0) {} int minimum; int maximum; }; -QFxIntegerModel::QFxIntegerModel(QObject *parent) +QmlGraphicsIntegerModel::QmlGraphicsIntegerModel(QObject *parent) : QListModelInterface(parent) { - d = new QFxIntegerModelPrivate; + d = new QmlGraphicsIntegerModelPrivate; } -QFxIntegerModel::~QFxIntegerModel() +QmlGraphicsIntegerModel::~QmlGraphicsIntegerModel() { delete d; } -int QFxIntegerModel::minimum() const +int QmlGraphicsIntegerModel::minimum() const { return d->minimum; } -void QFxIntegerModel::setMinimum(int minimum) +void QmlGraphicsIntegerModel::setMinimum(int minimum) { d->minimum = minimum; } -int QFxIntegerModel::maximum() const +int QmlGraphicsIntegerModel::maximum() const { return d->maximum; } -void QFxIntegerModel::setMaximum(int maximum) +void QmlGraphicsIntegerModel::setMaximum(int maximum) { d->maximum = maximum; } -int QFxIntegerModel::count() const +int QmlGraphicsIntegerModel::count() const { return qMax(0, d->maximum - d->minimum + 1); } -QHash QFxIntegerModel::data(int index, const QList &roles) const +QHash QmlGraphicsIntegerModel::data(int index, const QList &roles) const { QHash returnHash; @@ -108,7 +108,7 @@ QHash QFxIntegerModel::data(int index, const QList &roles) co return returnHash; } -QString QFxIntegerModel::toString(int role) const +QString QmlGraphicsIntegerModel::toString(int role) const { switch(role) { case Qt::DisplayRole: @@ -118,7 +118,7 @@ QString QFxIntegerModel::toString(int role) const } } -QList QFxIntegerModel::roles() const +QList QmlGraphicsIntegerModel::roles() const { return QList() << Qt::DisplayRole; } diff --git a/src/declarative/extra/qfxintegermodel.h b/src/declarative/extra/qfxintegermodel.h index 7fced2c..cf69bdc 100644 --- a/src/declarative/extra/qfxintegermodel.h +++ b/src/declarative/extra/qfxintegermodel.h @@ -52,13 +52,13 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxIntegerModelPrivate; -class Q_DECLARATIVE_EXPORT QFxIntegerModel : public QListModelInterface +class QmlGraphicsIntegerModelPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsIntegerModel : public QListModelInterface { Q_OBJECT public: - QFxIntegerModel(QObject *parent=0); - ~QFxIntegerModel(); + QmlGraphicsIntegerModel(QObject *parent=0); + ~QmlGraphicsIntegerModel(); Q_PROPERTY(int minimum READ minimum WRITE setMinimum) int minimum() const; @@ -74,12 +74,12 @@ public: QString toString(int role) const; private: - QFxIntegerModelPrivate *d; + QmlGraphicsIntegerModelPrivate *d; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxIntegerModel) +QML_DECLARE_TYPE(QmlGraphicsIntegerModel) QT_END_HEADER diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index 80255b9..0bb4826 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -81,10 +81,10 @@ inline qreal fastCos(qreal theta) return fastSin(theta); } -class QFxParticle +class QmlGraphicsParticle { public: - QFxParticle(int time) : lifeSpan(1000), fadeOutAge(800) + QmlGraphicsParticle(int time) : lifeSpan(1000), fadeOutAge(800) , opacity(0), birthTime(time), x_velocity(0), y_velocity(0) , state(FadeIn), data(0) { @@ -105,21 +105,21 @@ public: //--------------------------------------------------------------------------- -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotion,QFxParticleMotion) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotion,QmlGraphicsParticleMotion) /*! - \class QFxParticleMotion + \class QmlGraphicsParticleMotion \ingroup group_effects - \brief The QFxParticleMotion class is the base class for particle motion. + \brief The QmlGraphicsParticleMotion class is the base class for particle motion. \internal This class causes the particles to remain static. */ /*! - Constructs a QFxParticleMotion with parent object \a parent. + Constructs a QmlGraphicsParticleMotion with parent object \a parent. */ -QFxParticleMotion::QFxParticleMotion(QObject *parent) : +QmlGraphicsParticleMotion::QmlGraphicsParticleMotion(QObject *parent) : QObject(parent) { } @@ -128,7 +128,7 @@ QFxParticleMotion::QFxParticleMotion(QObject *parent) : Move the \a particle to its new position. \a interval is the number of milliseconds elapsed since it was last moved. */ -void QFxParticleMotion::advance(QFxParticle &particle, int interval) +void QmlGraphicsParticleMotion::advance(QmlGraphicsParticle &particle, int interval) { Q_UNUSED(particle); Q_UNUSED(interval); @@ -138,7 +138,7 @@ void QFxParticleMotion::advance(QFxParticle &particle, int interval) The \a particle has just been created. Some motion strategies require additional state information. This can be allocated by this function. */ -void QFxParticleMotion::created(QFxParticle &particle) +void QmlGraphicsParticleMotion::created(QmlGraphicsParticle &particle) { Q_UNUSED(particle); } @@ -147,7 +147,7 @@ void QFxParticleMotion::created(QFxParticle &particle) The \a particle is about to be destroyed. Any additional memory that has been allocated for the particle should be freed. */ -void QFxParticleMotion::destroy(QFxParticle &particle) +void QmlGraphicsParticleMotion::destroy(QmlGraphicsParticle &particle) { Q_UNUSED(particle); } @@ -161,14 +161,14 @@ void QFxParticleMotion::destroy(QFxParticle &particle) /*! \internal - \class QFxParticleMotionLinear + \class QmlGraphicsParticleMotionLinear \ingroup group_effects - \brief The QFxParticleMotionLinear class moves the particles linearly. + \brief The QmlGraphicsParticleMotionLinear class moves the particles linearly. */ -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotionLinear,QFxParticleMotionLinear) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotionLinear,QmlGraphicsParticleMotionLinear) -void QFxParticleMotionLinear::advance(QFxParticle &p, int interval) +void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interval) { p.x += interval * p.x_velocity; p.y += interval * p.y_velocity; @@ -183,12 +183,12 @@ void QFxParticleMotionLinear::advance(QFxParticle &p, int interval) /*! \internal - \class QFxParticleMotionGravity + \class QmlGraphicsParticleMotionGravity \ingroup group_effects - \brief The QFxParticleMotionGravity class moves the particles towards a point. + \brief The QmlGraphicsParticleMotionGravity class moves the particles towards a point. */ -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotionGravity,QFxParticleMotionGravity) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotionGravity,QmlGraphicsParticleMotionGravity) /*! \qmlproperty int ParticleMotionGravity::xattractor @@ -202,21 +202,21 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotionGravity,QFxParticl */ /*! - \property QFxParticleMotionGravity::xattractor + \property QmlGraphicsParticleMotionGravity::xattractor \brief the x coordinate of the point attracting the particles. */ /*! - \property QFxParticleMotionGravity::yattractor + \property QmlGraphicsParticleMotionGravity::yattractor \brief the y coordinate of the point attracting the particles. */ /*! - \property QFxParticleMotionGravity::acceleration + \property QmlGraphicsParticleMotionGravity::acceleration \brief the acceleration to apply to the particles. */ -void QFxParticleMotionGravity::advance(QFxParticle &p, int interval) +void QmlGraphicsParticleMotionGravity::advance(QmlGraphicsParticle &p, int interval) { qreal xdiff = p.x - _xAttr; qreal ydiff = p.y - _yAttr; @@ -270,32 +270,32 @@ Rectangle { /*! \internal - \class QFxParticleMotionWander + \class QmlGraphicsParticleMotionWander \ingroup group_effects - \brief The QFxParticleMotionWander class moves particles in a somewhat random fashion. + \brief The QmlGraphicsParticleMotionWander class moves particles in a somewhat random fashion. The particles will continue roughly in the original direction, however will randomly drift to each side. */ /*! - \qmlproperty int QFxParticleMotionWander::xvariance - \qmlproperty int QFxParticleMotionWander::yvariance + \qmlproperty int QmlGraphicsParticleMotionWander::xvariance + \qmlproperty int QmlGraphicsParticleMotionWander::yvariance These properties set the amount to wander in the x and y directions. */ /*! - \qmlproperty int QFxParticleMotionWander::pace + \qmlproperty int QmlGraphicsParticleMotionWander::pace This property holds how quickly the paricles will move from side to side. */ -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotionWander,QFxParticleMotionWander) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotionWander,QmlGraphicsParticleMotionWander) -void QFxParticleMotionWander::advance(QFxParticle &p, int interval) +void QmlGraphicsParticleMotionWander::advance(QmlGraphicsParticle &p, int interval) { if (!particles) - particles = qobject_cast(parent()); + particles = qobject_cast(parent()); if (particles) { Data *d = (Data*)p.data; if (_xvariance != 0.) { @@ -320,7 +320,7 @@ void QFxParticleMotionWander::advance(QFxParticle &p, int interval) } } -void QFxParticleMotionWander::created(QFxParticle &p) +void QmlGraphicsParticleMotionWander::created(QmlGraphicsParticle &p) { if (!p.data) { Data *d = new Data; @@ -334,18 +334,18 @@ void QFxParticleMotionWander::created(QFxParticle &p) } } -void QFxParticleMotionWander::destroy(QFxParticle &p) +void QmlGraphicsParticleMotionWander::destroy(QmlGraphicsParticle &p) { if (p.data) delete (Data*)p.data; } //--------------------------------------------------------------------------- -class QFxParticlesPainter : public QFxItem +class QmlGraphicsParticlesPainter : public QmlGraphicsItem { public: - QFxParticlesPainter(QFxParticlesPrivate *p, QFxItem* parent) - : QFxItem(parent), d(p) + QmlGraphicsParticlesPainter(QmlGraphicsParticlesPrivate *p, QmlGraphicsItem* parent) + : QmlGraphicsItem(parent), d(p) { setFlag(QGraphicsItem::ItemHasNoContents, false); maxX = minX = maxY = minY = 0; @@ -359,15 +359,15 @@ public: qreal minX; qreal maxY; qreal minY; - QFxParticlesPrivate* d; + QmlGraphicsParticlesPrivate* d; }; //--------------------------------------------------------------------------- -class QFxParticlesPrivate : public QFxItemPrivate +class QmlGraphicsParticlesPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxParticles) + Q_DECLARE_PUBLIC(QmlGraphicsParticles) public: - QFxParticlesPrivate() + QmlGraphicsParticlesPrivate() : count(1), lifeSpan(1000), lifeSpanDev(1000), fadeInDur(200), fadeOutDur(300) , angle(0), angleDev(0), velocity(0), velocityDev(0) , addParticleTime(0), addParticleCount(0), lastAdvTime(0), stream(false), streamDelay(0) @@ -375,19 +375,19 @@ public: { } - ~QFxParticlesPrivate() + ~QmlGraphicsParticlesPrivate() { } void init() { - Q_Q(QFxParticles); - paintItem = new QFxParticlesPainter(this, q); + Q_Q(QmlGraphicsParticles); + paintItem = new QmlGraphicsParticlesPainter(this, q); } void tick(int time); void createParticle(int time); - void updateOpacity(QFxParticle &p, int age); + void updateOpacity(QmlGraphicsParticle &p, int age); QUrl url; QPixmap image; @@ -406,30 +406,30 @@ public: bool stream; int streamDelay; bool emitting; - QFxParticleMotion *motion; - QFxParticlesPainter *paintItem; + QmlGraphicsParticleMotion *motion; + QmlGraphicsParticlesPainter *paintItem; bool pendingPixmapCache; - QList particles; - QTickAnimationProxy clock; + QList particles; + QTickAnimationProxy clock; }; -void QFxParticlesPrivate::tick(int time) +void QmlGraphicsParticlesPrivate::tick(int time) { - Q_Q(QFxParticles); + Q_Q(QmlGraphicsParticles); if (!motion) - motion = new QFxParticleMotionLinear(q); + motion = new QmlGraphicsParticleMotionLinear(q); int oldCount = particles.count(); int removed = 0; int interval = time - lastAdvTime; for (int i = 0; i < particles.count(); ) { - QFxParticle &particle = particles[i]; + QmlGraphicsParticle &particle = particles[i]; int age = time - particle.birthTime; if (age >= particle.lifeSpan) { - QFxParticle part = particles.takeAt(i); + QmlGraphicsParticle part = particles.takeAt(i); motion->destroy(part); ++removed; } else { @@ -478,13 +478,13 @@ void QFxParticlesPrivate::tick(int time) } } -void QFxParticlesPrivate::createParticle(int time) +void QmlGraphicsParticlesPrivate::createParticle(int time) { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer x; + QmlPerfTimer x; #endif - Q_Q(QFxParticles); - QFxParticle p(time); + Q_Q(QmlGraphicsParticles); + QmlGraphicsParticle p(time); p.x = q->x() + q->width() * qreal(rand()) / RAND_MAX - image.width()/2.0; p.y = q->y() + q->height() * qreal(rand()) / RAND_MAX - image.height()/2.0; p.lifeSpan = lifeSpan; @@ -492,7 +492,7 @@ void QFxParticlesPrivate::createParticle(int time) p.lifeSpan += int(lifeSpanDev/2 - lifeSpanDev * qreal(rand()) / RAND_MAX); p.fadeOutAge = p.lifeSpan - fadeOutDur; if (fadeInDur == 0.) { - p.state= QFxParticle::Solid; + p.state= QmlGraphicsParticle::Solid; p.opacity = 1.0; } qreal a = angle; @@ -509,32 +509,32 @@ void QFxParticlesPrivate::createParticle(int time) motion->created(particles.last()); } -void QFxParticlesPrivate::updateOpacity(QFxParticle &p, int age) +void QmlGraphicsParticlesPrivate::updateOpacity(QmlGraphicsParticle &p, int age) { switch (p.state) { - case QFxParticle::FadeIn: + case QmlGraphicsParticle::FadeIn: if (age <= fadeInDur) { p.opacity = qreal(age) / fadeInDur; break; } else { p.opacity = 1.0; - p.state = QFxParticle::Solid; + p.state = QmlGraphicsParticle::Solid; // Fall through } - case QFxParticle::Solid: + case QmlGraphicsParticle::Solid: if (age <= p.fadeOutAge) { break; } else { - p.state = QFxParticle::FadeOut; + p.state = QmlGraphicsParticle::FadeOut; // Fall through } - case QFxParticle::FadeOut: + case QmlGraphicsParticle::FadeOut: p.opacity = qreal(p.lifeSpan - age) / fadeOutDur; break; } } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Particles,QFxParticles) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Particles,QmlGraphicsParticles) /*! \qmlclass Particles @@ -596,30 +596,30 @@ Rectangle { /*! \internal - \class QFxParticles + \class QmlGraphicsParticles \ingroup group_effects - \brief The QFxParticles class generates and moves particles. + \brief The QmlGraphicsParticles class generates and moves particles. */ -QFxParticles::QFxParticles(QFxItem *parent) - : QFxItem(*(new QFxParticlesPrivate), parent) +QmlGraphicsParticles::QmlGraphicsParticles(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsParticlesPrivate), parent) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->init(); } -QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsParticles::QmlGraphicsParticles(QmlGraphicsParticlesPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->init(); } -QFxParticles::~QFxParticles() +QmlGraphicsParticles::~QmlGraphicsParticles() { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); if (d->pendingPixmapCache) - QFxPixmapCache::cancelGet(d->url, this); + QmlGraphicsPixmapCache::cancelGet(d->url, this); } /*! @@ -628,33 +628,33 @@ QFxParticles::~QFxParticles() */ /*! - \property QFxParticles::source + \property QmlGraphicsParticles::source \brief the URL of the particle image. */ -QUrl QFxParticles::source() const +QUrl QmlGraphicsParticles::source() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->url; } -void QFxParticles::imageLoaded() +void QmlGraphicsParticles::imageLoaded() { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->pendingPixmapCache = false; - QFxPixmapCache::find(d->url, &d->image); + QmlGraphicsPixmapCache::find(d->url, &d->image); d->paintItem->updateSize(); d->paintItem->update(); } -void QFxParticles::setSource(const QUrl &name) +void QmlGraphicsParticles::setSource(const QUrl &name) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); if ((d->url.isEmpty() == name.isEmpty()) && name == d->url) return; if (d->pendingPixmapCache) { - QFxPixmapCache::cancelGet(d->url, this); + QmlGraphicsPixmapCache::cancelGet(d->url, this); d->pendingPixmapCache = false; } if (name.isEmpty()) { @@ -665,7 +665,7 @@ void QFxParticles::setSource(const QUrl &name) } else { d->url = name; Q_ASSERT(!name.isRelative()); - QNetworkReply *reply = QFxPixmapCache::get(qmlEngine(this), d->url, &d->image); + QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->url, &d->image); if (reply) { connect(reply, SIGNAL(finished()), this, SLOT(imageLoaded())); d->pendingPixmapCache = true; @@ -683,18 +683,18 @@ void QFxParticles::setSource(const QUrl &name) */ /*! - \property QFxParticles::count + \property QmlGraphicsParticles::count \brief the target number of particles */ -int QFxParticles::count() const +int QmlGraphicsParticles::count() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->count; } -void QFxParticles::setCount(int cnt) +void QmlGraphicsParticles::setCount(int cnt) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); if (cnt == d->count) return; @@ -731,27 +731,27 @@ Particles { */ /*! - \property QFxParticles::lifeSpan + \property QmlGraphicsParticles::lifeSpan \brief the life span of each particle. Default value is 1000ms. - \sa QFxParticles::lifeSpanDeviation + \sa QmlGraphicsParticles::lifeSpanDeviation */ -int QFxParticles::lifeSpan() const +int QmlGraphicsParticles::lifeSpan() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->lifeSpan; } -void QFxParticles::setLifeSpan(int ls) +void QmlGraphicsParticles::setLifeSpan(int ls) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->lifeSpan = ls; } /*! - \property QFxParticles::lifeSpanDeviation + \property QmlGraphicsParticles::lifeSpanDeviation \brief the maximum possible deviation from the set lifeSpan. Randomly varies the lifeSpan up to the specified variation. For @@ -766,17 +766,17 @@ Particles { } \endqml - \sa QFxParticles::lifeSpan + \sa QmlGraphicsParticles::lifeSpan */ -int QFxParticles::lifeSpanDeviation() const +int QmlGraphicsParticles::lifeSpanDeviation() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->lifeSpanDev; } -void QFxParticles::setLifeSpanDeviation(int dev) +void QmlGraphicsParticles::setLifeSpanDeviation(int dev) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->lifeSpanDev = dev; } @@ -789,39 +789,39 @@ void QFxParticles::setLifeSpanDeviation(int dev) */ /*! - \property QFxParticles::fadeInDuration + \property QmlGraphicsParticles::fadeInDuration \brief the time taken to fade in the particles. Default value is 200ms. */ -int QFxParticles::fadeInDuration() const +int QmlGraphicsParticles::fadeInDuration() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->fadeInDur; } -void QFxParticles::setFadeInDuration(int dur) +void QmlGraphicsParticles::setFadeInDuration(int dur) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); if (dur >= 0.0) d->fadeInDur = dur; } /*! - \property QFxParticles::fadeOutDuration + \property QmlGraphicsParticles::fadeOutDuration \brief the time taken to fade out the particles. Default value is 300ms. */ -int QFxParticles::fadeOutDuration() const +int QmlGraphicsParticles::fadeOutDuration() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->fadeOutDur; } -void QFxParticles::setFadeOutDuration(int dur) +void QmlGraphicsParticles::setFadeOutDuration(int dur) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); if (dur >= 0.0) d->fadeOutDur = dur; } @@ -846,25 +846,25 @@ Particles { */ /*! - \property QFxParticles::angle + \property QmlGraphicsParticles::angle \brief the initial angle of direction. - \sa QFxParticles::angleDeviation + \sa QmlGraphicsParticles::angleDeviation */ -qreal QFxParticles::angle() const +qreal QmlGraphicsParticles::angle() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->angle * 180.0 / M_PI; } -void QFxParticles::setAngle(qreal angle) +void QmlGraphicsParticles::setAngle(qreal angle) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->angle = angle * M_PI / 180.0; } /*! - \property QFxParticles::angleDeviation + \property QmlGraphicsParticles::angleDeviation \brief the maximum possible deviation from the set angle. Randomly varies the direction up to the specified variation. For @@ -879,17 +879,17 @@ Particles { } \endqml - \sa QFxParticles::angle + \sa QmlGraphicsParticles::angle */ -qreal QFxParticles::angleDeviation() const +qreal QmlGraphicsParticles::angleDeviation() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->angleDev * 180.0 / M_PI; } -void QFxParticles::setAngleDeviation(qreal dev) +void QmlGraphicsParticles::setAngleDeviation(qreal dev) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->angleDev = dev * M_PI / 180.0;; } @@ -913,25 +913,25 @@ Particles { */ /*! - \property QFxParticles::velocity + \property QmlGraphicsParticles::velocity \brief the initial velocity of the particles. - \sa QFxParticles::velocityDeviation + \sa QmlGraphicsParticles::velocityDeviation */ -qreal QFxParticles::velocity() const +qreal QmlGraphicsParticles::velocity() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->velocity * 1000.0; } -void QFxParticles::setVelocity(qreal velocity) +void QmlGraphicsParticles::setVelocity(qreal velocity) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->velocity = velocity / 1000.0; } /*! - \property QFxParticles::velocityDeviation + \property QmlGraphicsParticles::velocityDeviation \brief the maximum possible deviation from the set velocity. Randomly varies the velocity up to the specified variation. For @@ -946,17 +946,17 @@ Particles { } \endqml - \sa QFxParticles::velocity + \sa QmlGraphicsParticles::velocity */ -qreal QFxParticles::velocityDeviation() const +qreal QmlGraphicsParticles::velocityDeviation() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->velocityDev * 1000.0; } -void QFxParticles::setVelocityDeviation(qreal velocity) +void QmlGraphicsParticles::setVelocityDeviation(qreal velocity) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->velocityDev = velocity / 1000.0; } @@ -970,7 +970,7 @@ void QFxParticles::setVelocityDeviation(qreal velocity) particles to unclump over time. */ /*! - \property QFxParticles::streamIn + \property QmlGraphicsParticles::streamIn \brief determines whether the particles stream in at a constant rate When stream is set to true the particles will stream in at a constant rate. @@ -979,15 +979,15 @@ void QFxParticles::setVelocityDeviation(qreal velocity) */ //The name may need a rethink -bool QFxParticles::streamIn() const +bool QmlGraphicsParticles::streamIn() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->stream; } -void QFxParticles::setStreamIn(bool b) +void QmlGraphicsParticles::setStreamIn(bool b) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->stream = b; } @@ -1003,7 +1003,7 @@ void QFxParticles::setStreamIn(bool b) will be produced until it is set to true. */ /*! - \property QFxParticles::emitting + \property QmlGraphicsParticles::emitting If emitting is set to false no new particles will be created. This means that when a particle reaches the end of its lifespan it is not replaced. This property can be used to turn particles on and off with a more natural look. @@ -1011,15 +1011,15 @@ void QFxParticles::setStreamIn(bool b) The default setting is true. Note that if it initialized to false no particles will be produced until it is set to true. */ -bool QFxParticles::emitting() const +bool QmlGraphicsParticles::emitting() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->emitting; } -void QFxParticles::setEmitting(bool r) +void QmlGraphicsParticles::setEmitting(bool r) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->emitting = r; if (d->count && r) d->clock.start(); @@ -1036,28 +1036,28 @@ void QFxParticles::setEmitting(bool r) */ /*! - \property QFxParticles::motion + \property QmlGraphicsParticles::motion \brief sets the type of motion to apply to the particles. When a particle is created it will have an initial direction and velocity. The motion of the particle during its lifeSpan is then influenced by the motion property. - Default motion is QFxParticleMotionLinear. + Default motion is QmlGraphicsParticleMotionLinear. */ -QFxParticleMotion *QFxParticles::motion() const +QmlGraphicsParticleMotion *QmlGraphicsParticles::motion() const { - Q_D(const QFxParticles); + Q_D(const QmlGraphicsParticles); return d->motion; } -void QFxParticles::setMotion(QFxParticleMotion *motion) +void QmlGraphicsParticles::setMotion(QmlGraphicsParticleMotion *motion) { - Q_D(QFxParticles); + Q_D(QmlGraphicsParticles); d->motion = motion; } -void QFxParticlesPainter::updateSize() +void QmlGraphicsParticlesPainter::updateSize() { if (!isComponentComplete()) return; @@ -1065,7 +1065,7 @@ void QFxParticlesPainter::updateSize() const int parentX = parentItem()->x(); const int parentY = parentItem()->y(); for (int i = 0; i < d->particles.count(); ++i) { - const QFxParticle &particle = d->particles.at(i); + const QmlGraphicsParticle &particle = d->particles.at(i); if(particle.x > maxX) maxX = particle.x; if(particle.x < minX) @@ -1086,13 +1086,13 @@ void QFxParticlesPainter::updateSize() setY(myY); } -void QFxParticles::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsParticles::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_UNUSED(p); //painting is done by the ParticlesPainter, so it can have the right size } -void QFxParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { if (d->image.isNull() || d->particles.isEmpty()) return; @@ -1106,7 +1106,7 @@ void QFxParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, Q const QRectF sourceRect = d->image.rect(); for (int i = 0; i < d->particles.count(); ++i) { - const QFxParticle &particle = d->particles.at(i); + const QmlGraphicsParticle &particle = d->particles.at(i); pixmapData[i].point = QPointF(particle.x - myX, particle.y - myY); pixmapData[i].opacity = particle.opacity; @@ -1119,10 +1119,10 @@ void QFxParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, Q qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image); } -void QFxParticles::componentComplete() +void QmlGraphicsParticles::componentComplete() { - Q_D(QFxParticles); - QFxItem::componentComplete(); + Q_D(QmlGraphicsParticles); + QmlGraphicsItem::componentComplete(); if (d->count) { d->paintItem->updateSize(); d->clock.start(); diff --git a/src/declarative/extra/qfxparticles.h b/src/declarative/extra/qfxparticles.h index 959c518..5e5a581 100644 --- a/src/declarative/extra/qfxparticles.h +++ b/src/declarative/extra/qfxparticles.h @@ -50,30 +50,30 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxParticle; -class QFxParticles; -class Q_DECLARATIVE_EXPORT QFxParticleMotion : public QObject +class QmlGraphicsParticle; +class QmlGraphicsParticles; +class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotion : public QObject { Q_OBJECT public: - QFxParticleMotion(QObject *parent=0); + QmlGraphicsParticleMotion(QObject *parent=0); - virtual void advance(QFxParticle &, int interval); - virtual void created(QFxParticle &); - virtual void destroy(QFxParticle &); + virtual void advance(QmlGraphicsParticle &, int interval); + virtual void created(QmlGraphicsParticle &); + virtual void destroy(QmlGraphicsParticle &); }; -class Q_DECLARATIVE_EXPORT QFxParticleMotionLinear : public QFxParticleMotion +class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionLinear : public QmlGraphicsParticleMotion { Q_OBJECT public: - QFxParticleMotionLinear(QObject *parent=0) - : QFxParticleMotion(parent) {} + QmlGraphicsParticleMotionLinear(QObject *parent=0) + : QmlGraphicsParticleMotion(parent) {} - virtual void advance(QFxParticle &, int interval); + virtual void advance(QmlGraphicsParticle &, int interval); }; -class Q_DECLARATIVE_EXPORT QFxParticleMotionGravity : public QFxParticleMotion +class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionGravity : public QmlGraphicsParticleMotion { Q_OBJECT @@ -81,8 +81,8 @@ class Q_DECLARATIVE_EXPORT QFxParticleMotionGravity : public QFxParticleMotion Q_PROPERTY(int yattractor READ yAttractor WRITE setYAttractor) Q_PROPERTY(int acceleration READ acceleration WRITE setAcceleration) public: - QFxParticleMotionGravity(QObject *parent=0) - : QFxParticleMotion(parent), _xAttr(0), _yAttr(0), _accel(0.00005) {} + QmlGraphicsParticleMotionGravity(QObject *parent=0) + : QmlGraphicsParticleMotion(parent), _xAttr(0), _yAttr(0), _accel(0.00005) {} int xAttractor() const { return _xAttr; } void setXAttractor(int x) { _xAttr = x; } @@ -93,7 +93,7 @@ public: int acceleration() const { return int(_accel * 1000000); } void setAcceleration(int accel) { _accel = qreal(accel)/1000000.0; } - virtual void advance(QFxParticle &, int interval); + virtual void advance(QmlGraphicsParticle &, int interval); private: int _xAttr; @@ -101,16 +101,16 @@ private: qreal _accel; }; -class Q_DECLARATIVE_EXPORT QFxParticleMotionWander : public QFxParticleMotion +class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionWander : public QmlGraphicsParticleMotion { Q_OBJECT public: - QFxParticleMotionWander() - : QFxParticleMotion(), particles(0), _xvariance(0), _yvariance(0) {} + QmlGraphicsParticleMotionWander() + : QmlGraphicsParticleMotion(), particles(0), _xvariance(0), _yvariance(0) {} - virtual void advance(QFxParticle &, int interval); - virtual void created(QFxParticle &); - virtual void destroy(QFxParticle &); + virtual void advance(QmlGraphicsParticle &, int interval); + virtual void created(QmlGraphicsParticle &); + virtual void destroy(QmlGraphicsParticle &); struct Data { qreal x_targetV; @@ -134,14 +134,14 @@ public: void setPace(int pace) { _pace = pace / 1000.0; } private: - QFxParticles *particles; + QmlGraphicsParticles *particles; qreal _xvariance; qreal _yvariance; qreal _pace; }; -class QFxParticlesPrivate; -class Q_DECLARATIVE_EXPORT QFxParticles : public QFxItem +class QmlGraphicsParticlesPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsParticles : public QmlGraphicsItem { Q_OBJECT @@ -157,12 +157,12 @@ class Q_DECLARATIVE_EXPORT QFxParticles : public QFxItem Q_PROPERTY(qreal velocityDeviation READ velocityDeviation WRITE setVelocityDeviation) Q_PROPERTY(bool streamIn READ streamIn WRITE setStreamIn) Q_PROPERTY(bool emitting READ emitting WRITE setEmitting) - Q_PROPERTY(QFxParticleMotion *motion READ motion WRITE setMotion) + Q_PROPERTY(QmlGraphicsParticleMotion *motion READ motion WRITE setMotion) Q_CLASSINFO("DefaultProperty", "motion") public: - QFxParticles(QFxItem *parent=0); - ~QFxParticles(); + QmlGraphicsParticles(QmlGraphicsItem *parent=0); + ~QmlGraphicsParticles(); QUrl source() const; void setSource(const QUrl &); @@ -200,30 +200,30 @@ public: bool emitting() const; void setEmitting(bool); - QFxParticleMotion *motion() const; - void setMotion(QFxParticleMotion *); + QmlGraphicsParticleMotion *motion() const; + void setMotion(QmlGraphicsParticleMotion *); void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); protected: virtual void componentComplete(); - QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent); + QmlGraphicsParticles(QmlGraphicsParticlesPrivate &dd, QmlGraphicsItem *parent); private Q_SLOTS: void imageLoaded(); private: - Q_DISABLE_COPY(QFxParticles) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxParticles) + Q_DISABLE_COPY(QmlGraphicsParticles) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsParticles) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxParticleMotion) -QML_DECLARE_TYPE(QFxParticleMotionLinear) -QML_DECLARE_TYPE(QFxParticleMotionGravity) -QML_DECLARE_TYPE(QFxParticleMotionWander) -QML_DECLARE_TYPE(QFxParticles) +QML_DECLARE_TYPE(QmlGraphicsParticleMotion) +QML_DECLARE_TYPE(QmlGraphicsParticleMotionLinear) +QML_DECLARE_TYPE(QmlGraphicsParticleMotionGravity) +QML_DECLARE_TYPE(QmlGraphicsParticleMotionWander) +QML_DECLARE_TYPE(QmlGraphicsParticles) QT_END_HEADER diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 8d4a8b8..3908520 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -47,36 +47,36 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Anchors,QFxAnchors) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Anchors,QmlGraphicsAnchors) //TODO: should we cache relationships, so we don't have to check each time (parent-child or sibling)? //TODO: support non-parent, non-sibling (need to find lowest common ancestor) //### const item? //local position -static qreal position(QFxItem *item, QFxAnchorLine::AnchorLine anchorLine) +static qreal position(QmlGraphicsItem *item, QmlGraphicsAnchorLine::AnchorLine anchorLine) { qreal ret = 0.0; switch(anchorLine) { - case QFxAnchorLine::Left: + case QmlGraphicsAnchorLine::Left: ret = item->x(); break; - case QFxAnchorLine::Right: + case QmlGraphicsAnchorLine::Right: ret = item->x() + item->width(); break; - case QFxAnchorLine::Top: + case QmlGraphicsAnchorLine::Top: ret = item->y(); break; - case QFxAnchorLine::Bottom: + case QmlGraphicsAnchorLine::Bottom: ret = item->y() + item->height(); break; - case QFxAnchorLine::HCenter: + case QmlGraphicsAnchorLine::HCenter: ret = item->x() + item->width()/2; break; - case QFxAnchorLine::VCenter: + case QmlGraphicsAnchorLine::VCenter: ret = item->y() + item->height()/2; break; - case QFxAnchorLine::Baseline: + case QmlGraphicsAnchorLine::Baseline: ret = item->y() + item->baselineOffset(); break; default: @@ -87,29 +87,29 @@ static qreal position(QFxItem *item, QFxAnchorLine::AnchorLine anchorLine) } //position when origin is 0,0 -static qreal adjustedPosition(QFxItem *item, QFxAnchorLine::AnchorLine anchorLine) +static qreal adjustedPosition(QmlGraphicsItem *item, QmlGraphicsAnchorLine::AnchorLine anchorLine) { int ret = 0; switch(anchorLine) { - case QFxAnchorLine::Left: + case QmlGraphicsAnchorLine::Left: ret = 0; break; - case QFxAnchorLine::Right: + case QmlGraphicsAnchorLine::Right: ret = item->width(); break; - case QFxAnchorLine::Top: + case QmlGraphicsAnchorLine::Top: ret = 0; break; - case QFxAnchorLine::Bottom: + case QmlGraphicsAnchorLine::Bottom: ret = item->height(); break; - case QFxAnchorLine::HCenter: + case QmlGraphicsAnchorLine::HCenter: ret = item->width()/2; break; - case QFxAnchorLine::VCenter: + case QmlGraphicsAnchorLine::VCenter: ret = item->height()/2; break; - case QFxAnchorLine::Baseline: + case QmlGraphicsAnchorLine::Baseline: ret = item->baselineOffset(); break; default: @@ -121,21 +121,21 @@ static qreal adjustedPosition(QFxItem *item, QFxAnchorLine::AnchorLine anchorLin /*! \internal - \class QFxAnchors + \class QmlGraphicsAnchors \ingroup group_layouts - \brief The QFxAnchors class provides a way to lay out items relative to other items. + \brief The QmlGraphicsAnchors class provides a way to lay out items relative to other items. \warning Currently, only anchoring to siblings or parent is supported. */ -QFxAnchors::QFxAnchors(QObject *parent) - : QObject(*new QFxAnchorsPrivate(), parent) +QmlGraphicsAnchors::QmlGraphicsAnchors(QObject *parent) + : QObject(*new QmlGraphicsAnchorsPrivate(), parent) { } -QFxAnchors::~QFxAnchors() +QmlGraphicsAnchors::~QmlGraphicsAnchors() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->remDepend(d->fill); d->remDepend(d->centerIn); d->remDepend(d->left.item); @@ -147,7 +147,7 @@ QFxAnchors::~QFxAnchors() d->remDepend(d->baseline.item); } -void QFxAnchorsPrivate::fillChanged() +void QmlGraphicsAnchorsPrivate::fillChanged() { if (!fill || !isItemComplete()) return; @@ -161,7 +161,7 @@ void QFxAnchorsPrivate::fillChanged() setItemHeight(fill->height()-topMargin-bottomMargin); } -void QFxAnchorsPrivate::centerInChanged() +void QmlGraphicsAnchorsPrivate::centerInChanged() { if (!centerIn || fill || !isItemComplete()) return; @@ -179,7 +179,7 @@ void QFxAnchorsPrivate::centerInChanged() } } -void QFxAnchorsPrivate::clearItem(QFxItem *item) +void QmlGraphicsAnchorsPrivate::clearItem(QmlGraphicsItem *item) { if (!item) return; @@ -189,107 +189,107 @@ void QFxAnchorsPrivate::clearItem(QFxItem *item) centerIn = 0; if (left.item == item) { left.item = 0; - usedAnchors &= ~QFxAnchors::HasLeftAnchor; + usedAnchors &= ~QmlGraphicsAnchors::HasLeftAnchor; } if (right.item == item) { right.item = 0; - usedAnchors &= ~QFxAnchors::HasRightAnchor; + usedAnchors &= ~QmlGraphicsAnchors::HasRightAnchor; } if (top.item == item) { top.item = 0; - usedAnchors &= ~QFxAnchors::HasTopAnchor; + usedAnchors &= ~QmlGraphicsAnchors::HasTopAnchor; } if (bottom.item == item) { bottom.item = 0; - usedAnchors &= ~QFxAnchors::HasBottomAnchor; + usedAnchors &= ~QmlGraphicsAnchors::HasBottomAnchor; } if (vCenter.item == item) { vCenter.item = 0; - usedAnchors &= ~QFxAnchors::HasVCenterAnchor; + usedAnchors &= ~QmlGraphicsAnchors::HasVCenterAnchor; } if (hCenter.item == item) { hCenter.item = 0; - usedAnchors &= ~QFxAnchors::HasHCenterAnchor; + usedAnchors &= ~QmlGraphicsAnchors::HasHCenterAnchor; } if (baseline.item == item) { baseline.item = 0; - usedAnchors &= ~QFxAnchors::HasBaselineAnchor; + usedAnchors &= ~QmlGraphicsAnchors::HasBaselineAnchor; } } -void QFxAnchorsPrivate::addDepend(QFxItem *item) +void QmlGraphicsAnchorsPrivate::addDepend(QmlGraphicsItem *item) { - Q_Q(QFxAnchors); + Q_Q(QmlGraphicsAnchors); if (!item) return; - QFxItemPrivate *p = - static_cast(QGraphicsItemPrivate::get(item)); + QmlGraphicsItemPrivate *p = + static_cast(QGraphicsItemPrivate::get(item)); p->dependantAnchors.append(q); } -void QFxAnchorsPrivate::remDepend(QFxItem *item) +void QmlGraphicsAnchorsPrivate::remDepend(QmlGraphicsItem *item) { - Q_Q(QFxAnchors); + Q_Q(QmlGraphicsAnchors); if (!item) return; - QFxItemPrivate *p = - static_cast(QGraphicsItemPrivate::get(item)); + QmlGraphicsItemPrivate *p = + static_cast(QGraphicsItemPrivate::get(item)); p->dependantAnchors.removeOne(q); } -bool QFxAnchorsPrivate::isItemComplete() const +bool QmlGraphicsAnchorsPrivate::isItemComplete() const { return componentComplete; } -void QFxAnchors::classBegin() +void QmlGraphicsAnchors::classBegin() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->componentComplete = false; } -void QFxAnchors::componentComplete() +void QmlGraphicsAnchors::componentComplete() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->componentComplete = true; } -void QFxAnchorsPrivate::setItemHeight(qreal v) +void QmlGraphicsAnchorsPrivate::setItemHeight(qreal v) { updatingMe = true; item->setHeight(v); updatingMe = false; } -void QFxAnchorsPrivate::setItemWidth(qreal v) +void QmlGraphicsAnchorsPrivate::setItemWidth(qreal v) { updatingMe = true; item->setWidth(v); updatingMe = false; } -void QFxAnchorsPrivate::setItemX(qreal v) +void QmlGraphicsAnchorsPrivate::setItemX(qreal v) { updatingMe = true; item->setX(v); updatingMe = false; } -void QFxAnchorsPrivate::setItemY(qreal v) +void QmlGraphicsAnchorsPrivate::setItemY(qreal v) { updatingMe = true; item->setY(v); updatingMe = false; } -void QFxAnchorsPrivate::setItemPos(const QPointF &v) +void QmlGraphicsAnchorsPrivate::setItemPos(const QPointF &v) { updatingMe = true; item->setPos(v); updatingMe = false; } -void QFxAnchorsPrivate::updateMe() +void QmlGraphicsAnchorsPrivate::updateMe() { if (updatingMe) { updatingMe = false; @@ -302,7 +302,7 @@ void QFxAnchorsPrivate::updateMe() updateVerticalAnchors(); } -void QFxAnchorsPrivate::updateOnComplete() +void QmlGraphicsAnchorsPrivate::updateOnComplete() { fillChanged(); centerInChanged(); @@ -310,7 +310,7 @@ void QFxAnchorsPrivate::updateOnComplete() updateVerticalAnchors(); } -void QFxAnchorsPrivate::update(QFxItem *, const QRectF &newG, const QRectF &oldG) +void QmlGraphicsAnchorsPrivate::update(QmlGraphicsItem *, const QRectF &newG, const QRectF &oldG) { fillChanged(); centerInChanged(); @@ -321,15 +321,15 @@ void QFxAnchorsPrivate::update(QFxItem *, const QRectF &newG, const QRectF &oldG updateVerticalAnchors(); } -QFxItem *QFxAnchors::fill() const +QmlGraphicsItem *QmlGraphicsAnchors::fill() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->fill; } -void QFxAnchors::setFill(QFxItem *f) +void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!f) { d->remDepend(d->fill); d->fill = f; @@ -346,15 +346,15 @@ void QFxAnchors::setFill(QFxItem *f) d->fillChanged(); } -QFxItem *QFxAnchors::centerIn() const +QmlGraphicsItem *QmlGraphicsAnchors::centerIn() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->centerIn; } -void QFxAnchors::setCenterIn(QFxItem* c) +void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!c) { d->remDepend(d->centerIn); d->centerIn = c; @@ -372,11 +372,11 @@ void QFxAnchors::setCenterIn(QFxItem* c) d->centerInChanged(); } -bool QFxAnchorsPrivate::calcStretch(const QFxAnchorLine &edge1, - const QFxAnchorLine &edge2, +bool QmlGraphicsAnchorsPrivate::calcStretch(const QmlGraphicsAnchorLine &edge1, + const QmlGraphicsAnchorLine &edge2, int offset1, int offset2, - QFxAnchorLine::AnchorLine line, + QmlGraphicsAnchorLine::AnchorLine line, int &stretch) { bool edge1IsParent = (edge1.item == item->parentItem()); @@ -401,21 +401,21 @@ bool QFxAnchorsPrivate::calcStretch(const QFxAnchorLine &edge1, return invalid; } -void QFxAnchorsPrivate::updateVerticalAnchors() +void QmlGraphicsAnchorsPrivate::updateVerticalAnchors() { if (fill || centerIn || !isItemComplete()) return; if (updatingVerticalAnchor < 2) { ++updatingVerticalAnchor; - if (usedAnchors & QFxAnchors::HasTopAnchor) { + if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor) { //Handle stretching bool invalid = true; int height = 0; - if (usedAnchors & QFxAnchors::HasBottomAnchor) { - invalid = calcStretch(top, bottom, topMargin, -bottomMargin, QFxAnchorLine::Top, height); - } else if (usedAnchors & QFxAnchors::HasVCenterAnchor) { - invalid = calcStretch(top, vCenter, topMargin, vCenterOffset, QFxAnchorLine::Top, height); + if (usedAnchors & QmlGraphicsAnchors::HasBottomAnchor) { + invalid = calcStretch(top, bottom, topMargin, -bottomMargin, QmlGraphicsAnchorLine::Top, height); + } else if (usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) { + invalid = calcStretch(top, vCenter, topMargin, vCenterOffset, QmlGraphicsAnchorLine::Top, height); height *= 2; } if (!invalid) @@ -427,12 +427,12 @@ void QFxAnchorsPrivate::updateVerticalAnchors() } else if (top.item->parentItem() == item->parentItem()) { setItemY(position(top.item, top.anchorLine) + topMargin); } - } else if (usedAnchors & QFxAnchors::HasBottomAnchor) { + } else if (usedAnchors & QmlGraphicsAnchors::HasBottomAnchor) { //Handle stretching (top + bottom case is handled above) - if (usedAnchors & QFxAnchors::HasVCenterAnchor) { + if (usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) { int height = 0; bool invalid = calcStretch(vCenter, bottom, vCenterOffset, -bottomMargin, - QFxAnchorLine::Top, height); + QmlGraphicsAnchorLine::Top, height); if (!invalid) setItemHeight(height*2); } @@ -443,7 +443,7 @@ void QFxAnchorsPrivate::updateVerticalAnchors() } else if (bottom.item->parentItem() == item->parentItem()) { setItemY(position(bottom.item, bottom.anchorLine) - item->height() - bottomMargin); } - } else if (usedAnchors & QFxAnchors::HasVCenterAnchor) { + } else if (usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) { //(stetching handled above) //Handle vCenter @@ -453,7 +453,7 @@ void QFxAnchorsPrivate::updateVerticalAnchors() } else if (vCenter.item->parentItem() == item->parentItem()) { setItemY(position(vCenter.item, vCenter.anchorLine) - item->height()/2 + vCenterOffset); } - } else if (usedAnchors & QFxAnchors::HasBaselineAnchor) { + } else if (usedAnchors & QmlGraphicsAnchors::HasBaselineAnchor) { //Handle baseline if (baseline.item->parentItem() == item->parentItem()) { setItemY(position(baseline.item, baseline.anchorLine) - item->baselineOffset() + baselineOffset); @@ -462,11 +462,11 @@ void QFxAnchorsPrivate::updateVerticalAnchors() --updatingVerticalAnchor; } else { // ### Make this certain :) - qmlInfo(QFxAnchors::tr("Possible anchor loop detected on vertical anchor."), item); + qmlInfo(QmlGraphicsAnchors::tr("Possible anchor loop detected on vertical anchor."), item); } } -void QFxAnchorsPrivate::updateHorizontalAnchors() +void QmlGraphicsAnchorsPrivate::updateHorizontalAnchors() { if (fill || centerIn || !isItemComplete()) return; @@ -474,14 +474,14 @@ void QFxAnchorsPrivate::updateHorizontalAnchors() if (updatingHorizontalAnchor < 2) { ++updatingHorizontalAnchor; - if (usedAnchors & QFxAnchors::HasLeftAnchor) { + if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor) { //Handle stretching bool invalid = true; int width = 0; - if (usedAnchors & QFxAnchors::HasRightAnchor) { - invalid = calcStretch(left, right, leftMargin, -rightMargin, QFxAnchorLine::Left, width); - } else if (usedAnchors & QFxAnchors::HasHCenterAnchor) { - invalid = calcStretch(left, hCenter, leftMargin, hCenterOffset, QFxAnchorLine::Left, width); + if (usedAnchors & QmlGraphicsAnchors::HasRightAnchor) { + invalid = calcStretch(left, right, leftMargin, -rightMargin, QmlGraphicsAnchorLine::Left, width); + } else if (usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) { + invalid = calcStretch(left, hCenter, leftMargin, hCenterOffset, QmlGraphicsAnchorLine::Left, width); width *= 2; } if (!invalid) @@ -493,12 +493,12 @@ void QFxAnchorsPrivate::updateHorizontalAnchors() } else if (left.item->parentItem() == item->parentItem()) { setItemX(position(left.item, left.anchorLine) + leftMargin); } - } else if (usedAnchors & QFxAnchors::HasRightAnchor) { + } else if (usedAnchors & QmlGraphicsAnchors::HasRightAnchor) { //Handle stretching (left + right case is handled in updateLeftAnchor) - if (usedAnchors & QFxAnchors::HasHCenterAnchor) { + if (usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) { int width = 0; bool invalid = calcStretch(hCenter, right, hCenterOffset, -rightMargin, - QFxAnchorLine::Left, width); + QmlGraphicsAnchorLine::Left, width); if (!invalid) setItemWidth(width*2); } @@ -509,7 +509,7 @@ void QFxAnchorsPrivate::updateHorizontalAnchors() } else if (right.item->parentItem() == item->parentItem()) { setItemX(position(right.item, right.anchorLine) - item->width() - rightMargin); } - } else if (usedAnchors & QFxAnchors::HasHCenterAnchor) { + } else if (usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) { //Handle hCenter if (hCenter.item == item->parentItem()) { setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - item->width()/2 + hCenterOffset); @@ -521,19 +521,19 @@ void QFxAnchorsPrivate::updateHorizontalAnchors() --updatingHorizontalAnchor; } else { // ### Make this certain :) - qmlInfo(QFxAnchors::tr("Possible anchor loop detected on horizontal anchor."), item); + qmlInfo(QmlGraphicsAnchors::tr("Possible anchor loop detected on horizontal anchor."), item); } } -QFxAnchorLine QFxAnchors::top() const +QmlGraphicsAnchorLine QmlGraphicsAnchors::top() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->top; } -void QFxAnchors::setTop(const QFxAnchorLine &edge) +void QmlGraphicsAnchors::setTop(const QmlGraphicsAnchorLine &edge) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!d->checkVAnchorValid(edge)) return; @@ -550,24 +550,24 @@ void QFxAnchors::setTop(const QFxAnchorLine &edge) d->updateVerticalAnchors(); } -void QFxAnchors::resetTop() +void QmlGraphicsAnchors::resetTop() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->usedAnchors &= ~HasTopAnchor; d->remDepend(d->top.item); - d->top = QFxAnchorLine(); + d->top = QmlGraphicsAnchorLine(); d->updateVerticalAnchors(); } -QFxAnchorLine QFxAnchors::bottom() const +QmlGraphicsAnchorLine QmlGraphicsAnchors::bottom() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->bottom; } -void QFxAnchors::setBottom(const QFxAnchorLine &edge) +void QmlGraphicsAnchors::setBottom(const QmlGraphicsAnchorLine &edge) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!d->checkVAnchorValid(edge)) return; @@ -584,24 +584,24 @@ void QFxAnchors::setBottom(const QFxAnchorLine &edge) d->updateVerticalAnchors(); } -void QFxAnchors::resetBottom() +void QmlGraphicsAnchors::resetBottom() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->usedAnchors &= ~HasBottomAnchor; d->remDepend(d->bottom.item); - d->bottom = QFxAnchorLine(); + d->bottom = QmlGraphicsAnchorLine(); d->updateVerticalAnchors(); } -QFxAnchorLine QFxAnchors::verticalCenter() const +QmlGraphicsAnchorLine QmlGraphicsAnchors::verticalCenter() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->vCenter; } -void QFxAnchors::setVerticalCenter(const QFxAnchorLine &edge) +void QmlGraphicsAnchors::setVerticalCenter(const QmlGraphicsAnchorLine &edge) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!d->checkVAnchorValid(edge)) return; @@ -618,24 +618,24 @@ void QFxAnchors::setVerticalCenter(const QFxAnchorLine &edge) d->updateVerticalAnchors(); } -void QFxAnchors::resetVerticalCenter() +void QmlGraphicsAnchors::resetVerticalCenter() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->usedAnchors &= ~HasVCenterAnchor; d->remDepend(d->vCenter.item); - d->vCenter = QFxAnchorLine(); + d->vCenter = QmlGraphicsAnchorLine(); d->updateVerticalAnchors(); } -QFxAnchorLine QFxAnchors::baseline() const +QmlGraphicsAnchorLine QmlGraphicsAnchors::baseline() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->baseline; } -void QFxAnchors::setBaseline(const QFxAnchorLine &edge) +void QmlGraphicsAnchors::setBaseline(const QmlGraphicsAnchorLine &edge) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!d->checkVAnchorValid(edge)) return; @@ -652,24 +652,24 @@ void QFxAnchors::setBaseline(const QFxAnchorLine &edge) d->updateVerticalAnchors(); } -void QFxAnchors::resetBaseline() +void QmlGraphicsAnchors::resetBaseline() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->usedAnchors &= ~HasBaselineAnchor; d->remDepend(d->baseline.item); - d->baseline = QFxAnchorLine(); + d->baseline = QmlGraphicsAnchorLine(); d->updateVerticalAnchors(); } -QFxAnchorLine QFxAnchors::left() const +QmlGraphicsAnchorLine QmlGraphicsAnchors::left() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->left; } -void QFxAnchors::setLeft(const QFxAnchorLine &edge) +void QmlGraphicsAnchors::setLeft(const QmlGraphicsAnchorLine &edge) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!d->checkHAnchorValid(edge)) return; @@ -686,24 +686,24 @@ void QFxAnchors::setLeft(const QFxAnchorLine &edge) d->updateHorizontalAnchors(); } -void QFxAnchors::resetLeft() +void QmlGraphicsAnchors::resetLeft() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->usedAnchors &= ~HasLeftAnchor; d->remDepend(d->left.item); - d->left = QFxAnchorLine(); + d->left = QmlGraphicsAnchorLine(); d->updateHorizontalAnchors(); } -QFxAnchorLine QFxAnchors::right() const +QmlGraphicsAnchorLine QmlGraphicsAnchors::right() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->right; } -void QFxAnchors::setRight(const QFxAnchorLine &edge) +void QmlGraphicsAnchors::setRight(const QmlGraphicsAnchorLine &edge) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!d->checkHAnchorValid(edge)) return; @@ -721,24 +721,24 @@ void QFxAnchors::setRight(const QFxAnchorLine &edge) d->updateHorizontalAnchors(); } -void QFxAnchors::resetRight() +void QmlGraphicsAnchors::resetRight() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->usedAnchors &= ~HasRightAnchor; d->remDepend(d->right.item); - d->right = QFxAnchorLine(); + d->right = QmlGraphicsAnchorLine(); d->updateHorizontalAnchors(); } -QFxAnchorLine QFxAnchors::horizontalCenter() const +QmlGraphicsAnchorLine QmlGraphicsAnchors::horizontalCenter() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->hCenter; } -void QFxAnchors::setHorizontalCenter(const QFxAnchorLine &edge) +void QmlGraphicsAnchors::setHorizontalCenter(const QmlGraphicsAnchorLine &edge) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (!d->checkHAnchorValid(edge)) return; @@ -755,24 +755,24 @@ void QFxAnchors::setHorizontalCenter(const QFxAnchorLine &edge) d->updateHorizontalAnchors(); } -void QFxAnchors::resetHorizontalCenter() +void QmlGraphicsAnchors::resetHorizontalCenter() { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->usedAnchors &= ~HasHCenterAnchor; d->remDepend(d->hCenter.item); - d->hCenter = QFxAnchorLine(); + d->hCenter = QmlGraphicsAnchorLine(); d->updateHorizontalAnchors(); } -qreal QFxAnchors::leftMargin() const +qreal QmlGraphicsAnchors::leftMargin() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->leftMargin; } -void QFxAnchors::setLeftMargin(qreal offset) +void QmlGraphicsAnchors::setLeftMargin(qreal offset) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (d->leftMargin == offset) return; d->leftMargin = offset; @@ -780,15 +780,15 @@ void QFxAnchors::setLeftMargin(qreal offset) emit leftMarginChanged(); } -qreal QFxAnchors::rightMargin() const +qreal QmlGraphicsAnchors::rightMargin() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->rightMargin; } -void QFxAnchors::setRightMargin(qreal offset) +void QmlGraphicsAnchors::setRightMargin(qreal offset) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (d->rightMargin == offset) return; d->rightMargin = offset; @@ -796,15 +796,15 @@ void QFxAnchors::setRightMargin(qreal offset) emit rightMarginChanged(); } -qreal QFxAnchors::horizontalCenterOffset() const +qreal QmlGraphicsAnchors::horizontalCenterOffset() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->hCenterOffset; } -void QFxAnchors::setHorizontalCenterOffset(qreal offset) +void QmlGraphicsAnchors::setHorizontalCenterOffset(qreal offset) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (d->hCenterOffset == offset) return; d->hCenterOffset = offset; @@ -812,15 +812,15 @@ void QFxAnchors::setHorizontalCenterOffset(qreal offset) emit horizontalCenterOffsetChanged(); } -qreal QFxAnchors::topMargin() const +qreal QmlGraphicsAnchors::topMargin() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->topMargin; } -void QFxAnchors::setTopMargin(qreal offset) +void QmlGraphicsAnchors::setTopMargin(qreal offset) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (d->topMargin == offset) return; d->topMargin = offset; @@ -828,15 +828,15 @@ void QFxAnchors::setTopMargin(qreal offset) emit topMarginChanged(); } -qreal QFxAnchors::bottomMargin() const +qreal QmlGraphicsAnchors::bottomMargin() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->bottomMargin; } -void QFxAnchors::setBottomMargin(qreal offset) +void QmlGraphicsAnchors::setBottomMargin(qreal offset) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (d->bottomMargin == offset) return; d->bottomMargin = offset; @@ -844,15 +844,15 @@ void QFxAnchors::setBottomMargin(qreal offset) emit bottomMarginChanged(); } -qreal QFxAnchors::verticalCenterOffset() const +qreal QmlGraphicsAnchors::verticalCenterOffset() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->vCenterOffset; } -void QFxAnchors::setVerticalCenterOffset(qreal offset) +void QmlGraphicsAnchors::setVerticalCenterOffset(qreal offset) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (d->vCenterOffset == offset) return; d->vCenterOffset = offset; @@ -860,15 +860,15 @@ void QFxAnchors::setVerticalCenterOffset(qreal offset) emit verticalCenterOffsetChanged(); } -qreal QFxAnchors::baselineOffset() const +qreal QmlGraphicsAnchors::baselineOffset() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->baselineOffset; } -void QFxAnchors::setBaselineOffset(qreal offset) +void QmlGraphicsAnchors::setBaselineOffset(qreal offset) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); if (d->baselineOffset == offset) return; d->baselineOffset = offset; @@ -876,80 +876,80 @@ void QFxAnchors::setBaselineOffset(qreal offset) emit baselineOffsetChanged(); } -QFxAnchors::UsedAnchors QFxAnchors::usedAnchors() const +QmlGraphicsAnchors::UsedAnchors QmlGraphicsAnchors::usedAnchors() const { - Q_D(const QFxAnchors); + Q_D(const QmlGraphicsAnchors); return d->usedAnchors; } -void QFxAnchors::setItem(QFxItem *item) +void QmlGraphicsAnchors::setItem(QmlGraphicsItem *item) { - Q_D(QFxAnchors); + Q_D(QmlGraphicsAnchors); d->item = item; } -bool QFxAnchorsPrivate::checkHValid() const +bool QmlGraphicsAnchorsPrivate::checkHValid() const { - if (usedAnchors & QFxAnchors::HasLeftAnchor && - usedAnchors & QFxAnchors::HasRightAnchor && - usedAnchors & QFxAnchors::HasHCenterAnchor) { - qmlInfo(QFxAnchors::tr("Can't specify left, right, and hcenter anchors."), item); + if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor && + usedAnchors & QmlGraphicsAnchors::HasRightAnchor && + usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) { + qmlInfo(QmlGraphicsAnchors::tr("Can't specify left, right, and hcenter anchors."), item); return false; } return true; } -bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const +bool QmlGraphicsAnchorsPrivate::checkHAnchorValid(QmlGraphicsAnchorLine anchor) const { if (!anchor.item) { - qmlInfo(QFxAnchors::tr("Can't anchor to a null item."), item); + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to a null item."), item); return false; - } else if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) { - qmlInfo(QFxAnchors::tr("Can't anchor a horizontal edge to a vertical edge."), item); + } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Vertical_Mask) { + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor a horizontal edge to a vertical edge."), item); return false; } else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){ - qmlInfo(QFxAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item); + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item); return false; } else if (anchor.item == item) { - qmlInfo(QFxAnchors::tr("Can't anchor item to self."), item); + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor item to self."), item); return false; } return true; } -bool QFxAnchorsPrivate::checkVValid() const +bool QmlGraphicsAnchorsPrivate::checkVValid() const { - if (usedAnchors & QFxAnchors::HasTopAnchor && - usedAnchors & QFxAnchors::HasBottomAnchor && - usedAnchors & QFxAnchors::HasVCenterAnchor) { - qmlInfo(QFxAnchors::tr("Can't specify top, bottom, and vcenter anchors."), item); + if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor && + usedAnchors & QmlGraphicsAnchors::HasBottomAnchor && + usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) { + qmlInfo(QmlGraphicsAnchors::tr("Can't specify top, bottom, and vcenter anchors."), item); return false; - } else if (usedAnchors & QFxAnchors::HasBaselineAnchor && - (usedAnchors & QFxAnchors::HasTopAnchor || - usedAnchors & QFxAnchors::HasBottomAnchor || - usedAnchors & QFxAnchors::HasVCenterAnchor)) { - qmlInfo(QFxAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."), item); + } else if (usedAnchors & QmlGraphicsAnchors::HasBaselineAnchor && + (usedAnchors & QmlGraphicsAnchors::HasTopAnchor || + usedAnchors & QmlGraphicsAnchors::HasBottomAnchor || + usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor)) { + qmlInfo(QmlGraphicsAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."), item); return false; } return true; } -bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const +bool QmlGraphicsAnchorsPrivate::checkVAnchorValid(QmlGraphicsAnchorLine anchor) const { if (!anchor.item) { - qmlInfo(QFxAnchors::tr("Can't anchor to a null item."), item); + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to a null item."), item); return false; - } else if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) { - qmlInfo(QFxAnchors::tr("Can't anchor a vertical edge to a horizontal edge."), item); + } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Horizontal_Mask) { + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor a vertical edge to a horizontal edge."), item); return false; } else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){ - qmlInfo(QFxAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item); + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item); return false; } else if (anchor.item == item){ - qmlInfo(QFxAnchors::tr("Can't anchor item to self."), item); + qmlInfo(QmlGraphicsAnchors::tr("Can't anchor item to self."), item); return false; } diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h index 3dd64c7..9e2bac6 100644 --- a/src/declarative/fx/qfxanchors.h +++ b/src/declarative/fx/qfxanchors.h @@ -53,19 +53,19 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxAnchorsPrivate; -class QFxAnchorLine; -class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject +class QmlGraphicsAnchorsPrivate; +class QmlGraphicsAnchorLine; +class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject { Q_OBJECT - Q_PROPERTY(QFxAnchorLine left READ left WRITE setLeft RESET resetLeft) - Q_PROPERTY(QFxAnchorLine right READ right WRITE setRight RESET resetRight) - Q_PROPERTY(QFxAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter) - Q_PROPERTY(QFxAnchorLine top READ top WRITE setTop RESET resetTop) - Q_PROPERTY(QFxAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom) - Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter) - Q_PROPERTY(QFxAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline) + Q_PROPERTY(QmlGraphicsAnchorLine left READ left WRITE setLeft RESET resetLeft) + Q_PROPERTY(QmlGraphicsAnchorLine right READ right WRITE setRight RESET resetRight) + Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter) + Q_PROPERTY(QmlGraphicsAnchorLine top READ top WRITE setTop RESET resetTop) + Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom) + Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter) + Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline) Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged) Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged) Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged()) @@ -73,12 +73,12 @@ class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged) Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged()) Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged()) - Q_PROPERTY(QFxItem *fill READ fill WRITE setFill) - Q_PROPERTY(QFxItem *centerIn READ centerIn WRITE setCenterIn) + Q_PROPERTY(QmlGraphicsItem *fill READ fill WRITE setFill) + Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn) public: - QFxAnchors(QObject *parent=0); - virtual ~QFxAnchors(); + QmlGraphicsAnchors(QObject *parent=0); + virtual ~QmlGraphicsAnchors(); enum UsedAnchor { HasLeftAnchor = 0x01, @@ -93,32 +93,32 @@ public: }; Q_DECLARE_FLAGS(UsedAnchors, UsedAnchor) - QFxAnchorLine left() const; - void setLeft(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine left() const; + void setLeft(const QmlGraphicsAnchorLine &edge); void resetLeft(); - QFxAnchorLine right() const; - void setRight(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine right() const; + void setRight(const QmlGraphicsAnchorLine &edge); void resetRight(); - QFxAnchorLine horizontalCenter() const; - void setHorizontalCenter(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine horizontalCenter() const; + void setHorizontalCenter(const QmlGraphicsAnchorLine &edge); void resetHorizontalCenter(); - QFxAnchorLine top() const; - void setTop(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine top() const; + void setTop(const QmlGraphicsAnchorLine &edge); void resetTop(); - QFxAnchorLine bottom() const; - void setBottom(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine bottom() const; + void setBottom(const QmlGraphicsAnchorLine &edge); void resetBottom(); - QFxAnchorLine verticalCenter() const; - void setVerticalCenter(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine verticalCenter() const; + void setVerticalCenter(const QmlGraphicsAnchorLine &edge); void resetVerticalCenter(); - QFxAnchorLine baseline() const; - void setBaseline(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine baseline() const; + void setBaseline(const QmlGraphicsAnchorLine &edge); void resetBaseline(); qreal leftMargin() const; @@ -142,15 +142,15 @@ public: qreal baselineOffset() const; void setBaselineOffset(qreal); - QFxItem *fill() const; - void setFill(QFxItem *); + QmlGraphicsItem *fill() const; + void setFill(QmlGraphicsItem *); - QFxItem *centerIn() const; - void setCenterIn(QFxItem *); + QmlGraphicsItem *centerIn() const; + void setCenterIn(QmlGraphicsItem *); UsedAnchors usedAnchors() const; - void setItem(QFxItem *item); + void setItem(QmlGraphicsItem *item); void classBegin(); void componentComplete(); @@ -165,15 +165,15 @@ Q_SIGNALS: void baselineOffsetChanged(); private: - friend class QFxItem; - Q_DISABLE_COPY(QFxAnchors) - Q_DECLARE_PRIVATE(QFxAnchors) + friend class QmlGraphicsItem; + Q_DISABLE_COPY(QmlGraphicsAnchors) + Q_DECLARE_PRIVATE(QmlGraphicsAnchors) }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QFxAnchors::UsedAnchors) +Q_DECLARE_OPERATORS_FOR_FLAGS(QmlGraphicsAnchors::UsedAnchors) QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxAnchors) +QML_DECLARE_TYPE(QmlGraphicsAnchors) QT_END_HEADER diff --git a/src/declarative/fx/qfxanchors_p.h b/src/declarative/fx/qfxanchors_p.h index 9b1bc18..50f1dc4 100644 --- a/src/declarative/fx/qfxanchors_p.h +++ b/src/declarative/fx/qfxanchors_p.h @@ -58,10 +58,10 @@ QT_BEGIN_NAMESPACE -class QFxAnchorLine +class QmlGraphicsAnchorLine { public: - QFxAnchorLine() : item(0), anchorLine(Invalid) + QmlGraphicsAnchorLine() : item(0), anchorLine(Invalid) { } @@ -78,16 +78,16 @@ public: Vertical_Mask = Top | Bottom | VCenter | Baseline }; - QFxItem *item; + QmlGraphicsItem *item; AnchorLine anchorLine; }; -Q_DECLARE_METATYPE(QFxAnchorLine) +Q_DECLARE_METATYPE(QmlGraphicsAnchorLine) -class QFxAnchorsPrivate : public QObjectPrivate +class QmlGraphicsAnchorsPrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QFxAnchors) + Q_DECLARE_PUBLIC(QmlGraphicsAnchors) public: - QFxAnchorsPrivate() + QmlGraphicsAnchorsPrivate() : updatingMe(false), updatingHorizontalAnchor(0), updatingVerticalAnchor(0), item(0), usedAnchors(0), fill(0), centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), @@ -100,10 +100,10 @@ public: { } - void clearItem(QFxItem *); + void clearItem(QmlGraphicsItem *); - void addDepend(QFxItem *); - void remDepend(QFxItem *); + void addDepend(QmlGraphicsItem *); + void remDepend(QmlGraphicsItem *); bool isItemComplete() const; bool updatingMe; @@ -118,32 +118,32 @@ public: void updateOnComplete(); void updateMe(); - void update(QFxItem *, const QRectF &, const QRectF &); + void update(QmlGraphicsItem *, const QRectF &, const QRectF &); bool checkHValid() const; bool checkVValid() const; - bool checkHAnchorValid(QFxAnchorLine anchor) const; - bool checkVAnchorValid(QFxAnchorLine anchor) const; - bool calcStretch(const QFxAnchorLine &edge1, const QFxAnchorLine &edge2, int offset1, int offset2, QFxAnchorLine::AnchorLine line, int &stretch); + bool checkHAnchorValid(QmlGraphicsAnchorLine anchor) const; + bool checkVAnchorValid(QmlGraphicsAnchorLine anchor) const; + bool calcStretch(const QmlGraphicsAnchorLine &edge1, const QmlGraphicsAnchorLine &edge2, int offset1, int offset2, QmlGraphicsAnchorLine::AnchorLine line, int &stretch); void updateHorizontalAnchors(); void updateVerticalAnchors(); void fillChanged(); void centerInChanged(); - QFxItem *item; - QFxAnchors::UsedAnchors usedAnchors; + QmlGraphicsItem *item; + QmlGraphicsAnchors::UsedAnchors usedAnchors; - QFxItem *fill; - QFxItem *centerIn; + QmlGraphicsItem *fill; + QmlGraphicsItem *centerIn; - QFxAnchorLine left; - QFxAnchorLine right; - QFxAnchorLine top; - QFxAnchorLine bottom; - QFxAnchorLine vCenter; - QFxAnchorLine hCenter; - QFxAnchorLine baseline; + QmlGraphicsAnchorLine left; + QmlGraphicsAnchorLine right; + QmlGraphicsAnchorLine top; + QmlGraphicsAnchorLine bottom; + QmlGraphicsAnchorLine vCenter; + QmlGraphicsAnchorLine hCenter; + QmlGraphicsAnchorLine baseline; qreal leftMargin; qreal rightMargin; diff --git a/src/declarative/fx/qfxborderimage.cpp b/src/declarative/fx/qfxborderimage.cpp index f1574e5..1ee2f71 100644 --- a/src/declarative/fx/qfxborderimage.cpp +++ b/src/declarative/fx/qfxborderimage.cpp @@ -48,10 +48,10 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,BorderImage,QFxBorderImage) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,BorderImage,QmlGraphicsBorderImage) /*! - \qmlclass BorderImage QFxBorderImage + \qmlclass BorderImage QmlGraphicsBorderImage \brief The BorderImage element provides an image that can be used as a border. \inherits Item @@ -64,23 +64,23 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,BorderImage,QFxBorderImage) /*! \internal - \class QFxBorderImage BorderImage - \brief The QFxBorderImage class provides an image item that you can add to a QmlView. + \class QmlGraphicsBorderImage BorderImage + \brief The QmlGraphicsBorderImage class provides an image item that you can add to a QmlView. */ -QFxBorderImage::QFxBorderImage(QFxItem *parent) - : QFxImageBase(*(new QFxBorderImagePrivate), parent) +QmlGraphicsBorderImage::QmlGraphicsBorderImage(QmlGraphicsItem *parent) + : QmlGraphicsImageBase(*(new QmlGraphicsBorderImagePrivate), parent) { setFlag(QGraphicsItem::ItemHasNoContents, false); } -QFxBorderImage::~QFxBorderImage() +QmlGraphicsBorderImage::~QmlGraphicsBorderImage() { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); if (d->sciReply) d->sciReply->deleteLater(); if (d->sciPendingPixmapCache) - QFxPixmapCache::cancelGet(d->sciurl, this); + QmlGraphicsPixmapCache::cancelGet(d->sciurl, this); } /*! \qmlproperty enum BorderImage::status @@ -147,9 +147,9 @@ static QString toLocalFileOrQrc(const QUrl& url) } -void QFxBorderImage::setSource(const QUrl &url) +void QmlGraphicsBorderImage::setSource(const QUrl &url) { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); //equality is fairly expensive, so we bypass for simple, common case if ((d->url.isEmpty() == url.isEmpty()) && url == d->url) return; @@ -160,11 +160,11 @@ void QFxBorderImage::setSource(const QUrl &url) } if (d->pendingPixmapCache) { - QFxPixmapCache::cancelGet(d->url, this); + QmlGraphicsPixmapCache::cancelGet(d->url, this); d->pendingPixmapCache = false; } if (d->sciPendingPixmapCache) { - QFxPixmapCache::cancelGet(d->sciurl, this); + QmlGraphicsPixmapCache::cancelGet(d->sciurl, this); d->sciPendingPixmapCache = false; } @@ -193,7 +193,7 @@ void QFxBorderImage::setSource(const QUrl &url) if (!lf.isEmpty()) { QFile file(lf); file.open(QIODevice::ReadOnly); - setGridScaledImage(QFxGridScaledImage(&file)); + setGridScaledImage(QmlGraphicsGridScaledImage(&file)); } else #endif { @@ -203,7 +203,7 @@ void QFxBorderImage::setSource(const QUrl &url) this, SLOT(sciRequestFinished())); } } else { - QNetworkReply *reply = QFxPixmapCache::get(qmlEngine(this), d->url, &d->pix); + QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->url, &d->pix); if (reply) { d->pendingPixmapCache = true; connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); @@ -254,9 +254,9 @@ void QFxBorderImage::setSource(const QUrl &url) \l {BorderImage::source}{.sci file}. */ -QFxScaleGrid *QFxBorderImage::border() +QmlGraphicsScaleGrid *QmlGraphicsBorderImage::border() { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); return d->getScaleGrid(); } @@ -272,15 +272,15 @@ QFxScaleGrid *QFxBorderImage::border() \o Round - Like Repeat, but scales the images down to ensure that the last image is not cropped. \endlist */ -QFxBorderImage::TileMode QFxBorderImage::horizontalTileMode() const +QmlGraphicsBorderImage::TileMode QmlGraphicsBorderImage::horizontalTileMode() const { - Q_D(const QFxBorderImage); + Q_D(const QmlGraphicsBorderImage); return d->horizontalTileMode; } -void QFxBorderImage::setHorizontalTileMode(TileMode t) +void QmlGraphicsBorderImage::setHorizontalTileMode(TileMode t) { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); if (t != d->horizontalTileMode) { d->horizontalTileMode = t; emit horizontalTileModeChanged(); @@ -288,15 +288,15 @@ void QFxBorderImage::setHorizontalTileMode(TileMode t) } } -QFxBorderImage::TileMode QFxBorderImage::verticalTileMode() const +QmlGraphicsBorderImage::TileMode QmlGraphicsBorderImage::verticalTileMode() const { - Q_D(const QFxBorderImage); + Q_D(const QmlGraphicsBorderImage); return d->verticalTileMode; } -void QFxBorderImage::setVerticalTileMode(TileMode t) +void QmlGraphicsBorderImage::setVerticalTileMode(TileMode t) { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); if (t != d->verticalTileMode) { d->verticalTileMode = t; emit verticalTileModeChanged(); @@ -304,14 +304,14 @@ void QFxBorderImage::setVerticalTileMode(TileMode t) } } -void QFxBorderImage::setGridScaledImage(const QFxGridScaledImage& sci) +void QmlGraphicsBorderImage::setGridScaledImage(const QmlGraphicsGridScaledImage& sci) { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); if (!sci.isValid()) { d->status = Error; emit statusChanged(d->status); } else { - QFxScaleGrid *sg = border(); + QmlGraphicsScaleGrid *sg = border(); sg->setTop(sci.gridTop()); sg->setBottom(sci.gridBottom()); sg->setLeft(sci.gridLeft()); @@ -320,7 +320,7 @@ void QFxBorderImage::setGridScaledImage(const QFxGridScaledImage& sci) d->verticalTileMode = sci.verticalTileRule(); d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); - QNetworkReply *reply = QFxPixmapCache::get(qmlEngine(this), d->sciurl, &d->pix); + QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->sciurl, &d->pix); if (reply) { d->sciPendingPixmapCache = true; connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); @@ -342,16 +342,16 @@ void QFxBorderImage::setGridScaledImage(const QFxGridScaledImage& sci) } } -void QFxBorderImage::requestFinished() +void QmlGraphicsBorderImage::requestFinished() { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); if (d->url.path().endsWith(QLatin1String(".sci"))) { d->sciPendingPixmapCache = false; - QFxPixmapCache::find(d->sciurl, &d->pix); + QmlGraphicsPixmapCache::find(d->sciurl, &d->pix); } else { d->pendingPixmapCache = false; - if (!QFxPixmapCache::find(d->url, &d->pix)) + if (!QmlGraphicsPixmapCache::find(d->url, &d->pix)) d->status = Error; } setImplicitWidth(d->pix.width()); @@ -366,25 +366,25 @@ void QFxBorderImage::requestFinished() update(); } -void QFxBorderImage::sciRequestFinished() +void QmlGraphicsBorderImage::sciRequestFinished() { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); if (d->sciReply->error() != QNetworkReply::NoError) { d->status = Error; d->sciReply->deleteLater(); d->sciReply = 0; emit statusChanged(d->status); } else { - QFxGridScaledImage sci(d->sciReply); + QmlGraphicsGridScaledImage sci(d->sciReply); d->sciReply->deleteLater(); d->sciReply = 0; setGridScaledImage(sci); } } -void QFxBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { - Q_D(QFxBorderImage); + Q_D(QmlGraphicsBorderImage); if (d->pix.isNull()) return; @@ -402,8 +402,8 @@ void QFxBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidge } } -QFxBorderImage::QFxBorderImage(QFxBorderImagePrivate &dd, QFxItem *parent) - : QFxImageBase(dd, parent) +QmlGraphicsBorderImage::QmlGraphicsBorderImage(QmlGraphicsBorderImagePrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsImageBase(dd, parent) { setFlag(QGraphicsItem::ItemHasNoContents, false); } diff --git a/src/declarative/fx/qfxborderimage.h b/src/declarative/fx/qfxborderimage.h index 5bc1067..b6f99a3 100644 --- a/src/declarative/fx/qfxborderimage.h +++ b/src/declarative/fx/qfxborderimage.h @@ -50,23 +50,23 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxScaleGrid; -class QFxGridScaledImage; -class QFxBorderImagePrivate; -class Q_DECLARATIVE_EXPORT QFxBorderImage : public QFxImageBase +class QmlGraphicsScaleGrid; +class QmlGraphicsGridScaledImage; +class QmlGraphicsBorderImagePrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsBorderImage : public QmlGraphicsImageBase { Q_OBJECT Q_ENUMS(TileMode) - Q_PROPERTY(QFxScaleGrid *border READ border CONSTANT) + Q_PROPERTY(QmlGraphicsScaleGrid *border READ border CONSTANT) Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged) Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) public: - QFxBorderImage(QFxItem *parent=0); - ~QFxBorderImage(); + QmlGraphicsBorderImage(QmlGraphicsItem *parent=0); + ~QmlGraphicsBorderImage(); - QFxScaleGrid *border(); + QmlGraphicsScaleGrid *border(); enum TileMode { Stretch = Qt::StretchTile, Repeat = Qt::RepeatTile, Round = Qt::RoundTile }; @@ -84,22 +84,22 @@ Q_SIGNALS: void verticalTileModeChanged(); protected: - QFxBorderImage(QFxBorderImagePrivate &dd, QFxItem *parent); + QmlGraphicsBorderImage(QmlGraphicsBorderImagePrivate &dd, QmlGraphicsItem *parent); private: - void setGridScaledImage(const QFxGridScaledImage& sci); + void setGridScaledImage(const QmlGraphicsGridScaledImage& sci); private Q_SLOTS: void requestFinished(); void sciRequestFinished(); private: - Q_DISABLE_COPY(QFxBorderImage) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxBorderImage) + Q_DISABLE_COPY(QmlGraphicsBorderImage) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBorderImage) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxBorderImage) +QML_DECLARE_TYPE(QmlGraphicsBorderImage) QT_END_HEADER #endif // QFXBORDERIMAGE_H diff --git a/src/declarative/fx/qfxborderimage_p.h b/src/declarative/fx/qfxborderimage_p.h index aebe13f..75a638c 100644 --- a/src/declarative/fx/qfxborderimage_p.h +++ b/src/declarative/fx/qfxborderimage_p.h @@ -59,37 +59,37 @@ QT_BEGIN_NAMESPACE class QNetworkReply; -class QFxBorderImagePrivate : public QFxImageBasePrivate +class QmlGraphicsBorderImagePrivate : public QmlGraphicsImageBasePrivate { - Q_DECLARE_PUBLIC(QFxBorderImage) + Q_DECLARE_PUBLIC(QmlGraphicsBorderImage) public: - QFxBorderImagePrivate() + QmlGraphicsBorderImagePrivate() : border(0), sciReply(0), sciPendingPixmapCache(false), - horizontalTileMode(QFxBorderImage::Stretch), - verticalTileMode(QFxBorderImage::Stretch) + horizontalTileMode(QmlGraphicsBorderImage::Stretch), + verticalTileMode(QmlGraphicsBorderImage::Stretch) { } - ~QFxBorderImagePrivate() + ~QmlGraphicsBorderImagePrivate() { } - QFxScaleGrid *getScaleGrid() + QmlGraphicsScaleGrid *getScaleGrid() { - Q_Q(QFxBorderImage); + Q_Q(QmlGraphicsBorderImage); if (!border) - border = new QFxScaleGrid(q); + border = new QmlGraphicsScaleGrid(q); return border; } - QFxScaleGrid *border; + QmlGraphicsScaleGrid *border; QUrl sciurl; QNetworkReply *sciReply; bool sciPendingPixmapCache; - QFxBorderImage::TileMode horizontalTileMode; - QFxBorderImage::TileMode verticalTileMode; + QmlGraphicsBorderImage::TileMode horizontalTileMode; + QmlGraphicsBorderImage::TileMode verticalTileMode; }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxevents.cpp b/src/declarative/fx/qfxevents.cpp index 43f0dd7..fe249f9 100644 --- a/src/declarative/fx/qfxevents.cpp +++ b/src/declarative/fx/qfxevents.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE /*! - \qmlclass KeyEvent QFxKeyEvent + \qmlclass KeyEvent QmlGraphicsKeyEvent \brief The KeyEvent object provides information about a key event. For example, the following changes the Item's state property when the Enter @@ -58,7 +58,7 @@ Item { /*! \internal - \class QFxKeyEvent + \class QmlGraphicsKeyEvent */ /*! @@ -112,7 +112,7 @@ Item { /*! - \qmlclass MouseEvent QFxMouseEvent + \qmlclass MouseEvent QmlGraphicsMouseEvent \brief The MouseEvent object provides information about a mouse event. The position of the mouse can be found via the x and y properties. @@ -121,7 +121,7 @@ Item { /*! \internal - \class QFxMouseEvent + \class QmlGraphicsMouseEvent */ /*! @@ -189,7 +189,7 @@ MouseRegion { \endqml */ -QML_DEFINE_NOCREATE_TYPE(QFxKeyEvent) -QML_DEFINE_NOCREATE_TYPE(QFxMouseEvent) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsKeyEvent) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsMouseEvent) QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxevents_p.h b/src/declarative/fx/qfxevents_p.h index 7b0c24c..e558c42 100644 --- a/src/declarative/fx/qfxevents_p.h +++ b/src/declarative/fx/qfxevents_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE -class QFxKeyEvent : public QObject +class QmlGraphicsKeyEvent : public QObject { Q_OBJECT Q_PROPERTY(int key READ key) @@ -71,9 +71,9 @@ class QFxKeyEvent : public QObject Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) public: - QFxKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1) + QmlGraphicsKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1) : event(type, key, modifiers, text, autorep, count) { event.setAccepted(false); } - QFxKeyEvent(const QKeyEvent &ke) + QmlGraphicsKeyEvent(const QKeyEvent &ke) : event(ke) { event.setAccepted(false); } int key() const { return event.key(); } @@ -89,7 +89,7 @@ private: QKeyEvent event; }; -class QFxMouseEvent : public QObject +class QmlGraphicsMouseEvent : public QObject { Q_OBJECT Q_PROPERTY(int x READ x) @@ -102,7 +102,7 @@ class QFxMouseEvent : public QObject Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) public: - QFxMouseEvent(int x, int y, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers + QmlGraphicsMouseEvent(int x, int y, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers , bool isClick=false, bool wasHeld=false) : _x(x), _y(y), _button(button), _buttons(buttons), _modifiers(modifiers) , _wasHeld(wasHeld), _isClick(isClick), _accepted(true) {} @@ -131,7 +131,7 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxKeyEvent) -QML_DECLARE_TYPE(QFxMouseEvent) +QML_DECLARE_TYPE(QmlGraphicsKeyEvent) +QML_DECLARE_TYPE(QmlGraphicsMouseEvent) #endif // QFXEVENTS_P_H diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 0fb8474..34e3e75 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -60,7 +60,7 @@ static const int FlickThreshold = 20; // Really slow flicks can be annoying. static const int minimumFlickVelocity = 200; -class QFxFlickableVisibleArea : public QObject +class QmlGraphicsFlickableVisibleArea : public QObject { Q_OBJECT @@ -70,7 +70,7 @@ class QFxFlickableVisibleArea : public QObject Q_PROPERTY(qreal heightRatio READ heightRatio NOTIFY pageChanged) public: - QFxFlickableVisibleArea(QFxFlickable *parent=0); + QmlGraphicsFlickableVisibleArea(QmlGraphicsFlickable *parent=0); qreal xPosition() const; qreal widthRatio() const; @@ -83,42 +83,42 @@ signals: void pageChanged(); private: - QFxFlickable *flickable; + QmlGraphicsFlickable *flickable; qreal m_xPosition; qreal m_widthRatio; qreal m_yPosition; qreal m_heightRatio; }; -QFxFlickableVisibleArea::QFxFlickableVisibleArea(QFxFlickable *parent) +QmlGraphicsFlickableVisibleArea::QmlGraphicsFlickableVisibleArea(QmlGraphicsFlickable *parent) : QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.) , m_yPosition(0.), m_heightRatio(0.) { } -qreal QFxFlickableVisibleArea::widthRatio() const +qreal QmlGraphicsFlickableVisibleArea::widthRatio() const { return m_widthRatio; } -qreal QFxFlickableVisibleArea::xPosition() const +qreal QmlGraphicsFlickableVisibleArea::xPosition() const { return m_xPosition; } -qreal QFxFlickableVisibleArea::heightRatio() const +qreal QmlGraphicsFlickableVisibleArea::heightRatio() const { return m_heightRatio; } -qreal QFxFlickableVisibleArea::yPosition() const +qreal QmlGraphicsFlickableVisibleArea::yPosition() const { return m_yPosition; } -void QFxFlickableVisibleArea::updateVisible() +void QmlGraphicsFlickableVisibleArea::updateVisible() { - QFxFlickablePrivate *p = static_cast(QGraphicsItemPrivate::get(flickable)); + QmlGraphicsFlickablePrivate *p = static_cast(QGraphicsItemPrivate::get(flickable)); bool pageChange = false; // Vertical @@ -155,21 +155,21 @@ void QFxFlickableVisibleArea::updateVisible() } -QFxFlickablePrivate::QFxFlickablePrivate() - : viewport(new QFxItem), _moveX(viewport, &QFxItem::setX), _moveY(viewport, &QFxItem::setY) +QmlGraphicsFlickablePrivate::QmlGraphicsFlickablePrivate() + : viewport(new QmlGraphicsItem), _moveX(viewport, &QmlGraphicsItem::setX), _moveY(viewport, &QmlGraphicsItem::setY) , vWidth(-1), vHeight(-1), overShoot(true), flicked(false), moving(false), stealMouse(false) , pressed(false), atXEnd(false), atXBeginning(true), atYEnd(false), atYBeginning(true) , interactive(true), deceleration(500), maxVelocity(5000), reportedVelocitySmoothing(100) , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0) , horizontalVelocity(this), verticalVelocity(this), vTime(0), visibleArea(0) { - fixupXEvent = QmlTimeLineEvent::timeLineEvent(&_moveX, this); - fixupYEvent = QmlTimeLineEvent::timeLineEvent(&_moveY, this); + fixupXEvent = QmlTimeLineEvent::timeLineEvent(&_moveX, this); + fixupYEvent = QmlTimeLineEvent::timeLineEvent(&_moveY, this); } -void QFxFlickablePrivate::init() +void QmlGraphicsFlickablePrivate::init() { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); viewport->setParent(q); QObject::connect(&timeline, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(&timeline, SIGNAL(completed()), q, SLOT(movementEnding())); @@ -181,9 +181,9 @@ void QFxFlickablePrivate::init() QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(widthChange())); } -void QFxFlickablePrivate::flickX(qreal velocity) +void QmlGraphicsFlickablePrivate::flickX(qreal velocity) { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); qreal maxDistance = -1; if (qAbs(velocity) < minimumFlickVelocity) // Minimum velocity to avoid annoyingly slow flicks. velocity = velocity < 0 ? -minimumFlickVelocity : minimumFlickVelocity; @@ -219,9 +219,9 @@ void QFxFlickablePrivate::flickX(qreal velocity) } } -void QFxFlickablePrivate::flickY(qreal velocity) +void QmlGraphicsFlickablePrivate::flickY(qreal velocity) { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); qreal maxDistance = -1; // -ve velocity means list is moving up if (velocity > 0) { @@ -255,9 +255,9 @@ void QFxFlickablePrivate::flickY(qreal velocity) } } -void QFxFlickablePrivate::fixupX() +void QmlGraphicsFlickablePrivate::fixupX() { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); if (!q->xflick() || _moveX.timeLine()) return; @@ -277,9 +277,9 @@ void QFxFlickablePrivate::fixupX() } } -void QFxFlickablePrivate::fixupY() +void QmlGraphicsFlickablePrivate::fixupY() { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); if (!q->yflick() || _moveY.timeLine()) return; @@ -299,9 +299,9 @@ void QFxFlickablePrivate::fixupY() } } -void QFxFlickablePrivate::updateBeginningEnd() +void QmlGraphicsFlickablePrivate::updateBeginningEnd() { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); bool atBoundaryChange = false; // Vertical @@ -341,7 +341,7 @@ void QFxFlickablePrivate::updateBeginningEnd() visibleArea->updateVisible(); } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flickable,QFxFlickable) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flickable,QmlGraphicsFlickable) /*! \qmlclass Flickable @@ -369,12 +369,12 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flickable,QFxFlickable) /*! \internal - \class QFxFlickable - \brief The QFxFlickable class provides a view that can be "flicked". + \class QmlGraphicsFlickable + \brief The QmlGraphicsFlickable class provides a view that can be "flicked". \ingroup group_widgets - QFxFlickable allows its children to be dragged and flicked. + QmlGraphicsFlickable allows its children to be dragged and flicked. \code Flickable { @@ -383,8 +383,8 @@ Flickable { } \endcode - Note that QFxFlickable does not automatically clip its contents. If - it is not full-screen it is likely that QFxItem::clip should be set + Note that QmlGraphicsFlickable does not automatically clip its contents. If + it is not full-screen it is likely that QmlGraphicsItem::clip should be set to true. */ @@ -410,21 +410,21 @@ Flickable { \endcode */ -QFxFlickable::QFxFlickable(QFxItem *parent) - : QFxItem(*(new QFxFlickablePrivate), parent) +QmlGraphicsFlickable::QmlGraphicsFlickable(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsFlickablePrivate), parent) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->init(); } -QFxFlickable::QFxFlickable(QFxFlickablePrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsFlickable::QmlGraphicsFlickable(QmlGraphicsFlickablePrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->init(); } -QFxFlickable::~QFxFlickable() +QmlGraphicsFlickable::~QmlGraphicsFlickable() { } @@ -436,15 +436,15 @@ QFxFlickable::~QFxFlickable() corner of the Flickable. For example, if you flick an image up 100 pixels, \c yPosition will be 100. */ -qreal QFxFlickable::viewportX() const +qreal QmlGraphicsFlickable::viewportX() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return -d->_moveX.value(); } -void QFxFlickable::setViewportX(qreal pos) +void QmlGraphicsFlickable::setViewportX(qreal pos) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); pos = qRound(pos); d->timeline.reset(d->_moveX); if (-pos != d->_moveX.value()) { @@ -453,15 +453,15 @@ void QFxFlickable::setViewportX(qreal pos) } } -qreal QFxFlickable::viewportY() const +qreal QmlGraphicsFlickable::viewportY() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return -d->_moveY.value(); } -void QFxFlickable::setViewportY(qreal pos) +void QmlGraphicsFlickable::setViewportY(qreal pos) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); pos = qRound(pos); d->timeline.reset(d->_moveY); if (-pos != d->_moveY.value()) { @@ -479,15 +479,15 @@ void QFxFlickable::setViewportY(qreal pos) special interaction with Flickable's children: for example, you might want to freeze a flickable map while viewing detailed information on a location popup that is a child of the Flickable. */ -bool QFxFlickable::isInteractive() const +bool QmlGraphicsFlickable::isInteractive() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->interactive; } -void QFxFlickable::setInteractive(bool interactive) +void QmlGraphicsFlickable::setInteractive(bool interactive) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->interactive = interactive; if (!interactive && d->flicked) { d->timeline.clear(); @@ -507,15 +507,15 @@ void QFxFlickable::setInteractive(bool interactive) The reported velocity is smoothed to avoid erratic output. reportedVelocitySmoothing determines how much smoothing is applied. */ -qreal QFxFlickable::horizontalVelocity() const +qreal QmlGraphicsFlickable::horizontalVelocity() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->horizontalVelocity.value(); } -qreal QFxFlickable::verticalVelocity() const +qreal QmlGraphicsFlickable::verticalVelocity() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->verticalVelocity.value(); } @@ -528,62 +528,62 @@ qreal QFxFlickable::verticalVelocity() const These properties are true if the flickable view is positioned at the beginning, or end respecively. */ -bool QFxFlickable::isAtXEnd() const +bool QmlGraphicsFlickable::isAtXEnd() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->atXEnd; } -bool QFxFlickable::isAtXBeginning() const +bool QmlGraphicsFlickable::isAtXBeginning() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->atXBeginning; } -bool QFxFlickable::isAtYEnd() const +bool QmlGraphicsFlickable::isAtYEnd() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->atYEnd; } -bool QFxFlickable::isAtYBeginning() const +bool QmlGraphicsFlickable::isAtYBeginning() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->atYBeginning; } -void QFxFlickable::ticked() +void QmlGraphicsFlickable::ticked() { viewportMoved(); } -QFxItem *QFxFlickable::viewport() +QmlGraphicsItem *QmlGraphicsFlickable::viewport() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); return d->viewport; } -qreal QFxFlickable::visibleX() const +qreal QmlGraphicsFlickable::visibleX() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return -d->_moveX.value(); } -qreal QFxFlickable::visibleY() const +qreal QmlGraphicsFlickable::visibleY() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return -d->_moveY.value(); } -QFxFlickableVisibleArea *QFxFlickable::visibleArea() +QmlGraphicsFlickableVisibleArea *QmlGraphicsFlickable::visibleArea() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (!d->visibleArea) - d->visibleArea = new QFxFlickableVisibleArea(this); + d->visibleArea = new QmlGraphicsFlickableVisibleArea(this); return d->visibleArea; } -void QFxFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) { if (interactive && timeline.isActive() && (qAbs(velocityX) > 10 || qAbs(velocityY) > 10)) stealMouse = true; // If we've been flicked then steal the click. @@ -594,18 +594,18 @@ void QFxFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) velocityX = 0; velocityY = 0; lastPos = QPoint(); - QFxItemPrivate::start(lastPosTime); + QmlGraphicsItemPrivate::start(lastPosTime); pressPos = event->pos(); pressX = _moveX.value(); pressY = _moveY.value(); flicked = false; - QFxItemPrivate::start(pressTime); - QFxItemPrivate::start(velocityTime); + QmlGraphicsItemPrivate::start(pressTime); + QmlGraphicsItemPrivate::start(velocityTime); } -void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); if (!interactive || lastPosTime.isNull()) return; bool rejectY = false; @@ -614,7 +614,7 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) if (q->yflick()) { int dy = int(event->pos().y() - pressPos.y()); - if (qAbs(dy) > DragThreshold || QFxItemPrivate::elapsed(pressTime) > 200) { + if (qAbs(dy) > DragThreshold || QmlGraphicsItemPrivate::elapsed(pressTime) > 200) { qreal newY = dy + pressY; const qreal minY = q->minYExtent(); const qreal maxY = q->maxYExtent(); @@ -641,7 +641,7 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) if (q->xflick()) { int dx = int(event->pos().x() - pressPos.x()); - if (qAbs(dx) > DragThreshold || QFxItemPrivate::elapsed(pressTime) > 200) { + if (qAbs(dx) > DragThreshold || QmlGraphicsItemPrivate::elapsed(pressTime) > 200) { qreal newX = dx + pressX; const qreal minX = q->minXExtent(); const qreal maxX = q->maxXExtent(); @@ -668,7 +668,7 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) } if (!lastPos.isNull()) { - qreal elapsed = qreal(QFxItemPrivate::restart(lastPosTime)) / 1000.; + qreal elapsed = qreal(QmlGraphicsItemPrivate::restart(lastPosTime)) / 1000.; if (elapsed <= 0) elapsed = 1; if (q->yflick()) { @@ -697,14 +697,14 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) lastPos = event->pos(); } -void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); pressed = false; if (lastPosTime.isNull()) return; - if (QFxItemPrivate::elapsed(lastPosTime) > 100) { + if (QmlGraphicsItemPrivate::elapsed(lastPosTime) > 100) { // if we drag then pause before release we should not cause a flick. velocityX = 0.0; velocityY = 0.0; @@ -736,32 +736,32 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *even q->movementEnding(); } -void QFxFlickable::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsFlickable::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->handleMousePressEvent(event); event->accept(); } -void QFxFlickable::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsFlickable::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->handleMouseMoveEvent(event); event->accept(); } -void QFxFlickable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsFlickable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->clearDelayedPress(); d->handleMouseReleaseEvent(event); event->accept(); ungrabMouse(); } -void QFxFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *event) +void QmlGraphicsFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *event) { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); if (!q->scene() || pressDelay <= 0) return; delayedPressTarget = q->scene()->mouseGrabberItem(); @@ -787,7 +787,7 @@ void QFxFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *event) delayedPressTimer.start(pressDelay, q); } -void QFxFlickablePrivate::clearDelayedPress() +void QmlGraphicsFlickablePrivate::clearDelayedPress() { if (delayedPressEvent) { delayedPressTimer.stop(); @@ -796,13 +796,13 @@ void QFxFlickablePrivate::clearDelayedPress() } } -void QFxFlickable::timerEvent(QTimerEvent *event) +void QmlGraphicsFlickable::timerEvent(QTimerEvent *event) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (event->timerId() == d->delayedPressTimer.timerId()) { d->delayedPressTimer.stop(); if (d->delayedPressEvent) { - QFxItem *grabber = scene() ? qobject_cast(scene()->mouseGrabberItem()) : 0; + QmlGraphicsItem *grabber = scene() ? qobject_cast(scene()->mouseGrabberItem()) : 0; if (!grabber || grabber != this) scene()->sendEvent(d->delayedPressTarget, d->delayedPressEvent); delete d->delayedPressEvent; @@ -811,32 +811,32 @@ void QFxFlickable::timerEvent(QTimerEvent *event) } } -qreal QFxFlickable::minYExtent() const +qreal QmlGraphicsFlickable::minYExtent() const { return 0.0; } -qreal QFxFlickable::minXExtent() const +qreal QmlGraphicsFlickable::minXExtent() const { return 0.0; } /* returns -ve */ -qreal QFxFlickable::maxXExtent() const +qreal QmlGraphicsFlickable::maxXExtent() const { return width() - vWidth(); } /* returns -ve */ -qreal QFxFlickable::maxYExtent() const +qreal QmlGraphicsFlickable::maxYExtent() const { return height() - vHeight(); } -void QFxFlickable::viewportMoved() +void QmlGraphicsFlickable::viewportMoved() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); - int elapsed = QFxItemPrivate::elapsed(d->velocityTime); + int elapsed = QmlGraphicsItemPrivate::elapsed(d->velocityTime); if (elapsed) { qreal prevY = d->lastFlickablePosition.x(); @@ -861,7 +861,7 @@ void QFxFlickable::viewportMoved() } d->lastFlickablePosition = QPointF(d->_moveY.value(), d->_moveX.value()); - QFxItemPrivate::restart(d->velocityTime); + QmlGraphicsItemPrivate::restart(d->velocityTime); d->updateBeginningEnd(); if (d->flicked) { @@ -889,61 +889,61 @@ void QFxFlickable::viewportMoved() } } -void QFxFlickable::cancelFlick() +void QmlGraphicsFlickable::cancelFlick() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->timeline.reset(d->_moveX); d->timeline.reset(d->_moveY); movementEnding(); } -void QFxFlickablePrivate::data_removeAt(int) +void QmlGraphicsFlickablePrivate::data_removeAt(int) { // ### } -int QFxFlickablePrivate::data_count() const +int QmlGraphicsFlickablePrivate::data_count() const { // ### return 0; } -void QFxFlickablePrivate::data_append(QObject *o) +void QmlGraphicsFlickablePrivate::data_append(QObject *o) { - Q_Q(QFxFlickable); - QFxItem *i = qobject_cast(o); + Q_Q(QmlGraphicsFlickable); + QmlGraphicsItem *i = qobject_cast(o); if (i) viewport->fxChildren()->append(i); else o->setParent(q); } -void QFxFlickablePrivate::data_insert(int, QObject *) +void QmlGraphicsFlickablePrivate::data_insert(int, QObject *) { // ### } -QObject *QFxFlickablePrivate::data_at(int) const +QObject *QmlGraphicsFlickablePrivate::data_at(int) const { // ### return 0; } -void QFxFlickablePrivate::data_clear() +void QmlGraphicsFlickablePrivate::data_clear() { // ### } -QmlList *QFxFlickable::flickableData() +QmlList *QmlGraphicsFlickable::flickableData() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); return &d->data; } -QmlList *QFxFlickable::flickableChildren() +QmlList *QmlGraphicsFlickable::flickableChildren() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); return d->viewport->fxChildren(); } @@ -957,15 +957,15 @@ QmlList *QFxFlickable::flickableChildren() the feeling that the edges of the view are soft, rather than a hard physical boundary. */ -bool QFxFlickable::overShoot() const +bool QmlGraphicsFlickable::overShoot() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->overShoot; } -void QFxFlickable::setOverShoot(bool o) +void QmlGraphicsFlickable::setOverShoot(bool o) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->overShoot = o; } @@ -983,15 +983,15 @@ void QFxFlickable::setOverShoot(bool o) } \endcode */ -qreal QFxFlickable::viewportWidth() const +qreal QmlGraphicsFlickable::viewportWidth() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->vWidth; } -void QFxFlickable::setViewportWidth(qreal w) +void QmlGraphicsFlickable::setViewportWidth(qreal w) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (d->vWidth == w) return; d->vWidth = w; @@ -1006,9 +1006,9 @@ void QFxFlickable::setViewportWidth(qreal w) d->updateBeginningEnd(); } -void QFxFlickable::widthChange() +void QmlGraphicsFlickable::widthChange() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (d->vWidth < 0) { d->viewport->setWidth(width()); emit viewportWidthChanged(); @@ -1016,9 +1016,9 @@ void QFxFlickable::widthChange() d->updateBeginningEnd(); } -void QFxFlickable::heightChange() +void QmlGraphicsFlickable::heightChange() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (d->vHeight < 0) { d->viewport->setHeight(height()); emit viewportHeightChanged(); @@ -1026,15 +1026,15 @@ void QFxFlickable::heightChange() d->updateBeginningEnd(); } -qreal QFxFlickable::viewportHeight() const +qreal QmlGraphicsFlickable::viewportHeight() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->vHeight; } -void QFxFlickable::setViewportHeight(qreal h) +void QmlGraphicsFlickable::setViewportHeight(qreal h) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (d->vHeight == h) return; d->vHeight = h; @@ -1049,42 +1049,42 @@ void QFxFlickable::setViewportHeight(qreal h) d->updateBeginningEnd(); } -qreal QFxFlickable::vWidth() const +qreal QmlGraphicsFlickable::vWidth() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); if (d->vWidth < 0) return width(); else return d->vWidth; } -qreal QFxFlickable::vHeight() const +qreal QmlGraphicsFlickable::vHeight() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); if (d->vHeight < 0) return height(); else return d->vHeight; } -bool QFxFlickable::xflick() const +bool QmlGraphicsFlickable::xflick() const { return vWidth() != width(); } -bool QFxFlickable::yflick() const +bool QmlGraphicsFlickable::yflick() const { return vHeight() != height(); } -bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) +bool QmlGraphicsFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); QGraphicsSceneMouseEvent mouseEvent(event->type()); QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect(); QGraphicsScene *s = scene(); - QFxItem *grabber = s ? qobject_cast(s->mouseGrabberItem()) : 0; + QmlGraphicsItem *grabber = s ? qobject_cast(s->mouseGrabberItem()) : 0; if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { mouseEvent.setAccepted(false); for (int i = 0x1; i <= 0x10; i <<= 1) { @@ -1119,7 +1119,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) default: break; } - grabber = qobject_cast(s->mouseGrabberItem()); + grabber = qobject_cast(s->mouseGrabberItem()); if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this) { d->clearDelayedPress(); grabMouse(); @@ -1134,10 +1134,10 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) return false; } -bool QFxFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) +bool QmlGraphicsFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) { if (!isVisible()) - return QFxItem::sceneEventFilter(i, e); + return QmlGraphicsItem::sceneEventFilter(i, e); switch (e->type()) { case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: @@ -1147,7 +1147,7 @@ bool QFxFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) break; } - return QFxItem::sceneEventFilter(i, e); + return QmlGraphicsItem::sceneEventFilter(i, e); } /*! @@ -1156,15 +1156,15 @@ bool QFxFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) The default is 5000 pixels/s */ -qreal QFxFlickable::maximumFlickVelocity() const +qreal QmlGraphicsFlickable::maximumFlickVelocity() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->maxVelocity; } -void QFxFlickable::setMaximumFlickVelocity(qreal v) +void QmlGraphicsFlickable::setMaximumFlickVelocity(qreal v) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (v == d->maxVelocity) return; d->maxVelocity = v; @@ -1176,21 +1176,21 @@ void QFxFlickable::setMaximumFlickVelocity(qreal v) The default is 500. */ -qreal QFxFlickable::flickDeceleration() const +qreal QmlGraphicsFlickable::flickDeceleration() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->deceleration; } -void QFxFlickable::setFlickDeceleration(qreal deceleration) +void QmlGraphicsFlickable::setFlickDeceleration(qreal deceleration) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); d->deceleration = deceleration; } -bool QFxFlickable::isFlicking() const +bool QmlGraphicsFlickable::isFlicking() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->flicked; } @@ -1205,29 +1205,29 @@ bool QFxFlickable::isFlicking() const the press event will not be delivered. If the button is released within the timeout, both the press and release will be delivered. */ -int QFxFlickable::pressDelay() const +int QmlGraphicsFlickable::pressDelay() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->pressDelay; } -void QFxFlickable::setPressDelay(int delay) +void QmlGraphicsFlickable::setPressDelay(int delay) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (d->pressDelay == delay) return; d->pressDelay = delay; } -qreal QFxFlickable::reportedVelocitySmoothing() const +qreal QmlGraphicsFlickable::reportedVelocitySmoothing() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->reportedVelocitySmoothing; } -void QFxFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) +void QmlGraphicsFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); Q_ASSERT(reportedVelocitySmoothing >= 0); if (reportedVelocitySmoothing == d->reportedVelocitySmoothing) return; @@ -1235,15 +1235,15 @@ void QFxFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) emit reportedVelocitySmoothingChanged(reportedVelocitySmoothing); } -bool QFxFlickable::isMoving() const +bool QmlGraphicsFlickable::isMoving() const { - Q_D(const QFxFlickable); + Q_D(const QmlGraphicsFlickable); return d->moving; } -void QFxFlickable::movementStarting() +void QmlGraphicsFlickable::movementStarting() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (!d->moving) { d->moving = true; emit movingChanged(); @@ -1251,9 +1251,9 @@ void QFxFlickable::movementStarting() } } -void QFxFlickable::movementEnding() +void QmlGraphicsFlickable::movementEnding() { - Q_D(QFxFlickable); + Q_D(QmlGraphicsFlickable); if (d->moving) { d->moving = false; emit movingChanged(); @@ -1268,16 +1268,16 @@ void QFxFlickable::movementEnding() d->verticalVelocity.setValue(0); } -void QFxFlickablePrivate::updateVelocity() +void QmlGraphicsFlickablePrivate::updateVelocity() { - Q_Q(QFxFlickable); + Q_Q(QmlGraphicsFlickable); emit q->horizontalVelocityChanged(); emit q->verticalVelocityChanged(); } QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxFlickableVisibleArea) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisibleArea,QFxFlickableVisibleArea) +QML_DECLARE_TYPE(QmlGraphicsFlickableVisibleArea) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisibleArea,QmlGraphicsFlickableVisibleArea) #include "qfxflickable.moc" diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index 3db4ca7..634fe88 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -50,9 +50,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxFlickablePrivate; -class QFxFlickableVisibleArea; -class Q_DECLARATIVE_EXPORT QFxFlickable : public QFxItem +class QmlGraphicsFlickablePrivate; +class QmlGraphicsFlickableVisibleArea; +class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem { Q_OBJECT @@ -79,18 +79,18 @@ class Q_DECLARATIVE_EXPORT QFxFlickable : public QFxItem Q_PROPERTY(bool atXBeginning READ isAtXBeginning NOTIFY isAtBoundaryChanged) Q_PROPERTY(bool atYBeginning READ isAtYBeginning NOTIFY isAtBoundaryChanged) - Q_PROPERTY(QFxFlickableVisibleArea *visibleArea READ visibleArea CONSTANT) + Q_PROPERTY(QmlGraphicsFlickableVisibleArea *visibleArea READ visibleArea CONSTANT) Q_PROPERTY(QmlList* flickableData READ flickableData) - Q_PROPERTY(QmlList* flickableChildren READ flickableChildren) + Q_PROPERTY(QmlList* flickableChildren READ flickableChildren) Q_CLASSINFO("DefaultProperty", "flickableData") public: - QFxFlickable(QFxItem *parent=0); - ~QFxFlickable(); + QmlGraphicsFlickable(QmlGraphicsItem *parent=0); + ~QmlGraphicsFlickable(); QmlList *flickableData(); - QmlList *flickableChildren(); + QmlList *flickableChildren(); bool overShoot() const; void setOverShoot(bool); @@ -133,7 +133,7 @@ public: bool isAtYEnd() const; bool isAtYBeginning() const; - QFxItem *viewport(); + QmlGraphicsItem *viewport(); Q_SIGNALS: void viewportWidthChanged(); @@ -162,7 +162,7 @@ protected: qreal visibleX() const; qreal visibleY() const; - QFxFlickableVisibleArea *visibleArea(); + QmlGraphicsFlickableVisibleArea *visibleArea(); protected Q_SLOTS: virtual void ticked(); @@ -186,17 +186,17 @@ protected: void cancelFlick(); protected: - QFxFlickable(QFxFlickablePrivate &dd, QFxItem *parent); + QmlGraphicsFlickable(QmlGraphicsFlickablePrivate &dd, QmlGraphicsItem *parent); private: - Q_DISABLE_COPY(QFxFlickable) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxFlickable) - friend class QFxFlickableVisibleArea; + Q_DISABLE_COPY(QmlGraphicsFlickable) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsFlickable) + friend class QmlGraphicsFlickableVisibleArea; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxFlickable) +QML_DECLARE_TYPE(QmlGraphicsFlickable) QT_END_HEADER diff --git a/src/declarative/fx/qfxflickable_p.h b/src/declarative/fx/qfxflickable_p.h index 07d66b8..5e9863f 100644 --- a/src/declarative/fx/qfxflickable_p.h +++ b/src/declarative/fx/qfxflickable_p.h @@ -62,13 +62,13 @@ QT_BEGIN_NAMESPACE -class QFxFlickableVisibleArea; -class QFxFlickablePrivate : public QFxItemPrivate +class QmlGraphicsFlickableVisibleArea; +class QmlGraphicsFlickablePrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxFlickable) + Q_DECLARE_PUBLIC(QmlGraphicsFlickable) public: - QFxFlickablePrivate(); + QmlGraphicsFlickablePrivate(); void init(); virtual void flickX(qreal velocity); virtual void flickY(qreal velocity); @@ -80,9 +80,9 @@ public: void clearDelayedPress(); public: - QFxItem *viewport; - QmlTimeLineValueProxy _moveX; - QmlTimeLineValueProxy _moveY; + QmlGraphicsItem *viewport; + QmlTimeLineValueProxy _moveX; + QmlTimeLineValueProxy _moveY; QmlTimeLine timeline; qreal vWidth; qreal vHeight; @@ -121,19 +121,19 @@ public: void updateVelocity(); struct Velocity : public QmlTimeLineValue { - Velocity(QFxFlickablePrivate *p) + Velocity(QmlGraphicsFlickablePrivate *p) : parent(p) {} virtual void setValue(qreal v) { QmlTimeLineValue::setValue(v); parent->updateVelocity(); } - QFxFlickablePrivate *parent; + QmlGraphicsFlickablePrivate *parent; }; Velocity horizontalVelocity; Velocity verticalVelocity; int vTime; QmlTimeLine velocityTimeline; - QFxFlickableVisibleArea *visibleArea; + QmlGraphicsFlickableVisibleArea *visibleArea; void handleMousePressEvent(QGraphicsSceneMouseEvent *); void handleMouseMoveEvent(QGraphicsSceneMouseEvent *); @@ -147,8 +147,8 @@ public: QObject *data_at(int) const; void data_clear(); - friend class QFxFlickableVisibleArea; - QML_DECLARE_LIST_PROXY(QFxFlickablePrivate, QObject *, data) + friend class QmlGraphicsFlickableVisibleArea; + QML_DECLARE_LIST_PROXY(QmlGraphicsFlickablePrivate, QObject *, data) }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index d381cfe..090f8a0 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -46,23 +46,23 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flipable,QFxFlipable) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flipable,QmlGraphicsFlipable) -class QFxFlipablePrivate : public QFxItemPrivate +class QmlGraphicsFlipablePrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxFlipable) + Q_DECLARE_PUBLIC(QmlGraphicsFlipable) public: - QFxFlipablePrivate() : current(QFxFlipable::Front), front(0), back(0) {} + QmlGraphicsFlipablePrivate() : current(QmlGraphicsFlipable::Front), front(0), back(0) {} void updateSceneTransformFromParent(); - QFxFlipable::Side current; - QFxItem *front; - QFxItem *back; + QmlGraphicsFlipable::Side current; + QmlGraphicsItem *front; + QmlGraphicsItem *back; }; /*! - \qmlclass Flipable QFxFlipable + \qmlclass Flipable QmlGraphicsFlipable \brief The Flipable item provides a surface that can be flipped. \inherits Item @@ -107,21 +107,21 @@ public: /*! \internal - \class QFxFlipable - \brief The QFxFlipable class provides a flipable surface. + \class QmlGraphicsFlipable + \brief The QmlGraphicsFlipable class provides a flipable surface. \ingroup group_widgets - QFxFlipable allows you to specify a front and a back, as well as an + QmlGraphicsFlipable allows you to specify a front and a back, as well as an axis for the flip. */ -QFxFlipable::QFxFlipable(QFxItem *parent) -: QFxItem(*(new QFxFlipablePrivate), parent) +QmlGraphicsFlipable::QmlGraphicsFlipable(QmlGraphicsItem *parent) +: QmlGraphicsItem(*(new QmlGraphicsFlipablePrivate), parent) { } -QFxFlipable::~QFxFlipable() +QmlGraphicsFlipable::~QmlGraphicsFlipable() { } @@ -132,15 +132,15 @@ QFxFlipable::~QFxFlipable() The front and back sides of the flipable. */ -QFxItem *QFxFlipable::front() +QmlGraphicsItem *QmlGraphicsFlipable::front() { - Q_D(const QFxFlipable); + Q_D(const QmlGraphicsFlipable); return d->front; } -void QFxFlipable::setFront(QFxItem *front) +void QmlGraphicsFlipable::setFront(QmlGraphicsItem *front) { - Q_D(QFxFlipable); + Q_D(QmlGraphicsFlipable); if (d->front) { qmlInfo(tr("front is a write-once property"),this); return; @@ -151,15 +151,15 @@ void QFxFlipable::setFront(QFxItem *front) d->front->setOpacity(0.); } -QFxItem *QFxFlipable::back() +QmlGraphicsItem *QmlGraphicsFlipable::back() { - Q_D(const QFxFlipable); + Q_D(const QmlGraphicsFlipable); return d->back; } -void QFxFlipable::setBack(QFxItem *back) +void QmlGraphicsFlipable::setBack(QmlGraphicsItem *back) { - Q_D(QFxFlipable); + Q_D(QmlGraphicsFlipable); if (d->back) { qmlInfo(tr("back is a write-once property"),this); return; @@ -176,11 +176,11 @@ void QFxFlipable::setBack(QFxItem *back) The side of the Flippable currently visible. Possible values are \c Front and \c Back. */ -QFxFlipable::Side QFxFlipable::side() const +QmlGraphicsFlipable::Side QmlGraphicsFlipable::side() const { - Q_D(const QFxFlipable); + Q_D(const QmlGraphicsFlipable); if (d->dirtySceneTransform) - const_cast(d)->updateSceneTransformFromParent(); + const_cast(d)->updateSceneTransformFromParent(); return d->current; } @@ -188,11 +188,11 @@ QFxFlipable::Side QFxFlipable::side() const // determination on the currently visible side of the flipable // has to be done on the complete scene transform to give // correct results. -void QFxFlipablePrivate::updateSceneTransformFromParent() +void QmlGraphicsFlipablePrivate::updateSceneTransformFromParent() { - Q_Q(QFxFlipable); + Q_Q(QmlGraphicsFlipable); - QFxItemPrivate::updateSceneTransformFromParent(); + QmlGraphicsItemPrivate::updateSceneTransformFromParent(); QPointF p1(0, 0); QPointF p2(1, 0); QPointF p3(1, 1); @@ -204,16 +204,16 @@ void QFxFlipablePrivate::updateSceneTransformFromParent() qreal cross = (p1.x() - p2.x()) * (p3.y() - p2.y()) - (p1.y() - p2.y()) * (p3.x() - p2.x()); - QFxFlipable::Side newSide; + QmlGraphicsFlipable::Side newSide; if (cross > 0) { - newSide = QFxFlipable::Back; + newSide = QmlGraphicsFlipable::Back; } else { - newSide = QFxFlipable::Front; + newSide = QmlGraphicsFlipable::Front; } if (newSide != current) { current = newSide; - if (current == QFxFlipable::Back) { + if (current == QmlGraphicsFlipable::Back) { QTransform mat; mat.translate(back->width()/2,back->height()/2); if (back->width() && p1.x() >= p2.x()) @@ -224,9 +224,9 @@ void QFxFlipablePrivate::updateSceneTransformFromParent() back->setTransform(mat); } if (front) - front->setOpacity((current==QFxFlipable::Front)?1.:0.); + front->setOpacity((current==QmlGraphicsFlipable::Front)?1.:0.); if (back) - back->setOpacity((current==QFxFlipable::Back)?1.:0.); + back->setOpacity((current==QmlGraphicsFlipable::Back)?1.:0.); emit q->sideChanged(); } } diff --git a/src/declarative/fx/qfxflipable.h b/src/declarative/fx/qfxflipable.h index e1bd9ea..1b10d48 100644 --- a/src/declarative/fx/qfxflipable.h +++ b/src/declarative/fx/qfxflipable.h @@ -53,26 +53,26 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxFlipablePrivate; -class Q_DECLARATIVE_EXPORT QFxFlipable : public QFxItem +class QmlGraphicsFlipablePrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsFlipable : public QmlGraphicsItem { Q_OBJECT Q_ENUMS(Side) - Q_PROPERTY(QFxItem *front READ front WRITE setFront) - Q_PROPERTY(QFxItem *back READ back WRITE setBack) + Q_PROPERTY(QmlGraphicsItem *front READ front WRITE setFront) + Q_PROPERTY(QmlGraphicsItem *back READ back WRITE setBack) Q_PROPERTY(Side side READ side NOTIFY sideChanged) //### flipAxis //### flipRotation public: - QFxFlipable(QFxItem *parent=0); - ~QFxFlipable(); + QmlGraphicsFlipable(QmlGraphicsItem *parent=0); + ~QmlGraphicsFlipable(); - QFxItem *front(); - void setFront(QFxItem *); + QmlGraphicsItem *front(); + void setFront(QmlGraphicsItem *); - QFxItem *back(); - void setBack(QFxItem *); + QmlGraphicsItem *back(); + void setBack(QmlGraphicsItem *); enum Side { Front, Back }; Side side() const; @@ -81,13 +81,13 @@ Q_SIGNALS: void sideChanged(); private: - Q_DISABLE_COPY(QFxFlipable) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxFlipable) + Q_DISABLE_COPY(QmlGraphicsFlipable) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsFlipable) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxFlipable) +QML_DECLARE_TYPE(QmlGraphicsFlipable) QT_END_HEADER diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp index 3bb0b25..3d246a0 100644 --- a/src/declarative/fx/qfxfocuspanel.cpp +++ b/src/declarative/fx/qfxfocuspanel.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusPanel,QFxFocusPanel) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusPanel,QmlGraphicsFocusPanel) /*! \qmlclass FocusPanel @@ -59,16 +59,16 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusPanel,QFxFocusPanel) /*! \internal - \class QFxFocusPanel + \class QmlGraphicsFocusPanel */ -QFxFocusPanel::QFxFocusPanel(QFxItem *parent) : - QFxItem(parent) +QmlGraphicsFocusPanel::QmlGraphicsFocusPanel(QmlGraphicsItem *parent) : + QmlGraphicsItem(parent) { setFlag(ItemIsPanel); } -QFxFocusPanel::~QFxFocusPanel() +QmlGraphicsFocusPanel::~QmlGraphicsFocusPanel() { } @@ -78,12 +78,12 @@ QFxFocusPanel::~QFxFocusPanel() Sets whether the item is the active focus panel. */ -bool QFxFocusPanel::sceneEvent(QEvent *event) +bool QmlGraphicsFocusPanel::sceneEvent(QEvent *event) { if (event->type() == QEvent::WindowActivate || event->type() == QEvent::WindowDeactivate) emit activeChanged(); - return QFxItem::sceneEvent(event); + return QmlGraphicsItem::sceneEvent(event); } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxfocuspanel.h b/src/declarative/fx/qfxfocuspanel.h index 1fea011..43eb96e 100644 --- a/src/declarative/fx/qfxfocuspanel.h +++ b/src/declarative/fx/qfxfocuspanel.h @@ -50,13 +50,13 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QFxFocusPanel : public QFxItem +class Q_DECLARATIVE_EXPORT QmlGraphicsFocusPanel : public QmlGraphicsItem { Q_OBJECT Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) public: - QFxFocusPanel(QFxItem *parent=0); - virtual ~QFxFocusPanel(); + QmlGraphicsFocusPanel(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsFocusPanel(); Q_SIGNALS: void activeChanged(); @@ -65,12 +65,12 @@ protected: bool sceneEvent(QEvent *event); private: - Q_DISABLE_COPY(QFxFocusPanel) + Q_DISABLE_COPY(QmlGraphicsFocusPanel) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxFocusPanel) +QML_DECLARE_TYPE(QmlGraphicsFocusPanel) QT_END_HEADER diff --git a/src/declarative/fx/qfxfocusscope.cpp b/src/declarative/fx/qfxfocusscope.cpp index 9bcc17e..468d532 100644 --- a/src/declarative/fx/qfxfocusscope.cpp +++ b/src/declarative/fx/qfxfocusscope.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusScope,QFxFocusScope) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusScope,QmlGraphicsFocusScope) /*! \qmlclass FocusScope @@ -57,16 +57,16 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusScope,QFxFocusScope) /*! \internal - \class QFxFocusScope + \class QmlGraphicsFocusScope */ -QFxFocusScope::QFxFocusScope(QFxItem *parent) : - QFxItem(parent) +QmlGraphicsFocusScope::QmlGraphicsFocusScope(QmlGraphicsItem *parent) : + QmlGraphicsItem(parent) { setFlag(QGraphicsItem::ItemIsFocusScope); } -QFxFocusScope::~QFxFocusScope() +QmlGraphicsFocusScope::~QmlGraphicsFocusScope() { } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxfocusscope.h b/src/declarative/fx/qfxfocusscope.h index e337fc6..126ccfc 100644 --- a/src/declarative/fx/qfxfocusscope.h +++ b/src/declarative/fx/qfxfocusscope.h @@ -51,17 +51,17 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) //### set component root as focusscope -class Q_DECLARATIVE_EXPORT QFxFocusScope : public QFxItem +class Q_DECLARATIVE_EXPORT QmlGraphicsFocusScope : public QmlGraphicsItem { Q_OBJECT public: - QFxFocusScope(QFxItem *parent=0); - virtual ~QFxFocusScope(); + QmlGraphicsFocusScope(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsFocusScope(); }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxFocusScope) +QML_DECLARE_TYPE(QmlGraphicsFocusScope) QT_END_HEADER diff --git a/src/declarative/fx/qfxgraphicsobjectcontainer.cpp b/src/declarative/fx/qfxgraphicsobjectcontainer.cpp index 5a61d12..0c9dc69 100644 --- a/src/declarative/fx/qfxgraphicsobjectcontainer.cpp +++ b/src/declarative/fx/qfxgraphicsobjectcontainer.cpp @@ -47,19 +47,19 @@ QT_BEGIN_NAMESPACE -class QFxGraphicsObjectContainerPrivate : public QFxItemPrivate +class QmlGraphicsGraphicsObjectContainerPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxGraphicsObjectContainer) + Q_DECLARE_PUBLIC(QmlGraphicsGraphicsObjectContainer) public: - QFxGraphicsObjectContainerPrivate() : QFxItemPrivate(), graphicsObject(0), syncedResize(false) + QmlGraphicsGraphicsObjectContainerPrivate() : QmlGraphicsItemPrivate(), graphicsObject(0), syncedResize(false) { } void _q_updateSize(); void setFiltering(bool on) { - Q_Q(QFxGraphicsObjectContainer); + Q_Q(QmlGraphicsGraphicsObjectContainer); if (graphicsObject && graphicsObject->isWidget()) { if (!on) { graphicsObject->removeEventFilter(q); @@ -80,31 +80,31 @@ public: /*! - \qmlclass GraphicsObjectContainer QFxGraphicsObjectContainer + \qmlclass GraphicsObjectContainer QmlGraphicsGraphicsObjectContainer \brief The GraphicsObjectContainer element allows you to add QGraphicsObjects into Fluid UI elements. */ /*! \internal - \class QFxGraphicsObjectContainer - \brief The QFxGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications. + \class QmlGraphicsGraphicsObjectContainer + \brief The QmlGraphicsGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications. */ QML_DEFINE_NOCREATE_TYPE(QGraphicsObject) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GraphicsObjectContainer,QFxGraphicsObjectContainer) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GraphicsObjectContainer,QmlGraphicsGraphicsObjectContainer) -QFxGraphicsObjectContainer::QFxGraphicsObjectContainer(QFxItem *parent) -: QFxItem(*new QFxGraphicsObjectContainerPrivate, parent) +QmlGraphicsGraphicsObjectContainer::QmlGraphicsGraphicsObjectContainer(QmlGraphicsItem *parent) +: QmlGraphicsItem(*new QmlGraphicsGraphicsObjectContainerPrivate, parent) { } -QFxGraphicsObjectContainer::~QFxGraphicsObjectContainer() +QmlGraphicsGraphicsObjectContainer::~QmlGraphicsGraphicsObjectContainer() { } -QGraphicsObject *QFxGraphicsObjectContainer::graphicsObject() const +QGraphicsObject *QmlGraphicsGraphicsObjectContainer::graphicsObject() const { - Q_D(const QFxGraphicsObjectContainer); + Q_D(const QmlGraphicsGraphicsObjectContainer); return d->graphicsObject; } @@ -112,9 +112,9 @@ QGraphicsObject *QFxGraphicsObjectContainer::graphicsObject() const \qmlproperty QGraphicsObject GraphicsObjectContainer::graphicsObject The QGraphicsObject associated with this element. */ -void QFxGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object) +void QmlGraphicsGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object) { - Q_D(QFxGraphicsObjectContainer); + Q_D(QmlGraphicsGraphicsObjectContainer); if (object == d->graphicsObject) return; @@ -147,20 +147,20 @@ void QFxGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object) } } -QVariant QFxGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value) +QVariant QmlGraphicsGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value) { - Q_D(QFxGraphicsObjectContainer); + Q_D(QmlGraphicsGraphicsObjectContainer); if (change == ItemSceneHasChanged) { QGraphicsObject *o = d->graphicsObject; d->graphicsObject = 0; setGraphicsObject(o); } - return QFxItem::itemChange(change, value); + return QmlGraphicsItem::itemChange(change, value); } -bool QFxGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e) +bool QmlGraphicsGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e) { - Q_D(QFxGraphicsObjectContainer); + Q_D(QmlGraphicsGraphicsObjectContainer); if (watched == d->graphicsObject && e->type() == QEvent::GraphicsSceneResize) { if (d->graphicsObject && d->graphicsObject->isWidget() && d->syncedResize) { QSizeF newSize = static_cast(d->graphicsObject)->size(); @@ -168,7 +168,7 @@ bool QFxGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e) setImplicitHeight(newSize.height()); } } - return QFxItem::eventFilter(watched, e); + return QmlGraphicsItem::eventFilter(watched, e); } /*! @@ -190,15 +190,15 @@ bool QFxGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e) widget's size will be reflected in the container. \endlist */ -bool QFxGraphicsObjectContainer::synchronizedResizing() const +bool QmlGraphicsGraphicsObjectContainer::synchronizedResizing() const { - Q_D(const QFxGraphicsObjectContainer); + Q_D(const QmlGraphicsGraphicsObjectContainer); return d->syncedResize; } -void QFxGraphicsObjectContainer::setSynchronizedResizing(bool on) +void QmlGraphicsGraphicsObjectContainer::setSynchronizedResizing(bool on) { - Q_D(QFxGraphicsObjectContainer); + Q_D(QmlGraphicsGraphicsObjectContainer); if (on == d->syncedResize) return; @@ -206,7 +206,7 @@ void QFxGraphicsObjectContainer::setSynchronizedResizing(bool on) d->setFiltering(on); } -void QFxGraphicsObjectContainerPrivate::_q_updateSize() +void QmlGraphicsGraphicsObjectContainerPrivate::_q_updateSize() { if (!graphicsObject || !graphicsObject->isWidget() || !syncedResize) return; diff --git a/src/declarative/fx/qfxgraphicsobjectcontainer.h b/src/declarative/fx/qfxgraphicsobjectcontainer.h index 656a7f8..2ed5c1f 100644 --- a/src/declarative/fx/qfxgraphicsobjectcontainer.h +++ b/src/declarative/fx/qfxgraphicsobjectcontainer.h @@ -51,9 +51,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QGraphicsObject; -class QFxGraphicsObjectContainerPrivate; +class QmlGraphicsGraphicsObjectContainerPrivate; -class Q_DECLARATIVE_EXPORT QFxGraphicsObjectContainer : public QFxItem +class Q_DECLARATIVE_EXPORT QmlGraphicsGraphicsObjectContainer : public QmlGraphicsItem { Q_OBJECT @@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QFxGraphicsObjectContainer : public QFxItem Q_PROPERTY(bool synchronizedResizing READ synchronizedResizing WRITE setSynchronizedResizing) public: - QFxGraphicsObjectContainer(QFxItem *parent = 0); - ~QFxGraphicsObjectContainer(); + QmlGraphicsGraphicsObjectContainer(QmlGraphicsItem *parent = 0); + ~QmlGraphicsGraphicsObjectContainer(); QGraphicsObject *graphicsObject() const; void setGraphicsObject(QGraphicsObject *); @@ -77,13 +77,13 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_updateSize()) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxGraphicsObjectContainer) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsGraphicsObjectContainer) }; QT_END_NAMESPACE QML_DECLARE_TYPE(QGraphicsObject) -QML_DECLARE_TYPE(QFxGraphicsObjectContainer) +QML_DECLARE_TYPE(QmlGraphicsGraphicsObjectContainer) QT_END_HEADER diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index c07258d..5ed82d7 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -49,18 +49,18 @@ QT_BEGIN_NAMESPACE -class QFxGridViewAttached : public QObject +class QmlGraphicsGridViewAttached : public QObject { Q_OBJECT public: - QFxGridViewAttached(QObject *parent) + QmlGraphicsGridViewAttached(QObject *parent) : QObject(parent), m_isCurrent(false), m_delayRemove(false) {} - ~QFxGridViewAttached() { + ~QmlGraphicsGridViewAttached() { attachedProperties.remove(parent()); } - Q_PROPERTY(QFxGridView *view READ view CONSTANT) - QFxGridView *view() { return m_view; } + Q_PROPERTY(QmlGraphicsGridView *view READ view CONSTANT) + QmlGraphicsGridView *view() { return m_view; } Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) bool isCurrentItem() const { return m_isCurrent; } @@ -80,10 +80,10 @@ public: } } - static QFxGridViewAttached *properties(QObject *obj) { - QFxGridViewAttached *rv = attachedProperties.value(obj); + static QmlGraphicsGridViewAttached *properties(QObject *obj) { + QmlGraphicsGridViewAttached *rv = attachedProperties.value(obj); if (!rv) { - rv = new QFxGridViewAttached(obj); + rv = new QmlGraphicsGridViewAttached(obj); attachedProperties.insert(obj, rv); } return rv; @@ -99,14 +99,14 @@ Q_SIGNALS: void remove(); public: - QFxGridView *m_view; + QmlGraphicsGridView *m_view; bool m_isCurrent; bool m_delayRemove; - static QHash attachedProperties; + static QHash attachedProperties; }; -QHash QFxGridViewAttached::attachedProperties; +QHash QmlGraphicsGridViewAttached::attachedProperties; //---------------------------------------------------------------------------- @@ -114,42 +114,42 @@ QHash QFxGridViewAttached::attachedProperties; class FxGridItem { public: - FxGridItem(QFxItem *i, QFxGridView *v) : item(i), view(v) { - attached = QFxGridViewAttached::properties(item); + FxGridItem(QmlGraphicsItem *i, QmlGraphicsGridView *v) : item(i), view(v) { + attached = QmlGraphicsGridViewAttached::properties(item); attached->m_view = view; } ~FxGridItem() {} - qreal rowPos() const { return (view->flow() == QFxGridView::LeftToRight ? item->y() : item->x()); } - qreal colPos() const { return (view->flow() == QFxGridView::LeftToRight ? item->x() : item->y()); } + qreal rowPos() const { return (view->flow() == QmlGraphicsGridView::LeftToRight ? item->y() : item->x()); } + qreal colPos() const { return (view->flow() == QmlGraphicsGridView::LeftToRight ? item->x() : item->y()); } qreal endRowPos() const { - return view->flow() == QFxGridView::LeftToRight + return view->flow() == QmlGraphicsGridView::LeftToRight ? item->y() + view->cellHeight() - 1 : item->x() + view->cellWidth() - 1; } void setPosition(qreal col, qreal row) { - if (view->flow() == QFxGridView::LeftToRight) { + if (view->flow() == QmlGraphicsGridView::LeftToRight) { item->setPos(QPointF(col, row)); } else { item->setPos(QPointF(row, col)); } } - QFxItem *item; - QFxGridView *view; - QFxGridViewAttached *attached; + QmlGraphicsItem *item; + QmlGraphicsGridView *view; + QmlGraphicsGridViewAttached *attached; int index; }; //---------------------------------------------------------------------------- -class QFxGridViewPrivate : public QFxFlickablePrivate +class QmlGraphicsGridViewPrivate : public QmlGraphicsFlickablePrivate { - Q_DECLARE_PUBLIC(QFxGridView) + Q_DECLARE_PUBLIC(QmlGraphicsGridView) public: - QFxGridViewPrivate() - : model(0), currentItem(0), flow(QFxGridView::LeftToRight) + QmlGraphicsGridViewPrivate() + : model(0), currentItem(0), flow(QmlGraphicsGridView::LeftToRight) , visiblePos(0), visibleIndex(0) , currentIndex(-1) , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1) , highlightComponent(0), highlight(0), trackedItem(0) @@ -184,19 +184,19 @@ public: } qreal position() const { - Q_Q(const QFxGridView); - return flow == QFxGridView::LeftToRight ? q->viewportY() : q->viewportX(); + Q_Q(const QmlGraphicsGridView); + return flow == QmlGraphicsGridView::LeftToRight ? q->viewportY() : q->viewportX(); } void setPosition(qreal pos) { - Q_Q(QFxGridView); - if (flow == QFxGridView::LeftToRight) + Q_Q(QmlGraphicsGridView); + if (flow == QmlGraphicsGridView::LeftToRight) q->setViewportY(pos); else q->setViewportX(pos); } int size() const { - Q_Q(const QFxGridView); - return flow == QFxGridView::LeftToRight ? q->height() : q->width(); + Q_Q(const QmlGraphicsGridView); + return flow == QmlGraphicsGridView::LeftToRight ? q->height() : q->width(); } qreal startPosition() const { qreal pos = 0; @@ -217,10 +217,10 @@ public: } int rowSize() const { - return flow == QFxGridView::LeftToRight ? cellHeight : cellWidth; + return flow == QmlGraphicsGridView::LeftToRight ? cellHeight : cellWidth; } int colSize() const { - return flow == QFxGridView::LeftToRight ? cellWidth : cellHeight; + return flow == QmlGraphicsGridView::LeftToRight ? cellWidth : cellHeight; } qreal colPosAt(int modelIndex) const { @@ -293,12 +293,12 @@ public: } } - QFxVisualModel *model; + QmlGraphicsVisualModel *model; QVariant modelVariant; QList visibleItems; - QHash unrequestedItems; + QHash unrequestedItems; FxGridItem *currentItem; - QFxGridView::Flow flow; + QmlGraphicsGridView::Flow flow; int visiblePos; int visibleIndex; int currentIndex; @@ -321,15 +321,15 @@ public: int fixCurrentVisibility : 1; }; -void QFxGridViewPrivate::init() +void QmlGraphicsGridViewPrivate::init() { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); q->setFlag(QGraphicsItem::ItemIsFocusScope); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(sizeChange())); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(sizeChange())); } -void QFxGridViewPrivate::clear() +void QmlGraphicsGridViewPrivate::clear() { for (int i = 0; i < visibleItems.count(); ++i) releaseItem(visibleItems.at(i)); @@ -343,13 +343,13 @@ void QFxGridViewPrivate::clear() trackedItem = 0; } -FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) +FxGridItem *QmlGraphicsGridViewPrivate::createItem(int modelIndex) { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); // create object requestedIndex = modelIndex; FxGridItem *listItem = 0; - if (QFxItem *item = model->item(modelIndex, false)) { + if (QmlGraphicsItem *item = model->item(modelIndex, false)) { listItem = new FxGridItem(item, q); listItem->index = modelIndex; // complete @@ -362,9 +362,9 @@ FxGridItem *QFxGridViewPrivate::createItem(int modelIndex) } -void QFxGridViewPrivate::releaseItem(FxGridItem *item) +void QmlGraphicsGridViewPrivate::releaseItem(FxGridItem *item) { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); if (!item) return; if (trackedItem == item) { @@ -379,9 +379,9 @@ void QFxGridViewPrivate::releaseItem(FxGridItem *item) delete item; } -void QFxGridViewPrivate::refill(qreal from, qreal to) +void QmlGraphicsGridViewPrivate::refill(qreal from, qreal to) { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); if (!isValid() || !q->isComponentComplete()) return; @@ -463,28 +463,28 @@ void QFxGridViewPrivate::refill(qreal from, qreal to) changed = true; } if (changed) { - if (flow == QFxGridView::LeftToRight) + if (flow == QmlGraphicsGridView::LeftToRight) q->setViewportHeight(endPosition() - startPosition()); else q->setViewportWidth(endPosition() - startPosition()); } } -void QFxGridViewPrivate::updateGrid() +void QmlGraphicsGridViewPrivate::updateGrid() { - Q_Q(QFxGridView); - columns = (int)qMax((flow == QFxGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.)); + Q_Q(QmlGraphicsGridView); + columns = (int)qMax((flow == QmlGraphicsGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.)); if (isValid()) { - if (flow == QFxGridView::LeftToRight) + if (flow == QmlGraphicsGridView::LeftToRight) q->setViewportHeight(endPosition() - startPosition()); else q->setViewportWidth(endPosition() - startPosition()); } } -void QFxGridViewPrivate::layout(bool removed) +void QmlGraphicsGridViewPrivate::layout(bool removed) { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); if (visibleItems.count()) { qreal rowPos = visibleItems.first()->rowPos(); qreal colPos = visibleItems.first()->colPos(); @@ -510,7 +510,7 @@ void QFxGridViewPrivate::layout(bool removed) q->refill(); q->trackedPositionChanged(); updateHighlight(); - if (flow == QFxGridView::LeftToRight) { + if (flow == QmlGraphicsGridView::LeftToRight) { q->setViewportHeight(endPosition() - startPosition()); fixupY(); } else { @@ -520,19 +520,19 @@ void QFxGridViewPrivate::layout(bool removed) updateUnrequestedPositions(); } -void QFxGridViewPrivate::updateUnrequestedIndexes() +void QmlGraphicsGridViewPrivate::updateUnrequestedIndexes() { - Q_Q(QFxGridView); - QHash::iterator it; + Q_Q(QmlGraphicsGridView); + QHash::iterator it; for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) *it = model->indexOf(it.key(), q); } -void QFxGridViewPrivate::updateUnrequestedPositions() +void QmlGraphicsGridViewPrivate::updateUnrequestedPositions() { - QHash::const_iterator it; + QHash::const_iterator it; for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { - if (flow == QFxGridView::LeftToRight) { + if (flow == QmlGraphicsGridView::LeftToRight) { it.key()->setPos(QPointF(colPosAt(*it), rowPosAt(*it))); } else { it.key()->setPos(QPointF(rowPosAt(*it), colPosAt(*it))); @@ -540,9 +540,9 @@ void QFxGridViewPrivate::updateUnrequestedPositions() } } -void QFxGridViewPrivate::updateTrackedItem() +void QmlGraphicsGridViewPrivate::updateTrackedItem() { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); FxGridItem *item = currentItem; if (highlight) item = highlight; @@ -563,9 +563,9 @@ void QFxGridViewPrivate::updateTrackedItem() q->trackedPositionChanged(); } -void QFxGridViewPrivate::createHighlight() +void QmlGraphicsGridViewPrivate::createHighlight() { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); if (highlight) { if (trackedItem == highlight) trackedItem = 0; @@ -586,7 +586,7 @@ void QFxGridViewPrivate::createHighlight() QObject *nobj = highlightComponent->create(highlightContext); if (nobj) { highlightContext->setParent(nobj); - QFxItem *item = qobject_cast(nobj); + QmlGraphicsItem *item = qobject_cast(nobj); if (item) { item->setParent(q->viewport()); highlight = new FxGridItem(item, q); @@ -605,7 +605,7 @@ void QFxGridViewPrivate::createHighlight() } } -void QFxGridViewPrivate::updateHighlight() +void QmlGraphicsGridViewPrivate::updateHighlight() { if ((!currentItem && highlight) || (currentItem && !highlight)) createHighlight(); @@ -619,9 +619,9 @@ void QFxGridViewPrivate::updateHighlight() } } -void QFxGridViewPrivate::updateCurrent(int modelIndex) +void QmlGraphicsGridViewPrivate::updateCurrent(int modelIndex) { - Q_Q(QFxGridView); + Q_Q(QmlGraphicsGridView); if (!isValid() || modelIndex < 0 || modelIndex >= model->count()) { if (currentItem) { currentItem->attached->setIsCurrentItem(false); @@ -680,16 +680,16 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex) In this case ListModel is a handy way for us to test our UI. In practice the model would be implemented in C++, or perhaps via a SQL data source. */ -QFxGridView::QFxGridView(QFxItem *parent) - : QFxFlickable(*(new QFxGridViewPrivate), parent) +QmlGraphicsGridView::QmlGraphicsGridView(QmlGraphicsItem *parent) + : QmlGraphicsFlickable(*(new QmlGraphicsGridViewPrivate), parent) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); d->init(); } -QFxGridView::~QFxGridView() +QmlGraphicsGridView::~QmlGraphicsGridView() { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); d->clear(); if (d->ownModel) delete d->model; @@ -758,27 +758,27 @@ QFxGridView::~QFxGridView() \sa {qmlmodels}{Data Models} */ -QVariant QFxGridView::model() const +QVariant QmlGraphicsGridView::model() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->modelVariant; } -void QFxGridView::setModel(const QVariant &model) +void QmlGraphicsGridView::setModel(const QVariant &model) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); - disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); - disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); + disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); + disconnect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*))); } d->clear(); d->modelVariant = model; QObject *object = qvariant_cast(model); - QFxVisualModel *vim = 0; - if (object && (vim = qobject_cast(object))) { + QmlGraphicsVisualModel *vim = 0; + if (object && (vim = qobject_cast(object))) { if (d->ownModel) { delete d->model; d->ownModel = false; @@ -786,10 +786,10 @@ void QFxGridView::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) dataModel->setModel(model); } if (d->model) { @@ -800,8 +800,8 @@ void QFxGridView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); - connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); - connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); + connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); + connect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*))); refill(); emit countChanged(); } @@ -815,25 +815,25 @@ void QFxGridView::setModel(const QVariant &model) Here is an example delegate: \snippet doc/src/snippets/declarative/gridview/gridview.qml 0 */ -QmlComponent *QFxGridView::delegate() const +QmlComponent *QmlGraphicsGridView::delegate() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); if (d->model) { - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) return dataModel->delegate(); } return 0; } -void QFxGridView::setDelegate(QmlComponent *delegate) +void QmlGraphicsGridView::setDelegate(QmlComponent *delegate) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) { + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) { dataModel->setDelegate(delegate); d->updateCurrent(d->currentIndex); refill(); @@ -848,15 +848,15 @@ void QFxGridView::setDelegate(QmlComponent *delegate) \c currentItem is the current item. Note that the position of the current item may only be approximate until it becomes visible in the view. */ -int QFxGridView::currentIndex() const +int QmlGraphicsGridView::currentIndex() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->currentIndex; } -void QFxGridView::setCurrentIndex(int index) +void QmlGraphicsGridView::setCurrentIndex(int index) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { cancelFlick(); d->updateCurrent(index); @@ -865,9 +865,9 @@ void QFxGridView::setCurrentIndex(int index) } } -QFxItem *QFxGridView::currentItem() +QmlGraphicsItem *QmlGraphicsGridView::currentItem() { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (!d->currentItem) return 0; return d->currentItem->item; @@ -877,9 +877,9 @@ QFxItem *QFxGridView::currentItem() \qmlproperty int GridView::count This property holds the number of items in the view. */ -int QFxGridView::count() const +int QmlGraphicsGridView::count() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); if (d->model) return d->model->count(); return 0; @@ -898,15 +898,15 @@ int QFxGridView::count() const \sa highlightFollowsCurrentItem */ -QmlComponent *QFxGridView::highlight() const +QmlComponent *QmlGraphicsGridView::highlight() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->highlightComponent; } -void QFxGridView::setHighlight(QmlComponent *highlight) +void QmlGraphicsGridView::setHighlight(QmlComponent *highlight) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); delete d->highlightComponent; d->highlightComponent = highlight; d->updateCurrent(d->currentIndex); @@ -932,15 +932,15 @@ void QFxGridView::setHighlight(QmlComponent *highlight) } \endcode */ -bool QFxGridView::highlightFollowsCurrentItem() const +bool QmlGraphicsGridView::highlightFollowsCurrentItem() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->autoHighlight; } -void QFxGridView::setHighlightFollowsCurrentItem(bool autoHighlight) +void QmlGraphicsGridView::setHighlightFollowsCurrentItem(bool autoHighlight) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); d->autoHighlight = autoHighlight; if (d->highlightXAnimator) { d->highlightXAnimator->setEnabled(d->autoHighlight); @@ -958,15 +958,15 @@ void QFxGridView::setHighlightFollowsCurrentItem(bool autoHighlight) If \a flow is \c LeftToRight, the view will scroll vertically. If \a flow is \c TopToBottom, the view will scroll horizontally. */ -QFxGridView::Flow QFxGridView::flow() const +QmlGraphicsGridView::Flow QmlGraphicsGridView::flow() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->flow; } -void QFxGridView::setFlow(Flow flow) +void QmlGraphicsGridView::setFlow(Flow flow) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (d->flow != flow) { d->flow = flow; if (d->flow == LeftToRight) @@ -987,15 +987,15 @@ void QFxGridView::setFlow(Flow flow) If this property is true then key presses to move off of one end of the grid will cause the selection to jump to the other side. */ -bool QFxGridView::isWrapEnabled() const +bool QmlGraphicsGridView::isWrapEnabled() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->wrap; } -void QFxGridView::setWrapEnabled(bool wrap) +void QmlGraphicsGridView::setWrapEnabled(bool wrap) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); d->wrap = wrap; } @@ -1007,15 +1007,15 @@ void QFxGridView::setWrapEnabled(bool wrap) and below the bottom of the view to cache. Setting this value can make scrolling the view smoother at the expense of additional memory usage. */ -int QFxGridView::cacheBuffer() const +int QmlGraphicsGridView::cacheBuffer() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->buffer; } -void QFxGridView::setCacheBuffer(int buffer) +void QmlGraphicsGridView::setCacheBuffer(int buffer) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (d->buffer != buffer) { d->buffer = buffer; if (isComponentComplete()) @@ -1031,15 +1031,15 @@ void QFxGridView::setCacheBuffer(int buffer) The default sell size is 100x100. */ -int QFxGridView::cellWidth() const +int QmlGraphicsGridView::cellWidth() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->cellWidth; } -void QFxGridView::setCellWidth(int cellWidth) +void QmlGraphicsGridView::setCellWidth(int cellWidth) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (cellWidth != d->cellWidth && cellWidth > 0) { d->cellWidth = qMax(1, cellWidth); d->updateGrid(); @@ -1048,15 +1048,15 @@ void QFxGridView::setCellWidth(int cellWidth) } } -int QFxGridView::cellHeight() const +int QmlGraphicsGridView::cellHeight() const { - Q_D(const QFxGridView); + Q_D(const QmlGraphicsGridView); return d->cellHeight; } -void QFxGridView::setCellHeight(int cellHeight) +void QmlGraphicsGridView::setCellHeight(int cellHeight) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (cellHeight != d->cellHeight && cellHeight > 0) { d->cellHeight = qMax(1, cellHeight); d->updateGrid(); @@ -1065,62 +1065,62 @@ void QFxGridView::setCellHeight(int cellHeight) } } -void QFxGridView::sizeChange() +void QmlGraphicsGridView::sizeChange() { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (isComponentComplete()) { d->updateGrid(); d->layout(); } } -void QFxGridView::viewportMoved() +void QmlGraphicsGridView::viewportMoved() { - QFxFlickable::viewportMoved(); + QmlGraphicsFlickable::viewportMoved(); refill(); } -qreal QFxGridView::minYExtent() const +qreal QmlGraphicsGridView::minYExtent() const { - Q_D(const QFxGridView); - if (d->flow == QFxGridView::TopToBottom) - return QFxFlickable::minYExtent(); + Q_D(const QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::TopToBottom) + return QmlGraphicsFlickable::minYExtent(); return -d->startPosition(); } -qreal QFxGridView::maxYExtent() const +qreal QmlGraphicsGridView::maxYExtent() const { - Q_D(const QFxGridView); - if (d->flow == QFxGridView::TopToBottom) - return QFxFlickable::maxYExtent(); + Q_D(const QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::TopToBottom) + return QmlGraphicsFlickable::maxYExtent(); return -(d->endPosition() - height()); } -qreal QFxGridView::minXExtent() const +qreal QmlGraphicsGridView::minXExtent() const { - Q_D(const QFxGridView); - if (d->flow == QFxGridView::LeftToRight) - return QFxFlickable::minXExtent(); + Q_D(const QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::LeftToRight) + return QmlGraphicsFlickable::minXExtent(); return -d->startPosition(); } -qreal QFxGridView::maxXExtent() const +qreal QmlGraphicsGridView::maxXExtent() const { - Q_D(const QFxGridView); - if (d->flow == QFxGridView::LeftToRight) - return QFxFlickable::maxXExtent(); + Q_D(const QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::LeftToRight) + return QmlGraphicsFlickable::maxXExtent(); return -(d->endPosition() - width()); } -void QFxGridView::keyPressEvent(QKeyEvent *event) +void QmlGraphicsGridView::keyPressEvent(QKeyEvent *event) { - Q_D(QFxGridView); - QFxFlickable::keyPressEvent(event); + Q_D(QmlGraphicsGridView); + QmlGraphicsFlickable::keyPressEvent(event); if (event->isAccepted()) return; if (d->model && d->model->count() && d->interactive) { - d->moveReason = QFxGridViewPrivate::Key; + d->moveReason = QmlGraphicsGridViewPrivate::Key; int oldCurrent = currentIndex(); switch (event->key()) { case Qt::Key_Up: @@ -1143,7 +1143,7 @@ void QFxGridView::keyPressEvent(QKeyEvent *event) return; } } - d->moveReason = QFxGridViewPrivate::Other; + d->moveReason = QmlGraphicsGridViewPrivate::Other; event->ignore(); } @@ -1154,10 +1154,10 @@ void QFxGridView::keyPressEvent(QKeyEvent *event) The current index will wrap if keyNavigationWraps is true and it is currently at the end. */ -void QFxGridView::moveCurrentIndexUp() +void QmlGraphicsGridView::moveCurrentIndexUp() { - Q_D(QFxGridView); - if (d->flow == QFxGridView::LeftToRight) { + Q_D(QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::LeftToRight) { if (currentIndex() >= d->columns || d->wrap) { int index = currentIndex() - d->columns; setCurrentIndex(index >= 0 ? index : d->model->count()-1); @@ -1177,10 +1177,10 @@ void QFxGridView::moveCurrentIndexUp() The current index will wrap if keyNavigationWraps is true and it is currently at the end. */ -void QFxGridView::moveCurrentIndexDown() +void QmlGraphicsGridView::moveCurrentIndexDown() { - Q_D(QFxGridView); - if (d->flow == QFxGridView::LeftToRight) { + Q_D(QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::LeftToRight) { if (currentIndex() < d->model->count() - d->columns || d->wrap) { int index = currentIndex()+d->columns; setCurrentIndex(index < d->model->count() ? index : 0); @@ -1200,10 +1200,10 @@ void QFxGridView::moveCurrentIndexDown() The current index will wrap if keyNavigationWraps is true and it is currently at the end. */ -void QFxGridView::moveCurrentIndexLeft() +void QmlGraphicsGridView::moveCurrentIndexLeft() { - Q_D(QFxGridView); - if (d->flow == QFxGridView::LeftToRight) { + Q_D(QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::LeftToRight) { if (currentIndex() > 0 || d->wrap) { int index = currentIndex() - 1; setCurrentIndex(index >= 0 ? index : d->model->count()-1); @@ -1223,10 +1223,10 @@ void QFxGridView::moveCurrentIndexLeft() The current index will wrap if keyNavigationWraps is true and it is currently at the end. */ -void QFxGridView::moveCurrentIndexRight() +void QmlGraphicsGridView::moveCurrentIndexRight() { - Q_D(QFxGridView); - if (d->flow == QFxGridView::LeftToRight) { + Q_D(QmlGraphicsGridView); + if (d->flow == QmlGraphicsGridView::LeftToRight) { if (currentIndex() < d->model->count() - 1 || d->wrap) { int index = currentIndex() + 1; setCurrentIndex(index < d->model->count() ? index : 0); @@ -1239,22 +1239,22 @@ void QFxGridView::moveCurrentIndexRight() } } -void QFxGridView::componentComplete() +void QmlGraphicsGridView::componentComplete() { - Q_D(QFxGridView); - QFxFlickable::componentComplete(); + Q_D(QmlGraphicsGridView); + QmlGraphicsFlickable::componentComplete(); d->updateGrid(); if (d->currentIndex < 0) d->updateCurrent(0); refill(); } -void QFxGridView::trackedPositionChanged() +void QmlGraphicsGridView::trackedPositionChanged() { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (!d->trackedItem) return; - if (!isFlicking() && !d->pressed && d->moveReason == QFxGridViewPrivate::Key) { + if (!isFlicking() && !d->pressed && d->moveReason == QmlGraphicsGridViewPrivate::Key) { if (d->trackedItem->rowPos() < d->position()) { d->setPosition(d->trackedItem->rowPos()); } else if (d->trackedItem->endRowPos() > d->position() + d->size()) { @@ -1266,9 +1266,9 @@ void QFxGridView::trackedPositionChanged() } } -void QFxGridView::itemsInserted(int modelIndex, int count) +void QmlGraphicsGridView::itemsInserted(int modelIndex, int count) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); if (!d->visibleItems.count() || d->model->count() <= 1) { refill(); d->updateCurrent(qMax(0, qMin(d->currentIndex, d->model->count()-1))); @@ -1377,9 +1377,9 @@ void QFxGridView::itemsInserted(int modelIndex, int count) emit countChanged(); } -void QFxGridView::itemsRemoved(int modelIndex, int count) +void QmlGraphicsGridView::itemsRemoved(int modelIndex, int count) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count; int index = d->mapFromModel(modelIndex); if (index == -1) { @@ -1465,9 +1465,9 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) emit countChanged(); } -void QFxGridView::destroyRemoved() +void QmlGraphicsGridView::destroyRemoved() { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); for (QList::Iterator it = d->visibleItems.begin(); it != d->visibleItems.end();) { FxGridItem *listItem = *it; @@ -1483,9 +1483,9 @@ void QFxGridView::destroyRemoved() d->layout(); } -void QFxGridView::itemsMoved(int from, int to, int count) +void QmlGraphicsGridView::itemsMoved(int from, int to, int count) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); QHash moved; QList::Iterator it = d->visibleItems.begin(); @@ -1544,14 +1544,14 @@ void QFxGridView::itemsMoved(int from, int to, int count) d->layout(); } -void QFxGridView::createdItem(int index, QFxItem *item) +void QmlGraphicsGridView::createdItem(int index, QmlGraphicsItem *item) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); item->setParentItem(this); if (d->requestedIndex != index) { item->setParentItem(this); d->unrequestedItems.insert(item, index); - if (d->flow == QFxGridView::LeftToRight) { + if (d->flow == QmlGraphicsGridView::LeftToRight) { item->setPos(QPointF(d->colPosAt(index), d->rowPosAt(index))); } else { item->setPos(QPointF(d->rowPosAt(index), d->colPosAt(index))); @@ -1559,26 +1559,26 @@ void QFxGridView::createdItem(int index, QFxItem *item) } } -void QFxGridView::destroyingItem(QFxItem *item) +void QmlGraphicsGridView::destroyingItem(QmlGraphicsItem *item) { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); d->unrequestedItems.remove(item); } -void QFxGridView::refill() +void QmlGraphicsGridView::refill() { - Q_D(QFxGridView); + Q_D(QmlGraphicsGridView); d->refill(d->position(), d->position()+d->size()-1); } -QFxGridViewAttached *QFxGridView::qmlAttachedProperties(QObject *obj) +QmlGraphicsGridViewAttached *QmlGraphicsGridView::qmlAttachedProperties(QObject *obj) { - return QFxGridViewAttached::properties(obj); + return QmlGraphicsGridViewAttached::properties(obj); } -QML_DEFINE_TYPE(Qt, 4,6, (QT_VERSION&0x00ff00)>>8, GridView, QFxGridView) +QML_DEFINE_TYPE(Qt, 4,6, (QT_VERSION&0x00ff00)>>8, GridView, QmlGraphicsGridView) QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index 1c0a700..fd0a459 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -49,18 +49,18 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxVisualModel; -class QFxGridViewAttached; -class QFxGridViewPrivate; -class Q_DECLARATIVE_EXPORT QFxGridView : public QFxFlickable +class QmlGraphicsVisualModel; +class QmlGraphicsGridViewAttached; +class QmlGraphicsGridViewPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsGridView : public QmlGraphicsFlickable { Q_OBJECT - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxGridView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsGridView) Q_PROPERTY(QVariant model READ model WRITE setModel) Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) - Q_PROPERTY(QFxItem *currentItem READ currentItem NOTIFY currentIndexChanged) + Q_PROPERTY(QmlGraphicsItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(QmlComponent *highlight READ highlight WRITE setHighlight) Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) @@ -72,8 +72,8 @@ class Q_DECLARATIVE_EXPORT QFxGridView : public QFxFlickable Q_CLASSINFO("DefaultProperty", "data") public: - QFxGridView(QFxItem *parent=0); - ~QFxGridView(); + QmlGraphicsGridView(QmlGraphicsItem *parent=0); + ~QmlGraphicsGridView(); QVariant model() const; void setModel(const QVariant &); @@ -84,7 +84,7 @@ public: int currentIndex() const; void setCurrentIndex(int idx); - QFxItem *currentItem(); + QmlGraphicsItem *currentItem(); int count() const; QmlComponent *highlight() const; @@ -110,7 +110,7 @@ public: int cellHeight() const; void setCellHeight(int); - static QFxGridViewAttached *qmlAttachedProperties(QObject *); + static QmlGraphicsGridViewAttached *qmlAttachedProperties(QObject *); public Q_SLOTS: void moveCurrentIndexUp(); @@ -139,8 +139,8 @@ private Q_SLOTS: void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); void destroyRemoved(); - void createdItem(int index, QFxItem *item); - void destroyingItem(QFxItem *item); + void createdItem(int index, QmlGraphicsItem *item); + void destroyingItem(QmlGraphicsItem *item); void sizeChange(); private: @@ -149,8 +149,8 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxGridView) -QML_DECLARE_TYPEINFO(QFxGridView, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QmlGraphicsGridView) +QML_DECLARE_TYPEINFO(QmlGraphicsGridView, QML_HAS_ATTACHED_PROPERTIES) QT_END_HEADER diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 45a481c..34b3399 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -48,10 +48,10 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QmlGraphicsImage) /*! - \qmlclass Image QFxImage + \qmlclass Image QmlGraphicsImage \brief The Image element allows you to add bitmaps to a scene. \inherits Item @@ -112,8 +112,8 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage) /*! \internal - \class QFxImage Image - \brief The QFxImage class provides an image item that you can add to a QmlView. + \class QmlGraphicsImage Image + \brief The QmlGraphicsImage class provides an image item that you can add to a QmlView. \ingroup group_coreitems @@ -122,34 +122,34 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage) Image { source: "pics/star.png" } \endqml - A QFxImage object can be instantiated in Qml using the tag \l Image. + A QmlGraphicsImage object can be instantiated in Qml using the tag \l Image. */ -QFxImage::QFxImage(QFxItem *parent) - : QFxImageBase(*(new QFxImagePrivate), parent) +QmlGraphicsImage::QmlGraphicsImage(QmlGraphicsItem *parent) + : QmlGraphicsImageBase(*(new QmlGraphicsImagePrivate), parent) { setFlag(QGraphicsItem::ItemHasNoContents, false); } -QFxImage::QFxImage(QFxImagePrivate &dd, QFxItem *parent) - : QFxImageBase(dd, parent) +QmlGraphicsImage::QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsImageBase(dd, parent) { setFlag(QGraphicsItem::ItemHasNoContents, false); } -QFxImage::~QFxImage() +QmlGraphicsImage::~QmlGraphicsImage() { } -QPixmap QFxImage::pixmap() const +QPixmap QmlGraphicsImage::pixmap() const { - Q_D(const QFxImage); + Q_D(const QmlGraphicsImage); return d->pix; } -void QFxImage::setPixmap(const QPixmap &pix) +void QmlGraphicsImage::setPixmap(const QPixmap &pix) { - Q_D(QFxImage); + Q_D(QmlGraphicsImage); if (!d->url.isEmpty()) return; d->pix = pix; @@ -179,15 +179,15 @@ void QFxImage::setPixmap(const QPixmap &pix) \sa examples/declarative/fillmode \sa examples/declarative/aspectratio */ -QFxImage::FillMode QFxImage::fillMode() const +QmlGraphicsImage::FillMode QmlGraphicsImage::fillMode() const { - Q_D(const QFxImage); + Q_D(const QmlGraphicsImage); return d->fillMode; } -void QFxImage::setFillMode(FillMode mode) +void QmlGraphicsImage::setFillMode(FillMode mode) { - Q_D(QFxImage); + Q_D(QmlGraphicsImage); if (d->fillMode == mode) return; d->fillMode = mode; @@ -239,9 +239,9 @@ void QFxImage::setFillMode(FillMode mode) The URL may be absolute, or relative to the URL of the component. */ -void QFxImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { - Q_D(QFxImage); + Q_D(QmlGraphicsImage); if (d->pix.isNull()) return; diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h index fc8079c..1f52b17 100644 --- a/src/declarative/fx/qfximage.h +++ b/src/declarative/fx/qfximage.h @@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxImagePrivate; -class Q_DECLARATIVE_EXPORT QFxImage : public QFxImageBase +class QmlGraphicsImagePrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsImage : public QmlGraphicsImageBase { Q_OBJECT Q_ENUMS(FillMode) @@ -60,8 +60,8 @@ class Q_DECLARATIVE_EXPORT QFxImage : public QFxImageBase Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) public: - QFxImage(QFxItem *parent=0); - ~QFxImage(); + QmlGraphicsImage(QmlGraphicsItem *parent=0); + ~QmlGraphicsImage(); enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally }; FillMode fillMode() const; @@ -76,15 +76,15 @@ Q_SIGNALS: void fillModeChanged(); protected: - QFxImage(QFxImagePrivate &dd, QFxItem *parent); + QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent); private: - Q_DISABLE_COPY(QFxImage) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxImage) + Q_DISABLE_COPY(QmlGraphicsImage) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImage) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxImage) +QML_DECLARE_TYPE(QmlGraphicsImage) QT_END_HEADER #endif // QFXIMAGE_H diff --git a/src/declarative/fx/qfximage_p.h b/src/declarative/fx/qfximage_p.h index 8bdcc14..30f7665 100644 --- a/src/declarative/fx/qfximage_p.h +++ b/src/declarative/fx/qfximage_p.h @@ -58,17 +58,17 @@ QT_BEGIN_NAMESPACE -class QFxImagePrivate : public QFxImageBasePrivate +class QmlGraphicsImagePrivate : public QmlGraphicsImageBasePrivate { - Q_DECLARE_PUBLIC(QFxImage) + Q_DECLARE_PUBLIC(QmlGraphicsImage) public: - QFxImagePrivate() - : fillMode(QFxImage::Stretch) + QmlGraphicsImagePrivate() + : fillMode(QmlGraphicsImage::Stretch) { } - QFxImage::FillMode fillMode; + QmlGraphicsImage::FillMode fillMode; }; diff --git a/src/declarative/fx/qfximagebase.cpp b/src/declarative/fx/qfximagebase.cpp index a68c1f9..5afb79a 100644 --- a/src/declarative/fx/qfximagebase.cpp +++ b/src/declarative/fx/qfximagebase.cpp @@ -49,53 +49,53 @@ QT_BEGIN_NAMESPACE -QFxImageBase::QFxImageBase(QFxItem *parent) - : QFxItem(*(new QFxImageBasePrivate), parent) +QmlGraphicsImageBase::QmlGraphicsImageBase(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsImageBasePrivate), parent) { setFlag(QGraphicsItem::ItemHasNoContents, true); } -QFxImageBase::QFxImageBase(QFxImageBasePrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsImageBase::QmlGraphicsImageBase(QmlGraphicsImageBasePrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { setFlag(QGraphicsItem::ItemHasNoContents, true); } -QFxImageBase::~QFxImageBase() +QmlGraphicsImageBase::~QmlGraphicsImageBase() { - Q_D(QFxImageBase); + Q_D(QmlGraphicsImageBase); if (d->pendingPixmapCache) - QFxPixmapCache::cancelGet(d->url, this); + QmlGraphicsPixmapCache::cancelGet(d->url, this); } -QFxImageBase::Status QFxImageBase::status() const +QmlGraphicsImageBase::Status QmlGraphicsImageBase::status() const { - Q_D(const QFxImageBase); + Q_D(const QmlGraphicsImageBase); return d->status; } -qreal QFxImageBase::progress() const +qreal QmlGraphicsImageBase::progress() const { - Q_D(const QFxImageBase); + Q_D(const QmlGraphicsImageBase); return d->progress; } -QUrl QFxImageBase::source() const +QUrl QmlGraphicsImageBase::source() const { - Q_D(const QFxImageBase); + Q_D(const QmlGraphicsImageBase); return d->url; } -void QFxImageBase::setSource(const QUrl &url) +void QmlGraphicsImageBase::setSource(const QUrl &url) { - Q_D(QFxImageBase); + Q_D(QmlGraphicsImageBase); //equality is fairly expensive, so we bypass for simple, common case if ((d->url.isEmpty() == url.isEmpty()) && url == d->url) return; if (d->pendingPixmapCache) { - QFxPixmapCache::cancelGet(d->url, this); + QmlGraphicsPixmapCache::cancelGet(d->url, this); d->pendingPixmapCache = false; } @@ -117,7 +117,7 @@ void QFxImageBase::setSource(const QUrl &url) update(); } else { d->status = Loading; - QNetworkReply *reply = QFxPixmapCache::get(qmlEngine(this), d->url, &d->pix); + QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->url, &d->pix); if (reply) { d->pendingPixmapCache = true; connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); @@ -141,13 +141,13 @@ void QFxImageBase::setSource(const QUrl &url) emit statusChanged(d->status); } -void QFxImageBase::requestFinished() +void QmlGraphicsImageBase::requestFinished() { - Q_D(QFxImageBase); + Q_D(QmlGraphicsImageBase); d->pendingPixmapCache = false; - if (!QFxPixmapCache::find(d->url, &d->pix)) + if (!QmlGraphicsPixmapCache::find(d->url, &d->pix)) d->status = Error; setImplicitWidth(d->pix.width()); setImplicitHeight(d->pix.height()); @@ -161,9 +161,9 @@ void QFxImageBase::requestFinished() update(); } -void QFxImageBase::requestProgress(qint64 received, qint64 total) +void QmlGraphicsImageBase::requestProgress(qint64 received, qint64 total) { - Q_D(QFxImageBase); + Q_D(QmlGraphicsImageBase); if (d->status == Loading && total > 0) { d->progress = qreal(received)/total; emit progressChanged(d->progress); diff --git a/src/declarative/fx/qfximagebase.h b/src/declarative/fx/qfximagebase.h index 226d3c3..b43e9a2 100644 --- a/src/declarative/fx/qfximagebase.h +++ b/src/declarative/fx/qfximagebase.h @@ -47,8 +47,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QFxImageBasePrivate; -class QFxImageBase : public QFxItem +class QmlGraphicsImageBasePrivate; +class QmlGraphicsImageBase : public QmlGraphicsItem { Q_OBJECT Q_ENUMS(Status) @@ -58,8 +58,8 @@ class QFxImageBase : public QFxItem Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) public: - QFxImageBase(QFxItem *parent = 0); - ~QFxImageBase(); + QmlGraphicsImageBase(QmlGraphicsItem *parent = 0); + ~QmlGraphicsImageBase(); enum Status { Null, Ready, Loading, Error }; Status status() const; qreal progress() const; @@ -73,15 +73,15 @@ Q_SIGNALS: void progressChanged(qreal progress); protected: - QFxImageBase(QFxImageBasePrivate &dd, QFxItem *parent); + QmlGraphicsImageBase(QmlGraphicsImageBasePrivate &dd, QmlGraphicsItem *parent); private Q_SLOTS: virtual void requestFinished(); void requestProgress(qint64,qint64); private: - Q_DISABLE_COPY(QFxImageBase) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxImageBase) + Q_DISABLE_COPY(QmlGraphicsImageBase) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImageBase) }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfximagebase_p.h b/src/declarative/fx/qfximagebase_p.h index a6fcc80..9025c51 100644 --- a/src/declarative/fx/qfximagebase_p.h +++ b/src/declarative/fx/qfximagebase_p.h @@ -59,20 +59,20 @@ QT_BEGIN_NAMESPACE class QNetworkReply; -class QFxImageBasePrivate : public QFxItemPrivate +class QmlGraphicsImageBasePrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxImageBase) + Q_DECLARE_PUBLIC(QmlGraphicsImageBase) public: - QFxImageBasePrivate() - : status(QFxImageBase::Null), + QmlGraphicsImageBasePrivate() + : status(QmlGraphicsImageBase::Null), progress(0.0), pendingPixmapCache(false) { } QPixmap pix; - QFxImageBase::Status status; + QmlGraphicsImageBase::Status status; QUrl url; qreal progress; bool pendingPixmapCache; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 72833e1..7a3cded 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE #define FLT_MAX 1E+37 #endif -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Item,QFxItem) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Item,QmlGraphicsItem) QML_DEFINE_NOCREATE_TYPE(QGraphicsTransform); QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Scale,QGraphicsScale) @@ -224,13 +224,13 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation) /*! \internal - \class QFxContents + \class QmlGraphicsContents \ingroup group_utility - \brief The QFxContents class gives access to the height and width of an item's contents. + \brief The QmlGraphicsContents class gives access to the height and width of an item's contents. */ -QFxContents::QFxContents() : m_x(0), m_y(0), m_width(0), m_height(0) +QmlGraphicsContents::QmlGraphicsContents() : m_x(0), m_y(0), m_width(0), m_height(0) { } @@ -245,13 +245,13 @@ QFxContents::QFxContents() : m_x(0), m_y(0), m_width(0), m_height(0) sized to fit its children. */ -QRectF QFxContents::rectF() const +QRectF QmlGraphicsContents::rectF() const { return QRectF(m_x, m_y, m_width, m_height); } //TODO: optimization: only check sender(), if there is one -void QFxContents::calcHeight() +void QmlGraphicsContents::calcHeight() { qreal oldy = m_y; qreal oldheight = m_height; @@ -261,8 +261,8 @@ void QFxContents::calcHeight() QList children = m_item->childItems(); for (int i = 0; i < children.count(); ++i) { - QFxItem *child = qobject_cast(children.at(i)); - if(!child)//### Should this be ignoring non-QFxItem graphicsobjects? + QmlGraphicsItem *child = qobject_cast(children.at(i)); + if(!child)//### Should this be ignoring non-QmlGraphicsItem graphicsobjects? continue; qreal y = child->y(); if (y + child->height() > bottom) @@ -279,7 +279,7 @@ void QFxContents::calcHeight() } //TODO: optimization: only check sender(), if there is one -void QFxContents::calcWidth() +void QmlGraphicsContents::calcWidth() { qreal oldx = m_x; qreal oldwidth = m_width; @@ -289,8 +289,8 @@ void QFxContents::calcWidth() QList children = m_item->childItems(); for (int i = 0; i < children.count(); ++i) { - QFxItem *child = qobject_cast(children.at(i)); - if(!child)//### Should this be ignoring non-QFxItem graphicsobjects? + QmlGraphicsItem *child = qobject_cast(children.at(i)); + if(!child)//### Should this be ignoring non-QmlGraphicsItem graphicsobjects? continue; qreal x = child->x(); if (x + child->width() > right) @@ -306,14 +306,14 @@ void QFxContents::calcWidth() emit rectChanged(); } -void QFxContents::setItem(QFxItem *item) +void QmlGraphicsContents::setItem(QmlGraphicsItem *item) { m_item = item; QList children = m_item->childItems(); for (int i = 0; i < children.count(); ++i) { - QFxItem *child = qobject_cast(children.at(i)); - if(!child)//### Should this be ignoring non-QFxItem graphicsobjects? + QmlGraphicsItem *child = qobject_cast(children.at(i)); + if(!child)//### Should this be ignoring non-QmlGraphicsItem graphicsobjects? continue; connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight())); connect(child, SIGNAL(yChanged()), this, SLOT(calcHeight())); @@ -327,16 +327,16 @@ void QFxContents::setItem(QFxItem *item) } /* - Key filters can be installed on a QFxItem, but not removed. Currently they + Key filters can be installed on a QmlGraphicsItem, but not removed. Currently they are only used by attached objects (which are only destroyed on Item destruction), so this isn't a problem. If in future this becomes any form of public API, they will have to support removal too. */ -class QFxItemKeyFilter +class QmlGraphicsItemKeyFilter { public: - QFxItemKeyFilter(QFxItem * = 0); - virtual ~QFxItemKeyFilter(); + QmlGraphicsItemKeyFilter(QmlGraphicsItem * = 0); + virtual ~QmlGraphicsItemKeyFilter(); virtual void keyPressed(QKeyEvent *event); virtual void keyReleased(QKeyEvent *event); @@ -345,84 +345,84 @@ public: virtual void componentComplete(); private: - QFxItemKeyFilter *m_next; + QmlGraphicsItemKeyFilter *m_next; }; -QFxItemKeyFilter::QFxItemKeyFilter(QFxItem *item) +QmlGraphicsItemKeyFilter::QmlGraphicsItemKeyFilter(QmlGraphicsItem *item) : m_next(0) { - QFxItemPrivate *p = - item?static_cast(QGraphicsItemPrivate::get(item)):0; + QmlGraphicsItemPrivate *p = + item?static_cast(QGraphicsItemPrivate::get(item)):0; if (p) { m_next = p->keyHandler; p->keyHandler = this; } } -QFxItemKeyFilter::~QFxItemKeyFilter() +QmlGraphicsItemKeyFilter::~QmlGraphicsItemKeyFilter() { } -void QFxItemKeyFilter::keyPressed(QKeyEvent *event) +void QmlGraphicsItemKeyFilter::keyPressed(QKeyEvent *event) { if (m_next) m_next->keyPressed(event); } -void QFxItemKeyFilter::keyReleased(QKeyEvent *event) +void QmlGraphicsItemKeyFilter::keyReleased(QKeyEvent *event) { if (m_next) m_next->keyReleased(event); } -void QFxItemKeyFilter::inputMethodEvent(QInputMethodEvent *event) +void QmlGraphicsItemKeyFilter::inputMethodEvent(QInputMethodEvent *event) { if (m_next) m_next->inputMethodEvent(event); } -QVariant QFxItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const +QVariant QmlGraphicsItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const { if (m_next) return m_next->inputMethodQuery(query); return QVariant(); } -void QFxItemKeyFilter::componentComplete() +void QmlGraphicsItemKeyFilter::componentComplete() { if (m_next) m_next->componentComplete(); } -class QFxKeyNavigationAttachedPrivate : public QObjectPrivate +class QmlGraphicsKeyNavigationAttachedPrivate : public QObjectPrivate { public: - QFxKeyNavigationAttachedPrivate() + QmlGraphicsKeyNavigationAttachedPrivate() : QObjectPrivate(), left(0), right(0), up(0), down(0) {} - QFxItem *left; - QFxItem *right; - QFxItem *up; - QFxItem *down; + QmlGraphicsItem *left; + QmlGraphicsItem *right; + QmlGraphicsItem *up; + QmlGraphicsItem *down; }; -class QFxKeyNavigationAttached : public QObject, public QFxItemKeyFilter +class QmlGraphicsKeyNavigationAttached : public QObject, public QmlGraphicsItemKeyFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QFxKeyNavigationAttached) + Q_DECLARE_PRIVATE(QmlGraphicsKeyNavigationAttached) - Q_PROPERTY(QFxItem *left READ left WRITE setLeft NOTIFY changed) - Q_PROPERTY(QFxItem *right READ right WRITE setRight NOTIFY changed) - Q_PROPERTY(QFxItem *up READ up WRITE setUp NOTIFY changed) - Q_PROPERTY(QFxItem *down READ down WRITE setDown NOTIFY changed) + Q_PROPERTY(QmlGraphicsItem *left READ left WRITE setLeft NOTIFY changed) + Q_PROPERTY(QmlGraphicsItem *right READ right WRITE setRight NOTIFY changed) + Q_PROPERTY(QmlGraphicsItem *up READ up WRITE setUp NOTIFY changed) + Q_PROPERTY(QmlGraphicsItem *down READ down WRITE setDown NOTIFY changed) public: - QFxKeyNavigationAttached(QObject * = 0); + QmlGraphicsKeyNavigationAttached(QObject * = 0); - QFxItem *left() const; - void setLeft(QFxItem *); - QFxItem *right() const; - void setRight(QFxItem *); - QFxItem *up() const; - void setUp(QFxItem *); - QFxItem *down() const; - void setDown(QFxItem *); + QmlGraphicsItem *left() const; + void setLeft(QmlGraphicsItem *); + QmlGraphicsItem *right() const; + void setRight(QmlGraphicsItem *); + QmlGraphicsItem *up() const; + void setUp(QmlGraphicsItem *); + QmlGraphicsItem *down() const; + void setDown(QmlGraphicsItem *); - static QFxKeyNavigationAttached *qmlAttachedProperties(QObject *); + static QmlGraphicsKeyNavigationAttached *qmlAttachedProperties(QObject *); Q_SIGNALS: void changed(); @@ -432,73 +432,73 @@ private: virtual void keyReleased(QKeyEvent *event); }; -QFxKeyNavigationAttached::QFxKeyNavigationAttached(QObject *parent) -: QObject(*(new QFxKeyNavigationAttachedPrivate), parent), - QFxItemKeyFilter(qobject_cast(parent)) +QmlGraphicsKeyNavigationAttached::QmlGraphicsKeyNavigationAttached(QObject *parent) +: QObject(*(new QmlGraphicsKeyNavigationAttachedPrivate), parent), + QmlGraphicsItemKeyFilter(qobject_cast(parent)) { } -QFxKeyNavigationAttached * -QFxKeyNavigationAttached::qmlAttachedProperties(QObject *obj) +QmlGraphicsKeyNavigationAttached * +QmlGraphicsKeyNavigationAttached::qmlAttachedProperties(QObject *obj) { - return new QFxKeyNavigationAttached(obj); + return new QmlGraphicsKeyNavigationAttached(obj); } -QFxItem *QFxKeyNavigationAttached::left() const +QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::left() const { - Q_D(const QFxKeyNavigationAttached); + Q_D(const QmlGraphicsKeyNavigationAttached); return d->left; } -void QFxKeyNavigationAttached::setLeft(QFxItem *i) +void QmlGraphicsKeyNavigationAttached::setLeft(QmlGraphicsItem *i) { - Q_D(QFxKeyNavigationAttached); + Q_D(QmlGraphicsKeyNavigationAttached); d->left = i; emit changed(); } -QFxItem *QFxKeyNavigationAttached::right() const +QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::right() const { - Q_D(const QFxKeyNavigationAttached); + Q_D(const QmlGraphicsKeyNavigationAttached); return d->right; } -void QFxKeyNavigationAttached::setRight(QFxItem *i) +void QmlGraphicsKeyNavigationAttached::setRight(QmlGraphicsItem *i) { - Q_D(QFxKeyNavigationAttached); + Q_D(QmlGraphicsKeyNavigationAttached); d->right = i; emit changed(); } -QFxItem *QFxKeyNavigationAttached::up() const +QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::up() const { - Q_D(const QFxKeyNavigationAttached); + Q_D(const QmlGraphicsKeyNavigationAttached); return d->up; } -void QFxKeyNavigationAttached::setUp(QFxItem *i) +void QmlGraphicsKeyNavigationAttached::setUp(QmlGraphicsItem *i) { - Q_D(QFxKeyNavigationAttached); + Q_D(QmlGraphicsKeyNavigationAttached); d->up = i; emit changed(); } -QFxItem *QFxKeyNavigationAttached::down() const +QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::down() const { - Q_D(const QFxKeyNavigationAttached); + Q_D(const QmlGraphicsKeyNavigationAttached); return d->down; } -void QFxKeyNavigationAttached::setDown(QFxItem *i) +void QmlGraphicsKeyNavigationAttached::setDown(QmlGraphicsItem *i) { - Q_D(QFxKeyNavigationAttached); + Q_D(QmlGraphicsKeyNavigationAttached); d->down = i; emit changed(); } -void QFxKeyNavigationAttached::keyPressed(QKeyEvent *event) +void QmlGraphicsKeyNavigationAttached::keyPressed(QKeyEvent *event) { - Q_D(QFxKeyNavigationAttached); + Q_D(QmlGraphicsKeyNavigationAttached); event->ignore(); @@ -531,12 +531,12 @@ void QFxKeyNavigationAttached::keyPressed(QKeyEvent *event) break; } - if (!event->isAccepted()) QFxItemKeyFilter::keyPressed(event); + if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyPressed(event); } -void QFxKeyNavigationAttached::keyReleased(QKeyEvent *event) +void QmlGraphicsKeyNavigationAttached::keyReleased(QKeyEvent *event) { - Q_D(QFxKeyNavigationAttached); + Q_D(QmlGraphicsKeyNavigationAttached); event->ignore(); @@ -565,7 +565,7 @@ void QFxKeyNavigationAttached::keyReleased(QKeyEvent *event) break; } - if (!event->isAccepted()) QFxItemKeyFilter::keyReleased(event); + if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyReleased(event); } /*! @@ -895,10 +895,10 @@ void QFxKeyNavigationAttached::keyReleased(QKeyEvent *event) */ -class QFxKeysAttachedPrivate : public QObjectPrivate +class QmlGraphicsKeysAttachedPrivate : public QObjectPrivate { public: - QFxKeysAttachedPrivate() + QmlGraphicsKeysAttachedPrivate() : QObjectPrivate(), inPress(false), inRelease(false) , inIM(false), enabled(true), imeItem(0), item(0) {} @@ -921,82 +921,82 @@ public: bool enabled : 1; QGraphicsItem *imeItem; - QList targets; - QFxItem *item; + QList targets; + QmlGraphicsItem *item; }; -class QFxKeysAttached : public QObject, public QFxItemKeyFilter +class QmlGraphicsKeysAttached : public QObject, public QmlGraphicsItemKeyFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QFxKeysAttached) + Q_DECLARE_PRIVATE(QmlGraphicsKeysAttached) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - Q_PROPERTY(QList *forwardTo READ forwardTo) + Q_PROPERTY(QList *forwardTo READ forwardTo) public: - QFxKeysAttached(QObject *parent=0); - ~QFxKeysAttached(); + QmlGraphicsKeysAttached(QObject *parent=0); + ~QmlGraphicsKeysAttached(); - bool enabled() const { Q_D(const QFxKeysAttached); return d->enabled; } + bool enabled() const { Q_D(const QmlGraphicsKeysAttached); return d->enabled; } void setEnabled(bool enabled) { - Q_D(QFxKeysAttached); + Q_D(QmlGraphicsKeysAttached); if (enabled != d->enabled) { d->enabled = enabled; emit enabledChanged(); } } - QList *forwardTo() { - Q_D(QFxKeysAttached); + QList *forwardTo() { + Q_D(QmlGraphicsKeysAttached); return &d->targets; } virtual void componentComplete(); - static QFxKeysAttached *qmlAttachedProperties(QObject *); + static QmlGraphicsKeysAttached *qmlAttachedProperties(QObject *); Q_SIGNALS: void enabledChanged(); - void pressed(QFxKeyEvent *event); - void released(QFxKeyEvent *event); - void digit0Pressed(QFxKeyEvent *event); - void digit1Pressed(QFxKeyEvent *event); - void digit2Pressed(QFxKeyEvent *event); - void digit3Pressed(QFxKeyEvent *event); - void digit4Pressed(QFxKeyEvent *event); - void digit5Pressed(QFxKeyEvent *event); - void digit6Pressed(QFxKeyEvent *event); - void digit7Pressed(QFxKeyEvent *event); - void digit8Pressed(QFxKeyEvent *event); - void digit9Pressed(QFxKeyEvent *event); - - void leftPressed(QFxKeyEvent *event); - void rightPressed(QFxKeyEvent *event); - void upPressed(QFxKeyEvent *event); - void downPressed(QFxKeyEvent *event); - - void asteriskPressed(QFxKeyEvent *event); - void numberSignPressed(QFxKeyEvent *event); - void escapePressed(QFxKeyEvent *event); - void returnPressed(QFxKeyEvent *event); - void enterPressed(QFxKeyEvent *event); - void deletePressed(QFxKeyEvent *event); - void spacePressed(QFxKeyEvent *event); - void backPressed(QFxKeyEvent *event); - void cancelPressed(QFxKeyEvent *event); - void selectPressed(QFxKeyEvent *event); - void yesPressed(QFxKeyEvent *event); - void noPressed(QFxKeyEvent *event); - void context1Pressed(QFxKeyEvent *event); - void context2Pressed(QFxKeyEvent *event); - void context3Pressed(QFxKeyEvent *event); - void context4Pressed(QFxKeyEvent *event); - void callPressed(QFxKeyEvent *event); - void hangupPressed(QFxKeyEvent *event); - void flipPressed(QFxKeyEvent *event); - void menuPressed(QFxKeyEvent *event); - void volumeUpPressed(QFxKeyEvent *event); - void volumeDownPressed(QFxKeyEvent *event); + void pressed(QmlGraphicsKeyEvent *event); + void released(QmlGraphicsKeyEvent *event); + void digit0Pressed(QmlGraphicsKeyEvent *event); + void digit1Pressed(QmlGraphicsKeyEvent *event); + void digit2Pressed(QmlGraphicsKeyEvent *event); + void digit3Pressed(QmlGraphicsKeyEvent *event); + void digit4Pressed(QmlGraphicsKeyEvent *event); + void digit5Pressed(QmlGraphicsKeyEvent *event); + void digit6Pressed(QmlGraphicsKeyEvent *event); + void digit7Pressed(QmlGraphicsKeyEvent *event); + void digit8Pressed(QmlGraphicsKeyEvent *event); + void digit9Pressed(QmlGraphicsKeyEvent *event); + + void leftPressed(QmlGraphicsKeyEvent *event); + void rightPressed(QmlGraphicsKeyEvent *event); + void upPressed(QmlGraphicsKeyEvent *event); + void downPressed(QmlGraphicsKeyEvent *event); + + void asteriskPressed(QmlGraphicsKeyEvent *event); + void numberSignPressed(QmlGraphicsKeyEvent *event); + void escapePressed(QmlGraphicsKeyEvent *event); + void returnPressed(QmlGraphicsKeyEvent *event); + void enterPressed(QmlGraphicsKeyEvent *event); + void deletePressed(QmlGraphicsKeyEvent *event); + void spacePressed(QmlGraphicsKeyEvent *event); + void backPressed(QmlGraphicsKeyEvent *event); + void cancelPressed(QmlGraphicsKeyEvent *event); + void selectPressed(QmlGraphicsKeyEvent *event); + void yesPressed(QmlGraphicsKeyEvent *event); + void noPressed(QmlGraphicsKeyEvent *event); + void context1Pressed(QmlGraphicsKeyEvent *event); + void context2Pressed(QmlGraphicsKeyEvent *event); + void context3Pressed(QmlGraphicsKeyEvent *event); + void context4Pressed(QmlGraphicsKeyEvent *event); + void callPressed(QmlGraphicsKeyEvent *event); + void hangupPressed(QmlGraphicsKeyEvent *event); + void flipPressed(QmlGraphicsKeyEvent *event); + void menuPressed(QmlGraphicsKeyEvent *event); + void volumeUpPressed(QmlGraphicsKeyEvent *event); + void volumeDownPressed(QmlGraphicsKeyEvent *event); private: virtual void keyPressed(QKeyEvent *event); @@ -1026,7 +1026,7 @@ private: static const SigMap sigMap[]; }; -const QFxKeysAttached::SigMap QFxKeysAttached::sigMap[] = { +const QmlGraphicsKeysAttached::SigMap QmlGraphicsKeysAttached::sigMap[] = { { Qt::Key_Left, "leftPressed" }, { Qt::Key_Right, "rightPressed" }, { Qt::Key_Up, "upPressed" }, @@ -1056,26 +1056,26 @@ const QFxKeysAttached::SigMap QFxKeysAttached::sigMap[] = { { 0, 0 } }; -bool QFxKeysAttachedPrivate::isConnected(const char *signalName) +bool QmlGraphicsKeysAttachedPrivate::isConnected(const char *signalName) { return isSignalConnected(signalIndex(signalName)); } -QFxKeysAttached::QFxKeysAttached(QObject *parent) -: QObject(*(new QFxKeysAttachedPrivate), parent), - QFxItemKeyFilter(qobject_cast(parent)) +QmlGraphicsKeysAttached::QmlGraphicsKeysAttached(QObject *parent) +: QObject(*(new QmlGraphicsKeysAttachedPrivate), parent), + QmlGraphicsItemKeyFilter(qobject_cast(parent)) { - Q_D(QFxKeysAttached); - d->item = qobject_cast(parent); + Q_D(QmlGraphicsKeysAttached); + d->item = qobject_cast(parent); } -QFxKeysAttached::~QFxKeysAttached() +QmlGraphicsKeysAttached::~QmlGraphicsKeysAttached() { } -void QFxKeysAttached::componentComplete() +void QmlGraphicsKeysAttached::componentComplete() { - Q_D(QFxKeysAttached); + Q_D(QmlGraphicsKeysAttached); if (d->item) { for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *targetItem = d->finalFocusProxy(d->targets.at(ii)); @@ -1087,9 +1087,9 @@ void QFxKeysAttached::componentComplete() } } -void QFxKeysAttached::keyPressed(QKeyEvent *event) +void QmlGraphicsKeysAttached::keyPressed(QKeyEvent *event) { - Q_D(QFxKeysAttached); + Q_D(QmlGraphicsKeysAttached); if (!d->enabled || d->inPress) { event->ignore(); return; @@ -1111,27 +1111,27 @@ void QFxKeysAttached::keyPressed(QKeyEvent *event) d->inPress = false; } - QFxKeyEvent ke(*event); + QmlGraphicsKeyEvent ke(*event); QByteArray keySignal = keyToSignal(event->key()); if (!keySignal.isEmpty()) { - keySignal += "(QFxKeyEvent*)"; + keySignal += "(QmlGraphicsKeyEvent*)"; if (d->isConnected(keySignal)) { // If we specifically handle a key then default to accepted ke.setAccepted(true); - int idx = QFxKeysAttached::staticMetaObject.indexOfSignal(keySignal); - metaObject()->method(idx).invoke(this, Q_ARG(QFxKeysAttached, &ke)); + int idx = QmlGraphicsKeysAttached::staticMetaObject.indexOfSignal(keySignal); + metaObject()->method(idx).invoke(this, Q_ARG(QmlGraphicsKeysAttached, &ke)); } } if (!ke.isAccepted()) emit pressed(&ke); event->setAccepted(ke.isAccepted()); - if (!event->isAccepted()) QFxItemKeyFilter::keyPressed(event); + if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyPressed(event); } -void QFxKeysAttached::keyReleased(QKeyEvent *event) +void QmlGraphicsKeysAttached::keyReleased(QKeyEvent *event) { - Q_D(QFxKeysAttached); + Q_D(QmlGraphicsKeysAttached); if (!d->enabled || d->inRelease) { event->ignore(); return; @@ -1152,16 +1152,16 @@ void QFxKeysAttached::keyReleased(QKeyEvent *event) d->inRelease = false; } - QFxKeyEvent ke(*event); + QmlGraphicsKeyEvent ke(*event); emit released(&ke); event->setAccepted(ke.isAccepted()); - if (!event->isAccepted()) QFxItemKeyFilter::keyReleased(event); + if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyReleased(event); } -void QFxKeysAttached::inputMethodEvent(QInputMethodEvent *event) +void QmlGraphicsKeysAttached::inputMethodEvent(QInputMethodEvent *event) { - Q_D(QFxKeysAttached); + Q_D(QmlGraphicsKeysAttached); if (d->item && !d->inIM && d->item->scene()) { d->inIM = true; for (int ii = 0; ii < d->targets.count(); ++ii) { @@ -1177,10 +1177,10 @@ void QFxKeysAttached::inputMethodEvent(QInputMethodEvent *event) } d->inIM = false; } - if (!event->isAccepted()) QFxItemKeyFilter::inputMethodEvent(event); + if (!event->isAccepted()) QmlGraphicsItemKeyFilter::inputMethodEvent(event); } -class QFxItemAccessor : public QGraphicsItem +class QmlGraphicsItemAccessor : public QGraphicsItem { public: QVariant doInputMethodQuery(Qt::InputMethodQuery query) const { @@ -1188,43 +1188,43 @@ public: } }; -QVariant QFxKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const +QVariant QmlGraphicsKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const { - Q_D(const QFxKeysAttached); + Q_D(const QmlGraphicsKeysAttached); if (d->item) { for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? - QVariant v = static_cast(i)->doInputMethodQuery(query); + QVariant v = static_cast(i)->doInputMethodQuery(query); if (v.type() == QVariant::RectF) v = d->item->mapRectFromItem(i, v.toRectF()); //### cost? return v; } } } - return QFxItemKeyFilter::inputMethodQuery(query); + return QmlGraphicsItemKeyFilter::inputMethodQuery(query); } -QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj) +QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject *obj) { - return new QFxKeysAttached(obj); + return new QmlGraphicsKeysAttached(obj); } /*! - \class QFxItem - \brief The QFxItem class provides the most basic of all visual items in QML. + \class QmlGraphicsItem + \brief The QmlGraphicsItem class provides the most basic of all visual items in QML. - All visual items in Qt Declarative inherit from QFxItem. Although QFxItem + All visual items in Qt Declarative inherit from QmlGraphicsItem. Although QmlGraphicsItem has no visual appearance, it defines all the properties that are common across visual items - such as the x and y position, the width and height, \l {anchor-layout}{anchoring} and key handling. - You can subclass QFxItem to provide your own custom visual item that inherits + You can subclass QmlGraphicsItem to provide your own custom visual item that inherits these features. */ /*! - \qmlclass Item QFxItem + \qmlclass Item QmlGraphicsItem \brief The Item is the most basic of all visual items in QML. All visual items in Qt Declarative inherit from Item. Although Item @@ -1285,114 +1285,114 @@ QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj) */ /*! - \property QFxItem::baseline + \property QmlGraphicsItem::baseline \internal */ /*! - \property QFxItem::effect + \property QmlGraphicsItem::effect \internal */ /*! - \property QFxItem::focus + \property QmlGraphicsItem::focus \internal */ /*! - \property QFxItem::wantsFocus + \property QmlGraphicsItem::wantsFocus \internal */ /*! - \property QFxItem::transformOrigin + \property QmlGraphicsItem::transformOrigin \internal */ /*! - \fn void QFxItem::childrenRectChanged() + \fn void QmlGraphicsItem::childrenRectChanged() \internal */ /*! - \fn void QFxItem::baselineOffsetChanged() + \fn void QmlGraphicsItem::baselineOffsetChanged() \internal */ /*! - \fn void QFxItem::widthChanged() + \fn void QmlGraphicsItem::widthChanged() \internal */ /*! - \fn void QFxItem::heightChanged() + \fn void QmlGraphicsItem::heightChanged() \internal */ /*! - \fn void QFxItem::stateChanged(const QString &state) + \fn void QmlGraphicsItem::stateChanged(const QString &state) \internal */ /*! - \fn void QFxItem::parentChanged() + \fn void QmlGraphicsItem::parentChanged() \internal */ /*! - \fn void QFxItem::focusChanged() + \fn void QmlGraphicsItem::focusChanged() \internal */ /*! - \fn void QFxItem::wantsFocusChanged() + \fn void QmlGraphicsItem::wantsFocusChanged() \internal */ static inline void qfxitem_registerAnchorLine() { static bool registered = false; if (!registered) { - qRegisterMetaType("QFxAnchorLine"); + qRegisterMetaType("QmlGraphicsAnchorLine"); registered = true; } } /*! - \fn QFxItem::QFxItem(QFxItem *parent) + \fn QmlGraphicsItem::QmlGraphicsItem(QmlGraphicsItem *parent) - Constructs a QFxItem with the given \a parent. + Constructs a QmlGraphicsItem with the given \a parent. */ -QFxItem::QFxItem(QFxItem* parent) - : QGraphicsObject(*(new QFxItemPrivate), parent, 0) +QmlGraphicsItem::QmlGraphicsItem(QmlGraphicsItem* parent) + : QGraphicsObject(*(new QmlGraphicsItemPrivate), parent, 0) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); qfxitem_registerAnchorLine(); d->init(parent); } /*! \internal */ -QFxItem::QFxItem(QFxItemPrivate &dd, QFxItem *parent) +QmlGraphicsItem::QmlGraphicsItem(QmlGraphicsItemPrivate &dd, QmlGraphicsItem *parent) : QGraphicsObject(dd, parent, 0) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); qfxitem_registerAnchorLine(); d->init(parent); } /*! - Destroys the QFxItem. + Destroys the QmlGraphicsItem. */ -QFxItem::~QFxItem() +QmlGraphicsItem::~QmlGraphicsItem() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); for (int ii = 0; ii < d->dependantAnchors.count(); ++ii) { - QFxAnchors *anchor = d->dependantAnchors.at(ii); + QmlGraphicsAnchors *anchor = d->dependantAnchors.at(ii); anchor->d_func()->clearItem(this); } if (!d->parent || (parentItem() && !parentItem()->QGraphicsItem::d_ptr->inDestructor)) for (int ii = 0; ii < d->dependantAnchors.count(); ++ii) { - QFxAnchors *anchor = d->dependantAnchors.at(ii); + QmlGraphicsAnchors *anchor = d->dependantAnchors.at(ii); if (anchor->d_func()->item && anchor->d_func()->item->parentItem() != this) //child will be deleted anyway anchor->d_func()->updateOnComplete(); } @@ -1427,12 +1427,12 @@ QFxItem::~QFxItem() */ /*! - \property QFxItem::parent + \property QmlGraphicsItem::parent This property holds the parent of the item. */ -void QFxItem::setParentItem(QFxItem *parent) +void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent) { - QFxItem *oldParent = parentItem(); + QmlGraphicsItem *oldParent = parentItem(); if (parent == oldParent || !parent) return; QObject::setParent(parent); @@ -1440,11 +1440,11 @@ void QFxItem::setParentItem(QFxItem *parent) } /*! - Returns the QFxItem parent of this item. + Returns the QmlGraphicsItem parent of this item. */ -QFxItem *QFxItem::parentItem() const +QmlGraphicsItem *QmlGraphicsItem::parentItem() const { - return qobject_cast(QGraphicsObject::parentItem()); + return qobject_cast(QGraphicsObject::parentItem()); } /*! @@ -1475,12 +1475,12 @@ QFxItem *QFxItem::parentItem() const */ /*! - \property QFxItem::children + \property QmlGraphicsItem::children \internal */ /*! - \property QFxItem::resources + \property QmlGraphicsItem::resources \internal */ @@ -1493,86 +1493,86 @@ QFxItem *QFxItem::parentItem() const \sa componentComplete() */ -bool QFxItem::isComponentComplete() const +bool QmlGraphicsItem::isComponentComplete() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->_componentComplete; } /*! - \property QFxItem::anchors + \property QmlGraphicsItem::anchors \internal */ /*! \internal */ -QFxAnchors *QFxItem::anchors() +QmlGraphicsAnchors *QmlGraphicsItem::anchors() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return d->anchors(); } -void QFxItemPrivate::data_removeAt(int) +void QmlGraphicsItemPrivate::data_removeAt(int) { // ### } -int QFxItemPrivate::data_count() const +int QmlGraphicsItemPrivate::data_count() const { // ### return 0; } -void QFxItemPrivate::data_append(QObject *o) +void QmlGraphicsItemPrivate::data_append(QObject *o) { - Q_Q(QFxItem); - QFxItem *i = qobject_cast(o); + Q_Q(QmlGraphicsItem); + QmlGraphicsItem *i = qobject_cast(o); if (i) q->fxChildren()->append(i); else resources_append(o); } -void QFxItemPrivate::data_insert(int, QObject *) +void QmlGraphicsItemPrivate::data_insert(int, QObject *) { // ### } -QObject *QFxItemPrivate::data_at(int) const +QObject *QmlGraphicsItemPrivate::data_at(int) const { // ### return 0; } -void QFxItemPrivate::data_clear() +void QmlGraphicsItemPrivate::data_clear() { // ### } -void QFxItemPrivate::resources_removeAt(int) +void QmlGraphicsItemPrivate::resources_removeAt(int) { // ### } -int QFxItemPrivate::resources_count() const +int QmlGraphicsItemPrivate::resources_count() const { - Q_Q(const QFxItem); + Q_Q(const QmlGraphicsItem); return q->children().count(); } -void QFxItemPrivate::resources_append(QObject *o) +void QmlGraphicsItemPrivate::resources_append(QObject *o) { - Q_Q(QFxItem); + Q_Q(QmlGraphicsItem); o->setParent(q); } -void QFxItemPrivate::resources_insert(int, QObject *) +void QmlGraphicsItemPrivate::resources_insert(int, QObject *) { // ### } -QObject *QFxItemPrivate::resources_at(int idx) const +QObject *QmlGraphicsItemPrivate::resources_at(int idx) const { - Q_Q(const QFxItem); + Q_Q(const QmlGraphicsItem); QObjectList children = q->children(); if (idx < children.count()) return children.at(idx); @@ -1580,50 +1580,50 @@ QObject *QFxItemPrivate::resources_at(int idx) const return 0; } -void QFxItemPrivate::resources_clear() +void QmlGraphicsItemPrivate::resources_clear() { // ### } -void QFxItemPrivate::children_removeAt(int) +void QmlGraphicsItemPrivate::children_removeAt(int) { // ### } -int QFxItemPrivate::children_count() const +int QmlGraphicsItemPrivate::children_count() const { - Q_Q(const QFxItem); + Q_Q(const QmlGraphicsItem); return q->childItems().count(); } -void QFxItemPrivate::children_append(QFxItem *i) +void QmlGraphicsItemPrivate::children_append(QmlGraphicsItem *i) { - Q_Q(QFxItem); + Q_Q(QmlGraphicsItem); i->setParentItem(q); } -void QFxItemPrivate::children_insert(int, QFxItem *) +void QmlGraphicsItemPrivate::children_insert(int, QmlGraphicsItem *) { // ### } -QFxItem *QFxItemPrivate::children_at(int idx) const +QmlGraphicsItem *QmlGraphicsItemPrivate::children_at(int idx) const { - Q_Q(const QFxItem); + Q_Q(const QmlGraphicsItem); QList children = q->childItems(); if (idx < children.count()) - return qobject_cast(children.at(idx)); + return qobject_cast(children.at(idx)); else return 0; } -void QFxItemPrivate::children_clear() +void QmlGraphicsItemPrivate::children_clear() { // ### } -void QFxItemPrivate::transform_removeAt(int i) +void QmlGraphicsItemPrivate::transform_removeAt(int i) { if (!transformData) return; @@ -1631,33 +1631,33 @@ void QFxItemPrivate::transform_removeAt(int i) dirtySceneTransform = 1; } -int QFxItemPrivate::transform_count() const +int QmlGraphicsItemPrivate::transform_count() const { return transformData ? transformData->graphicsTransforms.size() : 0; } -void QFxItemPrivate::transform_append(QGraphicsTransform *item) +void QmlGraphicsItemPrivate::transform_append(QGraphicsTransform *item) { appendGraphicsTransform(item); } -void QFxItemPrivate::transform_insert(int, QGraphicsTransform *) +void QmlGraphicsItemPrivate::transform_insert(int, QGraphicsTransform *) { // ### } -QGraphicsTransform *QFxItemPrivate::transform_at(int idx) const +QGraphicsTransform *QmlGraphicsItemPrivate::transform_at(int idx) const { if (!transformData) return 0; return transformData->graphicsTransforms.at(idx); } -void QFxItemPrivate::transform_clear() +void QmlGraphicsItemPrivate::transform_clear() { if (!transformData) return; - Q_Q(QFxItem); + Q_Q(QmlGraphicsItem); q->setTransformations(QList()); } @@ -1696,40 +1696,40 @@ void QFxItemPrivate::transform_clear() */ /*! - \property QFxItem::data + \property QmlGraphicsItem::data \internal */ /*! \internal */ -QmlList *QFxItem::data() +QmlList *QmlGraphicsItem::data() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return &d->data; } /*! - \property QFxItem::childrenRect + \property QmlGraphicsItem::childrenRect \brief The geometry of an item's children. childrenRect provides an easy way to access the (collective) position and size of the item's children. */ -QRectF QFxItem::childrenRect() +QRectF QmlGraphicsItem::childrenRect() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (!d->_contents) { - d->_contents = new QFxContents; + d->_contents = new QmlGraphicsContents; d->_contents->setParent(this); d->_contents->setItem(this); } return d->_contents->rectF(); } -bool QFxItem::clip() const +bool QmlGraphicsItem::clip() const { return flags() & ItemClipsChildrenToShape; } -void QFxItem::setClip(bool c) +void QmlGraphicsItem::setClip(bool c) { setFlag(ItemClipsChildrenToShape, c); } @@ -1748,13 +1748,13 @@ void QFxItem::setClip(bool c) */ /*! - \property QFxItem::width + \property QmlGraphicsItem::width Defines the item's width relative to its parent. */ /*! - \property QFxItem::height + \property QmlGraphicsItem::height Defines the item's height relative to its parent. */ @@ -1842,15 +1842,15 @@ void QFxItem::setClip(bool c) geometry from \a oldGeometry to \a newGeometry. If the two geometries are the same, it doesn't do anything. */ -void QFxItem::geometryChanged(const QRectF &newGeometry, +void QmlGraphicsItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (d->_anchors) d->_anchors->d_func()->updateMe(); - if (transformOrigin() != QFxItem::TopLeft) + if (transformOrigin() != QmlGraphicsItem::TopLeft) setTransformOriginPoint(d->computeTransformOrigin()); if (newGeometry.x() != oldGeometry.x()) @@ -1863,15 +1863,15 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, emit heightChanged(); for(int ii = 0; ii < d->dependantAnchors.count(); ++ii) { - QFxAnchors *anchor = d->dependantAnchors.at(ii); + QmlGraphicsAnchors *anchor = d->dependantAnchors.at(ii); anchor->d_func()->update(this, newGeometry, oldGeometry); } } /*! \internal */ -void QFxItem::keyPressEvent(QKeyEvent *event) +void QmlGraphicsItem::keyPressEvent(QKeyEvent *event) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (d->keyHandler) d->keyHandler->keyPressed(event); else @@ -1879,9 +1879,9 @@ void QFxItem::keyPressEvent(QKeyEvent *event) } /*! \internal */ -void QFxItem::keyReleaseEvent(QKeyEvent *event) +void QmlGraphicsItem::keyReleaseEvent(QKeyEvent *event) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (d->keyHandler) d->keyHandler->keyReleased(event); else @@ -1889,9 +1889,9 @@ void QFxItem::keyReleaseEvent(QKeyEvent *event) } /*! \internal */ -void QFxItem::inputMethodEvent(QInputMethodEvent *event) +void QmlGraphicsItem::inputMethodEvent(QInputMethodEvent *event) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (d->keyHandler) d->keyHandler->inputMethodEvent(event); else @@ -1899,9 +1899,9 @@ void QFxItem::inputMethodEvent(QInputMethodEvent *event) } /*! \internal */ -QVariant QFxItem::inputMethodQuery(Qt::InputMethodQuery query) const +QVariant QmlGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); QVariant v; if (d->keyHandler) v = d->keyHandler->inputMethodQuery(query); @@ -1931,54 +1931,54 @@ QVariant QFxItem::inputMethodQuery(Qt::InputMethodQuery query) const /*! \internal */ -QFxAnchorLine QFxItem::left() const +QmlGraphicsAnchorLine QmlGraphicsItem::left() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->anchorLines()->left; } /*! \internal */ -QFxAnchorLine QFxItem::right() const +QmlGraphicsAnchorLine QmlGraphicsItem::right() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->anchorLines()->right; } /*! \internal */ -QFxAnchorLine QFxItem::horizontalCenter() const +QmlGraphicsAnchorLine QmlGraphicsItem::horizontalCenter() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->anchorLines()->hCenter; } /*! \internal */ -QFxAnchorLine QFxItem::top() const +QmlGraphicsAnchorLine QmlGraphicsItem::top() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->anchorLines()->top; } /*! \internal */ -QFxAnchorLine QFxItem::bottom() const +QmlGraphicsAnchorLine QmlGraphicsItem::bottom() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->anchorLines()->bottom; } /*! \internal */ -QFxAnchorLine QFxItem::verticalCenter() const +QmlGraphicsAnchorLine QmlGraphicsItem::verticalCenter() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->anchorLines()->vCenter; } @@ -1986,39 +1986,39 @@ QFxAnchorLine QFxItem::verticalCenter() const /*! \internal */ -QFxAnchorLine QFxItem::baseline() const +QmlGraphicsAnchorLine QmlGraphicsItem::baseline() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->anchorLines()->baseline; } /*! - \property QFxItem::top + \property QmlGraphicsItem::top \internal */ /*! - \property QFxItem::bottom + \property QmlGraphicsItem::bottom \internal */ /*! - \property QFxItem::left + \property QmlGraphicsItem::left \internal */ /*! - \property QFxItem::right + \property QmlGraphicsItem::right \internal */ /*! - \property QFxItem::horizontalCenter + \property QmlGraphicsItem::horizontalCenter \internal */ /*! - \property QFxItem::verticalCenter + \property QmlGraphicsItem::verticalCenter \internal */ @@ -2104,7 +2104,7 @@ QFxAnchorLine QFxItem::baseline() const */ /*! - \property QFxItem::baselineOffset + \property QmlGraphicsItem::baselineOffset \brief The position of the item's baseline in local coordinates. The baseline of a Text item is the imaginary line on which the text @@ -2113,18 +2113,18 @@ QFxAnchorLine QFxItem::baseline() const For non-text items, a default baseline offset of 0 is used. */ -qreal QFxItem::baselineOffset() const +qreal QmlGraphicsItem::baselineOffset() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); if (!d->_baselineOffset.isValid()) { return 0.0; } else return d->_baselineOffset; } -void QFxItem::setBaselineOffset(qreal offset) +void QmlGraphicsItem::setBaselineOffset(qreal offset) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (offset == d->_baselineOffset) return; @@ -2132,7 +2132,7 @@ void QFxItem::setBaselineOffset(qreal offset) emit baselineOffsetChanged(); for(int ii = 0; ii < d->dependantAnchors.count(); ++ii) { - QFxAnchors *anchor = d->dependantAnchors.at(ii); + QmlGraphicsAnchors *anchor = d->dependantAnchors.at(ii); anchor->d_func()->updateVerticalAnchors(); } } @@ -2254,9 +2254,9 @@ void QFxItem::setBaselineOffset(qreal offset) \sa setKeepMouseGrab() */ -bool QFxItem::keepMouseGrab() const +bool QmlGraphicsItem::keepMouseGrab() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->_keepMouse; } @@ -2278,9 +2278,9 @@ bool QFxItem::keepMouseGrab() const \sa keepMouseGrab */ -void QFxItem::setKeepMouseGrab(bool keep) +void QmlGraphicsItem::setKeepMouseGrab(bool keep) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->_keepMouse = keep; } @@ -2292,23 +2292,23 @@ void QFxItem::setKeepMouseGrab(bool keep) Subclasses overriding this function should call up to their base class. */ -void QFxItem::focusChanged(bool flag) +void QmlGraphicsItem::focusChanged(bool flag) { Q_UNUSED(flag); emit focusChanged(); } /*! \internal */ -QmlList *QFxItem::fxChildren() +QmlList *QmlGraphicsItem::fxChildren() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return &(d->children); } /*! \internal */ -QmlList *QFxItem::resources() +QmlList *QmlGraphicsItem::resources() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return &(d->resources); } @@ -2330,13 +2330,13 @@ QmlList *QFxItem::resources() */ /*! - \property QFxItem::states + \property QmlGraphicsItem::states \internal */ /*! \internal */ -QmlList* QFxItem::states() +QmlList* QmlGraphicsItem::states() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return d->states()->statesProperty(); } @@ -2358,14 +2358,14 @@ QmlList* QFxItem::states() */ /*! - \property QFxItem::transitions + \property QmlGraphicsItem::transitions \internal */ /*! \internal */ -QmlList* QFxItem::transitions() +QmlList* QmlGraphicsItem::transitions() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return d->states()->transitionsProperty(); } @@ -2401,7 +2401,7 @@ QmlList* QFxItem::transitions() */ /*! - \property QFxItem::clip + \property QmlGraphicsItem::clip This property holds whether clipping is enabled. if clipping is enabled, an item will clip its own painting, as well @@ -2437,14 +2437,14 @@ QmlList* QFxItem::transitions() */ /*! - \property QFxItem::state + \property QmlGraphicsItem::state \internal */ /*! \internal */ -QString QFxItem::state() const +QString QmlGraphicsItem::state() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); if (!d->_stateGroup) return QString(); else @@ -2452,9 +2452,9 @@ QString QFxItem::state() const } /*! \internal */ -void QFxItem::setState(const QString &state) +void QmlGraphicsItem::setState(const QString &state) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->states()->setState(state); } @@ -2466,14 +2466,14 @@ void QFxItem::setState(const QString &state) */ /*! - \property QFxItem::transform + \property QmlGraphicsItem::transform \internal */ /*! \internal */ -QmlList* QFxItem::transform() +QmlList* QmlGraphicsItem::transform() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return &(d->transform); } @@ -2485,9 +2485,9 @@ QmlList* QFxItem::transform() \sa componentComplete(), isComponentComplete() */ -void QFxItem::classBegin() +void QmlGraphicsItem::classBegin() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->_componentComplete = false; if (d->_stateGroup) d->_stateGroup->classBegin(); @@ -2503,13 +2503,13 @@ void QFxItem::classBegin() processing until the component is complete an all bindings in the component have been resolved. */ -void QFxItem::componentComplete() +void QmlGraphicsItem::componentComplete() { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer cc; + QmlPerfTimer cc; #endif - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->_componentComplete = true; if (d->_stateGroup) d->_stateGroup->componentComplete(); @@ -2521,9 +2521,9 @@ void QFxItem::componentComplete() d->keyHandler->componentComplete(); } -QmlStateGroup *QFxItemPrivate::states() +QmlStateGroup *QmlGraphicsItemPrivate::states() { - Q_Q(QFxItem); + Q_Q(QmlGraphicsItem); if (!_stateGroup) { _stateGroup = new QmlStateGroup(q); if (!_componentComplete) @@ -2535,55 +2535,55 @@ QmlStateGroup *QFxItemPrivate::states() return _stateGroup; } -QFxItemPrivate::AnchorLines::AnchorLines(QFxItem *q) +QmlGraphicsItemPrivate::AnchorLines::AnchorLines(QmlGraphicsItem *q) { left.item = q; - left.anchorLine = QFxAnchorLine::Left; + left.anchorLine = QmlGraphicsAnchorLine::Left; right.item = q; - right.anchorLine = QFxAnchorLine::Right; + right.anchorLine = QmlGraphicsAnchorLine::Right; hCenter.item = q; - hCenter.anchorLine = QFxAnchorLine::HCenter; + hCenter.anchorLine = QmlGraphicsAnchorLine::HCenter; top.item = q; - top.anchorLine = QFxAnchorLine::Top; + top.anchorLine = QmlGraphicsAnchorLine::Top; bottom.item = q; - bottom.anchorLine = QFxAnchorLine::Bottom; + bottom.anchorLine = QmlGraphicsAnchorLine::Bottom; vCenter.item = q; - vCenter.anchorLine = QFxAnchorLine::VCenter; + vCenter.anchorLine = QmlGraphicsAnchorLine::VCenter; baseline.item = q; - baseline.anchorLine = QFxAnchorLine::Baseline; + baseline.anchorLine = QmlGraphicsAnchorLine::Baseline; } -QPointF QFxItemPrivate::computeTransformOrigin() const +QPointF QmlGraphicsItemPrivate::computeTransformOrigin() const { - Q_Q(const QFxItem); + Q_Q(const QmlGraphicsItem); QRectF br = q->boundingRect(); switch(origin) { default: - case QFxItem::TopLeft: + case QmlGraphicsItem::TopLeft: return QPointF(0, 0); - case QFxItem::Top: + case QmlGraphicsItem::Top: return QPointF(br.width() / 2., 0); - case QFxItem::TopRight: + case QmlGraphicsItem::TopRight: return QPointF(br.width(), 0); - case QFxItem::Left: + case QmlGraphicsItem::Left: return QPointF(0, br.height() / 2.); - case QFxItem::Center: + case QmlGraphicsItem::Center: return QPointF(br.width() / 2., br.height() / 2.); - case QFxItem::Right: + case QmlGraphicsItem::Right: return QPointF(br.width(), br.height() / 2.); - case QFxItem::BottomLeft: + case QmlGraphicsItem::BottomLeft: return QPointF(0, br.height()); - case QFxItem::Bottom: + case QmlGraphicsItem::Bottom: return QPointF(br.width() / 2., br.height()); - case QFxItem::BottomRight: + case QmlGraphicsItem::BottomRight: return QPointF(br.width(), br.height()); } } /*! \internal */ -bool QFxItem::sceneEvent(QEvent *event) +bool QmlGraphicsItem::sceneEvent(QEvent *event) { bool rv = QGraphicsItem::sceneEvent(event); @@ -2596,7 +2596,7 @@ bool QFxItem::sceneEvent(QEvent *event) } /*! \internal */ -QVariant QFxItem::itemChange(GraphicsItemChange change, +QVariant QmlGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value) { if (change == ItemParentHasChanged) { @@ -2607,14 +2607,14 @@ QVariant QFxItem::itemChange(GraphicsItemChange change, } /*! \internal */ -QRectF QFxItem::boundingRect() const +QRectF QmlGraphicsItem::boundingRect() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return QRectF(0, 0, d->width, d->height); } /*! - \enum QFxItem::TransformOrigin + \enum QmlGraphicsItem::TransformOrigin Controls the point about which simple transforms like scale apply. @@ -2632,18 +2632,18 @@ QRectF QFxItem::boundingRect() const /*! Returns the current transform origin. */ -QFxItem::TransformOrigin QFxItem::transformOrigin() const +QmlGraphicsItem::TransformOrigin QmlGraphicsItem::transformOrigin() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->origin; } /*! Set the transform \a origin. */ -void QFxItem::setTransformOrigin(TransformOrigin origin) +void QmlGraphicsItem::setTransformOrigin(TransformOrigin origin) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (origin != d->origin) { d->origin = origin; QGraphicsItem::setTransformOriginPoint(d->computeTransformOrigin()); @@ -2651,7 +2651,7 @@ void QFxItem::setTransformOrigin(TransformOrigin origin) } /*! - \property QFxItem::smooth + \property QmlGraphicsItem::smooth \brief whether the item is smoothly transformed. This property is provided purely for the purpose of optimization. Turning @@ -2669,9 +2669,9 @@ void QFxItem::setTransformOrigin(TransformOrigin origin) \sa setSmoothTransform() */ -bool QFxItem::smoothTransform() const +bool QmlGraphicsItem::smoothTransform() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->smooth; } @@ -2681,24 +2681,24 @@ bool QFxItem::smoothTransform() const \sa smoothTransform() */ -void QFxItem::setSmoothTransform(bool smooth) +void QmlGraphicsItem::setSmoothTransform(bool smooth) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); if (d->smooth == smooth) return; d->smooth = smooth; update(); } -qreal QFxItem::width() const +qreal QmlGraphicsItem::width() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->width; } -void QFxItem::setWidth(qreal w) +void QmlGraphicsItem::setWidth(qreal w) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->widthValid = true; if (d->width == w) return; @@ -2713,22 +2713,22 @@ void QFxItem::setWidth(qreal w) QRectF(x(), y(), oldWidth, height())); } -void QFxItem::resetWidth() +void QmlGraphicsItem::resetWidth() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->widthValid = false; setImplicitWidth(implicitWidth()); } -qreal QFxItem::implicitWidth() const +qreal QmlGraphicsItem::implicitWidth() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->implicitWidth; } -void QFxItem::setImplicitWidth(qreal w) +void QmlGraphicsItem::setImplicitWidth(qreal w) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->implicitWidth = w; if (d->width == w || widthValid()) return; @@ -2743,21 +2743,21 @@ void QFxItem::setImplicitWidth(qreal w) QRectF(x(), y(), oldWidth, height())); } -bool QFxItem::widthValid() const +bool QmlGraphicsItem::widthValid() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->widthValid; } -qreal QFxItem::height() const +qreal QmlGraphicsItem::height() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->height; } -void QFxItem::setHeight(qreal h) +void QmlGraphicsItem::setHeight(qreal h) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->heightValid = true; if (d->height == h) return; @@ -2772,22 +2772,22 @@ void QFxItem::setHeight(qreal h) QRectF(x(), y(), width(), oldHeight)); } -void QFxItem::resetHeight() +void QmlGraphicsItem::resetHeight() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->heightValid = false; setImplicitHeight(implicitHeight()); } -qreal QFxItem::implicitHeight() const +qreal QmlGraphicsItem::implicitHeight() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->implicitHeight; } -void QFxItem::setImplicitHeight(qreal h) +void QmlGraphicsItem::setImplicitHeight(qreal h) { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); d->implicitHeight = h; if (d->height == h || heightValid()) return; @@ -2802,9 +2802,9 @@ void QFxItem::setImplicitHeight(qreal h) QRectF(x(), y(), width(), oldHeight)); } -bool QFxItem::heightValid() const +bool QmlGraphicsItem::heightValid() const { - Q_D(const QFxItem); + Q_D(const QmlGraphicsItem); return d->heightValid; } @@ -2815,7 +2815,7 @@ bool QFxItem::heightValid() const */ /*! \internal */ -bool QFxItem::wantsFocus() const +bool QmlGraphicsItem::wantsFocus() const { return focusItem() != 0; } @@ -2827,13 +2827,13 @@ bool QFxItem::wantsFocus() const */ /*! \internal */ -bool QFxItem::hasFocus() const +bool QmlGraphicsItem::hasFocus() const { return QGraphicsItem::hasFocus(); } /*! \internal */ -void QFxItem::setFocus(bool focus) +void QmlGraphicsItem::setFocus(bool focus) { if (focus) QGraphicsItem::setFocus(Qt::OtherFocusReason); @@ -2845,7 +2845,7 @@ void QFxItem::setFocus(bool focus) \reimp \internal */ -void QFxItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) { } @@ -2853,15 +2853,15 @@ void QFxItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) \reimp \internal */ -bool QFxItem::event(QEvent *ev) +bool QmlGraphicsItem::event(QEvent *ev) { return QGraphicsObject::event(ev); } -QDebug operator<<(QDebug debug, QFxItem *item) +QDebug operator<<(QDebug debug, QmlGraphicsItem *item) { if (!item) { - debug << "QFxItem(0)"; + debug << "QmlGraphicsItem(0)"; return debug; } @@ -2872,13 +2872,13 @@ QDebug operator<<(QDebug debug, QFxItem *item) return debug; } -int QFxItemPrivate::consistentTime = -1; -void QFxItemPrivate::setConsistentTime(int t) +int QmlGraphicsItemPrivate::consistentTime = -1; +void QmlGraphicsItemPrivate::setConsistentTime(int t) { consistentTime = t; } -QTime QFxItemPrivate::currentTime() +QTime QmlGraphicsItemPrivate::currentTime() { if (consistentTime == -1) return QTime::currentTime(); @@ -2886,12 +2886,12 @@ QTime QFxItemPrivate::currentTime() return QTime(0, 0).addMSecs(consistentTime); } -void QFxItemPrivate::start(QTime &t) +void QmlGraphicsItemPrivate::start(QTime &t) { t = currentTime(); } -int QFxItemPrivate::elapsed(QTime &t) +int QmlGraphicsItemPrivate::elapsed(QTime &t) { int n = t.msecsTo(currentTime()); if (n < 0) // passed midnight @@ -2899,7 +2899,7 @@ int QFxItemPrivate::elapsed(QTime &t) return n; } -int QFxItemPrivate::restart(QTime &t) +int QmlGraphicsItemPrivate::restart(QTime &t) { QTime time = currentTime(); int n = t.msecsTo(time); @@ -2911,11 +2911,11 @@ int QFxItemPrivate::restart(QTime &t) QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxKeysAttached) -QML_DECLARE_TYPEINFO(QFxKeysAttached, QML_HAS_ATTACHED_PROPERTIES) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Keys,QFxKeysAttached) -QML_DECLARE_TYPE(QFxKeyNavigationAttached) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,KeyNavigation,QFxKeyNavigationAttached) +QML_DECLARE_TYPE(QmlGraphicsKeysAttached) +QML_DECLARE_TYPEINFO(QmlGraphicsKeysAttached, QML_HAS_ATTACHED_PROPERTIES) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Keys,QmlGraphicsKeysAttached) +QML_DECLARE_TYPE(QmlGraphicsKeyNavigationAttached) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,KeyNavigation,QmlGraphicsKeyNavigationAttached) #include "moc_qfxitem.cpp" #include "qfxitem.moc" diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index b2aefe2..ac094ad 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -58,19 +58,19 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QmlState; -class QFxAnchorLine; +class QmlGraphicsAnchorLine; class QmlTransition; -class QFxKeyEvent; -class QFxAnchors; -class QFxItemPrivate; -class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserStatus +class QmlGraphicsKeyEvent; +class QmlGraphicsAnchors; +class QmlGraphicsItemPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsItem : public QGraphicsObject, public QmlParserStatus { Q_OBJECT Q_INTERFACES(QmlParserStatus) - Q_PROPERTY(QFxItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL) + Q_PROPERTY(QmlGraphicsItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL) Q_PROPERTY(QmlList *data READ data DESIGNABLE false) - Q_PROPERTY(QmlList* children READ fxChildren DESIGNABLE false) + Q_PROPERTY(QmlList* children READ fxChildren DESIGNABLE false) Q_PROPERTY(QmlList* resources READ resources DESIGNABLE false) Q_PROPERTY(QmlList* states READ states DESIGNABLE false) Q_PROPERTY(QmlList* transitions READ transitions DESIGNABLE false) @@ -78,14 +78,14 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL) Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL) Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false FINAL) - Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) - Q_PROPERTY(QFxAnchorLine left READ left CONSTANT FINAL) - Q_PROPERTY(QFxAnchorLine right READ right CONSTANT FINAL) - Q_PROPERTY(QFxAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL) - Q_PROPERTY(QFxAnchorLine top READ top CONSTANT FINAL) - Q_PROPERTY(QFxAnchorLine bottom READ bottom CONSTANT FINAL) - Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL) - Q_PROPERTY(QFxAnchorLine baseline READ baseline CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchorLine left READ left CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchorLine right READ right CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchorLine top READ top CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL) + Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline CONSTANT FINAL) Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(bool clip READ clip WRITE setClip) // ### move to QGI/QGO, NOTIFY Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL) @@ -104,18 +104,18 @@ public: BottomLeft, Bottom, BottomRight }; - QFxItem(QFxItem *parent = 0); - virtual ~QFxItem(); + QmlGraphicsItem(QmlGraphicsItem *parent = 0); + virtual ~QmlGraphicsItem(); - QFxItem *parentItem() const; - void setParentItem(QFxItem *parent); - void setParent(QFxItem *parent) { setParentItem(parent); } + QmlGraphicsItem *parentItem() const; + void setParentItem(QmlGraphicsItem *parent); + void setParent(QmlGraphicsItem *parent) { setParentItem(parent); } QmlList *data(); - QmlList *fxChildren(); + QmlList *fxChildren(); QmlList *resources(); - QFxAnchors *anchors(); + QmlGraphicsAnchors *anchors(); QRectF childrenRect(); bool clip() const; @@ -190,22 +190,22 @@ protected: const QRectF &oldGeometry); protected: - QFxItem(QFxItemPrivate &dd, QFxItem *parent = 0); + QmlGraphicsItem(QmlGraphicsItemPrivate &dd, QmlGraphicsItem *parent = 0); private: // ### public? - QFxAnchorLine left() const; - QFxAnchorLine right() const; - QFxAnchorLine horizontalCenter() const; - QFxAnchorLine top() const; - QFxAnchorLine bottom() const; - QFxAnchorLine verticalCenter() const; - QFxAnchorLine baseline() const; + QmlGraphicsAnchorLine left() const; + QmlGraphicsAnchorLine right() const; + QmlGraphicsAnchorLine horizontalCenter() const; + QmlGraphicsAnchorLine top() const; + QmlGraphicsAnchorLine bottom() const; + QmlGraphicsAnchorLine verticalCenter() const; + QmlGraphicsAnchorLine baseline() const; friend class QmlStatePrivate; - friend class QFxAnchors; - Q_DISABLE_COPY(QFxItem) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxItem) + friend class QmlGraphicsAnchors; + Q_DISABLE_COPY(QmlGraphicsItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsItem) }; template @@ -224,11 +224,11 @@ T qobject_cast(QGraphicsItem *item) return qobject_cast(o); } -QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, QFxItem *item); +QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, QmlGraphicsItem *item); QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxItem) +QML_DECLARE_TYPE(QmlGraphicsItem) QML_DECLARE_TYPE(QGraphicsTransform) QML_DECLARE_TYPE(QGraphicsScale) QML_DECLARE_TYPE(QGraphicsRotation) diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 2c7440f..87b33be 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -67,18 +67,18 @@ QT_BEGIN_NAMESPACE class QNetworkReply; -class QFxItemKeyFilter; +class QmlGraphicsItemKeyFilter; //### merge into private? -class QFxContents : public QObject +class QmlGraphicsContents : public QObject { Q_OBJECT public: - QFxContents(); + QmlGraphicsContents(); QRectF rectF() const; - void setItem(QFxItem *item); + void setItem(QmlGraphicsItem *item); public Q_SLOTS: void calcHeight(); @@ -88,34 +88,34 @@ Q_SIGNALS: void rectChanged(); private: - QFxItem *m_item; + QmlGraphicsItem *m_item; qreal m_x; qreal m_y; qreal m_width; qreal m_height; }; -class QFxItemPrivate : public QGraphicsItemPrivate +class QmlGraphicsItemPrivate : public QGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxItem) + Q_DECLARE_PUBLIC(QmlGraphicsItem) public: - QFxItemPrivate() + QmlGraphicsItemPrivate() : _anchors(0), _contents(0), _baselineOffset(0), _anchorLines(0), - _stateGroup(0), origin(QFxItem::TopLeft), + _stateGroup(0), origin(QmlGraphicsItem::TopLeft), widthValid(false), heightValid(false), _componentComplete(true), _keepMouse(false), smooth(false), keyHandler(0), width(0), height(0), implicitWidth(0), implicitHeight(0) {} - ~QFxItemPrivate() + ~QmlGraphicsItemPrivate() { delete _anchors; } - void init(QFxItem *parent) + void init(QmlGraphicsItem *parent) { - Q_Q(QFxItem); + Q_Q(QmlGraphicsItem); if (parent) q->setParentItem(parent); @@ -136,7 +136,7 @@ public: void data_insert(int, QObject *); QObject *data_at(int) const; void data_clear(); - QML_DECLARE_LIST_PROXY(QFxItemPrivate, QObject *, data) + QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QObject *, data) // resources property void resources_removeAt(int); @@ -145,16 +145,16 @@ public: void resources_insert(int, QObject *); QObject *resources_at(int) const; void resources_clear(); - QML_DECLARE_LIST_PROXY(QFxItemPrivate, QObject *, resources) + QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QObject *, resources) // children property void children_removeAt(int); int children_count() const; - void children_append(QFxItem *); - void children_insert(int, QFxItem *); - QFxItem *children_at(int) const; + void children_append(QmlGraphicsItem *); + void children_insert(int, QmlGraphicsItem *); + QmlGraphicsItem *children_at(int) const; void children_clear(); - QML_DECLARE_LIST_PROXY(QFxItemPrivate, QFxItem *, children) + QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QmlGraphicsItem *, children) // transform property void transform_removeAt(int); @@ -163,53 +163,53 @@ public: void transform_insert(int, QGraphicsTransform *); QGraphicsTransform *transform_at(int) const; void transform_clear(); - QML_DECLARE_LIST_PROXY(QFxItemPrivate, QGraphicsTransform *, transform) + QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QGraphicsTransform *, transform) - QFxAnchors *anchors() { + QmlGraphicsAnchors *anchors() { if (!_anchors) { - Q_Q(QFxItem); - _anchors = new QFxAnchors; + Q_Q(QmlGraphicsItem); + _anchors = new QmlGraphicsAnchors; _anchors->setItem(q); if (!_componentComplete) _anchors->classBegin(); } return _anchors; } - QList dependantAnchors; - QFxAnchors *_anchors; - QFxContents *_contents; + QList dependantAnchors; + QmlGraphicsAnchors *_anchors; + QmlGraphicsContents *_contents; QmlNullableValue _baselineOffset; struct AnchorLines { - AnchorLines(QFxItem *); - QFxAnchorLine left; - QFxAnchorLine right; - QFxAnchorLine hCenter; - QFxAnchorLine top; - QFxAnchorLine bottom; - QFxAnchorLine vCenter; - QFxAnchorLine baseline; + AnchorLines(QmlGraphicsItem *); + QmlGraphicsAnchorLine left; + QmlGraphicsAnchorLine right; + QmlGraphicsAnchorLine hCenter; + QmlGraphicsAnchorLine top; + QmlGraphicsAnchorLine bottom; + QmlGraphicsAnchorLine vCenter; + QmlGraphicsAnchorLine baseline; }; mutable AnchorLines *_anchorLines; AnchorLines *anchorLines() const { - Q_Q(const QFxItem); + Q_Q(const QmlGraphicsItem); if (!_anchorLines) _anchorLines = - new AnchorLines(const_cast(q)); + new AnchorLines(const_cast(q)); return _anchorLines; } QmlStateGroup *states(); QmlStateGroup *_stateGroup; - QFxItem::TransformOrigin origin:4; + QmlGraphicsItem::TransformOrigin origin:4; bool widthValid:1; bool heightValid:1; bool _componentComplete:1; bool _keepMouse:1; bool smooth:1; - QFxItemKeyFilter *keyHandler; + QmlGraphicsItemKeyFilter *keyHandler; qreal width; qreal height; @@ -220,7 +220,7 @@ public: virtual void setPosHelper(const QPointF &pos) { - Q_Q(QFxItem); + Q_Q(QmlGraphicsItem); 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); diff --git a/src/declarative/fx/qfxlayoutitem.cpp b/src/declarative/fx/qfxlayoutitem.cpp index 61998e7..201dea2 100644 --- a/src/declarative/fx/qfxlayoutitem.cpp +++ b/src/declarative/fx/qfxlayoutitem.cpp @@ -45,17 +45,17 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,LayoutItem,QFxLayoutItem) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,LayoutItem,QmlGraphicsLayoutItem) /*! - \qmlclass LayoutItem QFxLayoutItem + \qmlclass LayoutItem QmlGraphicsLayoutItem \brief The LayoutItem element allows you to place your Fluid UI elements inside a classical Qt layout. */ /*! \internal - \class QFxLayoutItem - \brief The QFxLayoutItem class allows you to place your Fluid UI elements inside a classical Qt layout. + \class QmlGraphicsLayoutItem + \brief The QmlGraphicsLayoutItem class allows you to place your Fluid UI elements inside a classical Qt layout. */ @@ -77,13 +77,13 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,LayoutItem,QFxLayoutItem) The preferredSize property can be set to specify the preferred size of this LayoutItem */ -QFxLayoutItem::QFxLayoutItem(QFxItem* parent) - : QFxItem(parent), m_maximumSize(INT_MAX,INT_MAX), m_minimumSize(0,0), m_preferredSize(0,0) +QmlGraphicsLayoutItem::QmlGraphicsLayoutItem(QmlGraphicsItem* parent) + : QmlGraphicsItem(parent), m_maximumSize(INT_MAX,INT_MAX), m_minimumSize(0,0), m_preferredSize(0,0) { setGraphicsItem(this); } -void QFxLayoutItem::setGeometry(const QRectF & rect) +void QmlGraphicsLayoutItem::setGeometry(const QRectF & rect) { setX(rect.x()); setY(rect.y()); @@ -91,7 +91,7 @@ void QFxLayoutItem::setGeometry(const QRectF & rect) setHeight(rect.height()); } -QSizeF QFxLayoutItem::sizeHint(Qt::SizeHint w, const QSizeF &constraint) const +QSizeF QmlGraphicsLayoutItem::sizeHint(Qt::SizeHint w, const QSizeF &constraint) const { Q_UNUSED(constraint); if(w == Qt::MinimumSize){ diff --git a/src/declarative/fx/qfxlayoutitem.h b/src/declarative/fx/qfxlayoutitem.h index 7150554..35e6e74 100644 --- a/src/declarative/fx/qfxlayoutitem.h +++ b/src/declarative/fx/qfxlayoutitem.h @@ -42,7 +42,7 @@ #ifndef QFXGRAPHICSLAYOUTITEM_H #define QFXGRAPHICSLAYOUTITEM_H #include -#include +#include #include QT_BEGIN_HEADER @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxLayoutItem : public QFxItem, public QGraphicsLayoutItem +class QmlGraphicsLayoutItem : public QmlGraphicsItem, public QGraphicsLayoutItem { Q_OBJECT Q_INTERFACES(QGraphicsLayoutItem) @@ -59,7 +59,7 @@ class QFxLayoutItem : public QFxItem, public QGraphicsLayoutItem Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize NOTIFY minimumSizeChanged) Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize NOTIFY preferredSizeChanged) public: - QFxLayoutItem(QFxItem* parent=0); + QmlGraphicsLayoutItem(QmlGraphicsItem* parent=0); QSizeF maximumSize() const { return m_maximumSize; } void setMaximumSize(const QSizeF &s) { if(s==m_maximumSize) return; m_maximumSize = s; emit maximumSizeChanged(); } @@ -87,7 +87,7 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxLayoutItem) +QML_DECLARE_TYPE(QmlGraphicsLayoutItem) QT_END_HEADER #endif diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 18c3062..f85380a 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -49,18 +49,18 @@ #include QT_BEGIN_NAMESPACE -class QFxListViewAttached : public QObject +class QmlGraphicsListViewAttached : public QObject { Q_OBJECT public: - QFxListViewAttached(QObject *parent) + QmlGraphicsListViewAttached(QObject *parent) : QObject(parent), m_view(0), m_isCurrent(false), m_delayRemove(false) {} - ~QFxListViewAttached() { + ~QmlGraphicsListViewAttached() { attachedProperties.remove(parent()); } - Q_PROPERTY(QFxListView *view READ view CONSTANT) - QFxListView *view() { return m_view; } + Q_PROPERTY(QmlGraphicsListView *view READ view CONSTANT) + QmlGraphicsListView *view() { return m_view; } Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged) bool isCurrentItem() const { return m_isCurrent; } @@ -98,10 +98,10 @@ public: } } - static QFxListViewAttached *properties(QObject *obj) { - QFxListViewAttached *rv = attachedProperties.value(obj); + static QmlGraphicsListViewAttached *properties(QObject *obj) { + QmlGraphicsListViewAttached *rv = attachedProperties.value(obj); if (!rv) { - rv = new QFxListViewAttached(obj); + rv = new QmlGraphicsListViewAttached(obj); attachedProperties.insert(obj, rv); } return rv; @@ -119,64 +119,64 @@ Q_SIGNALS: void remove(); public: - QFxListView *m_view; + QmlGraphicsListView *m_view; bool m_isCurrent; mutable QString m_section; QString m_prevSection; bool m_delayRemove; - static QHash attachedProperties; + static QHash attachedProperties; }; -QHash QFxListViewAttached::attachedProperties; +QHash QmlGraphicsListViewAttached::attachedProperties; //---------------------------------------------------------------------------- class FxListItem { public: - FxListItem(QFxItem *i, QFxListView *v) : item(i), view(v) { - attached = QFxListViewAttached::properties(item); + FxListItem(QmlGraphicsItem *i, QmlGraphicsListView *v) : item(i), view(v) { + attached = QmlGraphicsListViewAttached::properties(item); attached->m_view = view; } ~FxListItem() {} - qreal position() const { return (view->orientation() == QFxListView::Vertical ? item->y() : item->x()); } - int size() const { return (view->orientation() == QFxListView::Vertical ? item->height() : item->width()); } + qreal position() const { return (view->orientation() == QmlGraphicsListView::Vertical ? item->y() : item->x()); } + int size() const { return (view->orientation() == QmlGraphicsListView::Vertical ? item->height() : item->width()); } qreal endPosition() const { - return (view->orientation() == QFxListView::Vertical + return (view->orientation() == QmlGraphicsListView::Vertical ? item->y() + (item->height() > 0 ? item->height() : 1) : item->x() + (item->width() > 0 ? item->width() : 1)) - 1; } void setPosition(qreal pos) { - if (view->orientation() == QFxListView::Vertical) { + if (view->orientation() == QmlGraphicsListView::Vertical) { item->setY(pos); } else { item->setX(pos); } } - QFxItem *item; - QFxListView *view; - QFxListViewAttached *attached; + QmlGraphicsItem *item; + QmlGraphicsListView *view; + QmlGraphicsListViewAttached *attached; int index; }; //---------------------------------------------------------------------------- -class QFxListViewPrivate : public QFxFlickablePrivate +class QmlGraphicsListViewPrivate : public QmlGraphicsFlickablePrivate { - Q_DECLARE_PUBLIC(QFxListView) + Q_DECLARE_PUBLIC(QmlGraphicsListView) public: - QFxListViewPrivate() - : model(0), currentItem(0), orient(QFxListView::Vertical) + QmlGraphicsListViewPrivate() + : model(0), currentItem(0), orient(QmlGraphicsListView::Vertical) , visiblePos(0), visibleIndex(0) , averageSize(100.0), currentIndex(-1), requestedIndex(-1) , highlightRangeStart(0), highlightRangeEnd(0) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0), spacing(0.0) - , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightRange(QFxListView::NoHighlightRange) + , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightRange(QmlGraphicsListView::NoHighlightRange) , ownModel(false), wrap(false), autoHighlight(true) , haveHighlightRange(false) {} @@ -198,19 +198,19 @@ public: } qreal position() const { - Q_Q(const QFxListView); - return orient == QFxListView::Vertical ? q->viewportY() : q->viewportX(); + Q_Q(const QmlGraphicsListView); + return orient == QmlGraphicsListView::Vertical ? q->viewportY() : q->viewportX(); } void setPosition(qreal pos) { - Q_Q(QFxListView); - if (orient == QFxListView::Vertical) + Q_Q(QmlGraphicsListView); + if (orient == QmlGraphicsListView::Vertical) q->setViewportY(pos); else q->setViewportX(pos); } qreal size() const { - Q_Q(const QFxListView); - return orient == QFxListView::Vertical ? q->height() : q->width(); + Q_Q(const QmlGraphicsListView); + return orient == QmlGraphicsListView::Vertical ? q->height() : q->width(); } qreal startPosition() const { @@ -261,7 +261,7 @@ public: } QString sectionAt(int modelIndex) { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); if (FxListItem *item = visibleItem(modelIndex)) return item->attached->section(); QString section; @@ -344,8 +344,8 @@ public: } void updateViewport() { - Q_Q(QFxListView); - if (orient == QFxListView::Vertical) + Q_Q(QmlGraphicsListView); + if (orient == QmlGraphicsListView::Vertical) q->setViewportHeight(endPosition() - startPosition()); else q->setViewportWidth(endPosition() - startPosition()); @@ -382,12 +382,12 @@ public: virtual void flickX(qreal velocity); virtual void flickY(qreal velocity); - QFxVisualModel *model; + QmlGraphicsVisualModel *model; QVariant modelVariant; QList visibleItems; - QHash unrequestedItems; + QHash unrequestedItems; FxListItem *currentItem; - QFxListView::Orientation orient; + QmlGraphicsListView::Orientation orient; int visiblePos; int visibleIndex; qreal averageSize; @@ -408,7 +408,7 @@ public: qreal spacing; qreal highlightMoveSpeed; qreal highlightResizeSpeed; - QFxListView::HighlightRangeMode highlightRange; + QmlGraphicsListView::HighlightRangeMode highlightRange; bool ownModel : 1; bool wrap : 1; @@ -416,15 +416,15 @@ public: bool haveHighlightRange : 1; }; -void QFxListViewPrivate::init() +void QmlGraphicsListViewPrivate::init() { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); q->setFlag(QGraphicsItem::ItemIsFocusScope); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(refill())); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(refill())); } -void QFxListViewPrivate::clear() +void QmlGraphicsListViewPrivate::clear() { for (int i = 0; i < visibleItems.count(); ++i) releaseItem(visibleItems.at(i)); @@ -438,13 +438,13 @@ void QFxListViewPrivate::clear() trackedItem = 0; } -FxListItem *QFxListViewPrivate::createItem(int modelIndex) +FxListItem *QmlGraphicsListViewPrivate::createItem(int modelIndex) { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); // create object requestedIndex = modelIndex; FxListItem *listItem = 0; - if (QFxItem *item = model->item(modelIndex, false)) { + if (QmlGraphicsItem *item = model->item(modelIndex, false)) { listItem = new FxListItem(item, q); listItem->index = modelIndex; // initialise attached properties @@ -463,7 +463,7 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex) model->completeItem(); listItem->item->setZValue(1); listItem->item->setParent(q->viewport()); - if (orient == QFxListView::Vertical) + if (orient == QmlGraphicsListView::Vertical) QObject::connect(listItem->item, SIGNAL(heightChanged()), q, SLOT(itemResized())); else QObject::connect(listItem->item, SIGNAL(widthChanged()), q, SLOT(itemResized())); @@ -473,14 +473,14 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex) return listItem; } -void QFxListViewPrivate::releaseItem(FxListItem *item) +void QmlGraphicsListViewPrivate::releaseItem(FxListItem *item) { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); if (!item) return; if (trackedItem == item) { - const char *notifier1 = orient == QFxListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged()); - const char *notifier2 = orient == QFxListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); + const char *notifier1 = orient == QmlGraphicsListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged()); + const char *notifier2 = orient == QmlGraphicsListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); QObject::disconnect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged())); trackedItem = 0; @@ -488,7 +488,7 @@ void QFxListViewPrivate::releaseItem(FxListItem *item) if (model->release(item->item) == 0) { // item was not destroyed, and we no longer reference it. unrequestedItems.insert(item->item, model->indexOf(item->item, q)); - if (orient == QFxListView::Vertical) + if (orient == QmlGraphicsListView::Vertical) QObject::disconnect(item->item, SIGNAL(heightChanged()), q, SLOT(itemResized())); else QObject::disconnect(item->item, SIGNAL(widthChanged()), q, SLOT(itemResized())); @@ -496,9 +496,9 @@ void QFxListViewPrivate::releaseItem(FxListItem *item) delete item; } -void QFxListViewPrivate::refill(qreal from, qreal to) +void QmlGraphicsListViewPrivate::refill(qreal from, qreal to) { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); if (!isValid() || !q->isComponentComplete()) return; from -= buffer; @@ -566,9 +566,9 @@ void QFxListViewPrivate::refill(qreal from, qreal to) } } -void QFxListViewPrivate::layout() +void QmlGraphicsListViewPrivate::layout() { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); if (!visibleItems.isEmpty()) { int oldEnd = visibleItems.last()->endPosition(); int pos = visibleItems.first()->endPosition() + spacing + 1; @@ -590,38 +590,38 @@ void QFxListViewPrivate::layout() updateViewport(); } -void QFxListViewPrivate::updateUnrequestedIndexes() +void QmlGraphicsListViewPrivate::updateUnrequestedIndexes() { - Q_Q(QFxListView); - QHash::iterator it; + Q_Q(QmlGraphicsListView); + QHash::iterator it; for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) *it = model->indexOf(it.key(), q); } -void QFxListViewPrivate::updateUnrequestedPositions() +void QmlGraphicsListViewPrivate::updateUnrequestedPositions() { - QHash::const_iterator it; + QHash::const_iterator it; for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { if (visibleItem(*it)) continue; - if (orient == QFxListView::Vertical) + if (orient == QmlGraphicsListView::Vertical) it.key()->setY(positionAt(*it)); else it.key()->setX(positionAt(*it)); } } -void QFxListViewPrivate::updateTrackedItem() +void QmlGraphicsListViewPrivate::updateTrackedItem() { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); FxListItem *item = currentItem; if (highlight) item = highlight; FxListItem *oldTracked = trackedItem; - const char *notifier1 = orient == QFxListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged()); - const char *notifier2 = orient == QFxListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); + const char *notifier1 = orient == QmlGraphicsListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged()); + const char *notifier2 = orient == QmlGraphicsListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); if (trackedItem && item != trackedItem) { QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); @@ -638,9 +638,9 @@ void QFxListViewPrivate::updateTrackedItem() q->trackedPositionChanged(); } -void QFxListViewPrivate::createHighlight() +void QmlGraphicsListViewPrivate::createHighlight() { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); if (highlight) { if (trackedItem == highlight) trackedItem = 0; @@ -654,13 +654,13 @@ void QFxListViewPrivate::createHighlight() } if (currentItem) { - QFxItem *item = 0; + QmlGraphicsItem *item = 0; if (highlightComponent) { QmlContext *highlightContext = new QmlContext(qmlContext(q)); QObject *nobj = highlightComponent->create(highlightContext); if (nobj) { highlightContext->setParent(nobj); - item = qobject_cast(nobj); + item = qobject_cast(nobj); if (!item) { delete nobj; } else { @@ -670,22 +670,22 @@ void QFxListViewPrivate::createHighlight() delete highlightContext; } } else { - item = new QFxItem; + item = new QmlGraphicsItem; item->setParent(q->viewport()); } if (item) { item->setZValue(0); highlight = new FxListItem(item, q); - if (orient == QFxListView::Vertical) + if (orient == QmlGraphicsListView::Vertical) highlight->item->setHeight(currentItem->item->height()); else highlight->item->setWidth(currentItem->item->width()); - const QLatin1String posProp(orient == QFxListView::Vertical ? "y" : "x"); + const QLatin1String posProp(orient == QmlGraphicsListView::Vertical ? "y" : "x"); highlightPosAnimator = new QmlEaseFollow(q); highlightPosAnimator->setTarget(QmlMetaProperty(highlight->item, posProp)); highlightPosAnimator->setVelocity(highlightMoveSpeed); highlightPosAnimator->setEnabled(autoHighlight); - const QLatin1String sizeProp(orient == QFxListView::Vertical ? "height" : "width"); + const QLatin1String sizeProp(orient == QmlGraphicsListView::Vertical ? "height" : "width"); highlightSizeAnimator = new QmlEaseFollow(q); highlightSizeAnimator->setVelocity(highlightResizeSpeed); highlightSizeAnimator->setTarget(QmlMetaProperty(highlight->item, sizeProp)); @@ -694,7 +694,7 @@ void QFxListViewPrivate::createHighlight() } } -void QFxListViewPrivate::updateHighlight() +void QmlGraphicsListViewPrivate::updateHighlight() { if ((!currentItem && highlight) || (currentItem && !highlight)) createHighlight(); @@ -702,7 +702,7 @@ void QFxListViewPrivate::updateHighlight() // auto-update highlight highlightPosAnimator->setSourceValue(currentItem->position()); highlightSizeAnimator->setSourceValue(currentItem->size()); - if (orient == QFxListView::Vertical) { + if (orient == QmlGraphicsListView::Vertical) { if (highlight->item->width() == 0) highlight->item->setWidth(currentItem->item->width()); } else { @@ -713,7 +713,7 @@ void QFxListViewPrivate::updateHighlight() updateTrackedItem(); } -void QFxListViewPrivate::updateSections() +void QmlGraphicsListViewPrivate::updateSections() { if (!sectionExpression.isEmpty()) { QString prevSection; @@ -721,7 +721,7 @@ void QFxListViewPrivate::updateSections() prevSection = sectionAt(visibleIndex-1); for (int i = 0; i < visibleItems.count(); ++i) { if (visibleItems.at(i)->index != -1) { - QFxListViewAttached *attached = visibleItems.at(i)->attached; + QmlGraphicsListViewAttached *attached = visibleItems.at(i)->attached; attached->setPrevSection(prevSection); prevSection = attached->section(); } @@ -729,7 +729,7 @@ void QFxListViewPrivate::updateSections() } } -void QFxListViewPrivate::updateCurrentSection() +void QmlGraphicsListViewPrivate::updateCurrentSection() { if (sectionExpression.isEmpty() || visibleItems.isEmpty()) { currentSection = QString(); @@ -745,9 +745,9 @@ void QFxListViewPrivate::updateCurrentSection() currentSection = visibleItems.first()->attached->section(); } -void QFxListViewPrivate::updateCurrent(int modelIndex) +void QmlGraphicsListViewPrivate::updateCurrent(int modelIndex) { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); if (!isValid() || modelIndex < 0 || modelIndex >= model->count()) { if (currentItem) { currentItem->attached->setIsCurrentItem(false); @@ -787,7 +787,7 @@ void QFxListViewPrivate::updateCurrent(int modelIndex) releaseItem(oldCurrentItem); } -void QFxListViewPrivate::updateAverage() +void QmlGraphicsListViewPrivate::updateAverage() { if (!visibleItems.count()) return; @@ -797,21 +797,21 @@ void QFxListViewPrivate::updateAverage() averageSize = sum / visibleItems.count(); } -void QFxListViewPrivate::fixupPosition() +void QmlGraphicsListViewPrivate::fixupPosition() { - if (orient == QFxListView::Vertical) + if (orient == QmlGraphicsListView::Vertical) fixupY(); else fixupX(); } -void QFxListViewPrivate::fixupY() +void QmlGraphicsListViewPrivate::fixupY() { - QFxFlickablePrivate::fixupY(); - if (orient == QFxListView::Horizontal) + QmlGraphicsFlickablePrivate::fixupY(); + if (orient == QmlGraphicsListView::Horizontal) return; - if (haveHighlightRange && highlightRange == QFxListView::StrictlyEnforceRange) { + if (haveHighlightRange && highlightRange == QmlGraphicsListView::StrictlyEnforceRange) { if (currentItem && highlight && currentItem->position() != highlight->position()) { moveReason = Mouse; timeline.clear(); @@ -820,13 +820,13 @@ void QFxListViewPrivate::fixupY() } } -void QFxListViewPrivate::fixupX() +void QmlGraphicsListViewPrivate::fixupX() { - QFxFlickablePrivate::fixupX(); - if (orient == QFxListView::Vertical) + QmlGraphicsFlickablePrivate::fixupX(); + if (orient == QmlGraphicsListView::Vertical) return; - if (haveHighlightRange && highlightRange == QFxListView::StrictlyEnforceRange) { + if (haveHighlightRange && highlightRange == QmlGraphicsListView::StrictlyEnforceRange) { if (currentItem && highlight && currentItem->position() != highlight->position()) { moveReason = Mouse; timeline.clear(); @@ -835,12 +835,12 @@ void QFxListViewPrivate::fixupX() } } -void QFxListViewPrivate::flickX(qreal velocity) +void QmlGraphicsListViewPrivate::flickX(qreal velocity) { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); - if (!haveHighlightRange || highlightRange != QFxListView::StrictlyEnforceRange) { - QFxFlickablePrivate::flickX(velocity); + if (!haveHighlightRange || highlightRange != QmlGraphicsListView::StrictlyEnforceRange) { + QmlGraphicsFlickablePrivate::flickX(velocity); return; } @@ -893,12 +893,12 @@ void QFxListViewPrivate::flickX(qreal velocity) } } -void QFxListViewPrivate::flickY(qreal velocity) +void QmlGraphicsListViewPrivate::flickY(qreal velocity) { - Q_Q(QFxListView); + Q_Q(QmlGraphicsListView); - if (!haveHighlightRange || highlightRange != QFxListView::StrictlyEnforceRange) { - QFxFlickablePrivate::flickY(velocity); + if (!haveHighlightRange || highlightRange != QmlGraphicsListView::StrictlyEnforceRange) { + QmlGraphicsFlickablePrivate::flickY(velocity); return; } @@ -977,16 +977,16 @@ void QFxListViewPrivate::flickY(qreal velocity) the model would be implemented in C++, or perhaps via a SQL data source. */ -QFxListView::QFxListView(QFxItem *parent) - : QFxFlickable(*(new QFxListViewPrivate), parent) +QmlGraphicsListView::QmlGraphicsListView(QmlGraphicsItem *parent) + : QmlGraphicsFlickable(*(new QmlGraphicsListViewPrivate), parent) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->init(); } -QFxListView::~QFxListView() +QmlGraphicsListView::~QmlGraphicsListView() { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->clear(); if (d->ownModel) delete d->model; @@ -1079,27 +1079,27 @@ QFxListView::~QFxListView() \sa {qmlmodels}{Data Models} */ -QVariant QFxListView::model() const +QVariant QmlGraphicsListView::model() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->modelVariant; } -void QFxListView::setModel(const QVariant &model) +void QmlGraphicsListView::setModel(const QVariant &model) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); - disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); - disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); + disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); + disconnect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*))); } d->clear(); d->modelVariant = model; QObject *object = qvariant_cast(model); - QFxVisualModel *vim = 0; - if (object && (vim = qobject_cast(object))) { + QmlGraphicsVisualModel *vim = 0; + if (object && (vim = qobject_cast(object))) { if (d->ownModel) { delete d->model; d->ownModel = false; @@ -1107,10 +1107,10 @@ void QFxListView::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) dataModel->setModel(model); } if (d->model) { @@ -1121,8 +1121,8 @@ void QFxListView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); - connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); - connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); + connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); + connect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*))); refill(); emit countChanged(); } @@ -1136,25 +1136,25 @@ void QFxListView::setModel(const QVariant &model) Here is an example delegate: \snippet doc/src/snippets/declarative/listview/listview.qml 0 */ -QmlComponent *QFxListView::delegate() const +QmlComponent *QmlGraphicsListView::delegate() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); if (d->model) { - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) return dataModel->delegate(); } return 0; } -void QFxListView::setDelegate(QmlComponent *delegate) +void QmlGraphicsListView::setDelegate(QmlComponent *delegate) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) { + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) { dataModel->setDelegate(delegate); d->updateCurrent(d->currentIndex); refill(); @@ -1169,16 +1169,16 @@ void QFxListView::setDelegate(QmlComponent *delegate) \c currentItem is the current item. Note that the position of the current item may only be approximate until it becomes visible in the view. */ -int QFxListView::currentIndex() const +int QmlGraphicsListView::currentIndex() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->currentIndex; } -void QFxListView::setCurrentIndex(int index) +void QmlGraphicsListView::setCurrentIndex(int index) { - Q_D(QFxListView); - d->moveReason = QFxListViewPrivate::Other; + Q_D(QmlGraphicsListView); + d->moveReason = QmlGraphicsListViewPrivate::Other; if (d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { cancelFlick(); d->updateCurrent(index); @@ -1187,9 +1187,9 @@ void QFxListView::setCurrentIndex(int index) } } -QFxItem *QFxListView::currentItem() +QmlGraphicsItem *QmlGraphicsListView::currentItem() { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (!d->currentItem) return 0; return d->currentItem->item; @@ -1199,9 +1199,9 @@ QFxItem *QFxListView::currentItem() \qmlproperty int ListView::count This property holds the number of items in the view. */ -int QFxListView::count() const +int QmlGraphicsListView::count() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); if (d->model) return d->model->count(); return 0; @@ -1224,15 +1224,15 @@ int QFxListView::count() const \sa highlightFollowsCurrentItem */ -QmlComponent *QFxListView::highlight() const +QmlComponent *QmlGraphicsListView::highlight() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->highlightComponent; } -void QFxListView::setHighlight(QmlComponent *highlight) +void QmlGraphicsListView::setHighlight(QmlComponent *highlight) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); delete d->highlightComponent; d->highlightComponent = highlight; d->updateCurrent(d->currentIndex); @@ -1256,15 +1256,15 @@ void QFxListView::setHighlight(QmlComponent *highlight) \sa highlight */ -bool QFxListView::highlightFollowsCurrentItem() const +bool QmlGraphicsListView::highlightFollowsCurrentItem() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->autoHighlight; } -void QFxListView::setHighlightFollowsCurrentItem(bool autoHighlight) +void QmlGraphicsListView::setHighlightFollowsCurrentItem(bool autoHighlight) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->autoHighlight = autoHighlight; if (d->highlightPosAnimator) { d->highlightPosAnimator->setEnabled(d->autoHighlight); @@ -1296,41 +1296,41 @@ void QFxListView::setHighlightFollowsCurrentItem(bool autoHighlight) Note that a valid range requires preferredHighlightEnd to be greater than or equal to preferredHighlightBegin. */ -qreal QFxListView::preferredHighlightBegin() const +qreal QmlGraphicsListView::preferredHighlightBegin() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->highlightRangeStart; } -void QFxListView::setPreferredHighlightBegin(qreal start) +void QmlGraphicsListView::setPreferredHighlightBegin(qreal start) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->highlightRangeStart = start; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; } -qreal QFxListView::preferredHighlightEnd() const +qreal QmlGraphicsListView::preferredHighlightEnd() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->highlightRangeEnd; } -void QFxListView::setPreferredHighlightEnd(qreal end) +void QmlGraphicsListView::setPreferredHighlightEnd(qreal end) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->highlightRangeEnd = end; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; } -QFxListView::HighlightRangeMode QFxListView::highlightRangeMode() const +QmlGraphicsListView::HighlightRangeMode QmlGraphicsListView::highlightRangeMode() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->highlightRange; } -void QFxListView::setHighlightRangeMode(HighlightRangeMode mode) +void QmlGraphicsListView::setHighlightRangeMode(HighlightRangeMode mode) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->highlightRange = mode; d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; } @@ -1340,15 +1340,15 @@ void QFxListView::setHighlightRangeMode(HighlightRangeMode mode) This property holds the spacing to leave between items. */ -qreal QFxListView::spacing() const +qreal QmlGraphicsListView::spacing() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->spacing; } -void QFxListView::setSpacing(qreal spacing) +void QmlGraphicsListView::setSpacing(qreal spacing) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (spacing != d->spacing) { d->spacing = spacing; d->layout(); @@ -1367,18 +1367,18 @@ void QFxListView::setSpacing(qreal spacing) Horizontal Example: \image ListViewHorizontal.png */ -QFxListView::Orientation QFxListView::orientation() const +QmlGraphicsListView::Orientation QmlGraphicsListView::orientation() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->orient; } -void QFxListView::setOrientation(QFxListView::Orientation orientation) +void QmlGraphicsListView::setOrientation(QmlGraphicsListView::Orientation orientation) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (d->orient != orientation) { d->orient = orientation; - if (d->orient == QFxListView::Vertical) + if (d->orient == QmlGraphicsListView::Vertical) setViewportWidth(-1); else setViewportHeight(-1); @@ -1396,15 +1396,15 @@ void QFxListView::setOrientation(QFxListView::Orientation orientation) If this property is true then key presses to move off of one end of the list will cause the current item to jump to the other end. */ -bool QFxListView::isWrapEnabled() const +bool QmlGraphicsListView::isWrapEnabled() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->wrap; } -void QFxListView::setWrapEnabled(bool wrap) +void QmlGraphicsListView::setWrapEnabled(bool wrap) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->wrap = wrap; } @@ -1416,15 +1416,15 @@ void QFxListView::setWrapEnabled(bool wrap) and below the bottom of the list to cache. Setting this value can make scrolling the list smoother at the expense of additional memory usage. */ -int QFxListView::cacheBuffer() const +int QmlGraphicsListView::cacheBuffer() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->buffer; } -void QFxListView::setCacheBuffer(int b) +void QmlGraphicsListView::setCacheBuffer(int b) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (d->buffer != b) { d->buffer = b; if (isComponentComplete()) @@ -1446,24 +1446,24 @@ void QFxListView::setCacheBuffer(int b) \image ListViewSections.png */ -QString QFxListView::sectionExpression() const +QString QmlGraphicsListView::sectionExpression() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->sectionExpression; } -void QFxListView::setSectionExpression(const QString &expression) +void QmlGraphicsListView::setSectionExpression(const QString &expression) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (d->sectionExpression != expression) { d->sectionExpression = expression; emit sectionExpressionChanged(); } } -QString QFxListView::currentSection() const +QString QmlGraphicsListView::currentSection() const { - Q_D(const QFxListView); + Q_D(const QmlGraphicsListView); return d->currentSection; } @@ -1472,15 +1472,15 @@ QString QFxListView::currentSection() const This property holds the moving animation speed of the highlight delegate. */ -qreal QFxListView::highlightMoveSpeed() const +qreal QmlGraphicsListView::highlightMoveSpeed() const { - Q_D(const QFxListView);\ + Q_D(const QmlGraphicsListView);\ return d->highlightMoveSpeed; } -void QFxListView::setHighlightMoveSpeed(qreal speed) +void QmlGraphicsListView::setHighlightMoveSpeed(qreal speed) { - Q_D(QFxListView);\ + Q_D(QmlGraphicsListView);\ if (d->highlightMoveSpeed != speed) { d->highlightMoveSpeed = speed; @@ -1493,15 +1493,15 @@ void QFxListView::setHighlightMoveSpeed(qreal speed) This property holds the resizing animation speed of the highlight delegate. */ -qreal QFxListView::highlightResizeSpeed() const +qreal QmlGraphicsListView::highlightResizeSpeed() const { - Q_D(const QFxListView);\ + Q_D(const QmlGraphicsListView);\ return d->highlightResizeSpeed; } -void QFxListView::setHighlightResizeSpeed(qreal speed) +void QmlGraphicsListView::setHighlightResizeSpeed(qreal speed) { - Q_D(QFxListView);\ + Q_D(QmlGraphicsListView);\ if (d->highlightResizeSpeed != speed) { d->highlightResizeSpeed = speed; @@ -1509,14 +1509,14 @@ void QFxListView::setHighlightResizeSpeed(qreal speed) } } -void QFxListView::viewportMoved() +void QmlGraphicsListView::viewportMoved() { - Q_D(QFxListView); - QFxFlickable::viewportMoved(); + Q_D(QmlGraphicsListView); + QmlGraphicsFlickable::viewportMoved(); refill(); if (isFlicking() || d->moving) - d->moveReason = QFxListViewPrivate::Mouse; - if (d->moveReason == QFxListViewPrivate::Mouse) { + d->moveReason = QmlGraphicsListViewPrivate::Mouse; + if (d->moveReason == QmlGraphicsListViewPrivate::Mouse) { if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) { int idx = d->snapIndex(); if (idx >= 0 && idx != d->currentIndex) @@ -1532,11 +1532,11 @@ void QFxListView::viewportMoved() } } -qreal QFxListView::minYExtent() const +qreal QmlGraphicsListView::minYExtent() const { - Q_D(const QFxListView); - if (d->orient == QFxListView::Horizontal) - return QFxFlickable::minYExtent(); + Q_D(const QmlGraphicsListView); + if (d->orient == QmlGraphicsListView::Horizontal) + return QmlGraphicsFlickable::minYExtent(); qreal extent = -d->startPosition(); if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) extent += d->highlightRangeStart; @@ -1544,11 +1544,11 @@ qreal QFxListView::minYExtent() const return extent; } -qreal QFxListView::maxYExtent() const +qreal QmlGraphicsListView::maxYExtent() const { - Q_D(const QFxListView); - if (d->orient == QFxListView::Horizontal) - return QFxFlickable::maxYExtent(); + Q_D(const QmlGraphicsListView); + if (d->orient == QmlGraphicsListView::Horizontal) + return QmlGraphicsFlickable::maxYExtent(); qreal extent; if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) extent = -(d->positionAt(count()-1) - d->highlightRangeEnd); @@ -1560,11 +1560,11 @@ qreal QFxListView::maxYExtent() const return extent; } -qreal QFxListView::minXExtent() const +qreal QmlGraphicsListView::minXExtent() const { - Q_D(const QFxListView); - if (d->orient == QFxListView::Vertical) - return QFxFlickable::minXExtent(); + Q_D(const QmlGraphicsListView); + if (d->orient == QmlGraphicsListView::Vertical) + return QmlGraphicsFlickable::minXExtent(); qreal extent = -d->startPosition(); if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) extent += d->highlightRangeStart; @@ -1572,11 +1572,11 @@ qreal QFxListView::minXExtent() const return extent; } -qreal QFxListView::maxXExtent() const +qreal QmlGraphicsListView::maxXExtent() const { - Q_D(const QFxListView); - if (d->orient == QFxListView::Vertical) - return QFxFlickable::maxXExtent(); + Q_D(const QmlGraphicsListView); + if (d->orient == QmlGraphicsListView::Vertical) + return QmlGraphicsFlickable::maxXExtent(); qreal extent; if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) extent = -(d->positionAt(count()-1) - d->highlightRangeEnd); @@ -1588,18 +1588,18 @@ qreal QFxListView::maxXExtent() const return extent; } -void QFxListView::keyPressEvent(QKeyEvent *event) +void QmlGraphicsListView::keyPressEvent(QKeyEvent *event) { - Q_D(QFxListView); - QFxFlickable::keyPressEvent(event); + Q_D(QmlGraphicsListView); + QmlGraphicsFlickable::keyPressEvent(event); if (event->isAccepted()) return; if (d->model && d->model->count() && d->interactive) { - if ((d->orient == QFxListView::Horizontal && event->key() == Qt::Key_Left) - || (d->orient == QFxListView::Vertical && event->key() == Qt::Key_Up)) { + if ((d->orient == QmlGraphicsListView::Horizontal && event->key() == Qt::Key_Left) + || (d->orient == QmlGraphicsListView::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) { - d->moveReason = QFxListViewPrivate::Key; + d->moveReason = QmlGraphicsListViewPrivate::Key; decrementCurrentIndex(); event->accept(); return; @@ -1607,10 +1607,10 @@ void QFxListView::keyPressEvent(QKeyEvent *event) event->accept(); return; } - } else if ((d->orient == QFxListView::Horizontal && event->key() == Qt::Key_Right) - || (d->orient == QFxListView::Vertical && event->key() == Qt::Key_Down)) { + } else if ((d->orient == QmlGraphicsListView::Horizontal && event->key() == Qt::Key_Right) + || (d->orient == QmlGraphicsListView::Vertical && event->key() == Qt::Key_Down)) { if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) { - d->moveReason = QFxListViewPrivate::Key; + d->moveReason = QmlGraphicsListViewPrivate::Key; incrementCurrentIndex(); event->accept(); return; @@ -1620,7 +1620,7 @@ void QFxListView::keyPressEvent(QKeyEvent *event) } } } - d->moveReason = QFxListViewPrivate::Other; + d->moveReason = QmlGraphicsListViewPrivate::Other; event->ignore(); } @@ -1630,9 +1630,9 @@ void QFxListView::keyPressEvent(QKeyEvent *event) Increments the current index. The current index will wrap if keyNavigationWraps is true and it is currently at the end. */ -void QFxListView::incrementCurrentIndex() +void QmlGraphicsListView::incrementCurrentIndex() { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (currentIndex() < d->model->count() - 1 || d->wrap) { int index = currentIndex()+1; cancelFlick(); @@ -1646,9 +1646,9 @@ void QFxListView::incrementCurrentIndex() Decrements the current index. The current index will wrap if keyNavigationWraps is true and it is currently at the beginning. */ -void QFxListView::decrementCurrentIndex() +void QmlGraphicsListView::decrementCurrentIndex() { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (currentIndex() > 0 || d->wrap) { int index = currentIndex()-1; cancelFlick(); @@ -1656,28 +1656,28 @@ void QFxListView::decrementCurrentIndex() } } -void QFxListView::componentComplete() +void QmlGraphicsListView::componentComplete() { - Q_D(QFxListView); - QFxFlickable::componentComplete(); + Q_D(QmlGraphicsListView); + QmlGraphicsFlickable::componentComplete(); if (d->currentIndex < 0) d->updateCurrent(0); refill(); d->fixupPosition(); } -void QFxListView::refill() +void QmlGraphicsListView::refill() { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->refill(d->position(), d->position()+d->size()-1); } -void QFxListView::trackedPositionChanged() +void QmlGraphicsListView::trackedPositionChanged() { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (!d->trackedItem) return; - if (!isFlicking() && !d->moving && d->moveReason != QFxListViewPrivate::Mouse) { + if (!isFlicking() && !d->moving && d->moveReason != QmlGraphicsListViewPrivate::Mouse) { const qreal trackedPos = d->trackedItem->position(); const qreal viewPos = d->position(); if (d->haveHighlightRange) { @@ -1726,19 +1726,19 @@ void QFxListView::trackedPositionChanged() } } -void QFxListView::itemResized() +void QmlGraphicsListView::itemResized() { - Q_D(QFxListView); - QFxItem *item = qobject_cast(sender()); + Q_D(QmlGraphicsListView); + QmlGraphicsItem *item = qobject_cast(sender()); if (item) { d->layout(); d->fixupPosition(); } } -void QFxListView::itemsInserted(int modelIndex, int count) +void QmlGraphicsListView::itemsInserted(int modelIndex, int count) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->updateUnrequestedIndexes(); if (!d->visibleItems.count() || d->model->count() <= 1) { d->layout(); @@ -1824,9 +1824,9 @@ void QFxListView::itemsInserted(int modelIndex, int count) emit countChanged(); } -void QFxListView::itemsRemoved(int modelIndex, int count) +void QmlGraphicsListView::itemsRemoved(int modelIndex, int count) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->updateUnrequestedIndexes(); bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count; if (!d->mapRangeFromModel(modelIndex, count)) { @@ -1921,9 +1921,9 @@ void QFxListView::itemsRemoved(int modelIndex, int count) emit countChanged(); } -void QFxListView::destroyRemoved() +void QmlGraphicsListView::destroyRemoved() { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); for (QList::Iterator it = d->visibleItems.begin(); it != d->visibleItems.end();) { FxListItem *listItem = *it; @@ -1939,9 +1939,9 @@ void QFxListView::destroyRemoved() d->layout(); } -void QFxListView::itemsMoved(int from, int to, int count) +void QmlGraphicsListView::itemsMoved(int from, int to, int count) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); qreal firstItemPos = d->visibleItems.first()->position(); QHash moved; int moveBy = 0; @@ -2005,31 +2005,31 @@ void QFxListView::itemsMoved(int from, int to, int count) d->layout(); } -void QFxListView::createdItem(int index, QFxItem *item) +void QmlGraphicsListView::createdItem(int index, QmlGraphicsItem *item) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); if (d->requestedIndex != index) { item->setParentItem(viewport()); d->unrequestedItems.insert(item, index); - if (d->orient == QFxListView::Vertical) + if (d->orient == QmlGraphicsListView::Vertical) item->setY(d->positionAt(index)); else item->setX(d->positionAt(index)); } } -void QFxListView::destroyingItem(QFxItem *item) +void QmlGraphicsListView::destroyingItem(QmlGraphicsItem *item) { - Q_D(QFxListView); + Q_D(QmlGraphicsListView); d->unrequestedItems.remove(item); } -QFxListViewAttached *QFxListView::qmlAttachedProperties(QObject *obj) +QmlGraphicsListViewAttached *QmlGraphicsListView::qmlAttachedProperties(QObject *obj) { - return QFxListViewAttached::properties(obj); + return QmlGraphicsListViewAttached::properties(obj); } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ListView,QFxListView) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ListView,QmlGraphicsListView) QT_END_NAMESPACE #include "qfxlistview.moc" diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index b31b951..19e88c7 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -51,18 +51,18 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxVisualModel; -class QFxListViewAttached; -class QFxListViewPrivate; -class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable +class QmlGraphicsVisualModel; +class QmlGraphicsListViewAttached; +class QmlGraphicsListViewPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsListView : public QmlGraphicsFlickable { Q_OBJECT - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxListView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsListView) Q_PROPERTY(QVariant model READ model WRITE setModel) Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) - Q_PROPERTY(QFxItem *currentItem READ currentItem NOTIFY currentIndexChanged) + Q_PROPERTY(QmlGraphicsItem *currentItem READ currentItem NOTIFY currentIndexChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(QmlComponent *highlight READ highlight WRITE setHighlight) Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) @@ -85,8 +85,8 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable Q_CLASSINFO("DefaultProperty", "data") public: - QFxListView(QFxItem *parent=0); - ~QFxListView(); + QmlGraphicsListView(QmlGraphicsItem *parent=0); + ~QmlGraphicsListView(); QVariant model() const; void setModel(const QVariant &); @@ -97,7 +97,7 @@ public: int currentIndex() const; void setCurrentIndex(int idx); - QFxItem *currentItem(); + QmlGraphicsItem *currentItem(); int count() const; QmlComponent *highlight() const; @@ -139,7 +139,7 @@ public: qreal highlightResizeSpeed() const; void setHighlightResizeSpeed(qreal); - static QFxListViewAttached *qmlAttachedProperties(QObject *); + static QmlGraphicsListViewAttached *qmlAttachedProperties(QObject *); public Q_SLOTS: void incrementCurrentIndex(); @@ -172,14 +172,14 @@ private Q_SLOTS: void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); void destroyRemoved(); - void createdItem(int index, QFxItem *item); - void destroyingItem(QFxItem *item); + void createdItem(int index, QmlGraphicsItem *item); + void destroyingItem(QmlGraphicsItem *item); }; QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QFxListView, QML_HAS_ATTACHED_PROPERTIES) -QML_DECLARE_TYPE(QFxListView) +QML_DECLARE_TYPEINFO(QmlGraphicsListView, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QmlGraphicsListView) QT_END_HEADER diff --git a/src/declarative/fx/qfxloader.cpp b/src/declarative/fx/qfxloader.cpp index da4a280..af51282 100644 --- a/src/declarative/fx/qfxloader.cpp +++ b/src/declarative/fx/qfxloader.cpp @@ -44,16 +44,16 @@ QT_BEGIN_NAMESPACE -QFxLoaderPrivate::QFxLoaderPrivate() -: item(0), component(0), ownComponent(false), resizeMode(QFxLoader::SizeLoaderToItem) +QmlGraphicsLoaderPrivate::QmlGraphicsLoaderPrivate() +: item(0), component(0), ownComponent(false), resizeMode(QmlGraphicsLoader::SizeLoaderToItem) { } -QFxLoaderPrivate::~QFxLoaderPrivate() +QmlGraphicsLoaderPrivate::~QmlGraphicsLoaderPrivate() { } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Loader,QFxLoader) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Loader,QmlGraphicsLoader) /*! \qmlclass Loader @@ -78,22 +78,22 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Loader,QFxLoader) /*! \internal - \class QFxLoader + \class QmlGraphicsLoader \qmlclass Loader */ /*! - Create a new QFxLoader instance. + Create a new QmlGraphicsLoader instance. */ -QFxLoader::QFxLoader(QFxItem *parent) - : QFxItem(*(new QFxLoaderPrivate), parent) +QmlGraphicsLoader::QmlGraphicsLoader(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsLoaderPrivate), parent) { } /*! Destroy the loader instance. */ -QFxLoader::~QFxLoader() +QmlGraphicsLoader::~QmlGraphicsLoader() { } @@ -104,15 +104,15 @@ QFxLoader::~QFxLoader() \sa status, progress */ -QUrl QFxLoader::source() const +QUrl QmlGraphicsLoader::source() const { - Q_D(const QFxLoader); + Q_D(const QmlGraphicsLoader); return d->source; } -void QFxLoader::setSource(const QUrl &url) +void QmlGraphicsLoader::setSource(const QUrl &url) { - Q_D(QFxLoader); + Q_D(QmlGraphicsLoader); if (d->source == url) return; @@ -167,15 +167,15 @@ void QFxLoader::setSource(const QUrl &url) \sa source */ -QmlComponent *QFxLoader::sourceComponent() const +QmlComponent *QmlGraphicsLoader::sourceComponent() const { - Q_D(const QFxLoader); + Q_D(const QmlGraphicsLoader); return d->component; } -void QFxLoader::setSourceComponent(QmlComponent *comp) +void QmlGraphicsLoader::setSourceComponent(QmlComponent *comp) { - Q_D(QFxLoader); + Q_D(QmlGraphicsLoader); if (comp == d->component) return; @@ -211,9 +211,9 @@ void QFxLoader::setSourceComponent(QmlComponent *comp) } } -void QFxLoaderPrivate::_q_sourceLoaded() +void QmlGraphicsLoaderPrivate::_q_sourceLoaded() { - Q_Q(QFxLoader); + Q_Q(QmlGraphicsLoader); if (component) { QmlContext *ctxt = new QmlContext(qmlContext(q)); @@ -229,14 +229,14 @@ void QFxLoaderPrivate::_q_sourceLoaded() QObject *obj = component->create(ctxt); if (obj) { - item = qobject_cast(obj); + item = qobject_cast(obj); if (item) { item->setParentItem(q); // item->setFocus(true); - QFxItem *resizeItem = 0; - if (resizeMode == QFxLoader::SizeLoaderToItem) + QmlGraphicsItem *resizeItem = 0; + if (resizeMode == QmlGraphicsLoader::SizeLoaderToItem) resizeItem = item; - else if (resizeMode == QFxLoader::SizeItemToLoader) + else if (resizeMode == QmlGraphicsLoader::SizeItemToLoader) resizeItem = q; if (resizeItem) { QObject::connect(resizeItem, SIGNAL(widthChanged()), q, SLOT(_q_updateSize())); @@ -269,12 +269,12 @@ void QFxLoaderPrivate::_q_sourceLoaded() \sa progress */ -QFxLoader::Status QFxLoader::status() const +QmlGraphicsLoader::Status QmlGraphicsLoader::status() const { - Q_D(const QFxLoader); + Q_D(const QmlGraphicsLoader); if (d->component) - return static_cast(d->component->status()); + return static_cast(d->component->status()); if (d->item) return Ready; @@ -290,9 +290,9 @@ QFxLoader::Status QFxLoader::status() const \sa status */ -qreal QFxLoader::progress() const +qreal QmlGraphicsLoader::progress() const { - Q_D(const QFxLoader); + Q_D(const QmlGraphicsLoader); if (d->item) return 1.0; @@ -315,20 +315,20 @@ qreal QFxLoader::progress() const The default resizeMode is SizeLoaderToItem. */ -QFxLoader::ResizeMode QFxLoader::resizeMode() const +QmlGraphicsLoader::ResizeMode QmlGraphicsLoader::resizeMode() const { - Q_D(const QFxLoader); + Q_D(const QmlGraphicsLoader); return d->resizeMode; } -void QFxLoader::setResizeMode(ResizeMode mode) +void QmlGraphicsLoader::setResizeMode(ResizeMode mode) { - Q_D(QFxLoader); + Q_D(QmlGraphicsLoader); if (mode == d->resizeMode) return; if (d->item) { - QFxItem *resizeItem = 0; + QmlGraphicsItem *resizeItem = 0; if (d->resizeMode == SizeLoaderToItem) resizeItem = d->item; else if (d->resizeMode == SizeItemToLoader) @@ -342,7 +342,7 @@ void QFxLoader::setResizeMode(ResizeMode mode) d->resizeMode = mode; if (d->item) { - QFxItem *resizeItem = 0; + QmlGraphicsItem *resizeItem = 0; if (d->resizeMode == SizeLoaderToItem) resizeItem = d->item; else if (d->resizeMode == SizeItemToLoader) @@ -356,17 +356,17 @@ void QFxLoader::setResizeMode(ResizeMode mode) } } -void QFxLoaderPrivate::_q_updateSize() +void QmlGraphicsLoaderPrivate::_q_updateSize() { - Q_Q(QFxLoader); + Q_Q(QmlGraphicsLoader); if (!item) return; switch (resizeMode) { - case QFxLoader::SizeLoaderToItem: + case QmlGraphicsLoader::SizeLoaderToItem: q->setImplicitWidth(item->width()); q->setImplicitHeight(item->height()); break; - case QFxLoader::SizeItemToLoader: + case QmlGraphicsLoader::SizeItemToLoader: item->setWidth(q->width()); item->setHeight(q->height()); break; @@ -379,9 +379,9 @@ void QFxLoaderPrivate::_q_updateSize() \qmlproperty Item Loader::item This property holds the top-level item created from source. */ -QFxItem *QFxLoader::item() const +QmlGraphicsItem *QmlGraphicsLoader::item() const { - Q_D(const QFxLoader); + Q_D(const QmlGraphicsLoader); return d->item; } diff --git a/src/declarative/fx/qfxloader.h b/src/declarative/fx/qfxloader.h index b967465..b838ed0 100644 --- a/src/declarative/fx/qfxloader.h +++ b/src/declarative/fx/qfxloader.h @@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxLoaderPrivate; -class Q_DECLARATIVE_EXPORT QFxLoader : public QFxItem +class QmlGraphicsLoaderPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsLoader : public QmlGraphicsItem { Q_OBJECT Q_ENUMS(Status) @@ -60,14 +60,14 @@ class Q_DECLARATIVE_EXPORT QFxLoader : public QFxItem Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QmlComponent *sourceComponent READ sourceComponent WRITE setSourceComponent NOTIFY sourceChanged) Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) - Q_PROPERTY(QFxItem *item READ item NOTIFY itemChanged) + Q_PROPERTY(QmlGraphicsItem *item READ item NOTIFY itemChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) //### sourceItem public: - QFxLoader(QFxItem *parent=0); - virtual ~QFxLoader(); + QmlGraphicsLoader(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsLoader(); QUrl source() const; void setSource(const QUrl &); @@ -83,7 +83,7 @@ public: ResizeMode resizeMode() const; void setResizeMode(ResizeMode mode); - QFxItem *item() const; + QmlGraphicsItem *item() const; Q_SIGNALS: void itemChanged(); @@ -92,15 +92,15 @@ Q_SIGNALS: void progressChanged(); private: - Q_DISABLE_COPY(QFxLoader) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxLoader) + Q_DISABLE_COPY(QmlGraphicsLoader) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsLoader) Q_PRIVATE_SLOT(d_func(), void _q_sourceLoaded()) Q_PRIVATE_SLOT(d_func(), void _q_updateSize()) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxLoader) +QML_DECLARE_TYPE(QmlGraphicsLoader) QT_END_HEADER diff --git a/src/declarative/fx/qfxloader_p.h b/src/declarative/fx/qfxloader_p.h index 0700fcd..336c884 100644 --- a/src/declarative/fx/qfxloader_p.h +++ b/src/declarative/fx/qfxloader_p.h @@ -59,19 +59,19 @@ QT_BEGIN_NAMESPACE class QmlContext; -class QFxLoaderPrivate : public QFxItemPrivate +class QmlGraphicsLoaderPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxLoader) + Q_DECLARE_PUBLIC(QmlGraphicsLoader) public: - QFxLoaderPrivate(); - ~QFxLoaderPrivate(); + QmlGraphicsLoaderPrivate(); + ~QmlGraphicsLoaderPrivate(); QUrl source; - QFxItem *item; + QmlGraphicsItem *item; QmlComponent *component; bool ownComponent; - QFxLoader::ResizeMode resizeMode; + QmlGraphicsLoader::ResizeMode resizeMode; void _q_sourceLoaded(); void _q_updateSize(); diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp index 315a273..8acf32c 100644 --- a/src/declarative/fx/qfxmouseregion.cpp +++ b/src/declarative/fx/qfxmouseregion.cpp @@ -49,72 +49,72 @@ QT_BEGIN_NAMESPACE static const qreal DragThreshold = 5; static const int PressAndHoldDelay = 800; -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Drag,QFxDrag) -QFxDrag::QFxDrag(QObject *parent) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Drag,QmlGraphicsDrag) +QmlGraphicsDrag::QmlGraphicsDrag(QObject *parent) : QObject(parent), _target(0), _axis(XandYAxis), _xmin(0), _xmax(0), _ymin(0), _ymax(0) { } -QFxDrag::~QFxDrag() +QmlGraphicsDrag::~QmlGraphicsDrag() { } -QFxItem *QFxDrag::target() const +QmlGraphicsItem *QmlGraphicsDrag::target() const { return _target; } -void QFxDrag::setTarget(QFxItem *t) +void QmlGraphicsDrag::setTarget(QmlGraphicsItem *t) { _target = t; } -QFxDrag::Axis QFxDrag::axis() const +QmlGraphicsDrag::Axis QmlGraphicsDrag::axis() const { return _axis; } -void QFxDrag::setAxis(QFxDrag::Axis a) +void QmlGraphicsDrag::setAxis(QmlGraphicsDrag::Axis a) { _axis = a; } -qreal QFxDrag::xmin() const +qreal QmlGraphicsDrag::xmin() const { return _xmin; } -void QFxDrag::setXmin(qreal m) +void QmlGraphicsDrag::setXmin(qreal m) { _xmin = m; } -qreal QFxDrag::xmax() const +qreal QmlGraphicsDrag::xmax() const { return _xmax; } -void QFxDrag::setXmax(qreal m) +void QmlGraphicsDrag::setXmax(qreal m) { _xmax = m; } -qreal QFxDrag::ymin() const +qreal QmlGraphicsDrag::ymin() const { return _ymin; } -void QFxDrag::setYmin(qreal m) +void QmlGraphicsDrag::setYmin(qreal m) { _ymin = m; } -qreal QFxDrag::ymax() const +qreal QmlGraphicsDrag::ymax() const { return _ymax; } -void QFxDrag::setYmax(qreal m) +void QmlGraphicsDrag::setYmax(qreal m) { _ymax = m; } @@ -225,35 +225,35 @@ void QFxDrag::setYmax(qreal m) The \e accepted property of the MouseEvent parameter is ignored in this handler. */ -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,MouseRegion,QFxMouseRegion) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,MouseRegion,QmlGraphicsMouseRegion) /*! \internal - \class QFxMouseRegion - \brief The QFxMouseRegion class provides a simple mouse handling abstraction for use within Qml. + \class QmlGraphicsMouseRegion + \brief The QmlGraphicsMouseRegion class provides a simple mouse handling abstraction for use within Qml. \ingroup group_coreitems - All QFxItem derived classes can do mouse handling but the QFxMouseRegion class exposes mouse + All QmlGraphicsItem derived classes can do mouse handling but the QmlGraphicsMouseRegion class exposes mouse handling data as properties and tracks flicking and dragging of the mouse. - A QFxMouseRegion object can be instantiated in Qml using the tag \l MouseRegion. + A QmlGraphicsMouseRegion object can be instantiated in Qml using the tag \l MouseRegion. */ -QFxMouseRegion::QFxMouseRegion(QFxItem *parent) - : QFxItem(*(new QFxMouseRegionPrivate), parent) +QmlGraphicsMouseRegion::QmlGraphicsMouseRegion(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsMouseRegionPrivate), parent) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); d->init(); } -QFxMouseRegion::QFxMouseRegion(QFxMouseRegionPrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsMouseRegion::QmlGraphicsMouseRegion(QmlGraphicsMouseRegionPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); d->init(); } -QFxMouseRegion::~QFxMouseRegion() +QmlGraphicsMouseRegion::~QmlGraphicsMouseRegion() { } @@ -274,15 +274,15 @@ QFxMouseRegion::~QFxMouseRegion() The coordinates are relative to the MouseRegion. */ -qreal QFxMouseRegion::mouseX() const +qreal QmlGraphicsMouseRegion::mouseX() const { - Q_D(const QFxMouseRegion); + Q_D(const QmlGraphicsMouseRegion); return d->lastPos.x(); } -qreal QFxMouseRegion::mouseY() const +qreal QmlGraphicsMouseRegion::mouseY() const { - Q_D(const QFxMouseRegion); + Q_D(const QmlGraphicsMouseRegion); return d->lastPos.y(); } @@ -290,15 +290,15 @@ qreal QFxMouseRegion::mouseY() const \qmlproperty bool MouseRegion::enabled This property holds whether the item accepts mouse events. */ -bool QFxMouseRegion::isEnabled() const +bool QmlGraphicsMouseRegion::isEnabled() const { - Q_D(const QFxMouseRegion); + Q_D(const QmlGraphicsMouseRegion); return d->absorb; } -void QFxMouseRegion::setEnabled(bool a) +void QmlGraphicsMouseRegion::setEnabled(bool a) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (a != d->absorb) { d->absorb = a; emit enabledChanged(); @@ -331,40 +331,40 @@ void QFxMouseRegion::setEnabled(bool a) \sa acceptedButtons */ -Qt::MouseButtons QFxMouseRegion::pressedButtons() const +Qt::MouseButtons QmlGraphicsMouseRegion::pressedButtons() const { - Q_D(const QFxMouseRegion); + Q_D(const QmlGraphicsMouseRegion); return d->lastButtons; } -void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); d->moved = false; if (!d->absorb) - QFxItem::mousePressEvent(event); + QmlGraphicsItem::mousePressEvent(event); else { d->longPress = false; d->saveEvent(event); - d->dragX = drag()->axis() & QFxDrag::XAxis; - d->dragY = drag()->axis() & QFxDrag::YAxis; + d->dragX = drag()->axis() & QmlGraphicsDrag::XAxis; + d->dragY = drag()->axis() & QmlGraphicsDrag::YAxis; d->dragged = false; setHovered(true); d->start = event->pos(); d->startScene = event->scenePos(); // we should only start timer if pressAndHold is connected to. - if (d->isConnected("pressAndHold(QFxMouseEvent*)")) + if (d->isConnected("pressAndHold(QmlGraphicsMouseEvent*)")) d->pressAndHoldTimer.start(PressAndHoldDelay, this); setKeepMouseGrab(false); event->setAccepted(setPressed(true)); } } -void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (!d->absorb) { - QFxItem::mouseMoveEvent(event); + QmlGraphicsItem::mouseMoveEvent(event); return; } @@ -424,16 +424,16 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } } d->moved = true; - QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress); + QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress); emit positionChanged(&me); } -void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (!d->absorb) { - QFxItem::mouseReleaseEvent(event); + QmlGraphicsItem::mouseReleaseEvent(event); } else { d->saveEvent(event); setPressed(false); @@ -444,57 +444,57 @@ void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } } -void QFxMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (!d->absorb) { - QFxItem::mouseDoubleClickEvent(event); + QmlGraphicsItem::mouseDoubleClickEvent(event); } else { - QFxItem::mouseDoubleClickEvent(event); + QmlGraphicsItem::mouseDoubleClickEvent(event); if (event->isAccepted()) { // Only deliver the event if we have accepted the press. d->saveEvent(event); - QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false); + QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false); emit this->doubleClicked(&me); } } } -void QFxMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +void QmlGraphicsMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (!d->absorb) - QFxItem::hoverEnterEvent(event); + QmlGraphicsItem::hoverEnterEvent(event); else setHovered(true); } -void QFxMouseRegion::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +void QmlGraphicsMouseRegion::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (!d->absorb) { - QFxItem::hoverEnterEvent(event); + QmlGraphicsItem::hoverEnterEvent(event); } else { d->lastPos = event->pos(); - QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress); + QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress); emit positionChanged(&me); } } -void QFxMouseRegion::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +void QmlGraphicsMouseRegion::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (!d->absorb) - QFxItem::hoverLeaveEvent(event); + QmlGraphicsItem::hoverLeaveEvent(event); else setHovered(false); } -bool QFxMouseRegion::sceneEvent(QEvent *event) +bool QmlGraphicsMouseRegion::sceneEvent(QEvent *event) { - bool rv = QFxItem::sceneEvent(event); + bool rv = QmlGraphicsItem::sceneEvent(event); if (event->type() == QEvent::UngrabMouse) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (d->pressed) { // if our mouse grab has been removed (probably by Flickable), fix our // state @@ -507,14 +507,14 @@ bool QFxMouseRegion::sceneEvent(QEvent *event) return rv; } -void QFxMouseRegion::timerEvent(QTimerEvent *event) +void QmlGraphicsMouseRegion::timerEvent(QTimerEvent *event) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (event->timerId() == d->pressAndHoldTimer.timerId()) { d->pressAndHoldTimer.stop(); if (d->pressed && d->dragged == false && d->hovered == true) { d->longPress = true; - QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress); + QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress); emit pressAndHold(&me); } } @@ -538,9 +538,9 @@ void QFxMouseRegion::timerEvent(QTimerEvent *event) \warning This property is not updated if the region moves under the mouse: \e containsMouse will not change. In addition, if hoverEnabled is false, containsMouse will only be valid when the mouse is pressed. */ -bool QFxMouseRegion::hovered() const +bool QmlGraphicsMouseRegion::hovered() const { - Q_D(const QFxMouseRegion); + Q_D(const QmlGraphicsMouseRegion); return d->hovered; } @@ -548,15 +548,15 @@ bool QFxMouseRegion::hovered() const \qmlproperty bool MouseRegion::pressed This property holds whether the mouse region is currently pressed. */ -bool QFxMouseRegion::pressed() const +bool QmlGraphicsMouseRegion::pressed() const { - Q_D(const QFxMouseRegion); + Q_D(const QmlGraphicsMouseRegion); return d->pressed; } -void QFxMouseRegion::setHovered(bool h) +void QmlGraphicsMouseRegion::setHovered(bool h) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); if (d->hovered != h) { d->hovered = h; emit hoveredChanged(); @@ -584,12 +584,12 @@ void QFxMouseRegion::setHovered(bool h) The default is to accept the Left button. */ -Qt::MouseButtons QFxMouseRegion::acceptedButtons() const +Qt::MouseButtons QmlGraphicsMouseRegion::acceptedButtons() const { return acceptedMouseButtons(); } -void QFxMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons) +void QmlGraphicsMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons) { if (buttons != acceptedMouseButtons()) { setAcceptedMouseButtons(buttons); @@ -597,14 +597,14 @@ void QFxMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons) } } -bool QFxMouseRegion::setPressed(bool p) +bool QmlGraphicsMouseRegion::setPressed(bool p) { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); bool isclick = d->pressed == true && p == false && d->dragged == false && d->hovered == true; if (d->pressed != p) { d->pressed = p; - QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress); + QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress); if (d->pressed) { emit positionChanged(&me); emit pressed(&me); @@ -620,9 +620,9 @@ bool QFxMouseRegion::setPressed(bool p) return false; } -QFxDrag *QFxMouseRegion::drag() +QmlGraphicsDrag *QmlGraphicsMouseRegion::drag() { - Q_D(QFxMouseRegion); + Q_D(QmlGraphicsMouseRegion); return &(d->drag); } diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h index 114ea87..41c3d0e 100644 --- a/src/declarative/fx/qfxmouseregion.h +++ b/src/declarative/fx/qfxmouseregion.h @@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QFxDrag : public QObject +class Q_DECLARATIVE_EXPORT QmlGraphicsDrag : public QObject { Q_OBJECT Q_ENUMS(Axis) - Q_PROPERTY(QFxItem *target READ target WRITE setTarget) + Q_PROPERTY(QmlGraphicsItem *target READ target WRITE setTarget) Q_PROPERTY(Axis axis READ axis WRITE setAxis) Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin) Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax) @@ -64,11 +64,11 @@ class Q_DECLARATIVE_EXPORT QFxDrag : public QObject //### consider drag and drop public: - QFxDrag(QObject *parent=0); - ~QFxDrag(); + QmlGraphicsDrag(QObject *parent=0); + ~QmlGraphicsDrag(); - QFxItem *target() const; - void setTarget(QFxItem *); + QmlGraphicsItem *target() const; + void setTarget(QmlGraphicsItem *); enum Axis { XAxis=0x01, YAxis=0x02, XandYAxis=0x03 }; Axis axis() const; @@ -84,18 +84,18 @@ public: void setYmax(qreal); private: - QFxItem *_target; + QmlGraphicsItem *_target; Axis _axis; qreal _xmin; qreal _xmax; qreal _ymin; qreal _ymax; - Q_DISABLE_COPY(QFxDrag) + Q_DISABLE_COPY(QmlGraphicsDrag) }; -class QFxMouseEvent; -class QFxMouseRegionPrivate; -class Q_DECLARATIVE_EXPORT QFxMouseRegion : public QFxItem +class QmlGraphicsMouseEvent; +class QmlGraphicsMouseRegionPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem { Q_OBJECT @@ -107,11 +107,11 @@ class Q_DECLARATIVE_EXPORT QFxMouseRegion : public QFxItem Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedChanged) Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged) Q_PROPERTY(bool hoverEnabled READ acceptHoverEvents WRITE setAcceptHoverEvents) - Q_PROPERTY(QFxDrag *drag READ drag) //### add flicking to QFxDrag or add a QFxFlick ??? + Q_PROPERTY(QmlGraphicsDrag *drag READ drag) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ??? public: - QFxMouseRegion(QFxItem *parent=0); - ~QFxMouseRegion(); + QmlGraphicsMouseRegion(QmlGraphicsItem *parent=0); + ~QmlGraphicsMouseRegion(); qreal mouseX() const; qreal mouseY() const; @@ -127,20 +127,20 @@ public: Qt::MouseButtons acceptedButtons() const; void setAcceptedButtons(Qt::MouseButtons buttons); - QFxDrag *drag(); + QmlGraphicsDrag *drag(); Q_SIGNALS: void hoveredChanged(); void pressedChanged(); void enabledChanged(); void acceptedButtonsChanged(); - void positionChanged(QFxMouseEvent *mouse); + void positionChanged(QmlGraphicsMouseEvent *mouse); - void pressed(QFxMouseEvent *mouse); - void pressAndHold(QFxMouseEvent *mouse); - void released(QFxMouseEvent *mouse); - void clicked(QFxMouseEvent *mouse); - void doubleClicked(QFxMouseEvent *mouse); + void pressed(QmlGraphicsMouseEvent *mouse); + void pressAndHold(QmlGraphicsMouseEvent *mouse); + void released(QmlGraphicsMouseEvent *mouse); + void clicked(QmlGraphicsMouseEvent *mouse); + void doubleClicked(QmlGraphicsMouseEvent *mouse); void entered(); void exited(); @@ -163,17 +163,17 @@ private: void handleRelease(); protected: - QFxMouseRegion(QFxMouseRegionPrivate &dd, QFxItem *parent); + QmlGraphicsMouseRegion(QmlGraphicsMouseRegionPrivate &dd, QmlGraphicsItem *parent); private: - Q_DISABLE_COPY(QFxMouseRegion) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxMouseRegion) + Q_DISABLE_COPY(QmlGraphicsMouseRegion) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseRegion) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxDrag) -QML_DECLARE_TYPE(QFxMouseRegion) +QML_DECLARE_TYPE(QmlGraphicsDrag) +QML_DECLARE_TYPE(QmlGraphicsMouseRegion) QT_END_HEADER diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h index caed2ab..66efb6f 100644 --- a/src/declarative/fx/qfxmouseregion_p.h +++ b/src/declarative/fx/qfxmouseregion_p.h @@ -60,19 +60,19 @@ QT_BEGIN_NAMESPACE -class QFxMouseRegionPrivate : public QFxItemPrivate +class QmlGraphicsMouseRegionPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxMouseRegion) + Q_DECLARE_PUBLIC(QmlGraphicsMouseRegion) public: - QFxMouseRegionPrivate() + QmlGraphicsMouseRegionPrivate() : absorb(true), hovered(false), pressed(false), longPress(false), drag(0) { } void init() { - Q_Q(QFxMouseRegion); + Q_Q(QmlGraphicsMouseRegion); q->setAcceptedMouseButtons(Qt::LeftButton); } @@ -84,7 +84,7 @@ public: } bool isConnected(const char *signal) { - Q_Q(QFxMouseRegion); + Q_Q(QmlGraphicsMouseRegion); int idx = QObjectPrivate::get(q)->signalIndex(signal); return QObjectPrivate::get(q)->isSignalConnected(idx); } @@ -97,7 +97,7 @@ public: bool dragX : 1; bool dragY : 1; bool dragged : 1; - QFxDrag drag; + QmlGraphicsDrag drag; QPointF start; QPointF startScene; qreal startX; diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp index e0ef99f..24d9602 100644 --- a/src/declarative/fx/qfxpainteditem.cpp +++ b/src/declarative/fx/qfxpainteditem.cpp @@ -53,8 +53,8 @@ QT_BEGIN_NAMESPACE /*! - \class QFxPaintedItem - \brief The QFxPaintedItem class is an abstract base class for QmlView items that want cached painting. + \class QmlGraphicsPaintedItem + \brief The QmlGraphicsPaintedItem class is an abstract base class for QmlView items that want cached painting. \internal This is a convenience class for implementing items that paint their contents @@ -62,21 +62,21 @@ QT_BEGIN_NAMESPACE The dirtyCache() function should be called if the contents change to ensure the cache is refreshed the next time painting occurs. - To subclass QFxPaintedItem, you must reimplement drawContents() to draw + To subclass QmlGraphicsPaintedItem, you must reimplement drawContents() to draw the contents of the item. */ /*! - \fn void QFxPaintedItem::drawContents(QPainter *painter, const QRect &rect) + \fn void QmlGraphicsPaintedItem::drawContents(QPainter *painter, const QRect &rect) This function is called when the cache needs to be refreshed. When - sub-classing QFxPaintedItem this function should be implemented so as to + sub-classing QmlGraphicsPaintedItem this function should be implemented so as to paint the contents of the item using the given \a painter for the area of the contents specified by \a rect. */ /*! - \property QFxPaintedItem::contentsSize + \property QmlGraphicsPaintedItem::contentsSize \brief The size of the contents The contents size is the size of the item in regards to how it is painted @@ -94,11 +94,11 @@ static int inpaint_clearcache=0; \sa clearCache() */ -void QFxPaintedItem::dirtyCache(const QRect& rect) +void QmlGraphicsPaintedItem::dirtyCache(const QRect& rect) { - Q_D(QFxPaintedItem); + Q_D(QmlGraphicsPaintedItem); for (int i=0; i < d->imagecache.count(); ) { - QFxPaintedItemPrivate::ImageCacheItem *c = d->imagecache[i]; + QmlGraphicsPaintedItemPrivate::ImageCacheItem *c = d->imagecache[i]; QRect isect = (c->area & rect) | c->dirty; if (isect == c->area && !inpaint) { delete d->imagecache.takeAt(i); @@ -114,13 +114,13 @@ void QFxPaintedItem::dirtyCache(const QRect& rect) \sa dirtyCache() */ -void QFxPaintedItem::clearCache() +void QmlGraphicsPaintedItem::clearCache() { if (inpaint) { inpaint_clearcache=1; return; } - Q_D(QFxPaintedItem); + Q_D(QmlGraphicsPaintedItem); qDeleteAll(d->imagecache); d->imagecache.clear(); } @@ -130,9 +130,9 @@ void QFxPaintedItem::clearCache() \sa setContentsSize() */ -QSize QFxPaintedItem::contentsSize() const +QSize QmlGraphicsPaintedItem::contentsSize() const { - Q_D(const QFxPaintedItem); + Q_D(const QmlGraphicsPaintedItem); return d->contentsSize; } @@ -141,9 +141,9 @@ QSize QFxPaintedItem::contentsSize() const \sa contentsSize() */ -void QFxPaintedItem::setContentsSize(const QSize &size) +void QmlGraphicsPaintedItem::setContentsSize(const QSize &size) { - Q_D(QFxPaintedItem); + Q_D(QmlGraphicsPaintedItem); if (d->contentsSize == size) return; d->contentsSize = size; clearCache(); @@ -151,21 +151,21 @@ void QFxPaintedItem::setContentsSize(const QSize &size) } /*! - Constructs a new QFxPaintedItem with the given \a parent. + Constructs a new QmlGraphicsPaintedItem with the given \a parent. */ -QFxPaintedItem::QFxPaintedItem(QFxItem *parent) - : QFxItem(*(new QFxPaintedItemPrivate), parent) +QmlGraphicsPaintedItem::QmlGraphicsPaintedItem(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsPaintedItemPrivate), parent) { init(); } /*! \internal - Constructs a new QFxPaintedItem with the given \a parent and + Constructs a new QmlGraphicsPaintedItem with the given \a parent and initialized private data member \a dd. */ -QFxPaintedItem::QFxPaintedItem(QFxPaintedItemPrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsPaintedItem::QmlGraphicsPaintedItem(QmlGraphicsPaintedItemPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { init(); } @@ -173,7 +173,7 @@ QFxPaintedItem::QFxPaintedItem(QFxPaintedItemPrivate &dd, QFxItem *parent) /*! Destroys the image item. */ -QFxPaintedItem::~QFxPaintedItem() +QmlGraphicsPaintedItem::~QmlGraphicsPaintedItem() { clearCache(); } @@ -181,16 +181,16 @@ QFxPaintedItem::~QFxPaintedItem() /*! \internal */ -void QFxPaintedItem::init() +void QmlGraphicsPaintedItem::init() { connect(this,SIGNAL(widthChanged()),this,SLOT(clearCache())); connect(this,SIGNAL(heightChanged()),this,SLOT(clearCache())); connect(this,SIGNAL(visibleChanged()),this,SLOT(clearCache())); } -void QFxPaintedItem::setCacheFrozen(bool frozen) +void QmlGraphicsPaintedItem::setCacheFrozen(bool frozen) { - Q_D(QFxPaintedItem); + Q_D(QmlGraphicsPaintedItem); if (d->cachefrozen == frozen) return; d->cachefrozen = frozen; @@ -200,9 +200,9 @@ void QFxPaintedItem::setCacheFrozen(bool frozen) /*! \reimp */ -void QFxPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { - Q_D(QFxPaintedItem); + Q_D(QmlGraphicsPaintedItem); const QRect content(QPoint(0,0),d->contentsSize); if (content.width() <= 0 || content.height() <= 0) return; @@ -290,7 +290,7 @@ void QFxPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidge qp.translate(-r.x(),-r.y()); drawContents(&qp, r); } - QFxPaintedItemPrivate::ImageCacheItem *newitem = new QFxPaintedItemPrivate::ImageCacheItem; + QmlGraphicsPaintedItemPrivate::ImageCacheItem *newitem = new QmlGraphicsPaintedItemPrivate::ImageCacheItem; newitem->area = r; newitem->image = img; d->imagecache.append(newitem); @@ -320,21 +320,21 @@ void QFxPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidge */ /*! - \property QFxPaintedItem::cacheSize + \property QmlGraphicsPaintedItem::cacheSize The maximum number of pixels of image cache to allow. The default is 0.1 megapixels. The cache will not be larger than the (unscaled) - size of the QFxPaintedItem. + size of the QmlGraphicsPaintedItem. */ -int QFxPaintedItem::cacheSize() const +int QmlGraphicsPaintedItem::cacheSize() const { - Q_D(const QFxPaintedItem); + Q_D(const QmlGraphicsPaintedItem); return d->max_imagecache_size; } -void QFxPaintedItem::setCacheSize(int pixels) +void QmlGraphicsPaintedItem::setCacheSize(int pixels) { - Q_D(QFxPaintedItem); + Q_D(QmlGraphicsPaintedItem); if (pixels < d->max_imagecache_size) { int cachesize=0; for (int i=0; iimagecache.count(); ++i) { @@ -359,7 +359,7 @@ void QFxPaintedItem::setCacheSize(int pixels) } /*! - \property QFxPaintedItem::fillColor + \property QmlGraphicsPaintedItem::fillColor The color to be used to fill the item prior to calling drawContents(). By default, this is Qt::transparent. @@ -367,9 +367,9 @@ void QFxPaintedItem::setCacheSize(int pixels) Performance improvements can be achieved if subclasses call this with either an invalid color (QColor()), or an appropriate solid color. */ -void QFxPaintedItem::setFillColor(const QColor& c) +void QmlGraphicsPaintedItem::setFillColor(const QColor& c) { - Q_D(QFxPaintedItem); + Q_D(QmlGraphicsPaintedItem); if (d->fillColor == c) return; d->fillColor = c; @@ -377,9 +377,9 @@ void QFxPaintedItem::setFillColor(const QColor& c) update(); } -QColor QFxPaintedItem::fillColor() const +QColor QmlGraphicsPaintedItem::fillColor() const { - Q_D(const QFxPaintedItem); + Q_D(const QmlGraphicsPaintedItem); return d->fillColor; } diff --git a/src/declarative/fx/qfxpainteditem.h b/src/declarative/fx/qfxpainteditem.h index 13c6b15..33f938c 100644 --- a/src/declarative/fx/qfxpainteditem.h +++ b/src/declarative/fx/qfxpainteditem.h @@ -52,8 +52,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxPaintedItemPrivate; -class Q_DECLARATIVE_EXPORT QFxPaintedItem : public QFxItem +class QmlGraphicsPaintedItemPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsPaintedItem : public QmlGraphicsItem { Q_OBJECT @@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QFxPaintedItem : public QFxItem Q_PROPERTY(int cacheSize READ cacheSize WRITE setCacheSize) public: - QFxPaintedItem(QFxItem *parent=0); - ~QFxPaintedItem(); + QmlGraphicsPaintedItem(QmlGraphicsItem *parent=0); + ~QmlGraphicsPaintedItem(); QSize contentsSize() const; void setContentsSize(const QSize &); @@ -77,7 +77,7 @@ public: void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); protected: - QFxPaintedItem(QFxPaintedItemPrivate &dd, QFxItem *parent); + QmlGraphicsPaintedItem(QmlGraphicsPaintedItemPrivate &dd, QmlGraphicsItem *parent); virtual void drawContents(QPainter *p, const QRect &) = 0; @@ -92,13 +92,13 @@ protected Q_SLOTS: private: void init(); - Q_DISABLE_COPY(QFxPaintedItem) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxPaintedItem) + Q_DISABLE_COPY(QmlGraphicsPaintedItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPaintedItem) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxPaintedItem) +QML_DECLARE_TYPE(QmlGraphicsPaintedItem) QT_END_HEADER diff --git a/src/declarative/fx/qfxpainteditem_p.h b/src/declarative/fx/qfxpainteditem_p.h index 179fd61..cc7f697 100644 --- a/src/declarative/fx/qfxpainteditem_p.h +++ b/src/declarative/fx/qfxpainteditem_p.h @@ -57,12 +57,12 @@ QT_BEGIN_NAMESPACE -class QFxPaintedItemPrivate : public QFxItemPrivate +class QmlGraphicsPaintedItemPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxPaintedItem) + Q_DECLARE_PUBLIC(QmlGraphicsPaintedItem) public: - QFxPaintedItemPrivate() + QmlGraphicsPaintedItemPrivate() : max_imagecache_size(100000), fillColor(Qt::transparent), cachefrozen(false) { } diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp index 26fafc5..a9bd233 100644 --- a/src/declarative/fx/qfxpath.cpp +++ b/src/declarative/fx/qfxpath.cpp @@ -47,14 +47,14 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Path,QFxPath) -QML_DEFINE_NOCREATE_TYPE(QFxPathElement) -QML_DEFINE_NOCREATE_TYPE(QFxCurve) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathAttribute,QFxPathAttribute) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathPercent,QFxPathPercent) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathLine,QFxPathLine) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathQuad,QFxPathQuad) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathCubic,QFxPathCubic) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Path,QmlGraphicsPath) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsPathElement) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsCurve) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathAttribute,QmlGraphicsPathAttribute) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathPercent,QmlGraphicsPathPercent) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathLine,QmlGraphicsPathLine) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathQuad,QmlGraphicsPathQuad) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathCubic,QmlGraphicsPathCubic) /*! \qmlclass PathElement @@ -68,12 +68,12 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathCubic,QFxPathCubic) /*! \internal - \class QFxPathElement + \class QmlGraphicsPathElement \ingroup group_utility */ /*! - \qmlclass Path QFxPath + \qmlclass Path QmlGraphicsPath \brief A Path object defines a path for use by \l PathView. A Path is composed of one or more path segments - PathLine, PathQuad, @@ -90,22 +90,22 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathCubic,QFxPathCubic) /*! \internal - \class QFxPath + \class QmlGraphicsPath \ingroup group_utility - \brief The QFxPath class defines a path. - \sa QFxPathView + \brief The QmlGraphicsPath class defines a path. + \sa QmlGraphicsPathView */ -QFxPath::QFxPath(QObject *parent) - : QObject(*(new QFxPathPrivate), parent) +QmlGraphicsPath::QmlGraphicsPath(QObject *parent) + : QObject(*(new QmlGraphicsPathPrivate), parent) { } -QFxPath::QFxPath(QFxPathPrivate &dd, QObject *parent) +QmlGraphicsPath::QmlGraphicsPath(QmlGraphicsPathPrivate &dd, QObject *parent) : QObject(dd, parent) { } -QFxPath::~QFxPath() +QmlGraphicsPath::~QmlGraphicsPath() { } @@ -114,27 +114,27 @@ QFxPath::~QFxPath() \qmlproperty real Path::startY This property holds the starting position of the path. */ -qreal QFxPath::startX() const +qreal QmlGraphicsPath::startX() const { - Q_D(const QFxPath); + Q_D(const QmlGraphicsPath); return d->startX; } -void QFxPath::setStartX(qreal x) +void QmlGraphicsPath::setStartX(qreal x) { - Q_D(QFxPath); + Q_D(QmlGraphicsPath); d->startX = x; } -qreal QFxPath::startY() const +qreal QmlGraphicsPath::startY() const { - Q_D(const QFxPath); + Q_D(const QmlGraphicsPath); return d->startY; } -void QFxPath::setStartY(qreal y) +void QmlGraphicsPath::setStartY(qreal y) { - Q_D(QFxPath); + Q_D(QmlGraphicsPath); d->startY = y; } @@ -156,15 +156,15 @@ void QFxPath::setStartY(qreal y) \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 2 */ -QList* QFxPath::pathElements() +QList* QmlGraphicsPath::pathElements() { - Q_D(QFxPath); + Q_D(QmlGraphicsPath); return &(d->_pathElements); } -void QFxPath::interpolate(int idx, const QString &name, qreal value) +void QmlGraphicsPath::interpolate(int idx, const QString &name, qreal value) { - Q_D(QFxPath); + Q_D(QmlGraphicsPath); if (!idx) return; @@ -193,9 +193,9 @@ void QFxPath::interpolate(int idx, const QString &name, qreal value) } } -void QFxPath::endpoint(const QString &name) +void QmlGraphicsPath::endpoint(const QString &name) { - Q_D(QFxPath); + Q_D(QmlGraphicsPath); const AttributePoint &first = d->_attributePoints.first(); qreal val = first.values.value(name); for (int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) { @@ -210,9 +210,9 @@ void QFxPath::endpoint(const QString &name) } } -void QFxPath::processPath() +void QmlGraphicsPath::processPath() { - Q_D(QFxPath); + Q_D(QmlGraphicsPath); d->_pointCache.clear(); d->_attributePoints.clear(); @@ -225,17 +225,17 @@ void QFxPath::processPath() d->_path.moveTo(d->startX, d->startY); - foreach (QFxPathElement *pathElement, d->_pathElements) { - if (QFxCurve *curve = qobject_cast(pathElement)) { + foreach (QmlGraphicsPathElement *pathElement, d->_pathElements) { + if (QmlGraphicsCurve *curve = qobject_cast(pathElement)) { curve->addToPath(d->_path); AttributePoint p; p.origpercent = d->_path.length(); d->_attributePoints << p; - } else if (QFxPathAttribute *attribute = qobject_cast(pathElement)) { + } else if (QmlGraphicsPathAttribute *attribute = qobject_cast(pathElement)) { AttributePoint &point = d->_attributePoints.last(); point.values[attribute->name()] = attribute->value(); interpolate(d->_attributePoints.count() - 1, attribute->name(), attribute->value()); - } else if (QFxPathPercent *percent = qobject_cast(pathElement)) { + } else if (QmlGraphicsPathPercent *percent = qobject_cast(pathElement)) { AttributePoint &point = d->_attributePoints.last(); point.values[QLatin1String("_qfx_percent")] = percent->value(); interpolate(d->_attributePoints.count() - 1, QLatin1String("_qfx_percent"), percent->value()); @@ -255,7 +255,7 @@ void QFxPath::processPath() qreal prevorigpercent = 0; for (int ii = 0; ii < d->_attributePoints.count(); ++ii) { const AttributePoint &point = d->_attributePoints.at(ii); - if (point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QFxPathPercent + if (point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QmlGraphicsPathPercent if ( ii > 0) { qreal scale = (d->_attributePoints[ii].origpercent/length - prevorigpercent) / (point.values.value(QLatin1String("_qfx_percent"))-prevpercent); @@ -274,33 +274,33 @@ void QFxPath::processPath() emit changed(); } -void QFxPath::componentComplete() +void QmlGraphicsPath::componentComplete() { - Q_D(QFxPath); + Q_D(QmlGraphicsPath); QSet attrs; // First gather up all the attributes - foreach (QFxPathElement *pathElement, d->_pathElements) { - if (QFxPathAttribute *attribute = - qobject_cast(pathElement)) + foreach (QmlGraphicsPathElement *pathElement, d->_pathElements) { + if (QmlGraphicsPathAttribute *attribute = + qobject_cast(pathElement)) attrs.insert(attribute->name()); } d->_attributes = attrs.toList(); processPath(); - foreach (QFxPathElement *pathElement, d->_pathElements) + foreach (QmlGraphicsPathElement *pathElement, d->_pathElements) connect(pathElement, SIGNAL(changed()), this, SLOT(processPath())); } -QPainterPath QFxPath::path() const +QPainterPath QmlGraphicsPath::path() const { - Q_D(const QFxPath); + Q_D(const QmlGraphicsPath); return d->_path; } -QStringList QFxPath::attributes() const +QStringList QmlGraphicsPath::attributes() const { - Q_D(const QFxPath); + Q_D(const QmlGraphicsPath); return d->_attributes; } #include @@ -342,11 +342,11 @@ static inline QBezier nextBezier(const QPainterPath &path, int *from, qreal *bez return QBezier(); } -void QFxPath::createPointCache() const +void QmlGraphicsPath::createPointCache() const { - Q_D(const QFxPath); + Q_D(const QmlGraphicsPath); #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer pc; + QmlPerfTimer pc; #endif qreal pathLength = d->_path.length(); const int points = int(pathLength*2); @@ -393,9 +393,9 @@ void QFxPath::createPointCache() const } } -QPointF QFxPath::pointAt(qreal p) const +QPointF QmlGraphicsPath::pointAt(qreal p) const { - Q_D(const QFxPath); + Q_D(const QmlGraphicsPath); if (d->_pointCache.isEmpty()) { createPointCache(); } @@ -407,9 +407,9 @@ QPointF QFxPath::pointAt(qreal p) const return d->_pointCache.at(idx); } -qreal QFxPath::attributeAt(const QString &name, qreal percent) const +qreal QmlGraphicsPath::attributeAt(const QString &name, qreal percent) const { - Q_D(const QFxPath); + Q_D(const QmlGraphicsPath); if (percent < 0 || percent > 1) return 0; @@ -435,12 +435,12 @@ qreal QFxPath::attributeAt(const QString &name, qreal percent) const /****************************************************************************/ -qreal QFxCurve::x() const +qreal QmlGraphicsCurve::x() const { return _x; } -void QFxCurve::setX(qreal x) +void QmlGraphicsCurve::setX(qreal x) { if (_x != x) { _x = x; @@ -448,12 +448,12 @@ void QFxCurve::setX(qreal x) } } -qreal QFxCurve::y() const +qreal QmlGraphicsCurve::y() const { return _y; } -void QFxCurve::setY(qreal y) +void QmlGraphicsCurve::setY(qreal y) { if (_y != y) { _y = y; @@ -492,11 +492,11 @@ void QFxCurve::setY(qreal y) /*! \internal - \class QFxPathAttribute + \class QmlGraphicsPathAttribute \ingroup group_utility - \brief The QFxPathAttribute class allows to set the value of an attribute at a given position in the path. + \brief The QmlGraphicsPathAttribute class allows to set the value of an attribute at a given position in the path. - \sa QFxPath + \sa QmlGraphicsPath */ @@ -509,12 +509,12 @@ void QFxCurve::setY(qreal y) the name of the attribute to change. */ -QString QFxPathAttribute::name() const +QString QmlGraphicsPathAttribute::name() const { return _name; } -void QFxPathAttribute::setName(const QString &name) +void QmlGraphicsPathAttribute::setName(const QString &name) { _name = name; } @@ -527,12 +527,12 @@ void QFxPathAttribute::setName(const QString &name) /*! the new value of the attribute. */ -qreal QFxPathAttribute::value() const +qreal QmlGraphicsPathAttribute::value() const { return _value; } -void QFxPathAttribute::setValue(qreal value) +void QmlGraphicsPathAttribute::setValue(qreal value) { if (_value != value) { _value = value; @@ -561,11 +561,11 @@ void QFxPathAttribute::setValue(qreal value) /*! \internal - \class QFxPathLine + \class QmlGraphicsPathLine \ingroup group_utility - \brief The QFxPathLine class defines a straight line. + \brief The QmlGraphicsPathLine class defines a straight line. - \sa QFxPath + \sa QmlGraphicsPath */ /*! @@ -575,7 +575,7 @@ void QFxPathAttribute::setValue(qreal value) Defines the end point of the line. */ -void QFxPathLine::addToPath(QPainterPath &path) +void QmlGraphicsPathLine::addToPath(QPainterPath &path) { path.lineTo(x(), y()); } @@ -604,11 +604,11 @@ void QFxPathLine::addToPath(QPainterPath &path) /*! \internal - \class QFxPathQuad + \class QmlGraphicsPathQuad \ingroup group_utility - \brief The QFxPathQuad class defines a quadratic Bezier curve with a control point. + \brief The QmlGraphicsPathQuad class defines a quadratic Bezier curve with a control point. - \sa QFxPath + \sa QmlGraphicsPath */ @@ -629,12 +629,12 @@ void QFxPathLine::addToPath(QPainterPath &path) /*! the x position of the control point. */ -qreal QFxPathQuad::controlX() const +qreal QmlGraphicsPathQuad::controlX() const { return _controlX; } -void QFxPathQuad::setControlX(qreal x) +void QmlGraphicsPathQuad::setControlX(qreal x) { if (_controlX != x) { _controlX = x; @@ -646,12 +646,12 @@ void QFxPathQuad::setControlX(qreal x) /*! the y position of the control point. */ -qreal QFxPathQuad::controlY() const +qreal QmlGraphicsPathQuad::controlY() const { return _controlY; } -void QFxPathQuad::setControlY(qreal y) +void QmlGraphicsPathQuad::setControlY(qreal y) { if (_controlY != y) { _controlY = y; @@ -659,7 +659,7 @@ void QFxPathQuad::setControlY(qreal y) } } -void QFxPathQuad::addToPath(QPainterPath &path) +void QmlGraphicsPathQuad::addToPath(QPainterPath &path) { path.quadTo(controlX(), controlY(), x(), y()); } @@ -691,11 +691,11 @@ void QFxPathQuad::addToPath(QPainterPath &path) /*! \internal - \class QFxPathCubic + \class QmlGraphicsPathCubic \ingroup group_utility - \brief The QFxPathCubic class defines a cubic Bezier curve with two control points. + \brief The QmlGraphicsPathCubic class defines a cubic Bezier curve with two control points. - \sa QFxPath + \sa QmlGraphicsPath */ /*! @@ -711,12 +711,12 @@ void QFxPathQuad::addToPath(QPainterPath &path) Defines the position of the first control point. */ -qreal QFxPathCubic::control1X() const +qreal QmlGraphicsPathCubic::control1X() const { return _control1X; } -void QFxPathCubic::setControl1X(qreal x) +void QmlGraphicsPathCubic::setControl1X(qreal x) { if (_control1X != x) { _control1X = x; @@ -724,12 +724,12 @@ void QFxPathCubic::setControl1X(qreal x) } } -qreal QFxPathCubic::control1Y() const +qreal QmlGraphicsPathCubic::control1Y() const { return _control1Y; } -void QFxPathCubic::setControl1Y(qreal y) +void QmlGraphicsPathCubic::setControl1Y(qreal y) { if (_control1Y != y) { _control1Y = y; @@ -743,12 +743,12 @@ void QFxPathCubic::setControl1Y(qreal y) Defines the position of the second control point. */ -qreal QFxPathCubic::control2X() const +qreal QmlGraphicsPathCubic::control2X() const { return _control2X; } -void QFxPathCubic::setControl2X(qreal x) +void QmlGraphicsPathCubic::setControl2X(qreal x) { if (_control2X != x) { _control2X = x; @@ -756,12 +756,12 @@ void QFxPathCubic::setControl2X(qreal x) } } -qreal QFxPathCubic::control2Y() const +qreal QmlGraphicsPathCubic::control2Y() const { return _control2Y; } -void QFxPathCubic::setControl2Y(qreal y) +void QmlGraphicsPathCubic::setControl2Y(qreal y) { if (_control2Y != y) { _control2Y = y; @@ -769,7 +769,7 @@ void QFxPathCubic::setControl2Y(qreal y) } } -void QFxPathCubic::addToPath(QPainterPath &path) +void QmlGraphicsPathCubic::addToPath(QPainterPath &path) { path.cubicTo(control1X(), control1Y(), control2X(), control2Y(), x(), y()); } @@ -816,23 +816,23 @@ void QFxPathCubic::addToPath(QPainterPath &path) /*! \internal - \class QFxPathPercent + \class QmlGraphicsPathPercent \ingroup group_utility - \brief The QFxPathPercent class manipulates the way a path is interpreted. + \brief The QmlGraphicsPathPercent class manipulates the way a path is interpreted. - QFxPathPercent allows you to bunch up items (or spread out items) along various - segments of a QFxPathView's path. + QmlGraphicsPathPercent allows you to bunch up items (or spread out items) along various + segments of a QmlGraphicsPathView's path. - \sa QFxPath + \sa QmlGraphicsPath */ -qreal QFxPathPercent::value() const +qreal QmlGraphicsPathPercent::value() const { return _value; } -void QFxPathPercent::setValue(qreal value) +void QmlGraphicsPathPercent::setValue(qreal value) { _value = value; } diff --git a/src/declarative/fx/qfxpath.h b/src/declarative/fx/qfxpath.h index 04d24c6..e724474 100644 --- a/src/declarative/fx/qfxpath.h +++ b/src/declarative/fx/qfxpath.h @@ -53,23 +53,23 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QFxPathElement : public QObject +class Q_DECLARATIVE_EXPORT QmlGraphicsPathElement : public QObject { Q_OBJECT public: - QFxPathElement(QObject *parent=0) : QObject(parent) {} + QmlGraphicsPathElement(QObject *parent=0) : QObject(parent) {} Q_SIGNALS: void changed(); }; -class Q_DECLARATIVE_EXPORT QFxPathAttribute : public QFxPathElement +class Q_DECLARATIVE_EXPORT QmlGraphicsPathAttribute : public QmlGraphicsPathElement { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) public: - QFxPathAttribute(QObject *parent=0) : QFxPathElement(parent), _value(0) {} + QmlGraphicsPathAttribute(QObject *parent=0) : QmlGraphicsPathElement(parent), _value(0) {} QString name() const; @@ -83,14 +83,14 @@ private: qreal _value; }; -class Q_DECLARATIVE_EXPORT QFxCurve : public QFxPathElement +class Q_DECLARATIVE_EXPORT QmlGraphicsCurve : public QmlGraphicsPathElement { Q_OBJECT Q_PROPERTY(qreal x READ x WRITE setX NOTIFY changed) Q_PROPERTY(qreal y READ y WRITE setY NOTIFY changed) public: - QFxCurve(QObject *parent=0) : QFxPathElement(parent), _x(0), _y(0) {} + QmlGraphicsCurve(QObject *parent=0) : QmlGraphicsPathElement(parent), _x(0), _y(0) {} qreal x() const; void setX(qreal x); @@ -105,23 +105,23 @@ private: qreal _y; }; -class Q_DECLARATIVE_EXPORT QFxPathLine : public QFxCurve +class Q_DECLARATIVE_EXPORT QmlGraphicsPathLine : public QmlGraphicsCurve { Q_OBJECT public: - QFxPathLine(QObject *parent=0) : QFxCurve(parent) {} + QmlGraphicsPathLine(QObject *parent=0) : QmlGraphicsCurve(parent) {} void addToPath(QPainterPath &path); }; -class Q_DECLARATIVE_EXPORT QFxPathQuad : public QFxCurve +class Q_DECLARATIVE_EXPORT QmlGraphicsPathQuad : public QmlGraphicsCurve { Q_OBJECT Q_PROPERTY(qreal controlX READ controlX WRITE setControlX NOTIFY changed) Q_PROPERTY(qreal controlY READ controlY WRITE setControlY NOTIFY changed) public: - QFxPathQuad(QObject *parent=0) : QFxCurve(parent), _controlX(0), _controlY(0) {} + QmlGraphicsPathQuad(QObject *parent=0) : QmlGraphicsCurve(parent), _controlX(0), _controlY(0) {} qreal controlX() const; void setControlX(qreal x); @@ -136,7 +136,7 @@ private: qreal _controlY; }; -class Q_DECLARATIVE_EXPORT QFxPathCubic : public QFxCurve +class Q_DECLARATIVE_EXPORT QmlGraphicsPathCubic : public QmlGraphicsCurve { Q_OBJECT @@ -145,7 +145,7 @@ class Q_DECLARATIVE_EXPORT QFxPathCubic : public QFxCurve Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY changed) Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY changed) public: - QFxPathCubic(QObject *parent=0) : QFxCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {} + QmlGraphicsPathCubic(QObject *parent=0) : QmlGraphicsCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {} qreal control1X() const; void setControl1X(qreal x); @@ -168,12 +168,12 @@ private: int _control2Y; }; -class Q_DECLARATIVE_EXPORT QFxPathPercent : public QFxPathElement +class Q_DECLARATIVE_EXPORT QmlGraphicsPathPercent : public QmlGraphicsPathElement { Q_OBJECT Q_PROPERTY(qreal value READ value WRITE setValue) public: - QFxPathPercent(QObject *parent=0) : QFxPathElement(parent) {} + QmlGraphicsPathPercent(QObject *parent=0) : QmlGraphicsPathElement(parent) {} qreal value() const; void setValue(qreal value); @@ -182,22 +182,22 @@ private: qreal _value; }; -class QFxPathPrivate; -class Q_DECLARATIVE_EXPORT QFxPath : public QObject, public QmlParserStatus +class QmlGraphicsPathPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsPath : public QObject, public QmlParserStatus { Q_OBJECT Q_INTERFACES(QmlParserStatus) - Q_PROPERTY(QList* pathElements READ pathElements) + Q_PROPERTY(QList* pathElements READ pathElements) Q_PROPERTY(qreal startX READ startX WRITE setStartX) Q_PROPERTY(qreal startY READ startY WRITE setStartY) Q_CLASSINFO("DefaultProperty", "pathElements") Q_INTERFACES(QmlParserStatus) public: - QFxPath(QObject *parent=0); - ~QFxPath(); + QmlGraphicsPath(QObject *parent=0); + ~QmlGraphicsPath(); - QList* pathElements(); + QList* pathElements(); qreal startX() const; void setStartX(qreal x); @@ -215,7 +215,7 @@ Q_SIGNALS: protected: virtual void componentComplete(); - QFxPath(QFxPathPrivate &dd, QObject *parent); + QmlGraphicsPath(QmlGraphicsPathPrivate &dd, QObject *parent); private Q_SLOTS: void processPath(); @@ -239,20 +239,20 @@ private: void createPointCache() const; private: - Q_DISABLE_COPY(QFxPath) - Q_DECLARE_PRIVATE(QFxPath) + Q_DISABLE_COPY(QmlGraphicsPath) + Q_DECLARE_PRIVATE(QmlGraphicsPath) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxPathElement) -QML_DECLARE_TYPE(QFxPathAttribute) -QML_DECLARE_TYPE(QFxCurve) -QML_DECLARE_TYPE(QFxPathLine) -QML_DECLARE_TYPE(QFxPathQuad) -QML_DECLARE_TYPE(QFxPathCubic) -QML_DECLARE_TYPE(QFxPathPercent) -QML_DECLARE_TYPE(QFxPath) +QML_DECLARE_TYPE(QmlGraphicsPathElement) +QML_DECLARE_TYPE(QmlGraphicsPathAttribute) +QML_DECLARE_TYPE(QmlGraphicsCurve) +QML_DECLARE_TYPE(QmlGraphicsPathLine) +QML_DECLARE_TYPE(QmlGraphicsPathQuad) +QML_DECLARE_TYPE(QmlGraphicsPathCubic) +QML_DECLARE_TYPE(QmlGraphicsPathPercent) +QML_DECLARE_TYPE(QmlGraphicsPath) QT_END_HEADER diff --git a/src/declarative/fx/qfxpath_p.h b/src/declarative/fx/qfxpath_p.h index d4a419a..49bd0d8 100644 --- a/src/declarative/fx/qfxpath_p.h +++ b/src/declarative/fx/qfxpath_p.h @@ -59,17 +59,17 @@ QT_BEGIN_NAMESPACE -class QFxPathPrivate : public QObjectPrivate +class QmlGraphicsPathPrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QFxPath) + Q_DECLARE_PUBLIC(QmlGraphicsPath) public: - QFxPathPrivate() : startX(0), startY(0) { } + QmlGraphicsPathPrivate() : startX(0), startY(0) { } QPainterPath _path; - QList _pathElements; + QList _pathElements; mutable QVector _pointCache; - QList _attributePoints; + QList _attributePoints; QStringList _attributes; int startX; int startY; diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index c580e98..fd7d734 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -54,20 +54,20 @@ static const int FlickThreshold = 5; QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathView,QFxPathView) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathView,QmlGraphicsPathView) -class QFxPathViewAttached : public QObject +class QmlGraphicsPathViewAttached : public QObject { Q_OBJECT public: - QFxPathViewAttached(QObject *parent) + QmlGraphicsPathViewAttached(QObject *parent) : QObject(parent), mo(new QmlOpenMetaObject(this)) { } - ~QFxPathViewAttached() + ~QmlGraphicsPathViewAttached() { - QFxPathView::attachedProperties.remove(parent()); + QmlGraphicsPathView::attachedProperties.remove(parent()); } QVariant value(const QByteArray &name) const @@ -86,14 +86,14 @@ private: /*! \internal - \class QFxPathView - \brief The QFxPathView class lays out items provided by a model on a path. + \class QmlGraphicsPathView + \brief The QmlGraphicsPathView class lays out items provided by a model on a path. \ingroup group_views The model must be a \l QListModelInterface subclass. - \sa QFxPath + \sa QmlGraphicsPath */ /*! @@ -112,23 +112,23 @@ private: \sa Path */ -QFxPathView::QFxPathView(QFxItem *parent) - : QFxItem(*(new QFxPathViewPrivate), parent) +QmlGraphicsPathView::QmlGraphicsPathView(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsPathViewPrivate), parent) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); d->init(); } -QFxPathView::QFxPathView(QFxPathViewPrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsPathView::QmlGraphicsPathView(QmlGraphicsPathViewPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); d->init(); } -QFxPathView::~QFxPathView() +QmlGraphicsPathView::~QmlGraphicsPathView() { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (d->ownModel) delete d->model; } @@ -143,21 +143,21 @@ QFxPathView::~QFxPathView() \sa {qmlmodels}{Data Models} */ -QVariant QFxPathView::model() const +QVariant QmlGraphicsPathView::model() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->modelVariant; } -void QFxPathView::setModel(const QVariant &model) +void QmlGraphicsPathView::setModel(const QVariant &model) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); - disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); for (int i=0; iitems.count(); i++){ - QFxItem *p = d->items[i]; + QmlGraphicsItem *p = d->items[i]; d->model->release(p); } d->items.clear(); @@ -165,8 +165,8 @@ void QFxPathView::setModel(const QVariant &model) d->modelVariant = model; QObject *object = qvariant_cast(model); - QFxVisualModel *vim = 0; - if (object && (vim = qobject_cast(object))) { + QmlGraphicsVisualModel *vim = 0; + if (object && (vim = qobject_cast(object))) { if (d->ownModel) { delete d->model; d->ownModel = false; @@ -174,16 +174,16 @@ void QFxPathView::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) dataModel->setModel(model); } if (d->model) { connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); - connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); + connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); } d->firstIndex = 0; d->pathOffset = 0; @@ -195,9 +195,9 @@ void QFxPathView::setModel(const QVariant &model) \qmlproperty int PathView::count This property holds the number of items in the model. */ -int QFxPathView::count() const +int QmlGraphicsPathView::count() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->model ? d->model->count() : 0; } @@ -207,15 +207,15 @@ int QFxPathView::count() const This property holds the path used to lay out the items. For more information see the \l Path documentation. */ -QFxPath *QFxPathView::path() const +QmlGraphicsPath *QmlGraphicsPathView::path() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->path; } -void QFxPathView::setPath(QFxPath *path) +void QmlGraphicsPathView::setPath(QmlGraphicsPath *path) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); d->path = path; connect(d->path, SIGNAL(changed()), this, SLOT(refill())); d->regenerate(); @@ -225,15 +225,15 @@ void QFxPathView::setPath(QFxPath *path) \qmlproperty int PathView::currentIndex This property holds the index of the current item. */ -int QFxPathView::currentIndex() const +int QmlGraphicsPathView::currentIndex() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->currentIndex; } -void QFxPathView::setCurrentIndex(int idx) +void QmlGraphicsPathView::setCurrentIndex(int idx) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (d->model && d->model->count()) idx = qAbs(idx % d->model->count()); if (d->model && idx != d->currentIndex) { @@ -253,22 +253,22 @@ void QFxPathView::setCurrentIndex(int idx) The offset specifies how far along the path the items are from their initial positions. */ -qreal QFxPathView::offset() const +qreal QmlGraphicsPathView::offset() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->_offset; } -void QFxPathView::setOffset(qreal offset) +void QmlGraphicsPathView::setOffset(qreal offset) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); d->setOffset(offset); d->updateCurrent(); } -void QFxPathViewPrivate::setOffset(qreal o) +void QmlGraphicsPathViewPrivate::setOffset(qreal o) { - Q_Q(QFxPathView); + Q_Q(QmlGraphicsPathView); if (_offset != o) { _offset = fmod(o, 100.0); if (_offset < 0) @@ -282,15 +282,15 @@ void QFxPathViewPrivate::setOffset(qreal o) This property determines the position (0-100) the nearest item will snap to. */ -qreal QFxPathView::snapPosition() const +qreal QmlGraphicsPathView::snapPosition() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->snapPos; } -void QFxPathView::setSnapPosition(qreal pos) +void QmlGraphicsPathView::setSnapPosition(qreal pos) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); d->snapPos = pos/100; d->fixOffset(); } @@ -303,15 +303,15 @@ void QFxPathView::setSnapPosition(qreal pos) dragMargin is greater than zero, a drag can be initiated by clicking within dragMargin pixels of the path. */ -qreal QFxPathView::dragMargin() const +qreal QmlGraphicsPathView::dragMargin() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->dragMargin; } -void QFxPathView::setDragMargin(qreal dragMargin) +void QmlGraphicsPathView::setDragMargin(qreal dragMargin) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); d->dragMargin = dragMargin; } @@ -323,25 +323,25 @@ void QFxPathView::setDragMargin(qreal dragMargin) Here is an example delegate: \snippet doc/src/snippets/declarative/pathview/pathview.qml 1 */ -QmlComponent *QFxPathView::delegate() const +QmlComponent *QmlGraphicsPathView::delegate() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); if (d->model) { - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) return dataModel->delegate(); } return 0; } -void QFxPathView::setDelegate(QmlComponent *c) +void QmlGraphicsPathView::setDelegate(QmlComponent *c) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) { + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) { dataModel->setDelegate(c); d->regenerate(); } @@ -351,22 +351,22 @@ void QFxPathView::setDelegate(QmlComponent *c) \qmlproperty int PathView::pathItemCount This property holds the number of items visible on the path at any one time */ -int QFxPathView::pathItemCount() const +int QmlGraphicsPathView::pathItemCount() const { - Q_D(const QFxPathView); + Q_D(const QmlGraphicsPathView); return d->pathItems; } -void QFxPathView::setPathItemCount(int i) +void QmlGraphicsPathView::setPathItemCount(int i) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (i == d->pathItems) return; d->pathItems = i; d->regenerate(); } -QPointF QFxPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const +QPointF QmlGraphicsPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const { //XXX maybe do recursively at increasing resolution. qreal mindist = 1e10; // big number @@ -390,9 +390,9 @@ QPointF QFxPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) } -void QFxPathView::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsPathView::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (!d->items.count()) return; QPointF scenePoint = mapToScene(event->pos()); @@ -416,13 +416,13 @@ void QFxPathView::mousePressEvent(QGraphicsSceneMouseEvent *event) d->stealMouse = false; d->lastElapsed = 0; d->lastDist = 0; - QFxItemPrivate::start(d->lastPosTime); + QmlGraphicsItemPrivate::start(d->lastPosTime); d->tl.clear(); } -void QFxPathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsPathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (d->lastPosTime.isNull()) return; @@ -433,7 +433,7 @@ void QFxPathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } if (d->stealMouse) { - d->moveReason = QFxPathViewPrivate::Mouse; + d->moveReason = QmlGraphicsPathViewPrivate::Mouse; qreal newPc; d->pointNear(event->pos(), &newPc); qreal diff = newPc - d->startPc; @@ -445,20 +445,20 @@ void QFxPathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) else if (diff < -50) diff += 100; - d->lastElapsed = QFxItemPrivate::restart(d->lastPosTime); + d->lastElapsed = QmlGraphicsItemPrivate::restart(d->lastPosTime); d->lastDist = diff; d->startPc = newPc; } } } -void QFxPathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *) +void QmlGraphicsPathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (d->lastPosTime.isNull()) return; - qreal elapsed = qreal(d->lastElapsed + QFxItemPrivate::elapsed(d->lastPosTime)) / 1000.; + qreal elapsed = qreal(d->lastElapsed + QmlGraphicsItemPrivate::elapsed(d->lastPosTime)) / 1000.; qreal velocity = elapsed > 0. ? d->lastDist / elapsed : 0; if (d->model && d->model->count() && qAbs(velocity) > 5) { if (velocity > 100) @@ -479,13 +479,13 @@ void QFxPathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *) ungrabMouse(); } -bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) +bool QmlGraphicsPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); QGraphicsSceneMouseEvent mouseEvent(event->type()); QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect(); QGraphicsScene *s = scene(); - QFxItem *grabber = s ? qobject_cast(s->mouseGrabberItem()) : 0; + QmlGraphicsItem *grabber = s ? qobject_cast(s->mouseGrabberItem()) : 0; if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { mouseEvent.setAccepted(false); for (int i = 0x1; i <= 0x10; i <<= 1) { @@ -512,7 +512,7 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) default: break; } - grabber = qobject_cast(s->mouseGrabberItem()); + grabber = qobject_cast(s->mouseGrabberItem()); if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this) grabMouse(); @@ -523,10 +523,10 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) return false; } -bool QFxPathView::sceneEventFilter(QGraphicsItem *i, QEvent *e) +bool QmlGraphicsPathView::sceneEventFilter(QGraphicsItem *i, QEvent *e) { if (!isVisible()) - return QFxItem::sceneEventFilter(i, e); + return QmlGraphicsItem::sceneEventFilter(i, e); switch (e->type()) { case QEvent::GraphicsSceneMousePress: @@ -542,13 +542,13 @@ bool QFxPathView::sceneEventFilter(QGraphicsItem *i, QEvent *e) break; } - return QFxItem::sceneEventFilter(i, e); + return QmlGraphicsItem::sceneEventFilter(i, e); } -void QFxPathView::componentComplete() +void QmlGraphicsPathView::componentComplete() { - Q_D(QFxPathView); - QFxItem::componentComplete(); + Q_D(QmlGraphicsPathView); + QmlGraphicsItem::componentComplete(); d->regenerate(); // move to correct offset @@ -567,14 +567,14 @@ void QFxPathView::componentComplete() } } -void QFxPathViewPrivate::regenerate() +void QmlGraphicsPathViewPrivate::regenerate() { - Q_Q(QFxPathView); + Q_Q(QmlGraphicsPathView); if (!q->isComponentComplete()) return; for (int i=0; i= 0 ? pathItems : model->count(); for (int i=0; i < numItems && i < model->count(); ++i){ int index = (i + firstIndex) % model->count(); - QFxItem *item = getItem(index); + QmlGraphicsItem *item = getItem(index); if (!item) { qWarning() << "PathView: Cannot create item, index" << (i + firstIndex) % model->count(); return; @@ -603,20 +603,20 @@ void QFxPathViewPrivate::regenerate() q->refill(); } -void QFxPathViewPrivate::updateItem(QFxItem *item, qreal percent) +void QmlGraphicsPathViewPrivate::updateItem(QmlGraphicsItem *item, qreal percent) { - if (QObject *obj = QFxPathView::qmlAttachedProperties(item)) { + if (QObject *obj = QmlGraphicsPathView::qmlAttachedProperties(item)) { foreach(const QString &attr, path->attributes()) - static_cast(obj)->setValue(attr.toUtf8(), path->attributeAt(attr, percent)); + static_cast(obj)->setValue(attr.toUtf8(), path->attributeAt(attr, percent)); } QPointF pf = path->pointAt(percent); item->setX(pf.x() - item->width()*item->scale()/2); item->setY(pf.y() - item->height()*item->scale()/2); } -void QFxPathView::refill() +void QmlGraphicsPathView::refill() { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (!d->isValid() || !isComponentComplete()) return; @@ -649,13 +649,13 @@ void QFxPathView::refill() //A wraparound has occured if (wrapIndex < d->items.count()/2){ while(wrapIndex-- >= 0){ - QFxItem* p = d->items.takeFirst(); + QmlGraphicsItem* p = d->items.takeFirst(); d->updateItem(p, 0.0); d->releaseItem(p); d->firstIndex++; d->firstIndex %= d->model->count(); int index = (d->firstIndex + d->items.count())%d->model->count(); - QFxItem *item = d->getItem(index); + QmlGraphicsItem *item = d->getItem(index); item->setZValue(wrapIndex); if (d->currentIndex == index) item->setFocus(true); @@ -665,13 +665,13 @@ void QFxPathView::refill() } } else { while(wrapIndex++ < d->items.count()-1){ - QFxItem* p = d->items.takeLast(); + QmlGraphicsItem* p = d->items.takeLast(); d->updateItem(p, 1.0); d->releaseItem(p); d->firstIndex--; if (d->firstIndex < 0) d->firstIndex = d->model->count() - 1; - QFxItem *item = d->getItem(d->firstIndex); + QmlGraphicsItem *item = d->getItem(d->firstIndex); item->setZValue(d->firstIndex); if (d->currentIndex == d->firstIndex) item->setFocus(true); @@ -689,15 +689,15 @@ void QFxPathView::refill() d->updateItem(d->items.at(i), rotatedPositions[i]); } -void QFxPathView::itemsInserted(int modelIndex, int count) +void QmlGraphicsPathView::itemsInserted(int modelIndex, int count) { //XXX support animated insertion - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (!d->isValid() || !isComponentComplete()) return; if (d->pathItems == -1) { for (int i = 0; i < count; ++i) { - QFxItem *item = d->getItem(modelIndex + i); + QmlGraphicsItem *item = d->getItem(modelIndex + i); item->setZValue(modelIndex + i); d->items.insert(modelIndex + i, item); } @@ -719,15 +719,15 @@ void QFxPathView::itemsInserted(int modelIndex, int count) d->moveOffset.setValue(targetOffset); } -void QFxPathView::itemsRemoved(int modelIndex, int count) +void QmlGraphicsPathView::itemsRemoved(int modelIndex, int count) { //XXX support animated removal - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (!d->isValid() || !isComponentComplete()) return; if (d->pathItems == -1) { for (int i = 0; i < count; ++i) { - QFxItem* p = d->items.takeAt(modelIndex); + QmlGraphicsItem* p = d->items.takeAt(modelIndex); d->model->release(p); } d->snapToCurrent(); @@ -756,28 +756,28 @@ void QFxPathView::itemsRemoved(int modelIndex, int count) d->moveOffset.setValue(targetOffset); } -void QFxPathView::createdItem(int index, QFxItem *item) +void QmlGraphicsPathView::createdItem(int index, QmlGraphicsItem *item) { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); if (d->requestedIndex != index) { item->setParentItem(this); d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0); } } -void QFxPathView::destroyingItem(QFxItem *item) +void QmlGraphicsPathView::destroyingItem(QmlGraphicsItem *item) { Q_UNUSED(item); } -void QFxPathView::ticked() +void QmlGraphicsPathView::ticked() { - Q_D(QFxPathView); + Q_D(QmlGraphicsPathView); d->updateCurrent(); } // find the item closest to the snap position -int QFxPathViewPrivate::calcCurrentIndex() +int QmlGraphicsPathViewPrivate::calcCurrentIndex() { int current = -1; if (model && items.count()) { @@ -816,9 +816,9 @@ int QFxPathViewPrivate::calcCurrentIndex() return current; } -void QFxPathViewPrivate::updateCurrent() +void QmlGraphicsPathViewPrivate::updateCurrent() { - Q_Q(QFxPathView); + Q_Q(QmlGraphicsPathView); if (moveReason != Mouse) return; int idx = calcCurrentIndex(); @@ -831,9 +831,9 @@ void QFxPathViewPrivate::updateCurrent() } } -void QFxPathViewPrivate::fixOffset() +void QmlGraphicsPathViewPrivate::fixOffset() { - Q_Q(QFxPathView); + Q_Q(QmlGraphicsPathView); if (model && items.count()) { int curr = calcCurrentIndex(); if (curr != currentIndex) @@ -843,7 +843,7 @@ void QFxPathViewPrivate::fixOffset() } } -void QFxPathViewPrivate::snapToCurrent() +void QmlGraphicsPathViewPrivate::snapToCurrent() { if (!model || model->count() <= 0) return; @@ -897,12 +897,12 @@ void QFxPathViewPrivate::snapToCurrent() } } -QHash QFxPathView::attachedProperties; -QObject *QFxPathView::qmlAttachedProperties(QObject *obj) +QHash QmlGraphicsPathView::attachedProperties; +QObject *QmlGraphicsPathView::qmlAttachedProperties(QObject *obj) { QObject *rv = attachedProperties.value(obj); if (!rv) { - rv = new QFxPathViewAttached(obj); + rv = new QmlGraphicsPathViewAttached(obj); attachedProperties.insert(obj, rv); } return rv; diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index c8c0ac0..e961106 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -52,13 +52,13 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QListModelInterface; -class QFxPathViewPrivate; -class Q_DECLARATIVE_EXPORT QFxPathView : public QFxItem +class QmlGraphicsPathViewPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsPathView : public QmlGraphicsItem { Q_OBJECT Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QFxPath *path READ path WRITE setPath) + Q_PROPERTY(QmlGraphicsPath *path READ path WRITE setPath) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged) Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition) @@ -68,14 +68,14 @@ class Q_DECLARATIVE_EXPORT QFxPathView : public QFxItem Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount) public: - QFxPathView(QFxItem *parent=0); - virtual ~QFxPathView(); + QmlGraphicsPathView(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsPathView(); QVariant model() const; void setModel(const QVariant &); - QFxPath *path() const; - void setPath(QFxPath *); + QmlGraphicsPath *path() const; + void setPath(QmlGraphicsPath *); int currentIndex() const; void setCurrentIndex(int idx); @@ -116,23 +116,23 @@ private Q_SLOTS: void ticked(); void itemsInserted(int index, int count); void itemsRemoved(int index, int count); - void createdItem(int index, QFxItem *item); - void destroyingItem(QFxItem *item); + void createdItem(int index, QmlGraphicsItem *item); + void destroyingItem(QmlGraphicsItem *item); protected: - QFxPathView(QFxPathViewPrivate &dd, QFxItem *parent); + QmlGraphicsPathView(QmlGraphicsPathViewPrivate &dd, QmlGraphicsItem *parent); private: - friend class QFxPathViewAttached; + friend class QmlGraphicsPathViewAttached; static QHash attachedProperties; - Q_DISABLE_COPY(QFxPathView) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxPathView) + Q_DISABLE_COPY(QmlGraphicsPathView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPathView) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxPathView) -QML_DECLARE_TYPEINFO(QFxPathView, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QmlGraphicsPathView) +QML_DECLARE_TYPEINFO(QmlGraphicsPathView, QML_HAS_ATTACHED_PROPERTIES) QT_END_HEADER #endif // QFXPATHVIEW_H diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index 60bfdb3..23b468c 100644 --- a/src/declarative/fx/qfxpathview_p.h +++ b/src/declarative/fx/qfxpathview_p.h @@ -64,27 +64,27 @@ QT_BEGIN_NAMESPACE typedef struct PathViewItem{ int index; - QFxItem* item; + QmlGraphicsItem* item; }PathViewItem; -class QFxPathViewPrivate : public QFxItemPrivate +class QmlGraphicsPathViewPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxPathView) + Q_DECLARE_PUBLIC(QmlGraphicsPathView) public: - QFxPathViewPrivate() + QmlGraphicsPathViewPrivate() : path(0), currentIndex(0), startPc(0), lastDist(0) , lastElapsed(0), stealMouse(false), ownModel(false), activeItem(0) - , snapPos(0), dragMargin(0), moveOffset(this, &QFxPathViewPrivate::setOffset) + , snapPos(0), dragMargin(0), moveOffset(this, &QmlGraphicsPathViewPrivate::setOffset) , firstIndex(0), pathItems(-1), pathOffset(0), requestedIndex(-1), model(0) , moveReason(Other) { - fixupOffsetEvent = QmlTimeLineEvent::timeLineEvent(&moveOffset, this); + fixupOffsetEvent = QmlTimeLineEvent::timeLineEvent(&moveOffset, this); } void init() { - Q_Q(QFxPathView); + Q_Q(QmlGraphicsPathView); _offset = 0; q->setAcceptedMouseButtons(Qt::LeftButton); q->setFlag(QGraphicsItem::ItemIsFocusScope); @@ -92,16 +92,16 @@ public: q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); } - QFxItem *getItem(int modelIndex) { - Q_Q(QFxPathView); + QmlGraphicsItem *getItem(int modelIndex) { + Q_Q(QmlGraphicsPathView); requestedIndex = modelIndex; - QFxItem *item = model->item(modelIndex); + QmlGraphicsItem *item = model->item(modelIndex); if (item) item->setParentItem(q); requestedIndex = -1; return item; } - void releaseItem(QFxItem *item) { + void releaseItem(QmlGraphicsItem *item) { model->release(item); } @@ -114,11 +114,11 @@ public: void fixOffset(); void setOffset(qreal offset); void regenerate(); - void updateItem(QFxItem *, qreal); + void updateItem(QmlGraphicsItem *, qreal); void snapToCurrent(); QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const; - QFxPath *path; + QmlGraphicsPath *path; int currentIndex; qreal startPc; QPointF startPoint; @@ -129,18 +129,18 @@ public: bool ownModel : 1; QTime lastPosTime; QPointF lastPos; - QFxItem *activeItem; + QmlGraphicsItem *activeItem; qreal snapPos; qreal dragMargin; QmlTimeLine tl; - QmlTimeLineValueProxy moveOffset; + QmlTimeLineValueProxy moveOffset; QmlTimeLineEvent fixupOffsetEvent; int firstIndex; int pathItems; int pathOffset; int requestedIndex; - QList items; - QFxVisualModel *model; + QList items; + QmlGraphicsVisualModel *model; QVariant modelVariant; enum MovementReason { Other, Key, Mouse }; MovementReason moveReason; diff --git a/src/declarative/fx/qfxpixmapcache.cpp b/src/declarative/fx/qfxpixmapcache.cpp index 13e1b16..4d6104c 100644 --- a/src/declarative/fx/qfxpixmapcache.cpp +++ b/src/declarative/fx/qfxpixmapcache.cpp @@ -51,8 +51,8 @@ QT_BEGIN_NAMESPACE class QSharedNetworkReply; -typedef QHash QFxSharedNetworkReplyHash; -static QFxSharedNetworkReplyHash qfxActiveNetworkReplies; +typedef QHash QmlGraphicsSharedNetworkReplyHash; +static QmlGraphicsSharedNetworkReplyHash qfxActiveNetworkReplies; class QSharedNetworkReply { @@ -118,8 +118,8 @@ static bool readImage(QIODevice *dev, QPixmap *pixmap) /*! \internal - \class QFxPixmapCache - \brief Enacapsultes a pixmap for QFx items. + \class QmlGraphicsPixmapCache + \brief Enacapsultes a pixmap for QmlGraphics items. This class is NOT reentrant. */ @@ -140,10 +140,10 @@ static QString toLocalFileOrQrc(const QUrl& url) Returns true if the image was loaded without error. */ -bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap) +bool QmlGraphicsPixmapCache::find(const QUrl& url, QPixmap *pixmap) { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer perf; + QmlPerfTimer perf; #endif QString key = url.toString(); @@ -166,10 +166,10 @@ bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap) } else #endif { - QFxSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); + QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); if (iter == qfxActiveNetworkReplies.end()) { // API usage error - qWarning() << "QFxPixmapCache: URL not loaded" << url; + qWarning() << "QmlGraphicsPixmapCache: URL not loaded" << url; ok = false; } else { if ((*iter)->reply->error()) { @@ -195,7 +195,7 @@ bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap) #endif // We may be the second finder. Still need to check for active replies. { - QFxSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); + QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); if (iter != qfxActiveNetworkReplies.end()) (*iter)->release(); } @@ -213,7 +213,7 @@ bool QFxPixmapCache::find(const QUrl& url, QPixmap *pixmap) The returned QNetworkReply will be deleted when all get() calls are matched by a corresponding find() call. */ -QNetworkReply *QFxPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap *pixmap) +QNetworkReply *QmlGraphicsPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap *pixmap) { #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML QString lf = toLocalFileOrQrc(url); @@ -239,7 +239,7 @@ QNetworkReply *QFxPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap * return 0; } - QFxSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); + QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); if (iter == qfxActiveNetworkReplies.end()) { QNetworkRequest req(url); QSharedNetworkReply *item = new QSharedNetworkReply(engine->networkAccessManager()->get(req)); @@ -259,10 +259,10 @@ QNetworkReply *QFxPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap * Any connections from the QNetworkReply returned by get() to \a obj will be disconnected. */ -void QFxPixmapCache::cancelGet(const QUrl& url, QObject* obj) +void QmlGraphicsPixmapCache::cancelGet(const QUrl& url, QObject* obj) { QString key = url.toString(); - QFxSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); + QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); if (iter == qfxActiveNetworkReplies.end()) return; if (obj) @@ -274,7 +274,7 @@ void QFxPixmapCache::cancelGet(const QUrl& url, QObject* obj) This function is mainly for test verification. It returns the number of requests that are still unfinished. */ -int QFxPixmapCache::pendingRequests() +int QmlGraphicsPixmapCache::pendingRequests() { return qfxActiveNetworkReplies.count(); } diff --git a/src/declarative/fx/qfxpixmapcache.h b/src/declarative/fx/qfxpixmapcache.h index fb5b88a..2a5c4fa 100644 --- a/src/declarative/fx/qfxpixmapcache.h +++ b/src/declarative/fx/qfxpixmapcache.h @@ -54,13 +54,13 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QmlEngine; class QNetworkReply; -class Q_DECLARATIVE_EXPORT QFxPixmapCache +class Q_DECLARATIVE_EXPORT QmlGraphicsPixmapCache { public: static QNetworkReply *get(QmlEngine *, const QUrl& url, QPixmap *pixmap); static void cancelGet(const QUrl& url, QObject* obj); - static bool find(const QUrl& url, QPixmap *pixmap); // url must have been passed to QFxPixmapCache::get, and any returned reply finished. + static bool find(const QUrl& url, QPixmap *pixmap); // url must have been passed to QmlGraphicsPixmapCache::get, and any returned reply finished. static int pendingRequests(); // mainly for test verification }; diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp index 86a069d..d7ae49d 100644 --- a/src/declarative/fx/qfxpositioners.cpp +++ b/src/declarative/fx/qfxpositioners.cpp @@ -54,11 +54,11 @@ QT_BEGIN_NAMESPACE /*! \internal - \class QFxBasePositioner + \class QmlGraphicsBasePositioner \ingroup group_layouts - \brief The QFxBasePositioner class provides a base for QFx layouts. + \brief The QmlGraphicsBasePositioner class provides a base for QmlGraphics layouts. - To create a QFx Positioner, simply subclass QFxBasePositioner and implement + To create a QmlGraphics Positioner, simply subclass QmlGraphicsBasePositioner and implement doLayout(), which is automatically called when the layout might need updating. @@ -70,29 +70,29 @@ QT_BEGIN_NAMESPACE Note also that the subclass is responsible for adding the spacing in between items. */ -QFxBasePositioner::QFxBasePositioner(AutoUpdateType at, QFxItem *parent) - : QFxItem(*(new QFxBasePositionerPrivate), parent) +QmlGraphicsBasePositioner::QmlGraphicsBasePositioner(AutoUpdateType at, QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsBasePositionerPrivate), parent) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); d->init(at); } -QFxBasePositioner::QFxBasePositioner(QFxBasePositionerPrivate &dd, AutoUpdateType at, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsBasePositioner::QmlGraphicsBasePositioner(QmlGraphicsBasePositionerPrivate &dd, AutoUpdateType at, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); d->init(at); } -int QFxBasePositioner::spacing() const +int QmlGraphicsBasePositioner::spacing() const { - Q_D(const QFxBasePositioner); + Q_D(const QmlGraphicsBasePositioner); return d->_spacing; } -void QFxBasePositioner::setSpacing(int s) +void QmlGraphicsBasePositioner::setSpacing(int s) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); if (s==d->_spacing) return; d->_spacing = s; @@ -100,52 +100,52 @@ void QFxBasePositioner::setSpacing(int s) emit spacingChanged(); } -QmlTransition *QFxBasePositioner::move() const +QmlTransition *QmlGraphicsBasePositioner::move() const { - Q_D(const QFxBasePositioner); + Q_D(const QmlGraphicsBasePositioner); return d->moveTransition; } -void QFxBasePositioner::setMove(QmlTransition *mt) +void QmlGraphicsBasePositioner::setMove(QmlTransition *mt) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); d->moveTransition = mt; } -QmlTransition *QFxBasePositioner::add() const +QmlTransition *QmlGraphicsBasePositioner::add() const { - Q_D(const QFxBasePositioner); + Q_D(const QmlGraphicsBasePositioner); return d->addTransition; } -void QFxBasePositioner::setAdd(QmlTransition *add) +void QmlGraphicsBasePositioner::setAdd(QmlTransition *add) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); d->addTransition = add; } -QmlTransition *QFxBasePositioner::remove() const +QmlTransition *QmlGraphicsBasePositioner::remove() const { - Q_D(const QFxBasePositioner); + Q_D(const QmlGraphicsBasePositioner); return d->removeTransition; } -void QFxBasePositioner::setRemove(QmlTransition *remove) +void QmlGraphicsBasePositioner::setRemove(QmlTransition *remove) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); d->removeTransition = remove; } -void QFxBasePositioner::componentComplete() +void QmlGraphicsBasePositioner::componentComplete() { - QFxItem::componentComplete(); + QmlGraphicsItem::componentComplete(); #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer cc; + QmlPerfTimer cc; #endif prePositioning(); } -QVariant QFxBasePositioner::itemChange(GraphicsItemChange change, +QVariant QmlGraphicsBasePositioner::itemChange(GraphicsItemChange change, const QVariant &value) { if (change == ItemChildAddedChange || @@ -153,12 +153,12 @@ QVariant QFxBasePositioner::itemChange(GraphicsItemChange change, prePositioning(); } - return QFxItem::itemChange(change, value); + return QmlGraphicsItem::itemChange(change, value); } -bool QFxBasePositioner::event(QEvent *e) +bool QmlGraphicsBasePositioner::event(QEvent *e) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); if (e->type() == QEvent::User) { d->_ep = false; d->_stableItems += d->_newItems; @@ -166,25 +166,25 @@ bool QFxBasePositioner::event(QEvent *e) d->_newItems.clear(); return true; } - return QFxItem::event(e); + return QmlGraphicsItem::event(e); } /*! Items that have just been added to the positioner. This includes invisible items that have turned visible. */ -QSet* QFxBasePositioner::newItems() +QSet* QmlGraphicsBasePositioner::newItems() { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); return &d->_newItems; } /*! Items that are visible in the positioner, not including ones that have just been added. */ -QSet* QFxBasePositioner::items() +QSet* QmlGraphicsBasePositioner::items() { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); return &d->_stableItems; } @@ -192,15 +192,15 @@ QSet* QFxBasePositioner::items() Items that have just left the positioner. This includes visible items that have turned invisible. */ -QSet* QFxBasePositioner::leavingItems() +QSet* QmlGraphicsBasePositioner::leavingItems() { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); return &d->_leavingItems; } -void QFxBasePositioner::prePositioning() +void QmlGraphicsBasePositioner::prePositioning() { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); if (!isComponentComplete() || d->_movingItem) return; @@ -208,10 +208,10 @@ void QFxBasePositioner::prePositioning() d->_ep = true; QCoreApplication::postEvent(this, new QEvent(QEvent::User)); } - QSet allItems; + QSet allItems; QList children = childItems(); for (int ii = 0; ii < children.count(); ++ii) { - QFxItem *child = qobject_cast(children.at(ii)); + QmlGraphicsItem *child = qobject_cast(children.at(ii)); if (!child) continue; if (!d->_items.contains(child)){ @@ -235,8 +235,8 @@ void QFxBasePositioner::prePositioning() } allItems += child; } - QSet deletedItems = d->_items - allItems; - foreach(QFxItem *child, d->_items){ + QSet deletedItems = d->_items - allItems; + foreach(QmlGraphicsItem *child, d->_items){ if (!allItems.contains(child)){ if (!deletedItems.contains(child)) { QObject::disconnect(child, SIGNAL(opacityChanged()), @@ -256,7 +256,7 @@ void QFxBasePositioner::prePositioning() //###To keep this valid, do we need to update on pos change as well? qreal h = 0.0f; qreal w = 0.0f; - foreach(QFxItem *child, d->_items){ + foreach(QmlGraphicsItem *child, d->_items){ if(!child->isVisible() || child->opacity() <= 0) continue; h = qMax(h, child->y() + child->height()); @@ -266,9 +266,9 @@ void QFxBasePositioner::prePositioning() setImplicitWidth(w); } -void QFxBasePositioner::applyTransition(const QList >& changes, QFxItem* target, QmlStateOperation::ActionList &actions) +void QmlGraphicsBasePositioner::applyTransition(const QList >& changes, QmlGraphicsItem* target, QmlStateOperation::ActionList &actions) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); if (!target) return; @@ -282,9 +282,9 @@ void QFxBasePositioner::applyTransition(const QList >& d->_animated << target; } -void QFxBasePositioner::finishApplyTransitions() +void QmlGraphicsBasePositioner::finishApplyTransitions() { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); // Note that if a transition is not set the transition manager will // apply the changes directly, in the case someone uses applyAdd/Move/Remove // without testing add()/move()/remove(). @@ -295,9 +295,9 @@ void QFxBasePositioner::finishApplyTransitions() d->moveActions.clear(); d->removeActions.clear(); } -void QFxBasePositioner::setMovingItem(QFxItem *i) +void QmlGraphicsBasePositioner::setMovingItem(QmlGraphicsItem *i) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); d->_movingItem = i; } @@ -305,9 +305,9 @@ void QFxBasePositioner::setMovingItem(QFxItem *i) Applies the positioner's add transition to the \a target item.\a changes is a list of property,value pairs which will be changed on the target using the add transition. */ -void QFxBasePositioner::applyAdd(const QList >& changes, QFxItem* target) +void QmlGraphicsBasePositioner::applyAdd(const QList >& changes, QmlGraphicsItem* target) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); applyTransition(changes,target, d->addActions); } @@ -315,9 +315,9 @@ void QFxBasePositioner::applyAdd(const QList >& changes Applies the positioner's move transition to the \a target.\a changes is a list of property,value pairs which will be changed on the target using the move transition. */ -void QFxBasePositioner::applyMove(const QList >& changes, QFxItem* target) +void QmlGraphicsBasePositioner::applyMove(const QList >& changes, QmlGraphicsItem* target) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); applyTransition(changes,target, d->moveActions); } @@ -325,13 +325,13 @@ void QFxBasePositioner::applyMove(const QList >& change Applies the positioner's remove transition to the \a target item.\a changes is a list of property,value pairs which will be changed on the target using the remove transition. */ -void QFxBasePositioner::applyRemove(const QList >& changes, QFxItem* target) +void QmlGraphicsBasePositioner::applyRemove(const QList >& changes, QmlGraphicsItem* target) { - Q_D(QFxBasePositioner); + Q_D(QmlGraphicsBasePositioner); applyTransition(changes,target, d->removeActions); } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Column,QFxColumn) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Column,QmlGraphicsColumn) /*! \qmlclass Column \brief The Column item lines up its children vertically. @@ -472,20 +472,20 @@ Column { */ /*! \internal - \class QFxColumn - \brief The QFxColumn class lines up items vertically. + \class QmlGraphicsColumn + \brief The QmlGraphicsColumn class lines up items vertically. \ingroup group_positioners */ -QFxColumn::QFxColumn(QFxItem *parent) -: QFxBasePositioner(Vertical, parent) +QmlGraphicsColumn::QmlGraphicsColumn(QmlGraphicsItem *parent) +: QmlGraphicsBasePositioner(Vertical, parent) { } -void QFxColumn::doPositioning() +void QmlGraphicsColumn::doPositioning() { int voffset = 0; - foreach(QFxItem* item, *leavingItems()){ + foreach(QmlGraphicsItem* item, *leavingItems()){ if (remove()){ QList > changes; applyRemove(changes, item); @@ -494,7 +494,7 @@ void QFxColumn::doPositioning() QList children = childItems(); for (int ii = 0; ii < children.count(); ++ii) { - QFxItem *child = qobject_cast(children.at(ii)); + QmlGraphicsItem *child = qobject_cast(children.at(ii)); if (!child || child->opacity() == 0.0) continue; @@ -517,7 +517,7 @@ void QFxColumn::doPositioning() } } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Row,QFxRow) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Row,QmlGraphicsRow) /*! \qmlclass Row \brief The Row item lines up its children horizontally. @@ -629,20 +629,20 @@ Row { */ /*! \internal - \class QFxRow - \brief The QFxRow class lines up items horizontally. + \class QmlGraphicsRow + \brief The QmlGraphicsRow class lines up items horizontally. \ingroup group_positioners */ -QFxRow::QFxRow(QFxItem *parent) -: QFxBasePositioner(Horizontal, parent) +QmlGraphicsRow::QmlGraphicsRow(QmlGraphicsItem *parent) +: QmlGraphicsBasePositioner(Horizontal, parent) { } -void QFxRow::doPositioning() +void QmlGraphicsRow::doPositioning() { int hoffset = 0; - foreach(QFxItem* item, *leavingItems()){ + foreach(QmlGraphicsItem* item, *leavingItems()){ if (remove()){ QList > changes; applyRemove(changes, item); @@ -650,7 +650,7 @@ void QFxRow::doPositioning() } QList children = childItems(); for (int ii = 0; ii < children.count(); ++ii) { - QFxItem *child = qobject_cast(children.at(ii)); + QmlGraphicsItem *child = qobject_cast(children.at(ii)); if (!child || child->opacity() == 0.0) continue; @@ -675,10 +675,10 @@ void QFxRow::doPositioning() } } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Grid,QFxGrid) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Grid,QmlGraphicsGrid) /*! - \qmlclass Grid QFxGrid + \qmlclass Grid QmlGraphicsGrid \brief The Grid item positions its children in a grid. \inherits Item @@ -810,13 +810,13 @@ Grid { */ /*! \internal - \class QFxGrid - \brief The QFxGrid class lays out items in a grid. + \class QmlGraphicsGrid + \brief The QmlGraphicsGrid class lays out items in a grid. \ingroup group_layouts */ -QFxGrid::QFxGrid(QFxItem *parent) : - QFxBasePositioner(Both, parent) +QmlGraphicsGrid::QmlGraphicsGrid(QmlGraphicsItem *parent) : + QmlGraphicsBasePositioner(Both, parent) { _columns=-1; _rows=-1; @@ -840,7 +840,7 @@ QFxGrid::QFxGrid(QFxItem *parent) : many rows some rows will be of zero width. */ -void QFxGrid::doPositioning() +void QmlGraphicsGrid::doPositioning() { int c=_columns,r=_rows;//Actual number of rows/columns int numVisible = items()->size() + newItems()->size(); @@ -866,7 +866,7 @@ void QFxGrid::doPositioning() if (childIndex == children.count()) continue; - QFxItem *child = qobject_cast(children.at(childIndex++)); + QmlGraphicsItem *child = qobject_cast(children.at(childIndex++)); if (!child || child->opacity() == 0.0) continue; if (child->width() > maxColWidth[j]) @@ -880,14 +880,14 @@ void QFxGrid::doPositioning() int yoffset=0; int curRow =0; int curCol =0; - foreach(QFxItem* item, *leavingItems()){ + foreach(QmlGraphicsItem* item, *leavingItems()){ if (remove()){ QList > changes; applyRemove(changes, item); } } foreach(QGraphicsItem* schild, children){ - QFxItem *child = qobject_cast(schild); + QmlGraphicsItem *child = qobject_cast(schild); if (!child || child->opacity() == 0.0) continue; bool needMove = (child->x()!=xoffset)||(child->y()!=yoffset); diff --git a/src/declarative/fx/qfxpositioners.h b/src/declarative/fx/qfxpositioners.h index d62da08..29c121c 100644 --- a/src/declarative/fx/qfxpositioners.h +++ b/src/declarative/fx/qfxpositioners.h @@ -53,9 +53,9 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxBasePositionerPrivate; +class QmlGraphicsBasePositionerPrivate; -class Q_DECLARATIVE_EXPORT QFxBasePositioner : public QFxItem +class Q_DECLARATIVE_EXPORT QmlGraphicsBasePositioner : public QmlGraphicsItem { Q_OBJECT @@ -65,7 +65,7 @@ class Q_DECLARATIVE_EXPORT QFxBasePositioner : public QFxItem Q_PROPERTY(QmlTransition *remove READ remove WRITE setRemove) public: enum AutoUpdateType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; - QFxBasePositioner(AutoUpdateType, QFxItem *parent); + QmlGraphicsBasePositioner(AutoUpdateType, QmlGraphicsItem *parent); int spacing() const; void setSpacing(int); @@ -83,12 +83,12 @@ protected: virtual void componentComplete(); virtual QVariant itemChange(GraphicsItemChange, const QVariant &); virtual bool event(QEvent *); - QSet* newItems(); - QSet* leavingItems(); - QSet* items(); - void applyAdd(const QList >& changes, QFxItem* target); - void applyMove(const QList >& changes, QFxItem* target); - void applyRemove(const QList >& changes, QFxItem* target); + QSet* newItems(); + QSet* leavingItems(); + QSet* items(); + void applyAdd(const QList >& changes, QmlGraphicsItem* target); + void applyMove(const QList >& changes, QmlGraphicsItem* target); + void applyRemove(const QList >& changes, QmlGraphicsItem* target); void finishApplyTransitions(); Q_SIGNALS: @@ -102,45 +102,45 @@ private Q_SLOTS: void prePositioning(); protected: - QFxBasePositioner(QFxBasePositionerPrivate &dd, AutoUpdateType at, QFxItem *parent); - void setMovingItem(QFxItem *); + QmlGraphicsBasePositioner(QmlGraphicsBasePositionerPrivate &dd, AutoUpdateType at, QmlGraphicsItem *parent); + void setMovingItem(QmlGraphicsItem *); private: - void applyTransition(const QList >& changes, QFxItem* target, + void applyTransition(const QList >& changes, QmlGraphicsItem* target, QmlStateOperation::ActionList &actions); - Q_DISABLE_COPY(QFxBasePositioner) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxBasePositioner) + Q_DISABLE_COPY(QmlGraphicsBasePositioner) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBasePositioner) }; -class Q_DECLARATIVE_EXPORT QFxColumn : public QFxBasePositioner +class Q_DECLARATIVE_EXPORT QmlGraphicsColumn : public QmlGraphicsBasePositioner { Q_OBJECT public: - QFxColumn(QFxItem *parent=0); + QmlGraphicsColumn(QmlGraphicsItem *parent=0); protected Q_SLOTS: virtual void doPositioning(); private: - Q_DISABLE_COPY(QFxColumn) + Q_DISABLE_COPY(QmlGraphicsColumn) }; -class Q_DECLARATIVE_EXPORT QFxRow: public QFxBasePositioner +class Q_DECLARATIVE_EXPORT QmlGraphicsRow: public QmlGraphicsBasePositioner { Q_OBJECT public: - QFxRow(QFxItem *parent=0); + QmlGraphicsRow(QmlGraphicsItem *parent=0); protected Q_SLOTS: virtual void doPositioning(); private: - Q_DISABLE_COPY(QFxRow) + Q_DISABLE_COPY(QmlGraphicsRow) }; -class Q_DECLARATIVE_EXPORT QFxGrid : public QFxBasePositioner +class Q_DECLARATIVE_EXPORT QmlGraphicsGrid : public QmlGraphicsBasePositioner { Q_OBJECT Q_PROPERTY(int rows READ rows WRITE setRows) Q_PROPERTY(int columns READ columns WRITE setcolumns) public: - QFxGrid(QFxItem *parent=0); + QmlGraphicsGrid(QmlGraphicsItem *parent=0); int rows() const {return _rows;} void setRows(const int rows){_rows = rows;} @@ -153,14 +153,14 @@ protected Q_SLOTS: private: int _rows; int _columns; - Q_DISABLE_COPY(QFxGrid) + Q_DISABLE_COPY(QmlGraphicsGrid) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxColumn) -QML_DECLARE_TYPE(QFxRow) -QML_DECLARE_TYPE(QFxGrid) +QML_DECLARE_TYPE(QmlGraphicsColumn) +QML_DECLARE_TYPE(QmlGraphicsRow) +QML_DECLARE_TYPE(QmlGraphicsGrid) QT_END_HEADER diff --git a/src/declarative/fx/qfxpositioners_p.h b/src/declarative/fx/qfxpositioners_p.h index 8960952..fdc11bb 100644 --- a/src/declarative/fx/qfxpositioners_p.h +++ b/src/declarative/fx/qfxpositioners_p.h @@ -62,19 +62,19 @@ #include QT_BEGIN_NAMESPACE -class QFxBasePositionerPrivate : public QFxItemPrivate +class QmlGraphicsBasePositionerPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxBasePositioner) + Q_DECLARE_PUBLIC(QmlGraphicsBasePositioner) public: - QFxBasePositionerPrivate() + QmlGraphicsBasePositionerPrivate() : _ep(false), _componentComplete(false), _spacing(0), - aut(QFxBasePositioner::None), moveTransition(0), addTransition(0), + aut(QmlGraphicsBasePositioner::None), moveTransition(0), addTransition(0), removeTransition(0), _movingItem(0) { } - void init(QFxBasePositioner::AutoUpdateType at) + void init(QmlGraphicsBasePositioner::AutoUpdateType at) { aut = at; } @@ -82,15 +82,15 @@ public: bool _ep; bool _componentComplete; int _spacing; - QFxBasePositioner::AutoUpdateType aut; + QmlGraphicsBasePositioner::AutoUpdateType aut; QmlTransition *moveTransition; QmlTransition *addTransition; QmlTransition *removeTransition; - QSet _items; - QSet _leavingItems; - QSet _stableItems; - QSet _newItems; - QSet _animated; + QSet _items; + QSet _leavingItems; + QSet _stableItems; + QSet _newItems; + QSet _animated; QmlStateOperation::ActionList addActions; QmlStateOperation::ActionList moveActions; QmlStateOperation::ActionList removeActions; @@ -98,7 +98,7 @@ public: QmlTransitionManager moveTransitionManager; QmlTransitionManager removeTransitionManager; // QmlStateGroup *stateGroup; - QFxItem *_movingItem; + QmlGraphicsItem *_movingItem; }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index d4207a6..7ebacf0 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -46,14 +46,14 @@ #include QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Pen,QFxPen) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GradientStop,QFxGradientStop) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Gradient,QFxGradient) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Pen,QmlGraphicsPen) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GradientStop,QmlGraphicsGradientStop) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Gradient,QmlGraphicsGradient) /*! \internal - \class QFxPen - \brief The QFxPen class provides a pen used for drawing rectangle borders on a QmlView. + \class QmlGraphicsPen + \brief The QmlGraphicsPen class provides a pen used for drawing rectangle borders on a QmlView. By default, the pen is invalid and nothing is drawn. You must either set a color (then the default width is 1) or a width (then the default color is black). @@ -66,14 +66,14 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Gradient,QFxGradient) \endqml */ -void QFxPen::setColor(const QColor &c) +void QmlGraphicsPen::setColor(const QColor &c) { _color = c; _valid = _color.alpha() ? true : false; emit penChanged(); } -void QFxPen::setWidth(int w) +void QmlGraphicsPen::setWidth(int w) { if (_width == w && _valid) return; @@ -85,7 +85,7 @@ void QFxPen::setWidth(int w) /*! - \qmlclass GradientStop QFxGradientStop + \qmlclass GradientStop QmlGraphicsGradientStop \brief The GradientStop item defines the color at a position in a Gradient \sa Gradient @@ -98,14 +98,14 @@ void QFxPen::setWidth(int w) Sets a \e color at a \e position in a gradient. */ -void QFxGradientStop::updateGradient() +void QmlGraphicsGradientStop::updateGradient() { - if (QFxGradient *grad = qobject_cast(parent())) + if (QmlGraphicsGradient *grad = qobject_cast(parent())) grad->doUpdate(); } /*! - \qmlclass Gradient QFxGradient + \qmlclass Gradient QmlGraphicsGradient \brief The Gradient item defines a gradient fill. A gradient is defined by two or more colors, which will be blended seemlessly. The @@ -128,12 +128,12 @@ void QFxGradientStop::updateGradient() This property holds the gradient stops describing the gradient. */ -const QGradient *QFxGradient::gradient() const +const QGradient *QmlGraphicsGradient::gradient() const { if (!m_gradient && !m_stops.isEmpty()) { m_gradient = new QLinearGradient(0,0,0,1.0); for (int i = 0; i < m_stops.count(); ++i) { - const QFxGradientStop *stop = m_stops.at(i); + const QmlGraphicsGradientStop *stop = m_stops.at(i); m_gradient->setCoordinateMode(QGradient::ObjectBoundingMode); m_gradient->setColorAt(stop->position(), stop->color()); } @@ -142,17 +142,17 @@ const QGradient *QFxGradient::gradient() const return m_gradient; } -void QFxGradient::doUpdate() +void QmlGraphicsGradient::doUpdate() { delete m_gradient; m_gradient = 0; emit updated(); } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rectangle,QFxRect) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rectangle,QmlGraphicsRect) /*! - \qmlclass Rectangle QFxRect + \qmlclass Rectangle QmlGraphicsRect \brief The Rectangle item allows you to add rectangles to a scene. \inherits Item @@ -175,28 +175,28 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rectangle,QFxRect) /*! \internal - \class QFxRect - \brief The QFxRect class provides a rectangle item that you can add to a QmlView. + \class QmlGraphicsRect + \brief The QmlGraphicsRect class provides a rectangle item that you can add to a QmlView. */ -QFxRect::QFxRect(QFxItem *parent) - : QFxItem(*(new QFxRectPrivate), parent) +QmlGraphicsRect::QmlGraphicsRect(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsRectPrivate), parent) { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); d->init(); setFlag(QGraphicsItem::ItemHasNoContents, false); } -QFxRect::QFxRect(QFxRectPrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsRect::QmlGraphicsRect(QmlGraphicsRectPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); d->init(); setFlag(QGraphicsItem::ItemHasNoContents, false); } -void QFxRect::doUpdate() +void QmlGraphicsRect::doUpdate() { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); d->rectImage = QPixmap(); const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; d->setPaintMargin((pw+1)/2); @@ -214,9 +214,9 @@ void QFxRect::doUpdate() To keep the border smooth (rather than blurry), odd widths cause the rectangle to be painted at a half-pixel offset; */ -QFxPen *QFxRect::border() +QmlGraphicsPen *QmlGraphicsRect::border() { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); return d->getPen(); } @@ -254,15 +254,15 @@ QFxPen *QFxRect::border() \sa Gradient, color */ -QFxGradient *QFxRect::gradient() const +QmlGraphicsGradient *QmlGraphicsRect::gradient() const { - Q_D(const QFxRect); + Q_D(const QmlGraphicsRect); return d->gradient; } -void QFxRect::setGradient(QFxGradient *gradient) +void QmlGraphicsRect::setGradient(QmlGraphicsGradient *gradient) { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); if (d->gradient == gradient) return; if (d->gradient) @@ -282,15 +282,15 @@ void QFxRect::setGradient(QFxGradient *gradient) painted as a normal rectangle. The same radius is used by all 4 corners; there is currently no way to specify different radii for different corners. */ -qreal QFxRect::radius() const +qreal QmlGraphicsRect::radius() const { - Q_D(const QFxRect); + Q_D(const QmlGraphicsRect); return d->radius; } -void QFxRect::setRadius(qreal radius) +void QmlGraphicsRect::setRadius(qreal radius) { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); if (d->radius == radius) return; @@ -316,15 +316,15 @@ void QFxRect::setRadius(qreal radius) If both a gradient and a color are specified, the gradient will be used. */ -QColor QFxRect::color() const +QColor QmlGraphicsRect::color() const { - Q_D(const QFxRect); + Q_D(const QmlGraphicsRect); return d->color; } -void QFxRect::setColor(const QColor &c) +void QmlGraphicsRect::setColor(const QColor &c) { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); if (d->color == c) return; @@ -334,9 +334,9 @@ void QFxRect::setColor(const QColor &c) emit colorChanged(); } -void QFxRect::generateRoundedRect() +void QmlGraphicsRect::generateRoundedRect() { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); if (d->rectImage.isNull()) { const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; const int radius = qCeil(d->radius); //ensure odd numbered width/height so we get 1-pixel center @@ -358,9 +358,9 @@ void QFxRect::generateRoundedRect() } } -void QFxRect::generateBorderedRect() +void QmlGraphicsRect::generateBorderedRect() { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); if (d->rectImage.isNull()) { const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3); @@ -382,9 +382,9 @@ void QFxRect::generateBorderedRect() } } -void QFxRect::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsRect::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); if (d->radius > 0 || (d->pen && d->pen->isValid()) || (d->gradient && d->gradient->gradient()) ) { drawRect(*p); @@ -399,9 +399,9 @@ void QFxRect::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) } } -void QFxRect::drawRect(QPainter &p) +void QmlGraphicsRect::drawRect(QPainter &p) { - Q_D(QFxRect); + Q_D(QmlGraphicsRect); if (d->gradient && d->gradient->gradient()) { // XXX This path is still slower than the image path // Image path won't work for gradients though @@ -466,9 +466,9 @@ void QFxRect::drawRect(QPainter &p) \image rect-smooth.png */ -QRectF QFxRect::boundingRect() const +QRectF QmlGraphicsRect::boundingRect() const { - Q_D(const QFxRect); + Q_D(const QmlGraphicsRect); return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2); } diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index e5bb8d3..5154a8a 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -51,14 +51,14 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QFxPen : public QObject +class Q_DECLARATIVE_EXPORT QmlGraphicsPen : public QObject { Q_OBJECT Q_PROPERTY(int width READ width WRITE setWidth NOTIFY penChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged) public: - QFxPen(QObject *parent=0) + QmlGraphicsPen(QObject *parent=0) : QObject(parent), _width(1), _color("#000000"), _valid(false) {} @@ -79,7 +79,7 @@ private: bool _valid; }; -class Q_DECLARATIVE_EXPORT QFxGradientStop : public QObject +class Q_DECLARATIVE_EXPORT QmlGraphicsGradientStop : public QObject { Q_OBJECT @@ -87,7 +87,7 @@ class Q_DECLARATIVE_EXPORT QFxGradientStop : public QObject Q_PROPERTY(QColor color READ color WRITE setColor) public: - QFxGradientStop(QObject *parent=0) : QObject(parent) {} + QmlGraphicsGradientStop(QObject *parent=0) : QObject(parent) {} qreal position() const { return m_position; } void setPosition(qreal position) { m_position = position; updateGradient(); } @@ -103,18 +103,18 @@ private: QColor m_color; }; -class Q_DECLARATIVE_EXPORT QFxGradient : public QObject +class Q_DECLARATIVE_EXPORT QmlGraphicsGradient : public QObject { Q_OBJECT - Q_PROPERTY(QList *stops READ stops) + Q_PROPERTY(QList *stops READ stops) Q_CLASSINFO("DefaultProperty", "stops") public: - QFxGradient(QObject *parent=0) : QObject(parent), m_gradient(0) {} - ~QFxGradient() { delete m_gradient; } + QmlGraphicsGradient(QObject *parent=0) : QObject(parent), m_gradient(0) {} + ~QmlGraphicsGradient() { delete m_gradient; } - QList *stops() { return &m_stops; } + QList *stops() { return &m_stops; } const QGradient *gradient() const; @@ -125,30 +125,30 @@ private: void doUpdate(); private: - QList m_stops; + QList m_stops; mutable QGradient *m_gradient; - friend class QFxGradientStop; + friend class QmlGraphicsGradientStop; }; -class QFxRectPrivate; -class Q_DECLARATIVE_EXPORT QFxRect : public QFxItem +class QmlGraphicsRectPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsRect : public QmlGraphicsItem { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) - Q_PROPERTY(QFxGradient *gradient READ gradient WRITE setGradient) - Q_PROPERTY(QFxPen * border READ border CONSTANT) + Q_PROPERTY(QmlGraphicsGradient *gradient READ gradient WRITE setGradient) + Q_PROPERTY(QmlGraphicsPen * border READ border CONSTANT) Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) public: - QFxRect(QFxItem *parent=0); + QmlGraphicsRect(QmlGraphicsItem *parent=0); QColor color() const; void setColor(const QColor &); - QFxPen *border(); + QmlGraphicsPen *border(); - QFxGradient *gradient() const; - void setGradient(QFxGradient *gradient); + QmlGraphicsGradient *gradient() const; + void setGradient(QmlGraphicsGradient *gradient); qreal radius() const; void setRadius(qreal radius); @@ -170,19 +170,19 @@ private: void drawRect(QPainter &painter); protected: - QFxRect(QFxRectPrivate &dd, QFxItem *parent); + QmlGraphicsRect(QmlGraphicsRectPrivate &dd, QmlGraphicsItem *parent); private: - Q_DISABLE_COPY(QFxRect) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxRect) + Q_DISABLE_COPY(QmlGraphicsRect) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRect) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxPen) -QML_DECLARE_TYPE(QFxGradientStop) -QML_DECLARE_TYPE(QFxGradient) -QML_DECLARE_TYPE(QFxRect) +QML_DECLARE_TYPE(QmlGraphicsPen) +QML_DECLARE_TYPE(QmlGraphicsGradientStop) +QML_DECLARE_TYPE(QmlGraphicsGradient) +QML_DECLARE_TYPE(QmlGraphicsRect) QT_END_HEADER diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h index c055b76..d67209e 100644 --- a/src/declarative/fx/qfxrect_p.h +++ b/src/declarative/fx/qfxrect_p.h @@ -57,19 +57,19 @@ QT_BEGIN_NAMESPACE -class QFxGradient; -class QFxRect; -class QFxRectPrivate : public QFxItemPrivate +class QmlGraphicsGradient; +class QmlGraphicsRect; +class QmlGraphicsRectPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxRect) + Q_DECLARE_PUBLIC(QmlGraphicsRect) public: - QFxRectPrivate() : + QmlGraphicsRectPrivate() : color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0) { } - ~QFxRectPrivate() + ~QmlGraphicsRectPrivate() { delete pen; } @@ -80,23 +80,23 @@ public: QColor getColor(); QColor color; - QFxGradient *gradient; - QFxPen *getPen() { + QmlGraphicsGradient *gradient; + QmlGraphicsPen *getPen() { if (!pen) { - Q_Q(QFxRect); - pen = new QFxPen; + Q_Q(QmlGraphicsRect); + pen = new QmlGraphicsPen; QObject::connect(pen, SIGNAL(penChanged()), q, SLOT(doUpdate())); } return pen; } - QFxPen *pen; + QmlGraphicsPen *pen; qreal radius; qreal paintmargin; QPixmap rectImage; void setPaintMargin(qreal margin) { - Q_Q(QFxRect); + Q_Q(QmlGraphicsRect); if (margin == paintmargin) return; q->prepareGeometryChange(); diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 94954e7..e8e44cc 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -47,16 +47,16 @@ QT_BEGIN_NAMESPACE -QFxRepeaterPrivate::QFxRepeaterPrivate() +QmlGraphicsRepeaterPrivate::QmlGraphicsRepeaterPrivate() : model(0), ownModel(false) { } -QFxRepeaterPrivate::~QFxRepeaterPrivate() +QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate() { } -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QmlGraphicsRepeater) /*! \qmlclass Repeater @@ -103,7 +103,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) /*! \internal - \class QFxRepeater + \class QmlGraphicsRepeater \qmlclass Repeater XXX Repeater is very conservative in how it instatiates/deletes items. Also @@ -111,18 +111,18 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater) */ /*! - Create a new QFxRepeater instance. + Create a new QmlGraphicsRepeater instance. */ -QFxRepeater::QFxRepeater(QFxItem *parent) - : QFxItem(*(new QFxRepeaterPrivate), parent) +QmlGraphicsRepeater::QmlGraphicsRepeater(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsRepeaterPrivate), parent) { } /*! \internal */ -QFxRepeater::QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsRepeater::QmlGraphicsRepeater(QmlGraphicsRepeaterPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { } @@ -130,7 +130,7 @@ QFxRepeater::QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent) Destroy the repeater instance. All items it instantiated are also destroyed. */ -QFxRepeater::~QFxRepeater() +QmlGraphicsRepeater::~QmlGraphicsRepeater() { } @@ -154,29 +154,29 @@ QFxRepeater::~QFxRepeater() \sa {qmlmodels}{Data Models} */ -QVariant QFxRepeater::model() const +QVariant QmlGraphicsRepeater::model() const { - Q_D(const QFxRepeater); + Q_D(const QmlGraphicsRepeater); return d->dataSource; } -void QFxRepeater::setModel(const QVariant &model) +void QmlGraphicsRepeater::setModel(const QVariant &model) { - Q_D(QFxRepeater); + Q_D(QmlGraphicsRepeater); clear(); if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); /* - disconnect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); - disconnect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); + disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); + disconnect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*))); */ } d->dataSource = model; QObject *object = qvariant_cast(model); - QFxVisualModel *vim = 0; - if (object && (vim = qobject_cast(object))) { + QmlGraphicsVisualModel *vim = 0; + if (object && (vim = qobject_cast(object))) { if (d->ownModel) { delete d->model; d->ownModel = false; @@ -184,10 +184,10 @@ void QFxRepeater::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) dataModel->setModel(model); } if (d->model) { @@ -195,8 +195,8 @@ void QFxRepeater::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); /* - connect(d->model, SIGNAL(createdItem(int, QFxItem*)), this, SLOT(createdItem(int,QFxItem*))); - connect(d->model, SIGNAL(destroyingItem(QFxItem*)), this, SLOT(destroyingItem(QFxItem*))); + connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*))); + connect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*))); */ regenerate(); emit countChanged(); @@ -209,25 +209,25 @@ void QFxRepeater::setModel(const QVariant &model) The delegate provides a template describing what each item instantiated by the repeater should look and act like. */ -QmlComponent *QFxRepeater::delegate() const +QmlComponent *QmlGraphicsRepeater::delegate() const { - Q_D(const QFxRepeater); + Q_D(const QmlGraphicsRepeater); if (d->model) { - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) return dataModel->delegate(); } return 0; } -void QFxRepeater::setDelegate(QmlComponent *delegate) +void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate) { - Q_D(QFxRepeater); + Q_D(QmlGraphicsRepeater); if (!d->ownModel) { - d->model = new QFxVisualDataModel(qmlContext(this)); + d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; } - if (QFxVisualDataModel *dataModel = qobject_cast(d->model)) { + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast(d->model)) { dataModel->setDelegate(delegate); regenerate(); } @@ -238,9 +238,9 @@ void QFxRepeater::setDelegate(QmlComponent *delegate) This property holds the number of items in the repeater. */ -int QFxRepeater::count() const +int QmlGraphicsRepeater::count() const { - Q_D(const QFxRepeater); + Q_D(const QmlGraphicsRepeater); if (d->model) return d->model->count(); return 0; @@ -250,19 +250,19 @@ int QFxRepeater::count() const /*! \internal */ -void QFxRepeater::componentComplete() +void QmlGraphicsRepeater::componentComplete() { - QFxItem::componentComplete(); + QmlGraphicsItem::componentComplete(); regenerate(); } /*! \internal */ -QVariant QFxRepeater::itemChange(GraphicsItemChange change, +QVariant QmlGraphicsRepeater::itemChange(GraphicsItemChange change, const QVariant &value) { - QVariant rv = QFxItem::itemChange(change, value); + QVariant rv = QmlGraphicsItem::itemChange(change, value); if (change == ItemParentHasChanged) { regenerate(); } @@ -270,11 +270,11 @@ QVariant QFxRepeater::itemChange(GraphicsItemChange change, return rv; } -void QFxRepeater::clear() +void QmlGraphicsRepeater::clear() { - Q_D(QFxRepeater); + Q_D(QmlGraphicsRepeater); if (d->model) { - foreach (QFxItem *item, d->deletables) + foreach (QmlGraphicsItem *item, d->deletables) d->model->release(item); } d->deletables.clear(); @@ -283,9 +283,9 @@ void QFxRepeater::clear() /*! \internal */ -void QFxRepeater::regenerate() +void QmlGraphicsRepeater::regenerate() { - Q_D(QFxRepeater); + Q_D(QmlGraphicsRepeater); clear(); @@ -293,7 +293,7 @@ void QFxRepeater::regenerate() return; for (int ii = 0; ii < count(); ++ii) { - QFxItem *item = d->model->item(ii); + QmlGraphicsItem *item = d->model->item(ii); if (item) { item->setParent(parentItem()); item->stackBefore(this); @@ -302,17 +302,17 @@ void QFxRepeater::regenerate() } } -void QFxRepeater::itemsInserted(int, int) +void QmlGraphicsRepeater::itemsInserted(int, int) { regenerate(); } -void QFxRepeater::itemsRemoved(int, int) +void QmlGraphicsRepeater::itemsRemoved(int, int) { regenerate(); } -void QFxRepeater::itemsMoved(int,int,int) +void QmlGraphicsRepeater::itemsMoved(int,int,int) { regenerate(); } diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h index 7a0318b..f8a03cc 100644 --- a/src/declarative/fx/qfxrepeater.h +++ b/src/declarative/fx/qfxrepeater.h @@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxRepeaterPrivate; -class Q_DECLARATIVE_EXPORT QFxRepeater : public QFxItem +class QmlGraphicsRepeaterPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsRepeater : public QmlGraphicsItem { Q_OBJECT @@ -61,8 +61,8 @@ class Q_DECLARATIVE_EXPORT QFxRepeater : public QFxItem Q_CLASSINFO("DefaultProperty", "delegate") public: - QFxRepeater(QFxItem *parent=0); - virtual ~QFxRepeater(); + QmlGraphicsRepeater(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsRepeater(); QVariant model() const; void setModel(const QVariant &); @@ -82,7 +82,7 @@ private: protected: virtual void componentComplete(); QVariant itemChange(GraphicsItemChange change, const QVariant &value); - QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent); + QmlGraphicsRepeater(QmlGraphicsRepeaterPrivate &dd, QmlGraphicsItem *parent); private Q_SLOTS: void itemsInserted(int,int); @@ -90,13 +90,13 @@ private Q_SLOTS: void itemsMoved(int,int,int); private: - Q_DISABLE_COPY(QFxRepeater) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxRepeater) + Q_DISABLE_COPY(QmlGraphicsRepeater) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRepeater) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxRepeater) +QML_DECLARE_TYPE(QmlGraphicsRepeater) QT_END_HEADER diff --git a/src/declarative/fx/qfxrepeater_p.h b/src/declarative/fx/qfxrepeater_p.h index a4eb96d..eb35352 100644 --- a/src/declarative/fx/qfxrepeater_p.h +++ b/src/declarative/fx/qfxrepeater_p.h @@ -61,20 +61,20 @@ QT_BEGIN_NAMESPACE class QmlContext; -class QFxVisualModel; -class QFxRepeaterPrivate : public QFxItemPrivate +class QmlGraphicsVisualModel; +class QmlGraphicsRepeaterPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxRepeater) + Q_DECLARE_PUBLIC(QmlGraphicsRepeater) public: - QFxRepeaterPrivate(); - ~QFxRepeaterPrivate(); + QmlGraphicsRepeaterPrivate(); + ~QmlGraphicsRepeaterPrivate(); - QFxVisualModel *model; + QmlGraphicsVisualModel *model; QVariant dataSource; bool ownModel; - QList > deletables; + QList > deletables; }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxscalegrid.cpp b/src/declarative/fx/qfxscalegrid.cpp index 4c6a522..2012616 100644 --- a/src/declarative/fx/qfxscalegrid.cpp +++ b/src/declarative/fx/qfxscalegrid.cpp @@ -48,25 +48,25 @@ QT_BEGIN_NAMESPACE /*! \internal - \class QFxScaleGrid - \brief The QFxScaleGrid class allows you to specify a 3x3 grid to use in scaling an image. + \class QmlGraphicsScaleGrid + \brief The QmlGraphicsScaleGrid class allows you to specify a 3x3 grid to use in scaling an image. */ -QML_DEFINE_NOCREATE_TYPE(QFxScaleGrid) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsScaleGrid) -QFxScaleGrid::QFxScaleGrid(QObject *parent) : QObject(parent), _left(0), _top(0), _right(0), _bottom(0) +QmlGraphicsScaleGrid::QmlGraphicsScaleGrid(QObject *parent) : QObject(parent), _left(0), _top(0), _right(0), _bottom(0) { } -QFxScaleGrid::~QFxScaleGrid() +QmlGraphicsScaleGrid::~QmlGraphicsScaleGrid() { } -bool QFxScaleGrid::isNull() const +bool QmlGraphicsScaleGrid::isNull() const { return !_left && !_top && !_right && !_bottom; } -void QFxScaleGrid::setLeft(int pos) +void QmlGraphicsScaleGrid::setLeft(int pos) { if (_left != pos) { _left = pos; @@ -74,7 +74,7 @@ void QFxScaleGrid::setLeft(int pos) } } -void QFxScaleGrid::setTop(int pos) +void QmlGraphicsScaleGrid::setTop(int pos) { if (_top != pos) { _top = pos; @@ -82,7 +82,7 @@ void QFxScaleGrid::setTop(int pos) } } -void QFxScaleGrid::setRight(int pos) +void QmlGraphicsScaleGrid::setRight(int pos) { if (_right != pos) { _right = pos; @@ -90,7 +90,7 @@ void QFxScaleGrid::setRight(int pos) } } -void QFxScaleGrid::setBottom(int pos) +void QmlGraphicsScaleGrid::setBottom(int pos) { if (_bottom != pos) { _bottom = pos; @@ -98,18 +98,18 @@ void QFxScaleGrid::setBottom(int pos) } } -QFxGridScaledImage::QFxGridScaledImage() +QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage() : _l(-1), _r(-1), _t(-1), _b(-1), - _h(QFxBorderImage::Stretch), _v(QFxBorderImage::Stretch) + _h(QmlGraphicsBorderImage::Stretch), _v(QmlGraphicsBorderImage::Stretch) { } -QFxGridScaledImage::QFxGridScaledImage(const QFxGridScaledImage &o) +QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage(const QmlGraphicsGridScaledImage &o) : _l(o._l), _r(o._r), _t(o._t), _b(o._b), _h(o._h), _v(o._v), _pix(o._pix) { } -QFxGridScaledImage &QFxGridScaledImage::operator=(const QFxGridScaledImage &o) +QmlGraphicsGridScaledImage &QmlGraphicsGridScaledImage::operator=(const QmlGraphicsGridScaledImage &o) { _l = o._l; _r = o._r; @@ -121,8 +121,8 @@ QFxGridScaledImage &QFxGridScaledImage::operator=(const QFxGridScaledImage &o) return *this; } -QFxGridScaledImage::QFxGridScaledImage(QIODevice *data) -: _l(-1), _r(-1), _t(-1), _b(-1), _h(QFxBorderImage::Stretch), _v(QFxBorderImage::Stretch) +QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage(QIODevice *data) +: _l(-1), _r(-1), _t(-1), _b(-1), _h(QmlGraphicsBorderImage::Stretch), _v(QmlGraphicsBorderImage::Stretch) { int l = -1; int r = -1; @@ -166,45 +166,45 @@ QFxGridScaledImage::QFxGridScaledImage(QIODevice *data) _pix = imgFile; } -QFxBorderImage::TileMode QFxGridScaledImage::stringToRule(const QString &s) +QmlGraphicsBorderImage::TileMode QmlGraphicsGridScaledImage::stringToRule(const QString &s) { if (s == QLatin1String("Stretch")) - return QFxBorderImage::Stretch; + return QmlGraphicsBorderImage::Stretch; if (s == QLatin1String("Repeat")) - return QFxBorderImage::Repeat; + return QmlGraphicsBorderImage::Repeat; if (s == QLatin1String("Round")) - return QFxBorderImage::Round; + return QmlGraphicsBorderImage::Round; qWarning() << "Unknown tile rule specified. Using Stretch"; - return QFxBorderImage::Stretch; + return QmlGraphicsBorderImage::Stretch; } -bool QFxGridScaledImage::isValid() const +bool QmlGraphicsGridScaledImage::isValid() const { return _l >= 0; } -int QFxGridScaledImage::gridLeft() const +int QmlGraphicsGridScaledImage::gridLeft() const { return _l; } -int QFxGridScaledImage::gridRight() const +int QmlGraphicsGridScaledImage::gridRight() const { return _r; } -int QFxGridScaledImage::gridTop() const +int QmlGraphicsGridScaledImage::gridTop() const { return _t; } -int QFxGridScaledImage::gridBottom() const +int QmlGraphicsGridScaledImage::gridBottom() const { return _b; } -QString QFxGridScaledImage::pixmapUrl() const +QString QmlGraphicsGridScaledImage::pixmapUrl() const { return _pix; } diff --git a/src/declarative/fx/qfxscalegrid_p.h b/src/declarative/fx/qfxscalegrid_p.h index bae1436..f065f9d 100644 --- a/src/declarative/fx/qfxscalegrid_p.h +++ b/src/declarative/fx/qfxscalegrid_p.h @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QFxScaleGrid : public QObject +class Q_DECLARATIVE_EXPORT QmlGraphicsScaleGrid : public QObject { Q_OBJECT Q_ENUMS(TileRule) @@ -67,8 +67,8 @@ class Q_DECLARATIVE_EXPORT QFxScaleGrid : public QObject Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY borderChanged) public: - QFxScaleGrid(QObject *parent=0); - ~QFxScaleGrid(); + QmlGraphicsScaleGrid(QObject *parent=0); + ~QmlGraphicsScaleGrid(); bool isNull() const; @@ -94,39 +94,39 @@ private: int _bottom; }; -class Q_DECLARATIVE_EXPORT QFxGridScaledImage +class Q_DECLARATIVE_EXPORT QmlGraphicsGridScaledImage { public: - QFxGridScaledImage(); - QFxGridScaledImage(const QFxGridScaledImage &); - QFxGridScaledImage(QIODevice*); - QFxGridScaledImage &operator=(const QFxGridScaledImage &); + QmlGraphicsGridScaledImage(); + QmlGraphicsGridScaledImage(const QmlGraphicsGridScaledImage &); + QmlGraphicsGridScaledImage(QIODevice*); + QmlGraphicsGridScaledImage &operator=(const QmlGraphicsGridScaledImage &); bool isValid() const; int gridLeft() const; int gridRight() const; int gridTop() const; int gridBottom() const; - QFxBorderImage::TileMode horizontalTileRule() const { return _h; } - QFxBorderImage::TileMode verticalTileRule() const { return _v; } + QmlGraphicsBorderImage::TileMode horizontalTileRule() const { return _h; } + QmlGraphicsBorderImage::TileMode verticalTileRule() const { return _v; } QString pixmapUrl() const; private: - static QFxBorderImage::TileMode stringToRule(const QString &); + static QmlGraphicsBorderImage::TileMode stringToRule(const QString &); private: int _l; int _r; int _t; int _b; - QFxBorderImage::TileMode _h; - QFxBorderImage::TileMode _v; + QmlGraphicsBorderImage::TileMode _h; + QmlGraphicsBorderImage::TileMode _v; QString _pix; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxScaleGrid) +QML_DECLARE_TYPE(QmlGraphicsScaleGrid) QT_END_HEADER diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 4a01cbd..77b3ab4 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -52,10 +52,10 @@ #include QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Text,QFxText) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Text,QmlGraphicsText) /*! - \qmlclass Text QFxText + \qmlclass Text QmlGraphicsText \brief The Text item allows you to add formatted text to a scene. \inherits Item @@ -80,11 +80,11 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Text,QFxText) /*! \internal - \class QFxText + \class QmlGraphicsText \qmlclass Text \ingroup group_coreitems - \brief The QFxText class provides a formatted text item that you can add to a QmlView. + \brief The QmlGraphicsText class provides a formatted text item that you can add to a QmlView. Text was designed for read-only text; it does not allow for any text editing. It can display both plain and rich text. For example: @@ -102,23 +102,23 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Text,QFxText) The \c elide property can alternatively be used to fit a line of plain text to a set width. - A QFxText object can be instantiated in Qml using the tag \c Text. + A QmlGraphicsText object can be instantiated in Qml using the tag \c Text. */ -QFxText::QFxText(QFxItem *parent) - : QFxItem(*(new QFxTextPrivate), parent) +QmlGraphicsText::QmlGraphicsText(QmlGraphicsItem *parent) + : QmlGraphicsItem(*(new QmlGraphicsTextPrivate), parent) { setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, false); } -QFxText::QFxText(QFxTextPrivate &dd, QFxItem *parent) - : QFxItem(dd, parent) +QmlGraphicsText::QmlGraphicsText(QmlGraphicsTextPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsItem(dd, parent) { setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, false); } -QFxText::~QFxText() +QmlGraphicsText::~QmlGraphicsText() { } @@ -132,15 +132,15 @@ QFxText::~QFxText() Set the Text's font attributes. */ -QFont QFxText::font() const +QFont QmlGraphicsText::font() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->font; } -void QFxText::setFont(const QFont &font) +void QmlGraphicsText::setFont(const QFont &font) { - Q_D(QFxText); + Q_D(QmlGraphicsText); d->font = font; d->imgDirty = true; @@ -148,12 +148,12 @@ void QFxText::setFont(const QFont &font) update(); } -void QFxText::setText(const QString &n) +void QmlGraphicsText::setText(const QString &n) { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer st; + QmlPerfTimer st; #endif - Q_D(QFxText); + Q_D(QmlGraphicsText); if (d->text == n) return; @@ -184,15 +184,15 @@ void QFxText::setText(const QString &n) The item will try to automatically determine whether the text should be treated as rich text. This determination is made using Qt::mightBeRichText(). */ -QString QFxText::text() const +QString QmlGraphicsText::text() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->text; } -void QFxText::setColor(const QColor &color) +void QmlGraphicsText::setColor(const QColor &color) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (d->color == color) return; @@ -215,9 +215,9 @@ void QFxText::setColor(const QColor &color) \endqml */ -QColor QFxText::color() const +QColor QmlGraphicsText::color() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->color; } @@ -239,15 +239,15 @@ QColor QFxText::color() const \image declarative-textstyle.png */ -QFxText::TextStyle QFxText::style() const +QmlGraphicsText::TextStyle QmlGraphicsText::style() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->style; } -void QFxText::setStyle(QFxText::TextStyle style) +void QmlGraphicsText::setStyle(QmlGraphicsText::TextStyle style) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (d->style == style) return; @@ -256,9 +256,9 @@ void QFxText::setStyle(QFxText::TextStyle style) update(); } -void QFxText::setStyleColor(const QColor &color) +void QmlGraphicsText::setStyleColor(const QColor &color) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (d->styleColor == color) return; @@ -276,9 +276,9 @@ void QFxText::setStyleColor(const QColor &color) shadow color for raised or sunken text. If no style has been set, it is not used at all. */ -QColor QFxText::styleColor() const +QColor QmlGraphicsText::styleColor() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->styleColor; } @@ -293,27 +293,27 @@ QColor QFxText::styleColor() const \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom and \c AlignVCenter. */ -QFxText::HAlignment QFxText::hAlign() const +QmlGraphicsText::HAlignment QmlGraphicsText::hAlign() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->hAlign; } -void QFxText::setHAlign(HAlignment align) +void QmlGraphicsText::setHAlign(HAlignment align) { - Q_D(QFxText); + Q_D(QmlGraphicsText); d->hAlign = align; } -QFxText::VAlignment QFxText::vAlign() const +QmlGraphicsText::VAlignment QmlGraphicsText::vAlign() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->vAlign; } -void QFxText::setVAlign(VAlignment align) +void QmlGraphicsText::setVAlign(VAlignment align) { - Q_D(QFxText); + Q_D(QmlGraphicsText); d->vAlign = align; } @@ -330,15 +330,15 @@ void QFxText::setVAlign(VAlignment align) Wrapping is off by default. */ //### Future may provide choice of wrap modes, such as QTextOption::WrapAtWordBoundaryOrAnywhere -bool QFxText::wrap() const +bool QmlGraphicsText::wrap() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->wrap; } -void QFxText::setWrap(bool w) +void QmlGraphicsText::setWrap(bool w) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (w == d->wrap) return; @@ -384,15 +384,15 @@ Column { \endtable */ -QFxText::TextFormat QFxText::textFormat() const +QmlGraphicsText::TextFormat QmlGraphicsText::textFormat() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->format; } -void QFxText::setTextFormat(TextFormat format) +void QmlGraphicsText::setTextFormat(TextFormat format) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (format == d->format) return; bool wasRich = d->richText; @@ -435,15 +435,15 @@ void QFxText::setTextFormat(TextFormat format) Multi-length strings are ordered from longest to shortest, separated by the Unicode "String Terminator" character \c U009C (write this in QML with \c{"\\x9C"}). */ -QFxText::TextElideMode QFxText::elideMode() const +QmlGraphicsText::TextElideMode QmlGraphicsText::elideMode() const { - Q_D(const QFxText); + Q_D(const QmlGraphicsText); return d->elideMode; } -void QFxText::setElideMode(QFxText::TextElideMode mode) +void QmlGraphicsText::setElideMode(QmlGraphicsText::TextElideMode mode) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (mode == d->elideMode) return; @@ -453,22 +453,22 @@ void QFxText::setElideMode(QFxText::TextElideMode mode) d->updateSize(); } -void QFxText::geometryChanged(const QRectF &newGeometry, +void QmlGraphicsText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (newGeometry.width() != oldGeometry.width()) { - if (d->wrap || d->elideMode != QFxText::ElideNone) { + if (d->wrap || d->elideMode != QmlGraphicsText::ElideNone) { d->imgDirty = true; d->updateSize(); } } - QFxItem::geometryChanged(newGeometry, oldGeometry); + QmlGraphicsItem::geometryChanged(newGeometry, oldGeometry); } -void QFxTextPrivate::updateSize() +void QmlGraphicsTextPrivate::updateSize() { - Q_Q(QFxText); + Q_Q(QmlGraphicsText); if (q->isComponentComplete()) { QFontMetrics fm(font); if (text.isEmpty()) { @@ -486,7 +486,7 @@ void QFxTextPrivate::updateSize() tmp = text; tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); singleline = !tmp.contains(QChar::LineSeparator); - if (singleline && elideMode != QFxText::ElideNone && q->widthValid()) + if (singleline && elideMode != QmlGraphicsText::ElideNone && q->widthValid()) tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...? layout.clearLayout(); layout.setFont(font); @@ -514,9 +514,9 @@ void QFxTextPrivate::updateSize() int yoff = 0; if (q->heightValid()) { - if (vAlign == QFxText::AlignBottom) + if (vAlign == QmlGraphicsText::AlignBottom) yoff = dy; - else if (vAlign == QFxText::AlignVCenter) + else if (vAlign == QmlGraphicsText::AlignVCenter) yoff = dy/2; } q->setBaselineOffset(fm.ascent() + yoff); @@ -532,7 +532,7 @@ void QFxTextPrivate::updateSize() // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); -void QFxTextPrivate::drawOutline() +void QmlGraphicsTextPrivate::drawOutline() { QPixmap img = QPixmap(imgCache.size()); img.fill(Qt::transparent); @@ -556,7 +556,7 @@ void QFxTextPrivate::drawOutline() imgCache = img; } -void QFxTextPrivate::drawOutline(int yOffset) +void QmlGraphicsTextPrivate::drawOutline(int yOffset) { QPixmap img = QPixmap(imgCache.size()); img.fill(Qt::transparent); @@ -574,9 +574,9 @@ void QFxTextPrivate::drawOutline(int yOffset) imgCache = img; } -QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) +QSize QmlGraphicsTextPrivate::setupTextLayout(QTextLayout *layout) { - Q_Q(QFxText); + Q_Q(QmlGraphicsText); layout->setCacheEnabled(true); QFontMetrics fm = QFontMetrics(font); @@ -586,7 +586,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) qreal lineWidth = 0; //set manual width - if ((wrap || elideMode != QFxText::ElideNone) && q->widthValid()) + if ((wrap || elideMode != QmlGraphicsText::ElideNone) && q->widthValid()) lineWidth = q->width(); layout->beginLayout(); @@ -596,7 +596,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) if (!line.isValid()) break; - if ((wrap || elideMode != QFxText::ElideNone) && q->widthValid()) + if ((wrap || elideMode != QmlGraphicsText::ElideNone) && q->widthValid()) line.setLineWidth(lineWidth); } layout->endLayout(); @@ -610,7 +610,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) return QSize((int)widthUsed, height); } -QPixmap QFxTextPrivate::wrappedTextImage(bool drawStyle) +QPixmap QmlGraphicsTextPrivate::wrappedTextImage(bool drawStyle) { //do layout QSize size = cachedLayoutSize; @@ -618,11 +618,11 @@ QPixmap QFxTextPrivate::wrappedTextImage(bool drawStyle) int x = 0; for (int i = 0; i < layout.lineCount(); ++i) { QTextLine line = layout.lineAt(i); - if (hAlign == QFxText::AlignLeft) { + if (hAlign == QmlGraphicsText::AlignLeft) { x = 0; - } else if (hAlign == QFxText::AlignRight) { + } else if (hAlign == QmlGraphicsText::AlignRight) { x = size.width() - (int)line.naturalTextWidth(); - } else if (hAlign == QFxText::AlignHCenter) { + } else if (hAlign == QmlGraphicsText::AlignHCenter) { x = (size.width() - (int)line.naturalTextWidth()) / 2; } line.setPosition(QPoint(x, (int)line.y())); @@ -644,7 +644,7 @@ QPixmap QFxTextPrivate::wrappedTextImage(bool drawStyle) return img; } -QPixmap QFxTextPrivate::richTextImage(bool drawStyle) +QPixmap QmlGraphicsTextPrivate::richTextImage(bool drawStyle) { QSize size = doc->size().toSize(); @@ -671,7 +671,7 @@ QPixmap QFxTextPrivate::richTextImage(bool drawStyle) return img; } -void QFxTextPrivate::checkImgCache() +void QmlGraphicsTextPrivate::checkImgCache() { if (!imgDirty) return; @@ -682,22 +682,22 @@ void QFxTextPrivate::checkImgCache() imgStyleCache = QPixmap(); } else if (richText) { imgCache = richTextImage(false); - if (style != QFxText::Normal) + if (style != QmlGraphicsText::Normal) imgStyleCache = richTextImage(true); //### should use styleColor } else { imgCache = wrappedTextImage(false); - if (style != QFxText::Normal) + if (style != QmlGraphicsText::Normal) imgStyleCache = wrappedTextImage(true); //### should use styleColor } if (!empty) switch (style) { - case QFxText::Outline: + case QmlGraphicsText::Outline: drawOutline(); break; - case QFxText::Sunken: + case QmlGraphicsText::Sunken: drawOutline(-1); break; - case QFxText::Raised: + case QmlGraphicsText::Raised: drawOutline(1); break; default: @@ -707,9 +707,9 @@ void QFxTextPrivate::checkImgCache() imgDirty = false; } -void QFxText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) +void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { - Q_D(QFxText); + Q_D(QmlGraphicsText); d->checkImgCache(); if (d->imgCache.isNull()) return; @@ -779,13 +779,13 @@ void QFxText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) filtering at the beginning of the animation and reenable it at the conclusion. */ -void QFxText::componentComplete() +void QmlGraphicsText::componentComplete() { - Q_D(QFxText); + Q_D(QmlGraphicsText); #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer cc; + QmlPerfTimer cc; #endif - QFxItem::componentComplete(); + QmlGraphicsItem::componentComplete(); if (d->dirty) { d->updateSize(); d->dirty = false; @@ -796,9 +796,9 @@ void QFxText::componentComplete() \overload Handles the given mouse \a event. */ -void QFxText::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsText::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxText); + Q_D(QmlGraphicsText); if (!d->richText || !d->doc || d->control->anchorAt(event->pos()).isEmpty()) { event->setAccepted(false); @@ -810,7 +810,7 @@ void QFxText::mousePressEvent(QGraphicsSceneMouseEvent *event) // ### may malfunction if two of the same links are clicked & dragged onto each other) if (!event->isAccepted()) - QFxItem::mousePressEvent(event); + QmlGraphicsItem::mousePressEvent(event); } @@ -824,9 +824,9 @@ void QFxText::mousePressEvent(QGraphicsSceneMouseEvent *event) \overload Handles the given mouse \a event. */ -void QFxText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxText); + Q_D(QmlGraphicsText); // ### confirm the link, and send a signal out if (d->richText && d->doc && d->activeLink == d->control->anchorAt(event->pos())) @@ -835,6 +835,6 @@ void QFxText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) event->setAccepted(false); if (!event->isAccepted()) - QFxItem::mouseReleaseEvent(event); + QmlGraphicsItem::mouseReleaseEvent(event); } QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index cdb8025..bc2fb4f 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -49,8 +49,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxTextPrivate; -class Q_DECLARATIVE_EXPORT QFxText : public QFxItem +class QmlGraphicsTextPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsText : public QmlGraphicsItem { Q_OBJECT Q_ENUMS(HAlignment) @@ -71,8 +71,8 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode? public: - QFxText(QFxItem *parent=0); - ~QFxText(); + QmlGraphicsText(QmlGraphicsItem *parent=0); + ~QmlGraphicsText(); enum HAlignment { AlignLeft = Qt::AlignLeft, AlignRight = Qt::AlignRight, @@ -131,20 +131,20 @@ Q_SIGNALS: void linkActivated(const QString &link); protected: - QFxText(QFxTextPrivate &dd, QFxItem *parent); + QmlGraphicsText(QmlGraphicsTextPrivate &dd, QmlGraphicsItem *parent); void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); private: - Q_DISABLE_COPY(QFxText) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxText) + Q_DISABLE_COPY(QmlGraphicsText) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsText) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxText) +QML_DECLARE_TYPE(QmlGraphicsText) QT_END_HEADER diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h index a10cdfa..436aa08 100644 --- a/src/declarative/fx/qfxtext_p.h +++ b/src/declarative/fx/qfxtext_p.h @@ -64,15 +64,15 @@ class QTextLayout; class QTextDocument; class QTextControl; -class QFxTextPrivate : public QFxItemPrivate +class QmlGraphicsTextPrivate : public QmlGraphicsItemPrivate { - Q_DECLARE_PUBLIC(QFxText) + Q_DECLARE_PUBLIC(QmlGraphicsText) public: - QFxTextPrivate() - : color((QRgb)0), style(QFxText::Normal), imgDirty(true), - hAlign(QFxText::AlignLeft), vAlign(QFxText::AlignTop), elideMode(QFxText::ElideNone), + QmlGraphicsTextPrivate() + : color((QRgb)0), style(QmlGraphicsText::Normal), imgDirty(true), + hAlign(QmlGraphicsText::AlignLeft), vAlign(QmlGraphicsText::AlignTop), elideMode(QmlGraphicsText::ElideNone), dirty(true), wrap(false), richText(false), singleline(false), control(0), doc(0), - format(QFxText::AutoText) + format(QmlGraphicsText::AutoText) { } @@ -89,15 +89,15 @@ public: QString text; QFont font; QColor color; - QFxText::TextStyle style; + QmlGraphicsText::TextStyle style; QColor styleColor; QString activeLink; bool imgDirty; QPixmap imgCache; QPixmap imgStyleCache; - QFxText::HAlignment hAlign; - QFxText::VAlignment vAlign; - QFxText::TextElideMode elideMode; + QmlGraphicsText::HAlignment hAlign; + QmlGraphicsText::VAlignment vAlign; + QmlGraphicsText::TextElideMode elideMode; bool dirty; bool wrap; bool richText; @@ -106,7 +106,7 @@ public: QTextDocument *doc; QTextLayout layout; QSize cachedLayoutSize; - QFxText::TextFormat format; + QmlGraphicsText::TextFormat format; }; QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index ccb8f7e..ddb9194 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -53,7 +53,7 @@ #include QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextEdit,QFxTextEdit) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextEdit,QmlGraphicsTextEdit) /*! \qmlclass TextEdit @@ -80,42 +80,42 @@ TextEdit { /*! \internal - \class QFxTextEdit + \class QmlGraphicsTextEdit \qmlclass TextEdit \ingroup group_coreitems - \brief The QFxTextEdit class provides an editable formatted text item that you can add to a QmlView. + \brief The QmlGraphicsTextEdit class provides an editable formatted text item that you can add to a QmlView. It can display both plain and rich text. \image declarative-textedit.png - A QFxTextEdit object can be instantiated in Qml using the tag \c <TextEdit>. + A QmlGraphicsTextEdit object can be instantiated in Qml using the tag \c <TextEdit>. */ /*! - Constructs a new QFxTextEdit. + Constructs a new QmlGraphicsTextEdit. */ -QFxTextEdit::QFxTextEdit(QFxItem *parent) -: QFxPaintedItem(*(new QFxTextEditPrivate), parent) +QmlGraphicsTextEdit::QmlGraphicsTextEdit(QmlGraphicsItem *parent) +: QmlGraphicsPaintedItem(*(new QmlGraphicsTextEditPrivate), parent) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->init(); } /*! \internal */ -QFxTextEdit::QFxTextEdit(QFxTextEditPrivate &dd, QFxItem *parent) - : QFxPaintedItem(dd, parent) +QmlGraphicsTextEdit::QmlGraphicsTextEdit(QmlGraphicsTextEditPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsPaintedItem(dd, parent) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->init(); } -QString QFxTextEdit::text() const +QString QmlGraphicsTextEdit::text() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); if (d->richText) return d->document->toHtml(); @@ -141,10 +141,10 @@ QString QFxTextEdit::text() const automatically determine whether the text should be treated as rich text. This determination is made using Qt::mightBeRichText(). */ -void QFxTextEdit::setText(const QString &text) +void QmlGraphicsTextEdit::setText(const QString &text) { - Q_D(QFxTextEdit); - if (QFxTextEdit::text() == text) + Q_D(QmlGraphicsTextEdit); + if (QmlGraphicsTextEdit::text() == text) return; d->text = text; d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text)); @@ -192,15 +192,15 @@ Column { \o \image declarative-textformat.png \endtable */ -QFxTextEdit::TextFormat QFxTextEdit::textFormat() const +QmlGraphicsTextEdit::TextFormat QmlGraphicsTextEdit::textFormat() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->format; } -void QFxTextEdit::setTextFormat(TextFormat format) +void QmlGraphicsTextEdit::setTextFormat(TextFormat format) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (format == d->format) return; bool wasRich = d->richText; @@ -216,15 +216,15 @@ void QFxTextEdit::setTextFormat(TextFormat format) d->format = format; } -QFont QFxTextEdit::font() const +QFont QmlGraphicsTextEdit::font() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->font; } -void QFxTextEdit::setFont(const QFont &font) +void QmlGraphicsTextEdit::setFont(const QFont &font) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->font = font; clearCache(); @@ -250,15 +250,15 @@ TextEdit { color: "#00FF00"; ... } TextEdit { color: "steelblue"; ... } \endqml */ -QColor QFxTextEdit::color() const +QColor QmlGraphicsTextEdit::color() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->color; } -void QFxTextEdit::setColor(const QColor &color) +void QmlGraphicsTextEdit::setColor(const QColor &color) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->color == color) return; @@ -275,15 +275,15 @@ void QFxTextEdit::setColor(const QColor &color) The text highlight color, used behind selections. */ -QColor QFxTextEdit::selectionColor() const +QColor QmlGraphicsTextEdit::selectionColor() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->selectionColor; } -void QFxTextEdit::setSelectionColor(const QColor &color) +void QmlGraphicsTextEdit::setSelectionColor(const QColor &color) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->selectionColor == color) return; @@ -300,15 +300,15 @@ void QFxTextEdit::setSelectionColor(const QColor &color) The selected text color, used in selections. */ -QColor QFxTextEdit::selectedTextColor() const +QColor QmlGraphicsTextEdit::selectedTextColor() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->selectedTextColor; } -void QFxTextEdit::setSelectedTextColor(const QColor &color) +void QmlGraphicsTextEdit::setSelectedTextColor(const QColor &color) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->selectedTextColor == color) return; @@ -331,15 +331,15 @@ void QFxTextEdit::setSelectedTextColor(const QColor &color) \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom and \c AlignVCenter. */ -QFxTextEdit::HAlignment QFxTextEdit::hAlign() const +QmlGraphicsTextEdit::HAlignment QmlGraphicsTextEdit::hAlign() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->hAlign; } -void QFxTextEdit::setHAlign(QFxTextEdit::HAlignment alignment) +void QmlGraphicsTextEdit::setHAlign(QmlGraphicsTextEdit::HAlignment alignment) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (alignment == d->hAlign) return; d->hAlign = alignment; @@ -347,15 +347,15 @@ void QFxTextEdit::setHAlign(QFxTextEdit::HAlignment alignment) updateSize(); } -QFxTextEdit::VAlignment QFxTextEdit::vAlign() const +QmlGraphicsTextEdit::VAlignment QmlGraphicsTextEdit::vAlign() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->vAlign; } -void QFxTextEdit::setVAlign(QFxTextEdit::VAlignment alignment) +void QmlGraphicsTextEdit::setVAlign(QmlGraphicsTextEdit::VAlignment alignment) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (alignment == d->vAlign) return; d->vAlign = alignment; @@ -363,9 +363,9 @@ void QFxTextEdit::setVAlign(QFxTextEdit::VAlignment alignment) updateSize(); } -bool QFxTextEdit::wrap() const +bool QmlGraphicsTextEdit::wrap() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->wrap; } @@ -377,9 +377,9 @@ bool QFxTextEdit::wrap() const Wrapping is done on word boundaries (i.e. it is a "word-wrap"). Wrapping is off by default. */ -void QFxTextEdit::setWrap(bool w) +void QmlGraphicsTextEdit::setWrap(bool w) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (w == d->wrap) return; d->wrap = w; @@ -394,15 +394,15 @@ void QFxTextEdit::setWrap(bool w) This property is set and unset when the text edit gets focus, but it can also be set directly (useful, for example, if a KeyProxy might forward keys to it). */ -bool QFxTextEdit::isCursorVisible() const +bool QmlGraphicsTextEdit::isCursorVisible() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->cursorVisible; } -void QFxTextEdit::setCursorVisible(bool on) +void QmlGraphicsTextEdit::setCursorVisible(bool on) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->cursorVisible == on) return; d->cursorVisible = on; @@ -416,15 +416,15 @@ void QFxTextEdit::setCursorVisible(bool on) \qmlproperty int TextEdit::cursorPosition The position of the cursor in the TextEdit. */ -int QFxTextEdit::cursorPosition() const +int QmlGraphicsTextEdit::cursorPosition() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->textCursor().position(); } -void QFxTextEdit::setCursorPosition(int pos) +void QmlGraphicsTextEdit::setCursorPosition(int pos) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); QTextCursor cursor = d->control->textCursor(); if (cursor.position() == pos) return; @@ -442,18 +442,18 @@ void QFxTextEdit::setCursorPosition(int pos) needed, and the x and y properties of delegate instance will be set so as to be one pixel before the top left of the current character. - Note that the root item of the delegate component must be a QFxItem or - QFxItem derived item. + Note that the root item of the delegate component must be a QmlGraphicsItem or + QmlGraphicsItem derived item. */ -QmlComponent* QFxTextEdit::cursorDelegate() const +QmlComponent* QmlGraphicsTextEdit::cursorDelegate() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->cursorComponent; } -void QFxTextEdit::setCursorDelegate(QmlComponent* c) +void QmlGraphicsTextEdit::setCursorDelegate(QmlComponent* c) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if(d->cursorComponent){ if(d->cursor){ disconnect(d->control, SIGNAL(cursorPositionChanged()), @@ -474,12 +474,12 @@ void QFxTextEdit::setCursorDelegate(QmlComponent* c) } } -void QFxTextEdit::loadCursorDelegate() +void QmlGraphicsTextEdit::loadCursorDelegate() { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if(d->cursorComponent->isLoading()) return; - d->cursor = qobject_cast(d->cursorComponent->create(qmlContext(this))); + d->cursor = qobject_cast(d->cursorComponent->create(qmlContext(this))); if(d->cursor){ connect(d->control, SIGNAL(cursorPositionChanged()), this, SLOT(moveCursorDelegate())); @@ -506,15 +506,15 @@ void QFxTextEdit::loadCursorDelegate() \sa selectionEnd, cursorPosition, selectedText */ -int QFxTextEdit::selectionStart() const +int QmlGraphicsTextEdit::selectionStart() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->textCursor().selectionStart(); } -void QFxTextEdit::setSelectionStart(int s) +void QmlGraphicsTextEdit::setSelectionStart(int s) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if(d->lastSelectionStart == s || s < 0 || s > text().length()) return; d->lastSelectionStart = s; @@ -534,15 +534,15 @@ void QFxTextEdit::setSelectionStart(int s) \sa selectionStart, cursorPosition, selectedText */ -int QFxTextEdit::selectionEnd() const +int QmlGraphicsTextEdit::selectionEnd() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->textCursor().selectionEnd(); } -void QFxTextEdit::setSelectionEnd(int s) +void QmlGraphicsTextEdit::setSelectionEnd(int s) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if(d->lastSelectionEnd == s || s < 0 || s > text().length()) return; d->lastSelectionEnd = s; @@ -563,9 +563,9 @@ void QFxTextEdit::setSelectionEnd(int s) myTextEdit.selectionEnd); \endcode */ -QString QFxTextEdit::selectedText() const +QString QmlGraphicsTextEdit::selectedText() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->textCursor().selectedText(); } @@ -575,15 +575,15 @@ QString QFxTextEdit::selectedText() const Whether the TextEdit should gain focus on a mouse press. By default this is set to false; */ -bool QFxTextEdit::focusOnPress() const +bool QmlGraphicsTextEdit::focusOnPress() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->focusOnPress; } -void QFxTextEdit::setFocusOnPress(bool on) +void QmlGraphicsTextEdit::setFocusOnPress(bool on) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->focusOnPress == on) return; d->focusOnPress = on; @@ -595,51 +595,51 @@ void QFxTextEdit::setFocusOnPress(bool on) Whether the TextEdit should keep the selection visible when it loses focus to another item in the scene. By default this is set to true; */ -bool QFxTextEdit::persistentSelection() const +bool QmlGraphicsTextEdit::persistentSelection() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->persistentSelection; } -void QFxTextEdit::setPersistentSelection(bool on) +void QmlGraphicsTextEdit::setPersistentSelection(bool on) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->persistentSelection == on) return; d->persistentSelection = on; } -qreal QFxTextEdit::textMargin() const +qreal QmlGraphicsTextEdit::textMargin() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->textMargin; } -void QFxTextEdit::setTextMargin(qreal margin) +void QmlGraphicsTextEdit::setTextMargin(qreal margin) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->textMargin == margin) return; d->textMargin = margin; d->document->setDocumentMargin(d->textMargin); } -void QFxTextEdit::geometryChanged(const QRectF &newGeometry, +void QmlGraphicsTextEdit::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { if (newGeometry.width() != oldGeometry.width()) updateSize(); - QFxPaintedItem::geometryChanged(newGeometry, oldGeometry); + QmlGraphicsPaintedItem::geometryChanged(newGeometry, oldGeometry); } /*! Ensures any delayed caching or data loading the class needs to performed is complete. */ -void QFxTextEdit::componentComplete() +void QmlGraphicsTextEdit::componentComplete() { - Q_D(QFxTextEdit); - QFxPaintedItem::componentComplete(); + Q_D(QmlGraphicsTextEdit); + QmlGraphicsPaintedItem::componentComplete(); if (d->dirty) { updateSize(); d->dirty = false; @@ -654,9 +654,9 @@ void QFxTextEdit::componentComplete() By default this property is false. */ -void QFxTextEdit::setReadOnly(bool r) +void QmlGraphicsTextEdit::setReadOnly(bool r) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); Qt::TextInteractionFlags flags = Qt::NoTextInteraction; if (r) { @@ -669,9 +669,9 @@ void QFxTextEdit::setReadOnly(bool r) d->control->moveCursor(QTextCursor::End); } -bool QFxTextEdit::isReadOnly() const +bool QmlGraphicsTextEdit::isReadOnly() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return !(d->control->textInteractionFlags() & Qt::TextEditable); } @@ -679,9 +679,9 @@ bool QFxTextEdit::isReadOnly() const Sets how the text edit should interact with user input to the given \a flags. */ -void QFxTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags) +void QmlGraphicsTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->setTextInteractionFlags(flags); } @@ -689,9 +689,9 @@ void QFxTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags) Returns the flags specifying how the text edit should interact with user input. */ -Qt::TextInteractionFlags QFxTextEdit::textInteractionFlags() const +Qt::TextInteractionFlags QmlGraphicsTextEdit::textInteractionFlags() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->textInteractionFlags(); } @@ -699,9 +699,9 @@ Qt::TextInteractionFlags QFxTextEdit::textInteractionFlags() const Returns the cursor for the point at the given \a pos on the text edit. */ -QTextCursor QFxTextEdit::cursorForPosition(const QPoint &pos) const +QTextCursor QmlGraphicsTextEdit::cursorForPosition(const QPoint &pos) const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->cursorForPosition(pos); } @@ -709,9 +709,9 @@ QTextCursor QFxTextEdit::cursorForPosition(const QPoint &pos) const Returns the rectangle where the given text \a cursor is rendered within the text edit. */ -QRect QFxTextEdit::cursorRect(const QTextCursor &cursor) const +QRect QmlGraphicsTextEdit::cursorRect(const QTextCursor &cursor) const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); if (cursor.isNull()) return QRect(); @@ -722,9 +722,9 @@ QRect QFxTextEdit::cursorRect(const QTextCursor &cursor) const Returns the rectangle where the text cursor is rendered within the text edit. */ -QRect QFxTextEdit::cursorRect() const +QRect QmlGraphicsTextEdit::cursorRect() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->cursorRect().toRect(); } @@ -732,18 +732,18 @@ QRect QFxTextEdit::cursorRect() const /*! Sets the text cursor for the text edit to the given \a cursor. */ -void QFxTextEdit::setTextCursor(const QTextCursor &cursor) +void QmlGraphicsTextEdit::setTextCursor(const QTextCursor &cursor) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->setTextCursor(cursor); } /*! Returns the text cursor for the text edit. */ -QTextCursor QFxTextEdit::textCursor() const +QTextCursor QmlGraphicsTextEdit::textCursor() const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->textCursor(); } @@ -752,9 +752,9 @@ Moves the cursor by performing the given \a operation. If \a mode is QTextCursor::KeepAnchor, the cursor selects the text it moves over. This is the same effect that the user achieves when they hold down the Shift key and move the cursor with the cursor keys. */ -void QFxTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode) +void QmlGraphicsTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->moveCursor(operation, mode); } @@ -762,23 +762,23 @@ void QFxTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor:: \overload Handles the given \a event. */ -bool QFxTextEdit::event(QEvent *event) +bool QmlGraphicsTextEdit::event(QEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (event->type() == QEvent::ShortcutOverride) { d->control->processEvent(event, QPointF(0, 0)); return event->isAccepted(); } - return QFxPaintedItem::event(event); + return QmlGraphicsPaintedItem::event(event); } /*! \overload Handles the given key \a event. */ -void QFxTextEdit::keyPressEvent(QKeyEvent *event) +void QmlGraphicsTextEdit::keyPressEvent(QKeyEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); //### this causes non-standard cursor behavior in some cases. // is it still needed? /*QTextCursor c = textCursor(); @@ -803,19 +803,19 @@ void QFxTextEdit::keyPressEvent(QKeyEvent *event) d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QFxPaintedItem::keyPressEvent(event); + QmlGraphicsPaintedItem::keyPressEvent(event); } /*! \overload Handles the given key \a event. */ -void QFxTextEdit::keyReleaseEvent(QKeyEvent *event) +void QmlGraphicsTextEdit::keyReleaseEvent(QKeyEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QFxPaintedItem::keyReleaseEvent(event); + QmlGraphicsPaintedItem::keyReleaseEvent(event); } /*! @@ -825,18 +825,18 @@ void QFxTextEdit::keyReleaseEvent(QKeyEvent *event) like KeyProxy can give the behavior of focus even when hasFocus() isn't true. */ -void QFxTextEdit::focusChanged(bool hasFocus) +void QmlGraphicsTextEdit::focusChanged(bool hasFocus) { setCursorVisible(hasFocus); - QFxItem::focusChanged(hasFocus); + QmlGraphicsItem::focusChanged(hasFocus); } /*! Causes all text to be selected. */ -void QFxTextEdit::selectAll() +void QmlGraphicsTextEdit::selectAll() { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->selectAll(); } @@ -844,59 +844,59 @@ void QFxTextEdit::selectAll() \overload Handles the given mouse \a event. */ -void QFxTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (d->focusOnPress) setFocus(true); d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QFxPaintedItem::mousePressEvent(event); + QmlGraphicsPaintedItem::mousePressEvent(event); } /*! \overload Handles the given mouse \a event. */ -void QFxTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QFxPaintedItem::mousePressEvent(event); + QmlGraphicsPaintedItem::mousePressEvent(event); } /*! \overload Handles the given mouse \a event. */ -void QFxTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QFxPaintedItem::mouseDoubleClickEvent(event); + QmlGraphicsPaintedItem::mouseDoubleClickEvent(event); } /*! \overload Handles the given mouse \a event. */ -void QFxTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QFxPaintedItem::mousePressEvent(event); + QmlGraphicsPaintedItem::mousePressEvent(event); } /*! \overload Handles the given input method \a event. */ -void QFxTextEdit::inputMethodEvent(QInputMethodEvent *event) +void QmlGraphicsTextEdit::inputMethodEvent(QInputMethodEvent *event) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); d->control->processEvent(event, QPointF(0, 0)); } @@ -904,9 +904,9 @@ void QFxTextEdit::inputMethodEvent(QInputMethodEvent *event) \overload Returns the value of the given \a property. */ -QVariant QFxTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const +QVariant QmlGraphicsTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const { - Q_D(const QFxTextEdit); + Q_D(const QmlGraphicsTextEdit); return d->control->inputMethodQuery(property); } @@ -914,16 +914,16 @@ QVariant QFxTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const Draws the contents of the text edit using the given \a painter within the given \a bounds. */ -void QFxTextEdit::drawContents(QPainter *painter, const QRect &bounds) +void QmlGraphicsTextEdit::drawContents(QPainter *painter, const QRect &bounds) { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); painter->setRenderHint(QPainter::TextAntialiasing, true); d->control->drawContents(painter, bounds); } -void QFxTextEdit::updateImgCache(const QRectF &r) +void QmlGraphicsTextEdit::updateImgCache(const QRectF &r) { dirtyCache(r.toRect()); emit update(); @@ -942,9 +942,9 @@ void QFxTextEdit::updateImgCache(const QRectF &r) filtering at the beginning of the animation and reenable it at the conclusion. */ -void QFxTextEditPrivate::init() +void QmlGraphicsTextEditPrivate::init() { - Q_Q(QFxTextEdit); + Q_Q(QmlGraphicsTextEdit); q->setSmoothTransform(smooth); q->setAcceptedMouseButtons(Qt::LeftButton); @@ -969,16 +969,16 @@ void QFxTextEditPrivate::init() updateDefaultTextOption(); } -void QFxTextEdit::q_textChanged() +void QmlGraphicsTextEdit::q_textChanged() { if (!widthValid()) updateSize(); //### optimize: we get 3 calls to updateSize every time a letter is typed emit textChanged(text()); } -void QFxTextEdit::moveCursorDelegate() +void QmlGraphicsTextEdit::moveCursorDelegate() { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if(!d->cursor) return; QRectF cursorRect = d->control->cursorRect(); @@ -986,9 +986,9 @@ void QFxTextEdit::moveCursorDelegate() d->cursor->setY(cursorRect.y()); } -void QFxTextEditPrivate::updateSelection() +void QmlGraphicsTextEditPrivate::updateSelection() { - Q_Q(QFxTextEdit); + Q_Q(QmlGraphicsTextEdit); QTextCursor cursor = control->textCursor(); bool startChange = (lastSelectionStart != cursor.selectionStart()); bool endChange = (lastSelectionEnd != cursor.selectionEnd()); @@ -1005,12 +1005,12 @@ void QFxTextEditPrivate::updateSelection() startChange = (lastSelectionStart != control->textCursor().selectionStart()); endChange = (lastSelectionEnd != control->textCursor().selectionEnd()); if(startChange || endChange) - qWarning() << "QFxTextEditPrivate::updateSelection() has failed you."; + qWarning() << "QmlGraphicsTextEditPrivate::updateSelection() has failed you."; } -void QFxTextEdit::updateSelectionMarkers() +void QmlGraphicsTextEdit::updateSelectionMarkers() { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if(d->lastSelectionStart != d->control->textCursor().selectionStart()){ d->lastSelectionStart = d->control->textCursor().selectionStart(); emit selectionStartChanged(); @@ -1023,9 +1023,9 @@ void QFxTextEdit::updateSelectionMarkers() //### we should perhaps be a bit smarter here -- depending on what has changed, we shouldn't // need to do all the calculations each time -void QFxTextEdit::updateSize() +void QmlGraphicsTextEdit::updateSize() { - Q_D(QFxTextEdit); + Q_D(QmlGraphicsTextEdit); if (isComponentComplete()) { QFontMetrics fm = QFontMetrics(d->font); int dy = height(); @@ -1064,7 +1064,7 @@ void QFxTextEdit::updateSize() emit update(); } -void QFxTextEditPrivate::updateDefaultTextOption() +void QmlGraphicsTextEditPrivate::updateDefaultTextOption() { QTextOption opt = document->defaultTextOption(); int oldAlignment = opt.alignment(); diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index f4f101a..28eb180 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -58,8 +58,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxTextEditPrivate; -class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem +class QmlGraphicsTextEditPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsTextEdit : public QmlGraphicsPaintedItem { Q_OBJECT Q_ENUMS(VAlignment) @@ -87,7 +87,7 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin) public: - QFxTextEdit(QFxItem *parent=0); + QmlGraphicsTextEdit(QmlGraphicsItem *parent=0); enum HAlignment { AlignLeft = Qt::AlignLeft, @@ -201,7 +201,7 @@ private: void updateSize(); protected: - QFxTextEdit(QFxTextEditPrivate &dd, QFxItem *parent); + QmlGraphicsTextEdit(QmlGraphicsTextEditPrivate &dd, QmlGraphicsItem *parent); virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); @@ -221,13 +221,13 @@ protected: void drawContents(QPainter *, const QRect &); private: - Q_DISABLE_COPY(QFxTextEdit) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxTextEdit) + Q_DISABLE_COPY(QmlGraphicsTextEdit) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextEdit) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxTextEdit) +QML_DECLARE_TYPE(QmlGraphicsTextEdit) QT_END_HEADER diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h index 82481ff..ca65109 100644 --- a/src/declarative/fx/qfxtextedit_p.h +++ b/src/declarative/fx/qfxtextedit_p.h @@ -62,16 +62,16 @@ QT_BEGIN_NAMESPACE class QTextLayout; class QTextDocument; class QTextControl; -class QFxTextEditPrivate : public QFxPaintedItemPrivate +class QmlGraphicsTextEditPrivate : public QmlGraphicsPaintedItemPrivate { - Q_DECLARE_PUBLIC(QFxTextEdit) + Q_DECLARE_PUBLIC(QmlGraphicsTextEdit) public: - QFxTextEditPrivate() - : color("black"), imgDirty(true), hAlign(QFxTextEdit::AlignLeft), vAlign(QFxTextEdit::AlignTop), + QmlGraphicsTextEditPrivate() + : color("black"), imgDirty(true), hAlign(QmlGraphicsTextEdit::AlignLeft), vAlign(QmlGraphicsTextEdit::AlignTop), dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false), persistentSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), - cursorComponent(0), cursor(0), format(QFxTextEdit::AutoText), document(0) + cursorComponent(0), cursor(0), format(QmlGraphicsTextEdit::AutoText), document(0) { } @@ -91,8 +91,8 @@ public: bool imgDirty; QPixmap imgCache; QPixmap imgStyleCache; - QFxTextEdit::HAlignment hAlign; - QFxTextEdit::VAlignment vAlign; + QmlGraphicsTextEdit::HAlignment hAlign; + QmlGraphicsTextEdit::VAlignment vAlign; bool dirty; bool wrap; bool richText; @@ -103,8 +103,8 @@ public: int lastSelectionStart; int lastSelectionEnd; QmlComponent* cursorComponent; - QFxItem* cursor; - QFxTextEdit::TextFormat format; + QmlGraphicsItem* cursor; + QmlGraphicsTextEdit::TextFormat format; QTextDocument *document; QTextControl *control; }; diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp index e9ddd3f..930768d 100644 --- a/src/declarative/fx/qfxtextinput.cpp +++ b/src/declarative/fx/qfxtextinput.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextInput,QFxTextInput); +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextInput,QmlGraphicsTextInput); QML_DEFINE_NOCREATE_TYPE(QValidator); QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QIntValidator,QIntValidator); @@ -63,24 +63,24 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QIntValidator,QIntValidator); Input constraints include setting a QValidator, an input mask, or a maximum input length. */ -QFxTextInput::QFxTextInput(QFxItem* parent) - : QFxPaintedItem(*(new QFxTextInputPrivate), parent) +QmlGraphicsTextInput::QmlGraphicsTextInput(QmlGraphicsItem* parent) + : QmlGraphicsPaintedItem(*(new QmlGraphicsTextInputPrivate), parent) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->init(); } /* \internal */ -QFxTextInput::QFxTextInput(QFxTextInputPrivate &dd, QFxItem* parent) - : QFxPaintedItem(dd, parent) +QmlGraphicsTextInput::QmlGraphicsTextInput(QmlGraphicsTextInputPrivate &dd, QmlGraphicsItem* parent) + : QmlGraphicsPaintedItem(dd, parent) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->init(); } -QFxTextInput::~QFxTextInput() +QmlGraphicsTextInput::~QmlGraphicsTextInput() { } @@ -90,15 +90,15 @@ QFxTextInput::~QFxTextInput() The text in the TextInput. */ -QString QFxTextInput::text() const +QString QmlGraphicsTextInput::text() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->text(); } -void QFxTextInput::setText(const QString &s) +void QmlGraphicsTextInput::setText(const QString &s) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if(s == text()) return; d->control->setText(s); @@ -115,15 +115,15 @@ void QFxTextInput::setText(const QString &s) Set the TextInput's font attributes. */ -QFont QFxTextInput::font() const +QFont QmlGraphicsTextInput::font() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->font; } -void QFxTextInput::setFont(const QFont &font) +void QmlGraphicsTextInput::setFont(const QFont &font) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->font = font; d->control->setFont(d->font); @@ -139,15 +139,15 @@ void QFxTextInput::setFont(const QFont &font) The text color. */ -QColor QFxTextInput::color() const +QColor QmlGraphicsTextInput::color() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->color; } -void QFxTextInput::setColor(const QColor &c) +void QmlGraphicsTextInput::setColor(const QColor &c) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->color = c; } @@ -157,15 +157,15 @@ void QFxTextInput::setColor(const QColor &c) The text highlight color, used behind selections. */ -QColor QFxTextInput::selectionColor() const +QColor QmlGraphicsTextInput::selectionColor() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->selectionColor; } -void QFxTextInput::setSelectionColor(const QColor &color) +void QmlGraphicsTextInput::setSelectionColor(const QColor &color) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if (d->selectionColor == color) return; @@ -180,15 +180,15 @@ void QFxTextInput::setSelectionColor(const QColor &color) The highlighted text color, used in selections. */ -QColor QFxTextInput::selectedTextColor() const +QColor QmlGraphicsTextInput::selectedTextColor() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->selectedTextColor; } -void QFxTextInput::setSelectedTextColor(const QColor &color) +void QmlGraphicsTextInput::setSelectedTextColor(const QColor &color) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if (d->selectedTextColor == color) return; @@ -213,40 +213,40 @@ void QFxTextInput::setSelectedTextColor(const QColor &color) The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and \c AlignHCenter. */ -QFxTextInput::HAlignment QFxTextInput::hAlign() const +QmlGraphicsTextInput::HAlignment QmlGraphicsTextInput::hAlign() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->hAlign; } -void QFxTextInput::setHAlign(HAlignment align) +void QmlGraphicsTextInput::setHAlign(HAlignment align) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->hAlign = align; //TODO: implement } -bool QFxTextInput::isReadOnly() const +bool QmlGraphicsTextInput::isReadOnly() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->isReadOnly(); } -void QFxTextInput::setReadOnly(bool ro) +void QmlGraphicsTextInput::setReadOnly(bool ro) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->control->setReadOnly(ro); } -int QFxTextInput::maxLength() const +int QmlGraphicsTextInput::maxLength() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->maxLength(); } -void QFxTextInput::setMaxLength(int ml) +void QmlGraphicsTextInput::setMaxLength(int ml) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->control->setMaxLength(ml); } @@ -257,15 +257,15 @@ void QFxTextInput::setMaxLength(int ml) This property is set and unset when the line edit gets focus, but it can also be set directly (useful, for example, if a KeyProxy might forward keys to it). */ -bool QFxTextInput::isCursorVisible() const +bool QmlGraphicsTextInput::isCursorVisible() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->cursorVisible; } -void QFxTextInput::setCursorVisible(bool on) +void QmlGraphicsTextInput::setCursorVisible(bool on) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if (d->cursorVisible == on) return; d->cursorVisible = on; @@ -277,14 +277,14 @@ void QFxTextInput::setCursorVisible(bool on) \qmlproperty int TextInput::cursorPosition The position of the cursor in the TextInput. */ -int QFxTextInput::cursorPosition() const +int QmlGraphicsTextInput::cursorPosition() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->cursor(); } -void QFxTextInput::setCursorPosition(int cp) +void QmlGraphicsTextInput::setCursorPosition(int cp) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->control->moveCursor(cp); } @@ -294,9 +294,9 @@ void QFxTextInput::setCursorPosition(int cp) Returns a Rect which encompasses the cursor, but which may be larger than is required. Ignores custom cursor delegates. */ -QRect QFxTextInput::cursorRect() const +QRect QmlGraphicsTextInput::cursorRect() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->cursorRect(); } @@ -313,15 +313,15 @@ QRect QFxTextInput::cursorRect() const \sa selectionEnd, cursorPosition, selectedText */ -int QFxTextInput::selectionStart() const +int QmlGraphicsTextInput::selectionStart() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->lastSelectionStart; } -void QFxTextInput::setSelectionStart(int s) +void QmlGraphicsTextInput::setSelectionStart(int s) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if(d->lastSelectionStart == s || s < 0 || s > text().length()) return; d->lastSelectionStart = s; @@ -341,15 +341,15 @@ void QFxTextInput::setSelectionStart(int s) \sa selectionStart, cursorPosition, selectedText */ -int QFxTextInput::selectionEnd() const +int QmlGraphicsTextInput::selectionEnd() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->lastSelectionEnd; } -void QFxTextInput::setSelectionEnd(int s) +void QmlGraphicsTextInput::setSelectionEnd(int s) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if(d->lastSelectionEnd == s || s < 0 || s > text().length()) return; d->lastSelectionEnd = s; @@ -370,9 +370,9 @@ void QFxTextInput::setSelectionEnd(int s) myTextInput.selectionEnd); \endqml */ -QString QFxTextInput::selectedText() const +QString QmlGraphicsTextInput::selectedText() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->selectedText(); } @@ -382,15 +382,15 @@ QString QFxTextInput::selectedText() const Whether the TextInput should gain focus on a mouse press. By default this is set to true. */ -bool QFxTextInput::focusOnPress() const +bool QmlGraphicsTextInput::focusOnPress() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->focusOnPress; } -void QFxTextInput::setFocusOnPress(bool b) +void QmlGraphicsTextInput::setFocusOnPress(bool b) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->focusOnPress = b; } @@ -404,16 +404,16 @@ void QFxTextInput::setFocusOnPress(bool b) \sa acceptableInput, inputMask */ -QValidator* QFxTextInput::validator() const +QValidator* QmlGraphicsTextInput::validator() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); //###const cast isn't good, but needed for property system? return const_cast(d->control->validator()); } -void QFxTextInput::setValidator(QValidator* v) +void QmlGraphicsTextInput::setValidator(QValidator* v) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->control->setValidator(v); if(!d->control->hasAcceptableInput()){ d->oldValidity = false; @@ -430,15 +430,15 @@ void QFxTextInput::setValidator(QValidator* v) \sa acceptableInput, validator */ -QString QFxTextInput::inputMask() const +QString QmlGraphicsTextInput::inputMask() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->inputMask(); } -void QFxTextInput::setInputMask(const QString &im) +void QmlGraphicsTextInput::setInputMask(const QString &im) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->control->setInputMask(im); } @@ -450,9 +450,9 @@ void QFxTextInput::setInputMask(const QString &im) if the current text is acceptable to the validator or input mask as a final string (not as an intermediate string). */ -bool QFxTextInput::hasAcceptableInput() const +bool QmlGraphicsTextInput::hasAcceptableInput() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->hasAcceptableInput(); } @@ -466,15 +466,15 @@ bool QFxTextInput::hasAcceptableInput() const current character as asterixes. */ -QFxTextInput::EchoMode QFxTextInput::echoMode() const +QmlGraphicsTextInput::EchoMode QmlGraphicsTextInput::echoMode() const { - Q_D(const QFxTextInput); - return (QFxTextInput::EchoMode)d->control->echoMode(); + Q_D(const QmlGraphicsTextInput); + return (QmlGraphicsTextInput::EchoMode)d->control->echoMode(); } -void QFxTextInput::setEchoMode(QFxTextInput::EchoMode echo) +void QmlGraphicsTextInput::setEchoMode(QmlGraphicsTextInput::EchoMode echo) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->control->setEchoMode((uint)echo); } @@ -488,18 +488,18 @@ void QFxTextInput::setEchoMode(QFxTextInput::EchoMode echo) needed, and the x property of delegate instance will be set so as to be one pixel before the top left of the current character. - Note that the root item of the delegate component must be a QFxItem or - QFxItem derived item. + Note that the root item of the delegate component must be a QmlGraphicsItem or + QmlGraphicsItem derived item. */ -QmlComponent* QFxTextInput::cursorDelegate() const +QmlComponent* QmlGraphicsTextInput::cursorDelegate() const { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->cursorComponent; } -void QFxTextInput::setCursorDelegate(QmlComponent* c) +void QmlGraphicsTextInput::setCursorDelegate(QmlComponent* c) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->cursorComponent = c; if(!c){ //note that the components are owned by something else @@ -511,9 +511,9 @@ void QFxTextInput::setCursorDelegate(QmlComponent* c) } } -void QFxTextInputPrivate::startCreatingCursor() +void QmlGraphicsTextInputPrivate::startCreatingCursor() { - Q_Q(QFxTextInput); + Q_Q(QmlGraphicsTextInput); q->connect(control, SIGNAL(cursorPositionChanged(int, int)), q, SLOT(moveCursor())); if(cursorComponent->isReady()){ @@ -522,14 +522,14 @@ void QFxTextInputPrivate::startCreatingCursor() q->connect(cursorComponent, SIGNAL(statusChanged(int)), q, SLOT(createCursor())); }else{//isError - qmlInfo(QFxTextInput::tr("Could not load cursor delegate"), q); + qmlInfo(QmlGraphicsTextInput::tr("Could not load cursor delegate"), q); qWarning() << cursorComponent->errors(); } } -void QFxTextInput::createCursor() +void QmlGraphicsTextInput::createCursor() { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if(d->cursorComponent->isError()){ qmlInfo(tr("Could not load cursor delegate"),this); qWarning() << d->cursorComponent->errors(); @@ -541,7 +541,7 @@ void QFxTextInput::createCursor() if(d->cursorItem) delete d->cursorItem; - d->cursorItem = qobject_cast(d->cursorComponent->create()); + d->cursorItem = qobject_cast(d->cursorComponent->create()); if(!d->cursorItem){ qmlInfo(tr("Could not instantiate cursor delegate"),this); //The failed instantiation should print its own error messages @@ -553,31 +553,31 @@ void QFxTextInput::createCursor() d->cursorItem->setHeight(d->control->height()); } -void QFxTextInput::moveCursor() +void QmlGraphicsTextInput::moveCursor() { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if(!d->cursorItem) return; d->cursorItem->setX(d->control->cursorToX() - d->hscroll); } -int QFxTextInput::xToPos(int x) +int QmlGraphicsTextInput::xToPos(int x) { - Q_D(const QFxTextInput); + Q_D(const QmlGraphicsTextInput); return d->control->xToPos(x - d->hscroll); } -void QFxTextInput::focusChanged(bool hasFocus) +void QmlGraphicsTextInput::focusChanged(bool hasFocus) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->focused = hasFocus; setCursorVisible(hasFocus); - QFxItem::focusChanged(hasFocus); + QmlGraphicsItem::focusChanged(hasFocus); } -void QFxTextInput::keyPressEvent(QKeyEvent* ev) +void QmlGraphicsTextInput::keyPressEvent(QKeyEvent* ev) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if((d->control->cursor() == 0 && ev->key() == Qt::Key_Left) || (d->control->cursor() == d->control->text().length() && ev->key() == Qt::Key_Right)){ @@ -587,12 +587,12 @@ void QFxTextInput::keyPressEvent(QKeyEvent* ev) d->control->processKeyEvent(ev); } if (!ev->isAccepted()) - QFxPaintedItem::keyPressEvent(ev); + QmlGraphicsPaintedItem::keyPressEvent(ev); } -void QFxTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); if(d->focusOnPress){ setFocus(true); setCursorVisible(true); @@ -601,9 +601,9 @@ void QFxTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) d->control->processEvent(event); } -bool QFxTextInput::event(QEvent* ev) +bool QmlGraphicsTextInput::event(QEvent* ev) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); //Anything we don't deal with ourselves, pass to the control bool handled = false; switch(ev->type()){ @@ -615,21 +615,21 @@ bool QFxTextInput::event(QEvent* ev) handled = d->control->processEvent(ev); } if(!handled) - return QFxPaintedItem::event(ev); + return QmlGraphicsPaintedItem::event(ev); return true; } -void QFxTextInput::geometryChanged(const QRectF &newGeometry, +void QmlGraphicsTextInput::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { if (newGeometry.width() != oldGeometry.width()) updateSize(); - QFxPaintedItem::geometryChanged(newGeometry, oldGeometry); + QmlGraphicsPaintedItem::geometryChanged(newGeometry, oldGeometry); } -void QFxTextInput::drawContents(QPainter *p, const QRect &r) +void QmlGraphicsTextInput::drawContents(QPainter *p, const QRect &r) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); p->setRenderHint(QPainter::TextAntialiasing, true); p->save(); p->setPen(QPen(d->color)); @@ -647,9 +647,9 @@ void QFxTextInput::drawContents(QPainter *p, const QRect &r) p->restore(); } -void QFxTextInput::selectAll() +void QmlGraphicsTextInput::selectAll() { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); d->control->setSelection(0, d->control->text().length()); } @@ -667,9 +667,9 @@ void QFxTextInput::selectAll() filtering at the beginning of the animation and reenable it at the conclusion. */ -void QFxTextInputPrivate::init() +void QmlGraphicsTextInputPrivate::init() { - Q_Q(QFxTextInput); + Q_Q(QmlGraphicsTextInput); control->setCursorWidth(1); control->setPasswordCharacter(QLatin1Char('*')); control->setLayoutDirection(Qt::LeftToRight); @@ -698,9 +698,9 @@ void QFxTextInputPrivate::init() lastSelectionEnd = 0; } -void QFxTextInput::cursorPosChanged() +void QmlGraphicsTextInput::cursorPosChanged() { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); emit cursorPositionChanged(); if(!d->control->hasSelectedText()){ @@ -715,9 +715,9 @@ void QFxTextInput::cursorPosChanged() } } -void QFxTextInput::selectionChanged() +void QmlGraphicsTextInput::selectionChanged() { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); emit selectedTextChanged(); if(d->lastSelectionStart != d->control->selectionStart()){ @@ -734,9 +734,9 @@ void QFxTextInput::selectionChanged() } } -void QFxTextInput::q_textChanged() +void QmlGraphicsTextInput::q_textChanged() { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); updateSize(); emit textChanged(); if(hasAcceptableInput() != d->oldValidity){ @@ -745,7 +745,7 @@ void QFxTextInput::q_textChanged() } } -void QFxTextInput::updateRect(const QRect &r) +void QmlGraphicsTextInput::updateRect(const QRect &r) { if(r == QRect()) clearCache(); @@ -754,9 +754,9 @@ void QFxTextInput::updateRect(const QRect &r) update(); } -void QFxTextInput::updateSize(bool needsRedraw) +void QmlGraphicsTextInput::updateSize(bool needsRedraw) { - Q_D(QFxTextInput); + Q_D(QmlGraphicsTextInput); int w = width(); int h = height(); setImplicitHeight(d->control->height()); diff --git a/src/declarative/fx/qfxtextinput.h b/src/declarative/fx/qfxtextinput.h index 2540d41..ada32f9 100644 --- a/src/declarative/fx/qfxtextinput.h +++ b/src/declarative/fx/qfxtextinput.h @@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxTextInputPrivate; +class QmlGraphicsTextInputPrivate; class QValidator; -class Q_DECLARATIVE_EXPORT QFxTextInput : public QFxPaintedItem +class Q_DECLARATIVE_EXPORT QmlGraphicsTextInput : public QmlGraphicsPaintedItem { Q_OBJECT Q_ENUMS(HAlignment) @@ -84,8 +84,8 @@ class Q_DECLARATIVE_EXPORT QFxTextInput : public QFxPaintedItem Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) public: - QFxTextInput(QFxItem* parent=0); - ~QFxTextInput(); + QmlGraphicsTextInput(QmlGraphicsItem* parent=0); + ~QmlGraphicsTextInput(); enum EchoMode {//To match QLineEdit::EchoMode Normal, @@ -172,7 +172,7 @@ Q_SIGNALS: void acceptableInputChanged(); protected: - QFxTextInput(QFxTextInputPrivate &dd, QFxItem *parent); + QmlGraphicsTextInput(QmlGraphicsTextInputPrivate &dd, QmlGraphicsItem *parent); virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); @@ -195,12 +195,12 @@ private Q_SLOTS: void updateRect(const QRect &r = QRect()); private: - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxTextInput) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextInput) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxTextInput) +QML_DECLARE_TYPE(QmlGraphicsTextInput) QML_DECLARE_TYPE(QValidator) QML_DECLARE_TYPE(QIntValidator) diff --git a/src/declarative/fx/qfxtextinput_p.h b/src/declarative/fx/qfxtextinput_p.h index 3978be4..be8c946 100644 --- a/src/declarative/fx/qfxtextinput_p.h +++ b/src/declarative/fx/qfxtextinput_p.h @@ -59,19 +59,19 @@ QT_BEGIN_NAMESPACE -class QFxTextInputPrivate : public QFxPaintedItemPrivate +class QmlGraphicsTextInputPrivate : public QmlGraphicsPaintedItemPrivate { - Q_DECLARE_PUBLIC(QFxTextInput) + Q_DECLARE_PUBLIC(QmlGraphicsTextInput) public: - QFxTextInputPrivate() : control(new QLineControl(QString())), - color((QRgb)0), style(QFxText::Normal), - styleColor((QRgb)0), hAlign(QFxTextInput::AlignLeft), + QmlGraphicsTextInputPrivate() : control(new QLineControl(QString())), + color((QRgb)0), style(QmlGraphicsText::Normal), + styleColor((QRgb)0), hAlign(QmlGraphicsTextInput::AlignLeft), hscroll(0), oldScroll(0), focused(false), focusOnPress(true), cursorVisible(false) { } - ~QFxTextInputPrivate() + ~QmlGraphicsTextInputPrivate() { delete control; } @@ -85,11 +85,11 @@ public: QColor color; QColor selectionColor; QColor selectedTextColor; - QFxText::TextStyle style; + QmlGraphicsText::TextStyle style; QColor styleColor; - QFxTextInput::HAlignment hAlign; + QmlGraphicsTextInput::HAlignment hAlign; QPointer cursorComponent; - QPointer cursorItem; + QPointer cursorItem; int lastSelectionStart; int lastSelectionEnd; diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index 7ee6eea..681e360 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -59,14 +59,14 @@ QML_DECLARE_TYPE(QListModelInterface) QT_BEGIN_NAMESPACE -class QFxVisualItemModelAttached : public QObject +class QmlGraphicsVisualItemModelAttached : public QObject { Q_OBJECT public: - QFxVisualItemModelAttached(QObject *parent) + QmlGraphicsVisualItemModelAttached(QObject *parent) : QObject(parent), m_index(0) {} - ~QFxVisualItemModelAttached() { + ~QmlGraphicsVisualItemModelAttached() { attachedProperties.remove(parent()); } @@ -79,10 +79,10 @@ public: } } - static QFxVisualItemModelAttached *properties(QObject *obj) { - QFxVisualItemModelAttached *rv = attachedProperties.value(obj); + static QmlGraphicsVisualItemModelAttached *properties(QObject *obj) { + QmlGraphicsVisualItemModelAttached *rv = attachedProperties.value(obj); if (!rv) { - rv = new QFxVisualItemModelAttached(obj); + rv = new QmlGraphicsVisualItemModelAttached(obj); attachedProperties.insert(obj, rv); } return rv; @@ -94,37 +94,37 @@ Q_SIGNALS: public: int m_index; - static QHash attachedProperties; + static QHash attachedProperties; }; -QHash QFxVisualItemModelAttached::attachedProperties; +QHash QmlGraphicsVisualItemModelAttached::attachedProperties; -class QFxVisualItemModelPrivate : public QObjectPrivate +class QmlGraphicsVisualItemModelPrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QFxVisualItemModel) + Q_DECLARE_PUBLIC(QmlGraphicsVisualItemModel) public: - QFxVisualItemModelPrivate() : QObjectPrivate(), children(this) {} + QmlGraphicsVisualItemModelPrivate() : QObjectPrivate(), children(this) {} - struct ItemList : public QmlConcreteList + struct ItemList : public QmlConcreteList { - ItemList(QFxVisualItemModelPrivate *m) : QmlConcreteList(), model(m) {} + ItemList(QmlGraphicsVisualItemModelPrivate *m) : QmlConcreteList(), model(m) {} - void append(QFxItem *item); + void append(QmlGraphicsItem *item); - QFxVisualItemModelPrivate *model; + QmlGraphicsVisualItemModelPrivate *model; }; void itemAppended() { - Q_Q(QFxVisualItemModel); - QFxVisualItemModelAttached *attached = QFxVisualItemModelAttached::properties(children.last()); + Q_Q(QmlGraphicsVisualItemModel); + QmlGraphicsVisualItemModelAttached *attached = QmlGraphicsVisualItemModelAttached::properties(children.last()); attached->setIndex(children.count()-1); emit q->itemsInserted(children.count()-1, 1); emit q->countChanged(); } void emitChildrenChanged() { - Q_Q(QFxVisualItemModel); + Q_Q(QmlGraphicsVisualItemModel); emit q->childrenChanged(); } ItemList children; @@ -132,7 +132,7 @@ public: /*! - \qmlclass VisualItemModel QFxVisualItemModel + \qmlclass VisualItemModel QmlGraphicsVisualItemModel \brief The VisualItemModel allows items to be provided to a view. The children of the VisualItemModel are provided in a model which @@ -160,14 +160,14 @@ public: } \endcode */ -QFxVisualItemModel::QFxVisualItemModel() - : QFxVisualModel(*(new QFxVisualItemModelPrivate)) +QmlGraphicsVisualItemModel::QmlGraphicsVisualItemModel() + : QmlGraphicsVisualModel(*(new QmlGraphicsVisualItemModelPrivate)) { } -QmlList *QFxVisualItemModel::children() +QmlList *QmlGraphicsVisualItemModel::children() { - Q_D(QFxVisualItemModel); + Q_D(QmlGraphicsVisualItemModel); return &(d->children); } @@ -176,37 +176,37 @@ QmlList *QFxVisualItemModel::children() The number of items in the model. This property is readonly. */ -int QFxVisualItemModel::count() const +int QmlGraphicsVisualItemModel::count() const { - Q_D(const QFxVisualItemModel); + Q_D(const QmlGraphicsVisualItemModel); return d->children.count(); } -bool QFxVisualItemModel::isValid() const +bool QmlGraphicsVisualItemModel::isValid() const { return true; } -QFxItem *QFxVisualItemModel::item(int index, bool) +QmlGraphicsItem *QmlGraphicsVisualItemModel::item(int index, bool) { - Q_D(QFxVisualItemModel); + Q_D(QmlGraphicsVisualItemModel); return d->children.at(index); } -QFxVisualModel::ReleaseFlags QFxVisualItemModel::release(QFxItem *) +QmlGraphicsVisualModel::ReleaseFlags QmlGraphicsVisualItemModel::release(QmlGraphicsItem *) { // Nothing to do return 0; } -void QFxVisualItemModel::completeItem() +void QmlGraphicsVisualItemModel::completeItem() { // Nothing to do } -QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObject *objectContext) +QVariant QmlGraphicsVisualItemModel::evaluate(int index, const QString &expression, QObject *objectContext) { - Q_D(QFxVisualItemModel); + Q_D(QmlGraphicsVisualItemModel); QmlContext *ccontext = qmlContext(this); QmlContext *ctxt = new QmlContext(ccontext); ctxt->addDefaultObject(d->children.at(index)); @@ -217,41 +217,41 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj return value; } -int QFxVisualItemModel::indexOf(QFxItem *item, QObject *) const +int QmlGraphicsVisualItemModel::indexOf(QmlGraphicsItem *item, QObject *) const { - Q_D(const QFxVisualItemModel); + Q_D(const QmlGraphicsVisualItemModel); return d->children.indexOf(item); } -void QFxVisualItemModelPrivate::ItemList::append(QFxItem *item) +void QmlGraphicsVisualItemModelPrivate::ItemList::append(QmlGraphicsItem *item) { - QmlConcreteList::append(item); + QmlConcreteList::append(item); item->QObject::setParent(model->q_ptr); model->itemAppended(); model->emitChildrenChanged(); } -QFxVisualItemModelAttached *QFxVisualItemModel::qmlAttachedProperties(QObject *obj) +QmlGraphicsVisualItemModelAttached *QmlGraphicsVisualItemModel::qmlAttachedProperties(QObject *obj) { - return QFxVisualItemModelAttached::properties(obj); + return QmlGraphicsVisualItemModelAttached::properties(obj); } -class QFxVisualDataModelParts; -class QFxVisualDataModelData; -class QFxVisualDataModelPrivate : public QObjectPrivate +class QmlGraphicsVisualDataModelParts; +class QmlGraphicsVisualDataModelData; +class QmlGraphicsVisualDataModelPrivate : public QObjectPrivate { public: - QFxVisualDataModelPrivate(QmlContext *); + QmlGraphicsVisualDataModelPrivate(QmlContext *); - static QFxVisualDataModelPrivate *get(QFxVisualDataModel *m) { - return static_cast(QObjectPrivate::get(m)); + static QmlGraphicsVisualDataModelPrivate *get(QmlGraphicsVisualDataModel *m) { + return static_cast(QObjectPrivate::get(m)); } QGuard m_listModelInterface; QGuard m_abstractItemModel; - QGuard m_visualItemModel; + QGuard m_visualItemModel; QString m_part; QmlComponent *m_delegate; @@ -334,10 +334,10 @@ public: Cache m_cache; QHash m_packaged; - QFxVisualDataModelParts *m_parts; - friend class QFxVisualItemParts; + QmlGraphicsVisualDataModelParts *m_parts; + friend class QmlGraphicsVisualItemParts; - QFxVisualDataModelData *data(QObject *item); + QmlGraphicsVisualDataModelData *data(QObject *item); QVariant m_modelVariant; QmlListAccessor *m_listAccessor; @@ -355,26 +355,26 @@ public: } }; -class QFxVisualDataModelDataMetaObject : public QmlOpenMetaObject +class QmlGraphicsVisualDataModelDataMetaObject : public QmlOpenMetaObject { public: - QFxVisualDataModelDataMetaObject(QObject *parent) + QmlGraphicsVisualDataModelDataMetaObject(QObject *parent) : QmlOpenMetaObject(parent) {} virtual QVariant propertyCreated(int, QMetaPropertyBuilder &); virtual int createProperty(const char *, const char *); private: - friend class QFxVisualDataModelData; + friend class QmlGraphicsVisualDataModelData; QList roles; }; -class QFxVisualDataModelData : public QObject +class QmlGraphicsVisualDataModelData : public QObject { Q_OBJECT public: - QFxVisualDataModelData(int index, QFxVisualDataModel *model); - ~QFxVisualDataModelData(); + QmlGraphicsVisualDataModelData(int index, QmlGraphicsVisualDataModel *model); + ~QmlGraphicsVisualDataModelData(); Q_PROPERTY(int index READ index NOTIFY indexChanged) int index() const; @@ -388,37 +388,37 @@ Q_SIGNALS: void indexChanged(); private: - friend class QFxVisualDataModelDataMetaObject; + friend class QmlGraphicsVisualDataModelDataMetaObject; int m_index; - QGuard m_model; - QFxVisualDataModelDataMetaObject *m_meta; + QGuard m_model; + QmlGraphicsVisualDataModelDataMetaObject *m_meta; }; -int QFxVisualDataModelData::count() const +int QmlGraphicsVisualDataModelData::count() const { return m_meta->count(); } -int QFxVisualDataModelData::role(int id) const +int QmlGraphicsVisualDataModelData::role(int id) const { Q_ASSERT(id >= 0 && id < count()); return m_meta->roles.at(id); } -void QFxVisualDataModelData::setValue(int id, const QVariant &val) +void QmlGraphicsVisualDataModelData::setValue(int id, const QVariant &val) { m_meta->setValue(id, val); } -int QFxVisualDataModelDataMetaObject::createProperty(const char *name, const char *type) +int QmlGraphicsVisualDataModelDataMetaObject::createProperty(const char *name, const char *type) { - QFxVisualDataModelData *data = - static_cast(object()); + QmlGraphicsVisualDataModelData *data = + static_cast(object()); if (!data->m_model) return -1; - QFxVisualDataModelPrivate *model = QFxVisualDataModelPrivate::get(data->m_model); + QmlGraphicsVisualDataModelPrivate *model = QmlGraphicsVisualDataModelPrivate::get(data->m_model); if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { model->ensureRoles(); @@ -439,15 +439,15 @@ int QFxVisualDataModelDataMetaObject::createProperty(const char *name, const cha } QVariant -QFxVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &prop) +QmlGraphicsVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &prop) { prop.setWritable(false); - QFxVisualDataModelData *data = - static_cast(object()); + QmlGraphicsVisualDataModelData *data = + static_cast(object()); Q_ASSERT(data->m_model); - QFxVisualDataModelPrivate *model = QFxVisualDataModelPrivate::get(data->m_model); + QmlGraphicsVisualDataModelPrivate *model = QmlGraphicsVisualDataModelPrivate::get(data->m_model); QString name = QString::fromUtf8(prop.name()); if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { @@ -493,109 +493,109 @@ QFxVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro return QVariant(); } -QFxVisualDataModelData::QFxVisualDataModelData(int index, - QFxVisualDataModel *model) +QmlGraphicsVisualDataModelData::QmlGraphicsVisualDataModelData(int index, + QmlGraphicsVisualDataModel *model) : m_index(index), m_model(model), - m_meta(new QFxVisualDataModelDataMetaObject(this)) + m_meta(new QmlGraphicsVisualDataModelDataMetaObject(this)) { } -QFxVisualDataModelData::~QFxVisualDataModelData() +QmlGraphicsVisualDataModelData::~QmlGraphicsVisualDataModelData() { } -int QFxVisualDataModelData::index() const +int QmlGraphicsVisualDataModelData::index() const { return m_index; } // This is internal only - it should not be set from qml -void QFxVisualDataModelData::setIndex(int index) +void QmlGraphicsVisualDataModelData::setIndex(int index) { m_index = index; emit indexChanged(); } -class QFxVisualDataModelPartsMetaObject : public QmlOpenMetaObject +class QmlGraphicsVisualDataModelPartsMetaObject : public QmlOpenMetaObject { public: - QFxVisualDataModelPartsMetaObject(QObject *parent) + QmlGraphicsVisualDataModelPartsMetaObject(QObject *parent) : QmlOpenMetaObject(parent) {} virtual QVariant propertyCreated(int, QMetaPropertyBuilder &); }; -class QFxVisualDataModelParts : public QObject +class QmlGraphicsVisualDataModelParts : public QObject { Q_OBJECT public: - QFxVisualDataModelParts(QFxVisualDataModel *parent); + QmlGraphicsVisualDataModelParts(QmlGraphicsVisualDataModel *parent); private: - friend class QFxVisualDataModelPartsMetaObject; - QFxVisualDataModel *model; + friend class QmlGraphicsVisualDataModelPartsMetaObject; + QmlGraphicsVisualDataModel *model; }; QVariant -QFxVisualDataModelPartsMetaObject::propertyCreated(int, QMetaPropertyBuilder &prop) +QmlGraphicsVisualDataModelPartsMetaObject::propertyCreated(int, QMetaPropertyBuilder &prop) { prop.setWritable(false); - QFxVisualDataModel *m = new QFxVisualDataModel; + QmlGraphicsVisualDataModel *m = new QmlGraphicsVisualDataModel; m->setParent(object()); m->setPart(QString::fromUtf8(prop.name())); - m->setModel(QVariant::fromValue(static_cast(object())->model)); + m->setModel(QVariant::fromValue(static_cast(object())->model)); QVariant var = QVariant::fromValue((QObject *)m); return var; } -QFxVisualDataModelParts::QFxVisualDataModelParts(QFxVisualDataModel *parent) +QmlGraphicsVisualDataModelParts::QmlGraphicsVisualDataModelParts(QmlGraphicsVisualDataModel *parent) : QObject(parent), model(parent) { - new QFxVisualDataModelPartsMetaObject(this); + new QmlGraphicsVisualDataModelPartsMetaObject(this); } -QFxVisualDataModelPrivate::QFxVisualDataModelPrivate(QmlContext *ctxt) +QmlGraphicsVisualDataModelPrivate::QmlGraphicsVisualDataModelPrivate(QmlContext *ctxt) : m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0) , m_context(ctxt), m_parts(0), m_listAccessor(0) { } -QFxVisualDataModelData *QFxVisualDataModelPrivate::data(QObject *item) +QmlGraphicsVisualDataModelData *QmlGraphicsVisualDataModelPrivate::data(QObject *item) { - QFxVisualDataModelData *dataItem = - item->findChild(); + QmlGraphicsVisualDataModelData *dataItem = + item->findChild(); Q_ASSERT(dataItem); return dataItem; } -QFxVisualDataModel::QFxVisualDataModel() -: QFxVisualModel(*(new QFxVisualDataModelPrivate(0))) +QmlGraphicsVisualDataModel::QmlGraphicsVisualDataModel() +: QmlGraphicsVisualModel(*(new QmlGraphicsVisualDataModelPrivate(0))) { } -QFxVisualDataModel::QFxVisualDataModel(QmlContext *ctxt) -: QFxVisualModel(*(new QFxVisualDataModelPrivate(ctxt))) +QmlGraphicsVisualDataModel::QmlGraphicsVisualDataModel(QmlContext *ctxt) +: QmlGraphicsVisualModel(*(new QmlGraphicsVisualDataModelPrivate(ctxt))) { } -QFxVisualDataModel::~QFxVisualDataModel() +QmlGraphicsVisualDataModel::~QmlGraphicsVisualDataModel() { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); if (d->m_listAccessor) delete d->m_listAccessor; } -QVariant QFxVisualDataModel::model() const +QVariant QmlGraphicsVisualDataModel::model() const { - Q_D(const QFxVisualDataModel); + Q_D(const QmlGraphicsVisualDataModel); return d->m_modelVariant; } -void QFxVisualDataModel::setModel(const QVariant &model) +void QmlGraphicsVisualDataModel::setModel(const QVariant &model) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); delete d->m_listAccessor; d->m_listAccessor = 0; d->m_modelVariant = model; @@ -656,7 +656,7 @@ void QFxVisualDataModel::setModel(const QVariant &model) this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&))); return; } - if ((d->m_visualItemModel = qvariant_cast(model))) { + if ((d->m_visualItemModel = qvariant_cast(model))) { QObject::connect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)), this, SIGNAL(itemsInserted(int,int))); QObject::connect(d->m_visualItemModel, SIGNAL(itemsRemoved(int,int)), @@ -677,17 +677,17 @@ void QFxVisualDataModel::setModel(const QVariant &model) } } -QmlComponent *QFxVisualDataModel::delegate() const +QmlComponent *QmlGraphicsVisualDataModel::delegate() const { - Q_D(const QFxVisualDataModel); + Q_D(const QmlGraphicsVisualDataModel); if (d->m_visualItemModel) return d->m_visualItemModel->delegate(); return d->m_delegate; } -void QFxVisualDataModel::setDelegate(QmlComponent *delegate) +void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); d->m_delegate = delegate; if (d->modelCount()) { emit itemsInserted(0, d->modelCount()); @@ -695,27 +695,27 @@ void QFxVisualDataModel::setDelegate(QmlComponent *delegate) } } -QString QFxVisualDataModel::part() const +QString QmlGraphicsVisualDataModel::part() const { - Q_D(const QFxVisualDataModel); + Q_D(const QmlGraphicsVisualDataModel); return d->m_part; } -void QFxVisualDataModel::setPart(const QString &part) +void QmlGraphicsVisualDataModel::setPart(const QString &part) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); d->m_part = part; } -int QFxVisualDataModel::count() const +int QmlGraphicsVisualDataModel::count() const { - Q_D(const QFxVisualDataModel); + Q_D(const QmlGraphicsVisualDataModel); return d->modelCount(); } -QFxItem *QFxVisualDataModel::item(int index, bool complete) +QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, bool complete) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); if (d->m_visualItemModel) return d->m_visualItemModel->item(index, d->m_part.toUtf8(), complete); return item(index, QByteArray(), complete); @@ -724,9 +724,9 @@ QFxItem *QFxVisualDataModel::item(int index, bool complete) /* Returns ReleaseStatus flags. */ -QFxVisualDataModel::ReleaseFlags QFxVisualDataModel::release(QFxItem *item) +QmlGraphicsVisualDataModel::ReleaseFlags QmlGraphicsVisualDataModel::release(QmlGraphicsItem *item) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); if (d->m_visualItemModel) return d->m_visualItemModel->release(item); @@ -757,17 +757,17 @@ QFxVisualDataModel::ReleaseFlags QFxVisualDataModel::release(QFxItem *item) return stat; } -QObject *QFxVisualDataModel::parts() +QObject *QmlGraphicsVisualDataModel::parts() { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); if (!d->m_parts) - d->m_parts = new QFxVisualDataModelParts(this); + d->m_parts = new QmlGraphicsVisualDataModelParts(this); return d->m_parts; } -QFxItem *QFxVisualDataModel::item(int index, const QByteArray &viewId, bool complete) +QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &viewId, bool complete) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); if (d->m_visualItemModel) return d->m_visualItemModel->item(index, viewId, complete); @@ -779,7 +779,7 @@ QFxItem *QFxVisualDataModel::item(int index, const QByteArray &viewId, bool comp QmlContext *ccontext = d->m_context; if (!ccontext) ccontext = qmlContext(this); QmlContext *ctxt = new QmlContext(ccontext); - QFxVisualDataModelData *data = new QFxVisualDataModelData(index, this); + QmlGraphicsVisualDataModelData *data = new QmlGraphicsVisualDataModelData(index, this); ctxt->setContextProperty(QLatin1String("model"), data); ctxt->addDefaultObject(data); nobj = d->m_delegate->beginCreate(ctxt); @@ -797,27 +797,27 @@ QFxItem *QFxVisualDataModel::item(int index, const QByteArray &viewId, bool comp qWarning() << d->m_delegate->errors(); } } - QFxItem *item = qobject_cast(nobj); + QmlGraphicsItem *item = qobject_cast(nobj); if (!item) { QmlPackage *package = qobject_cast(nobj); if (package) { QObject *o = package->part(QString::fromUtf8(viewId)); - item = qobject_cast(o); + item = qobject_cast(o); if (item) d->m_packaged.insertMulti(item, package); } } if (!item) { d->m_cache.releaseItem(nobj); - qmlInfo(QFxVisualDataModel::tr("Delegate component must be Item type."), d->m_delegate); + qmlInfo(QmlGraphicsVisualDataModel::tr("Delegate component must be Item type."), d->m_delegate); } return item; } -void QFxVisualDataModel::completeItem() +void QmlGraphicsVisualDataModel::completeItem() { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); if (d->m_visualItemModel) { d->m_visualItemModel->completeItem(); return; @@ -826,9 +826,9 @@ void QFxVisualDataModel::completeItem() d->m_delegate->completeCreate(); } -QVariant QFxVisualDataModel::evaluate(int index, const QString &expression, QObject *objectContext) +QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expression, QObject *objectContext) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); if (d->m_visualItemModel) return d->m_visualItemModel->evaluate(index, expression, objectContext); @@ -838,7 +838,7 @@ QVariant QFxVisualDataModel::evaluate(int index, const QString &expression, QObj QVariant value; QObject *nobj = d->m_cache.item(index); if (nobj) { - QFxItem *item = qobject_cast(nobj); + QmlGraphicsItem *item = qobject_cast(nobj); if (item) { QmlExpression e(qmlContext(item), expression, objectContext); e.setTrackChange(false); @@ -848,7 +848,7 @@ QVariant QFxVisualDataModel::evaluate(int index, const QString &expression, QObj QmlContext *ccontext = d->m_context; if (!ccontext) ccontext = qmlContext(this); QmlContext *ctxt = new QmlContext(ccontext); - QFxVisualDataModelData *data = new QFxVisualDataModelData(index, this); + QmlGraphicsVisualDataModelData *data = new QmlGraphicsVisualDataModelData(index, this); ctxt->addDefaultObject(data); QmlExpression e(ctxt, expression, objectContext); e.setTrackChange(false); @@ -860,7 +860,7 @@ QVariant QFxVisualDataModel::evaluate(int index, const QString &expression, QObj return value; } -int QFxVisualDataModel::indexOf(QFxItem *item, QObject *objectContext) const +int QmlGraphicsVisualDataModel::indexOf(QmlGraphicsItem *item, QObject *objectContext) const { QmlExpression e(qmlContext(item), QLatin1String("index"), objectContext); e.setTrackChange(false); @@ -870,15 +870,15 @@ int QFxVisualDataModel::indexOf(QFxItem *item, QObject *objectContext) const return -1; } -void QFxVisualDataModel::_q_itemsChanged(int index, int count, +void QmlGraphicsVisualDataModel::_q_itemsChanged(int index, int count, const QList &roles) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); // XXX - highly inefficient for (int ii = index; ii < index + count; ++ii) { if (QObject *item = d->m_cache.item(ii)) { - QFxVisualDataModelData *data = d->data(item); + QmlGraphicsVisualDataModelData *data = d->data(item); for (int prop = 0; prop < data->count(); ++prop) { @@ -897,22 +897,22 @@ void QFxVisualDataModel::_q_itemsChanged(int index, int count, } } -void QFxVisualDataModel::_q_itemsInserted(int index, int count) +void QmlGraphicsVisualDataModel::_q_itemsInserted(int index, int count) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); // XXX - highly inefficient - QHash items; - for (QHash::Iterator iter = d->m_cache.begin(); + QHash items; + for (QHash::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= index) { - QFxVisualDataModelPrivate::ObjectRef objRef = *iter; + QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter; int index = iter.key() + count; iter = d->m_cache.erase(iter); items.insert(index, objRef); - QFxVisualDataModelData *data = d->data(objRef.obj); + QmlGraphicsVisualDataModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -924,25 +924,25 @@ void QFxVisualDataModel::_q_itemsInserted(int index, int count) emit countChanged(); } -void QFxVisualDataModel::_q_itemsRemoved(int index, int count) +void QmlGraphicsVisualDataModel::_q_itemsRemoved(int index, int count) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); // XXX - highly inefficient - QHash items; - for (QHash::Iterator iter = d->m_cache.begin(); + QHash items; + for (QHash::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= index && iter.key() < index + count) { - QFxVisualDataModelPrivate::ObjectRef objRef = *iter; + QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter; iter = d->m_cache.erase(iter); items.insertMulti(-1, objRef); //XXX perhaps better to maintain separately - QFxVisualDataModelData *data = d->data(objRef.obj); + QmlGraphicsVisualDataModelData *data = d->data(objRef.obj); data->setIndex(-1); } else if (iter.key() >= index + count) { - QFxVisualDataModelPrivate::ObjectRef objRef = *iter; + QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter; int index = iter.key() - count; iter = d->m_cache.erase(iter); items.insert(index, objRef); - QFxVisualDataModelData *data = d->data(objRef.obj); + QmlGraphicsVisualDataModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -954,38 +954,38 @@ void QFxVisualDataModel::_q_itemsRemoved(int index, int count) emit countChanged(); } -void QFxVisualDataModel::_q_itemsMoved(int from, int to, int count) +void QmlGraphicsVisualDataModel::_q_itemsMoved(int from, int to, int count) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); // XXX - highly inefficient - QHash items; - for (QHash::Iterator iter = d->m_cache.begin(); + QHash items; + for (QHash::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= from && iter.key() < from + count) { - QFxVisualDataModelPrivate::ObjectRef objRef = *iter; + QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter; int index = iter.key() - from + to; iter = d->m_cache.erase(iter); items.insert(index, objRef); - QFxVisualDataModelData *data = d->data(objRef.obj); + QmlGraphicsVisualDataModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; } } - for (QHash::Iterator iter = d->m_cache.begin(); + for (QHash::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { if (iter.key() >= qMin(from,to) && iter.key() < qMax(from+count,to+count)) { - QFxVisualDataModelPrivate::ObjectRef objRef = *iter; + QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter; int index = iter.key() + from - to; iter = d->m_cache.erase(iter); items.insert(index, objRef); - QFxVisualDataModelData *data = d->data(objRef.obj); + QmlGraphicsVisualDataModelData *data = d->data(objRef.obj); data->setIndex(index); } else { ++iter; @@ -996,37 +996,37 @@ void QFxVisualDataModel::_q_itemsMoved(int from, int to, int count) emit itemsMoved(from, to, count); } -void QFxVisualDataModel::_q_rowsInserted(const QModelIndex &, int begin, int end) +void QmlGraphicsVisualDataModel::_q_rowsInserted(const QModelIndex &, int begin, int end) { _q_itemsInserted(begin, end - begin + 1); } -void QFxVisualDataModel::_q_rowsRemoved(const QModelIndex &, int begin, int end) +void QmlGraphicsVisualDataModel::_q_rowsRemoved(const QModelIndex &, int begin, int end) { _q_itemsRemoved(begin, end - begin + 1); } -void QFxVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end) +void QmlGraphicsVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end) { - Q_D(QFxVisualDataModel); + Q_D(QmlGraphicsVisualDataModel); _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } -void QFxVisualDataModel::_q_createdPackage(int index, QmlPackage *package) +void QmlGraphicsVisualDataModel::_q_createdPackage(int index, QmlPackage *package) { - Q_D(QFxVisualDataModel); - emit createdItem(index, qobject_cast(package->part(d->m_part))); + Q_D(QmlGraphicsVisualDataModel); + emit createdItem(index, qobject_cast(package->part(d->m_part))); } -void QFxVisualDataModel::_q_destroyingPackage(QmlPackage *package) +void QmlGraphicsVisualDataModel::_q_destroyingPackage(QmlPackage *package) { - Q_D(QFxVisualDataModel); - emit destroyingItem(qobject_cast(package->part(d->m_part))); + Q_D(QmlGraphicsVisualDataModel); + emit destroyingItem(qobject_cast(package->part(d->m_part))); } -QML_DEFINE_NOCREATE_TYPE(QFxVisualModel); -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisualItemModel,QFxVisualItemModel) -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisualDataModel,QFxVisualDataModel) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsVisualModel); +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisualItemModel,QmlGraphicsVisualItemModel) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisualDataModel,QmlGraphicsVisualDataModel) QT_END_NAMESPACE #include "qfxvisualitemmodel.moc" diff --git a/src/declarative/fx/qfxvisualitemmodel.h b/src/declarative/fx/qfxvisualitemmodel.h index 8e33279..7f7a13f 100644 --- a/src/declarative/fx/qfxvisualitemmodel.h +++ b/src/declarative/fx/qfxvisualitemmodel.h @@ -58,88 +58,88 @@ QT_MODULE(Declarative) ***************************************************************************** *****************************************************************************/ -class QFxItem; +class QmlGraphicsItem; class QmlComponent; class QmlPackage; -class QFxVisualDataModelPrivate; +class QmlGraphicsVisualDataModelPrivate; -class Q_DECLARATIVE_EXPORT QFxVisualModel : public QObject +class Q_DECLARATIVE_EXPORT QmlGraphicsVisualModel : public QObject { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) public: - QFxVisualModel() {} - virtual ~QFxVisualModel() {} + QmlGraphicsVisualModel() {} + virtual ~QmlGraphicsVisualModel() {} enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02 }; Q_DECLARE_FLAGS(ReleaseFlags, ReleaseFlag) virtual int count() const = 0; virtual bool isValid() const = 0; - virtual QFxItem *item(int index, bool complete=true) = 0; - virtual ReleaseFlags release(QFxItem *item) = 0; + virtual QmlGraphicsItem *item(int index, bool complete=true) = 0; + virtual ReleaseFlags release(QmlGraphicsItem *item) = 0; virtual void completeItem() = 0; virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext) = 0; - virtual int indexOf(QFxItem *item, QObject *objectContext) const = 0; + virtual int indexOf(QmlGraphicsItem *item, QObject *objectContext) const = 0; Q_SIGNALS: void countChanged(); void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); - void createdItem(int index, QFxItem *item); - void destroyingItem(QFxItem *item); + void createdItem(int index, QmlGraphicsItem *item); + void destroyingItem(QmlGraphicsItem *item); protected: - QFxVisualModel(QObjectPrivate &dd, QObject *parent = 0) + QmlGraphicsVisualModel(QObjectPrivate &dd, QObject *parent = 0) : QObject(dd, parent) {} private: - Q_DISABLE_COPY(QFxVisualModel) + Q_DISABLE_COPY(QmlGraphicsVisualModel) }; -class QFxVisualItemModelAttached; -class QFxVisualItemModelPrivate; -class Q_DECLARATIVE_EXPORT QFxVisualItemModel : public QFxVisualModel +class QmlGraphicsVisualItemModelAttached; +class QmlGraphicsVisualItemModelPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsVisualItemModel : public QmlGraphicsVisualModel { Q_OBJECT - Q_DECLARE_PRIVATE(QFxVisualItemModel) + Q_DECLARE_PRIVATE(QmlGraphicsVisualItemModel) - Q_PROPERTY(QmlList* children READ children NOTIFY childrenChanged DESIGNABLE false) + Q_PROPERTY(QmlList* children READ children NOTIFY childrenChanged DESIGNABLE false) Q_CLASSINFO("DefaultProperty", "children") public: - QFxVisualItemModel(); - virtual ~QFxVisualItemModel() {} + QmlGraphicsVisualItemModel(); + virtual ~QmlGraphicsVisualItemModel() {} virtual int count() const; virtual bool isValid() const; - virtual QFxItem *item(int index, bool complete=true); - virtual ReleaseFlags release(QFxItem *item); + virtual QmlGraphicsItem *item(int index, bool complete=true); + virtual ReleaseFlags release(QmlGraphicsItem *item); virtual void completeItem(); virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext); - virtual int indexOf(QFxItem *item, QObject *objectContext) const; + virtual int indexOf(QmlGraphicsItem *item, QObject *objectContext) const; - QmlList *children(); + QmlList *children(); - static QFxVisualItemModelAttached *qmlAttachedProperties(QObject *obj); + static QmlGraphicsVisualItemModelAttached *qmlAttachedProperties(QObject *obj); signals: void childrenChanged(); private: - Q_DISABLE_COPY(QFxVisualItemModel) + Q_DISABLE_COPY(QmlGraphicsVisualItemModel) }; -class Q_DECLARATIVE_EXPORT QFxVisualDataModel : public QFxVisualModel +class Q_DECLARATIVE_EXPORT QmlGraphicsVisualDataModel : public QmlGraphicsVisualModel { Q_OBJECT - Q_DECLARE_PRIVATE(QFxVisualDataModel) + Q_DECLARE_PRIVATE(QmlGraphicsVisualDataModel) Q_PROPERTY(QVariant model READ model WRITE setModel) Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) @@ -147,9 +147,9 @@ class Q_DECLARATIVE_EXPORT QFxVisualDataModel : public QFxVisualModel Q_PROPERTY(QObject *parts READ parts CONSTANT) Q_CLASSINFO("DefaultProperty", "delegate") public: - QFxVisualDataModel(); - QFxVisualDataModel(QmlContext *); - virtual ~QFxVisualDataModel(); + QmlGraphicsVisualDataModel(); + QmlGraphicsVisualDataModel(QmlContext *); + virtual ~QmlGraphicsVisualDataModel(); QVariant model() const; void setModel(const QVariant &); @@ -162,13 +162,13 @@ public: int count() const; bool isValid() const { return delegate() != 0; } - QFxItem *item(int index, bool complete=true); - QFxItem *item(int index, const QByteArray &, bool complete=true); - ReleaseFlags release(QFxItem *item); + QmlGraphicsItem *item(int index, bool complete=true); + QmlGraphicsItem *item(int index, const QByteArray &, bool complete=true); + ReleaseFlags release(QmlGraphicsItem *item); void completeItem(); QVariant evaluate(int index, const QString &expression, QObject *objectContext); - int indexOf(QFxItem *item, QObject *objectContext) const; + int indexOf(QmlGraphicsItem *item, QObject *objectContext) const; QObject *parts(); @@ -188,15 +188,15 @@ private Q_SLOTS: void _q_destroyingPackage(QmlPackage *package); private: - Q_DISABLE_COPY(QFxVisualDataModel) + Q_DISABLE_COPY(QmlGraphicsVisualDataModel) }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxVisualModel) -QML_DECLARE_TYPE(QFxVisualItemModel) -QML_DECLARE_TYPEINFO(QFxVisualItemModel, QML_HAS_ATTACHED_PROPERTIES) -QML_DECLARE_TYPE(QFxVisualDataModel) +QML_DECLARE_TYPE(QmlGraphicsVisualModel) +QML_DECLARE_TYPE(QmlGraphicsVisualItemModel) +QML_DECLARE_TYPEINFO(QmlGraphicsVisualItemModel, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QmlGraphicsVisualDataModel) QT_END_HEADER diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index f7030ca..e6f0a1d 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -62,12 +62,12 @@ #include QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,WebView,QFxWebView) +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,WebView,QmlGraphicsWebView) QML_DEFINE_NOCREATE_TYPE(QAction) static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system -class QFxWebSettings : public QObject { +class QmlGraphicsWebSettings : public QObject { Q_OBJECT Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) @@ -99,7 +99,7 @@ class QFxWebSettings : public QObject { Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) public: - QFxWebSettings() {} + QmlGraphicsWebSettings() {} QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); } @@ -157,17 +157,17 @@ public: QWebSettings *s; }; -QML_DECLARE_TYPE(QFxWebSettings) -QML_DEFINE_NOCREATE_TYPE(QFxWebSettings) +QML_DECLARE_TYPE(QmlGraphicsWebSettings) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsWebSettings) -class QFxWebViewPrivate : public QFxPaintedItemPrivate +class QmlGraphicsWebViewPrivate : public QmlGraphicsPaintedItemPrivate { - Q_DECLARE_PUBLIC(QFxWebView) + Q_DECLARE_PUBLIC(QmlGraphicsWebView) public: - QFxWebViewPrivate() - : QFxPaintedItemPrivate(), page(0), preferredwidth(0), pagewidth(0), - progress(1.0), status(QFxWebView::Null), pending(PendingNone), + QmlGraphicsWebViewPrivate() + : QmlGraphicsPaintedItemPrivate(), page(0), preferredwidth(0), pagewidth(0), + progress(1.0), status(QmlGraphicsWebView::Null), pending(PendingNone), newWindowComponent(0), newWindowParent(0), windowObjects(this), rendering(true) @@ -180,28 +180,28 @@ public: int preferredwidth; int pagewidth; qreal progress; - QFxWebView::Status status; + QmlGraphicsWebView::Status status; QString statusText; enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; QUrl pending_url; QString pending_string; QByteArray pending_data; - mutable QFxWebSettings settings; + mutable QmlGraphicsWebSettings settings; QmlComponent *newWindowComponent; - QFxItem *newWindowParent; + QmlGraphicsItem *newWindowParent; void updateWindowObjects(); class WindowObjectList : public QmlConcreteList { public: - WindowObjectList(QFxWebViewPrivate *p) + WindowObjectList(QmlGraphicsWebViewPrivate *p) : priv(p) {} virtual void append(QObject *v) { QmlConcreteList::append(v); priv->updateWindowObjects(); } private: - QFxWebViewPrivate *priv; + QmlGraphicsWebViewPrivate *priv; } windowObjects; bool rendering; @@ -240,8 +240,8 @@ public: /*! \internal - \class QFxWebView - \brief The QFxWebView class allows you to add web content to a QmlView. + \class QmlGraphicsWebView + \brief The QmlGraphicsWebView class allows you to add web content to a QmlView. A WebView renders web content base on a URL. @@ -251,30 +251,30 @@ public: toolbars, etc., those must be implemented around WebView. See the WebBrowser example for a demonstration of this. - A QFxWebView object can be instantiated in Qml using the tag \l WebView. + A QmlGraphicsWebView object can be instantiated in Qml using the tag \l WebView. */ -QFxWebView::QFxWebView(QFxItem *parent) - : QFxPaintedItem(*(new QFxWebViewPrivate), parent) +QmlGraphicsWebView::QmlGraphicsWebView(QmlGraphicsItem *parent) + : QmlGraphicsPaintedItem(*(new QmlGraphicsWebViewPrivate), parent) { init(); } -QFxWebView::QFxWebView(QFxWebViewPrivate &dd, QFxItem *parent) - : QFxPaintedItem(dd, parent) +QmlGraphicsWebView::QmlGraphicsWebView(QmlGraphicsWebViewPrivate &dd, QmlGraphicsItem *parent) + : QmlGraphicsPaintedItem(dd, parent) { init(); } -QFxWebView::~QFxWebView() +QmlGraphicsWebView::~QmlGraphicsWebView() { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); delete d->page; } -void QFxWebView::init() +void QmlGraphicsWebView::init() { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); @@ -283,30 +283,30 @@ void QFxWebView::init() d->page = 0; } -void QFxWebView::componentComplete() +void QmlGraphicsWebView::componentComplete() { - QFxPaintedItem::componentComplete(); - Q_D(QFxWebView); + QmlGraphicsPaintedItem::componentComplete(); + Q_D(QmlGraphicsWebView); switch (d->pending) { - case QFxWebViewPrivate::PendingUrl: + case QmlGraphicsWebViewPrivate::PendingUrl: setUrl(d->pending_url); break; - case QFxWebViewPrivate::PendingHtml: + case QmlGraphicsWebViewPrivate::PendingHtml: setHtml(d->pending_string, d->pending_url); break; - case QFxWebViewPrivate::PendingContent: + case QmlGraphicsWebViewPrivate::PendingContent: setContent(d->pending_data, d->pending_string, d->pending_url); break; default: break; } - d->pending = QFxWebViewPrivate::PendingNone; + d->pending = QmlGraphicsWebViewPrivate::PendingNone; d->updateWindowObjects(); } -QFxWebView::Status QFxWebView::status() const +QmlGraphicsWebView::Status QmlGraphicsWebView::status() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->status; } @@ -317,15 +317,15 @@ QFxWebView::Status QFxWebView::status() const \sa onLoadFinished() onLoadFailed() */ -qreal QFxWebView::progress() const +qreal QmlGraphicsWebView::progress() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->progress; } -void QFxWebView::doLoadStarted() +void QmlGraphicsWebView::doLoadStarted() { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (!d->url.isEmpty()) { d->status = Loading; @@ -334,18 +334,18 @@ void QFxWebView::doLoadStarted() emit loadStarted(); } -void QFxWebView::doLoadProgress(int p) +void QmlGraphicsWebView::doLoadProgress(int p) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (d->progress == p/100.0) return; d->progress = p/100.0; emit progressChanged(); } -void QFxWebView::pageUrlChanged() +void QmlGraphicsWebView::pageUrlChanged() { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); // Reset zooming to full qreal zf = 1.0; @@ -371,9 +371,9 @@ void QFxWebView::pageUrlChanged() } } -void QFxWebView::doLoadFinished(bool ok) +void QmlGraphicsWebView::doLoadFinished(bool ok) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (title().isEmpty()) pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged() @@ -398,15 +398,15 @@ void QFxWebView::doLoadFinished(bool ok) The url is always absolute (QML will resolve relative URL strings in the context of the containing QML document). */ -QUrl QFxWebView::url() const +QUrl QmlGraphicsWebView::url() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->url; } -void QFxWebView::setUrl(const QUrl &url) +void QmlGraphicsWebView::setUrl(const QUrl &url) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (url == d->url) return; @@ -440,15 +440,15 @@ void QFxWebView::setUrl(const QUrl &url) \qmlproperty int WebView::preferredWidth This property holds the ideal width for displaying the current URL. */ -int QFxWebView::preferredWidth() const +int QmlGraphicsWebView::preferredWidth() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->preferredwidth; } -void QFxWebView::setPreferredWidth(int iw) +void QmlGraphicsWebView::setPreferredWidth(int iw) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (d->preferredwidth == iw) return; if (d->pagewidth) { if (d->preferredwidth) { @@ -466,15 +466,15 @@ void QFxWebView::setPreferredWidth(int iw) \qmlproperty int WebView::webPageWidth This property holds the page width suggested to the web engine. */ -int QFxWebView::webPageWidth() const +int QmlGraphicsWebView::webPageWidth() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->pagewidth; } -void QFxWebView::setWebPageWidth(int pw) +void QmlGraphicsWebView::setWebPageWidth(int pw) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (d->pagewidth == pw) return; d->pagewidth = pw; expandToWebPage(); @@ -484,26 +484,26 @@ void QFxWebView::setWebPageWidth(int pw) Evaluates the \a scriptSource JavaScript inside the main frame context and returns the result of the last executed statement. */ -QVariant QFxWebView::evaluateJavaScript(const QString &scriptSource) +QVariant QmlGraphicsWebView::evaluateJavaScript(const QString &scriptSource) { return this->page()->mainFrame()->evaluateJavaScript(scriptSource); } -void QFxWebView::focusChanged(bool hasFocus) +void QmlGraphicsWebView::focusChanged(bool hasFocus) { QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); page()->event(&e); - QFxItem::focusChanged(hasFocus); + QmlGraphicsItem::focusChanged(hasFocus); } -void QFxWebView::contentsSizeChanged(const QSize&) +void QmlGraphicsWebView::contentsSizeChanged(const QSize&) { expandToWebPage(); } -void QFxWebView::expandToWebPage() +void QmlGraphicsWebView::expandToWebPage() { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); QSize cs = page()->mainFrame()->contentsSize(); qreal zoom = zoomFactor(); if (cs.width() < d->preferredwidth*zoom) @@ -520,17 +520,17 @@ void QFxWebView::expandToWebPage() } } -void QFxWebView::geometryChanged(const QRectF &newGeometry, +void QmlGraphicsWebView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { if (newGeometry.size() != oldGeometry.size()) expandToWebPage(); - QFxPaintedItem::geometryChanged(newGeometry, oldGeometry); + QmlGraphicsPaintedItem::geometryChanged(newGeometry, oldGeometry); } -void QFxWebView::paintPage(const QRect& r) +void QmlGraphicsWebView::paintPage(const QRect& r) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (d->page->mainFrame()->contentsSize() != contentsSize()) setContentsSize(d->page->mainFrame()->contentsSize()); dirtyCache(r); @@ -544,15 +544,15 @@ void QFxWebView::paintPage(const QRect& r) allow. The default is 0.1 megapixels. The cache will not be larger than the (unscaled) size of the WebView. */ -int QFxWebView::pixelCacheSize() const +int QmlGraphicsWebView::pixelCacheSize() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->max_imagecache_size; } -void QFxWebView::setPixelCacheSize(int pixels) +void QmlGraphicsWebView::setPixelCacheSize(int pixels) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (pixels < d->max_imagecache_size) { int cachesize=0; for (int i=0; iimagecache.count(); ++i) { @@ -598,18 +598,18 @@ void QFxWebView::setPixelCacheSize(int pixels) If Javascript is not enabled for this page, then this property does nothing. */ -QmlList *QFxWebView::javaScriptWindowObjects() +QmlList *QmlGraphicsWebView::javaScriptWindowObjects() { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); return &d->windowObjects; } -class QFxWebViewAttached : public QObject +class QmlGraphicsWebViewAttached : public QObject { Q_OBJECT Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) public: - QFxWebViewAttached(QObject *parent) + QmlGraphicsWebViewAttached(QObject *parent) : QObject(parent) { } @@ -628,35 +628,35 @@ private: QString m_windowObjectName; }; -QFxWebViewAttached *QFxWebView::qmlAttachedProperties(QObject *o) +QmlGraphicsWebViewAttached *QmlGraphicsWebView::qmlAttachedProperties(QObject *o) { - return new QFxWebViewAttached(o); + return new QmlGraphicsWebViewAttached(o); } -void QFxWebViewPrivate::updateWindowObjects() +void QmlGraphicsWebViewPrivate::updateWindowObjects() { - Q_Q(QFxWebView); + Q_Q(QmlGraphicsWebView); if (!q->isComponentComplete() || !page) return; for (int ii = 0; ii < windowObjects.count(); ++ii) { QObject *object = windowObjects.at(ii); - QFxWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); + QmlGraphicsWebViewAttached *attached = static_cast(qmlAttachedPropertiesObject(object)); if (attached && !attached->windowObjectName().isEmpty()) { page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); } } } -bool QFxWebView::renderingEnabled() const +bool QmlGraphicsWebView::renderingEnabled() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->rendering; } -void QFxWebView::setRenderingEnabled(bool enabled) +void QmlGraphicsWebView::setRenderingEnabled(bool enabled) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (d->rendering == enabled) return; d->rendering = enabled; @@ -666,9 +666,9 @@ void QFxWebView::setRenderingEnabled(bool enabled) } -void QFxWebView::drawContents(QPainter *p, const QRect &r) +void QmlGraphicsWebView::drawContents(QPainter *p, const QRect &r) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (d->rendering) page()->mainFrame()->render(p,r); } @@ -713,16 +713,16 @@ static QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) emits this signals. */ -void QFxWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { QMouseEvent *me = sceneMouseEventToMouseEvent(event); emit doubleClick(me->x(),me->y()); delete me; } -void QFxWebView::heuristicZoom(int clickX, int clickY) +void QmlGraphicsWebView::heuristicZoom(int clickX, int clickY) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); qreal ozf = zoomFactor(); QRect showarea = elementAreaAt(clickX, clickY, 1, 1); qreal z = qreal(preferredWidth())*ozf/showarea.width()*.95; @@ -734,7 +734,7 @@ void QFxWebView::heuristicZoom(int clickX, int clickY) emit zooming(z,r.x()+r.width()/2, r.y()+r.height()/2); } -void QFxWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) { setFocus (true); QMouseEvent *me = sceneMouseEventToMouseEvent(event); @@ -753,11 +753,11 @@ void QFxWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) ); delete me; if (!event->isAccepted()) { - QFxPaintedItem::mousePressEvent(event); + QmlGraphicsPaintedItem::mousePressEvent(event); } } -void QFxWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { QMouseEvent *me = sceneMouseEventToMouseEvent(event); page()->event(me); @@ -774,11 +774,11 @@ void QFxWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) ); delete me; if (!event->isAccepted()) { - QFxPaintedItem::mouseReleaseEvent(event); + QmlGraphicsPaintedItem::mouseReleaseEvent(event); } } -void QFxWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +void QmlGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { QMouseEvent *me = sceneMouseEventToMouseEvent(event); page()->event(me); @@ -796,10 +796,10 @@ void QFxWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) ); delete me; if (!event->isAccepted()) - QFxPaintedItem::mouseMoveEvent(event); + QmlGraphicsPaintedItem::mouseMoveEvent(event); } -void QFxWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) +void QmlGraphicsWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) { QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event); page()->event(me); @@ -812,24 +812,24 @@ void QFxWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) ); delete me; if (!event->isAccepted()) - QFxPaintedItem::hoverMoveEvent(event); + QmlGraphicsPaintedItem::hoverMoveEvent(event); } -void QFxWebView::keyPressEvent(QKeyEvent* event) +void QmlGraphicsWebView::keyPressEvent(QKeyEvent* event) { page()->event(event); if (!event->isAccepted()) - QFxPaintedItem::keyPressEvent(event); + QmlGraphicsPaintedItem::keyPressEvent(event); } -void QFxWebView::keyReleaseEvent(QKeyEvent* event) +void QmlGraphicsWebView::keyReleaseEvent(QKeyEvent* event) { page()->event(event); if (!event->isAccepted()) - QFxPaintedItem::keyReleaseEvent(event); + QmlGraphicsPaintedItem::keyReleaseEvent(event); } -bool QFxWebView::sceneEvent(QEvent *event) +bool QmlGraphicsWebView::sceneEvent(QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent *k = static_cast(event); @@ -841,7 +841,7 @@ bool QFxWebView::sceneEvent(QEvent *event) } } } - return QFxPaintedItem::sceneEvent(event); + return QmlGraphicsPaintedItem::sceneEvent(event); } @@ -850,7 +850,7 @@ bool QFxWebView::sceneEvent(QEvent *event) \qmlproperty action WebView::back This property holds the action for causing the previous URL in the history to be displayed. */ -QAction *QFxWebView::backAction() const +QAction *QmlGraphicsWebView::backAction() const { return page()->action(QWebPage::Back); } @@ -859,7 +859,7 @@ QAction *QFxWebView::backAction() const \qmlproperty action WebView::forward This property holds the action for causing the next URL in the history to be displayed. */ -QAction *QFxWebView::forwardAction() const +QAction *QmlGraphicsWebView::forwardAction() const { return page()->action(QWebPage::Forward); } @@ -868,7 +868,7 @@ QAction *QFxWebView::forwardAction() const \qmlproperty action WebView::reload This property holds the action for reloading with the current URL */ -QAction *QFxWebView::reloadAction() const +QAction *QmlGraphicsWebView::reloadAction() const { return page()->action(QWebPage::Reload); } @@ -877,7 +877,7 @@ QAction *QFxWebView::reloadAction() const \qmlproperty action WebView::stop This property holds the action for stopping loading with the current URL */ -QAction *QFxWebView::stopAction() const +QAction *QmlGraphicsWebView::stopAction() const { return page()->action(QWebPage::Stop); } @@ -888,7 +888,7 @@ QAction *QFxWebView::stopAction() const By default, this property contains an empty string. */ -QString QFxWebView::title() const +QString QmlGraphicsWebView::title() const { return page()->mainFrame()->title(); } @@ -899,7 +899,7 @@ QString QFxWebView::title() const \qmlproperty pixmap WebView::icon This property holds the icon associated with the web page currently viewed */ -QPixmap QFxWebView::icon() const +QPixmap QmlGraphicsWebView::icon() const { return page()->mainFrame()->icon().pixmap(QSize(256,256)); } @@ -909,12 +909,12 @@ QPixmap QFxWebView::icon() const \qmlproperty real WebView::textSizeMultiplier This property holds the multiplier used to scale the text in a Web page */ -void QFxWebView::setTextSizeMultiplier(qreal factor) +void QmlGraphicsWebView::setTextSizeMultiplier(qreal factor) { page()->mainFrame()->setTextSizeMultiplier(factor); } -qreal QFxWebView::textSizeMultiplier() const +qreal QmlGraphicsWebView::textSizeMultiplier() const { return page()->mainFrame()->textSizeMultiplier(); } @@ -923,9 +923,9 @@ qreal QFxWebView::textSizeMultiplier() const \qmlproperty real WebView::zoomFactor This property holds the multiplier used to scale the contents of a Web page. */ -void QFxWebView::setZoomFactor(qreal factor) +void QmlGraphicsWebView::setZoomFactor(qreal factor) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (factor == page()->mainFrame()->zoomFactor()) return; @@ -936,7 +936,7 @@ void QFxWebView::setZoomFactor(qreal factor) emit zoomFactorChanged(); } -qreal QFxWebView::zoomFactor() const +qreal QmlGraphicsWebView::zoomFactor() const { return page()->mainFrame()->zoomFactor(); } @@ -947,32 +947,32 @@ qreal QFxWebView::zoomFactor() const This property is the current status suggested by the current web page. In a web browser, such status is often shown in some kind of status bar. */ -void QFxWebView::setStatusText(const QString& s) +void QmlGraphicsWebView::setStatusText(const QString& s) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); d->statusText = s; emit statusTextChanged(); } -void QFxWebView::windowObjectCleared() +void QmlGraphicsWebView::windowObjectCleared() { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); d->updateWindowObjects(); } -QString QFxWebView::statusText() const +QString QmlGraphicsWebView::statusText() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->statusText; } -QWebPage *QFxWebView::page() const +QWebPage *QmlGraphicsWebView::page() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); if (!d->page) { - QFxWebView *self = const_cast(this); - QWebPage *wp = new QFxWebPage(self); + QmlGraphicsWebView *self = const_cast(this); + QWebPage *wp = new QmlGraphicsWebPage(self); // QML items don't default to having a background, // even though most we pages will set one anyway. @@ -1033,16 +1033,16 @@ QWebPage *QFxWebView::page() const } \endqml */ -QFxWebSettings *QFxWebView::settingsObject() const +QmlGraphicsWebSettings *QmlGraphicsWebView::settingsObject() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); d->settings.s = page()->settings(); return &d->settings; } -void QFxWebView::setPage(QWebPage *page) +void QmlGraphicsWebView::setPage(QWebPage *page) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); if (d->page == page) return; if (d->page) { @@ -1098,14 +1098,14 @@ void QFxWebView::setPage(QWebPage *page) \sa progress onLoadFinished() */ -void QFxWebView::load(const QNetworkRequest &request, +void QmlGraphicsWebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body) { page()->mainFrame()->load(request, operation, body); } -QString QFxWebView::html() const +QString QmlGraphicsWebView::html() const { return page()->mainFrame()->toHtml(); } @@ -1122,9 +1122,9 @@ QString QFxWebView::html() const } \endqml */ -void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl) +void QmlGraphicsWebView::setHtml(const QString &html, const QUrl &baseUrl) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); page()->setViewportSize(QSize( d->preferredwidth>0 ? d->preferredwidth : width(), height())); if (isComponentComplete()) @@ -1136,9 +1136,9 @@ void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl) } } -void QFxWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) +void QmlGraphicsWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); page()->setViewportSize(QSize( d->preferredwidth>0 ? d->preferredwidth : width(), height())); @@ -1152,19 +1152,19 @@ void QFxWebView::setContent(const QByteArray &data, const QString &mimeType, con } } -QWebHistory *QFxWebView::history() const +QWebHistory *QmlGraphicsWebView::history() const { return page()->history(); } -QWebSettings *QFxWebView::settings() const +QWebSettings *QmlGraphicsWebView::settings() const { return page()->settings(); } -QFxWebView *QFxWebView::createWindow(QWebPage::WebWindowType type) +QmlGraphicsWebView *QmlGraphicsWebView::createWindow(QWebPage::WebWindowType type) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); switch (type) { case QWebPage::WebBrowserWindow: { if (!d->newWindowComponent && d->newWindowParent) @@ -1172,17 +1172,17 @@ QFxWebView *QFxWebView::createWindow(QWebPage::WebWindowType type) else if (d->newWindowComponent && !d->newWindowParent) qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); else if (d->newWindowComponent && d->newWindowParent) { - QFxWebView *webview = 0; + QmlGraphicsWebView *webview = 0; QmlContext *windowContext = new QmlContext(qmlContext(this)); QObject *nobj = d->newWindowComponent->create(windowContext); if (nobj) { windowContext->setParent(nobj); - QFxItem *item = qobject_cast(nobj); + QmlGraphicsItem *item = qobject_cast(nobj); if (!item) { delete nobj; } else { - webview = item->findChild(); + webview = item->findChild(); if (!webview) { delete item; } else { @@ -1215,15 +1215,15 @@ QFxWebView *QFxWebView::createWindow(QWebPage::WebWindowType type) The parent of the new window is set by newWindowParent. It must be set. */ -QmlComponent *QFxWebView::newWindowComponent() const +QmlComponent *QmlGraphicsWebView::newWindowComponent() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->newWindowComponent; } -void QFxWebView::setNewWindowComponent(QmlComponent *newWindow) +void QmlGraphicsWebView::setNewWindowComponent(QmlComponent *newWindow) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); delete d->newWindowComponent; d->newWindowComponent = newWindow; } @@ -1236,15 +1236,15 @@ void QFxWebView::setNewWindowComponent(QmlComponent *newWindow) \sa newWindowComponent */ -QFxItem *QFxWebView::newWindowParent() const +QmlGraphicsItem *QmlGraphicsWebView::newWindowParent() const { - Q_D(const QFxWebView); + Q_D(const QmlGraphicsWebView); return d->newWindowParent; } -void QFxWebView::setNewWindowParent(QFxItem *parent) +void QmlGraphicsWebView::setNewWindowParent(QmlGraphicsItem *parent) { - Q_D(QFxWebView); + Q_D(QmlGraphicsWebView); delete d->newWindowParent; d->newWindowParent = parent; } @@ -1255,7 +1255,7 @@ void QFxWebView::setNewWindowParent(QFxItem *parent) May return an area larger in the case when no smaller element is at the position. */ -QRect QFxWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const +QRect QmlGraphicsWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const { QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y)); QWebElement element = hit.enclosingBlockElement(); @@ -1271,17 +1271,17 @@ QRect QFxWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const /*! \internal - \class QFxWebPage - \brief The QFxWebPage class is a QWebPage that can create QML plugins. + \class QmlGraphicsWebPage + \brief The QmlGraphicsWebPage class is a QWebPage that can create QML plugins. - \sa QFxWebView + \sa QmlGraphicsWebView */ -QFxWebPage::QFxWebPage(QFxWebView *parent) : +QmlGraphicsWebPage::QmlGraphicsWebPage(QmlGraphicsWebView *parent) : QWebPage(parent) { } -QFxWebPage::~QFxWebPage() +QmlGraphicsWebPage::~QmlGraphicsWebPage() { } @@ -1306,7 +1306,7 @@ public: } return dsp; } - QWidget_Dummy_Plugin(const QUrl& url, QFxWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : + QWidget_Dummy_Plugin(const QUrl& url, QmlGraphicsWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : QWidget(dummy_shared_parent()), propertyNames(paramNames), propertyValues(paramValues), @@ -1329,7 +1329,7 @@ public Q_SLOTS: qWarning() << component->errors(); return; } - item = qobject_cast(component->create(qmlContext(webview))); + item = qobject_cast(component->create(qmlContext(webview))); item->setParent(webview); QString jsObjName; for (int i=0; i(parent()); + return static_cast(parent()); } -QObject *QFxWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) +QObject *QmlGraphicsWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) { QUrl comp = qmlContext(viewItem())->resolvedUrl(url); return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); } -QWebPage *QFxWebPage::createWindow(WebWindowType type) +QWebPage *QmlGraphicsWebPage::createWindow(WebWindowType type) { - QFxWebView *newView = viewItem()->createWindow(type); + QmlGraphicsWebView *newView = viewItem()->createWindow(type); if (newView) return newView->page(); return 0; diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index a31b2b0..e567197 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -57,31 +57,31 @@ class QWebSettings; QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxWebViewPrivate; +class QmlGraphicsWebViewPrivate; class QNetworkRequest; -class QFxWebView; +class QmlGraphicsWebView; -class Q_DECLARATIVE_EXPORT QFxWebPage : public QWebPage +class Q_DECLARATIVE_EXPORT QmlGraphicsWebPage : public QWebPage { Q_OBJECT public: - explicit QFxWebPage(QFxWebView *parent); - ~QFxWebPage(); + explicit QmlGraphicsWebPage(QmlGraphicsWebView *parent); + ~QmlGraphicsWebPage(); protected: QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); QWebPage *createWindow(WebWindowType type); private: - QFxWebView *viewItem(); + QmlGraphicsWebView *viewItem(); }; -class QFxWebViewAttached; -class QFxWebSettings; +class QmlGraphicsWebViewAttached; +class QmlGraphicsWebSettings; //### TODO: browser plugins -class Q_DECLARATIVE_EXPORT QFxWebView : public QFxPaintedItem +class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem { Q_OBJECT @@ -107,18 +107,18 @@ class Q_DECLARATIVE_EXPORT QFxWebView : public QFxPaintedItem Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) Q_PROPERTY(QAction* stop READ stopAction CONSTANT) - Q_PROPERTY(QFxWebSettings* settings READ settingsObject CONSTANT) + Q_PROPERTY(QmlGraphicsWebSettings* settings READ settingsObject CONSTANT) Q_PROPERTY(QmlList* javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) Q_PROPERTY(QmlComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent) - Q_PROPERTY(QFxItem* newWindowParent READ newWindowParent WRITE setNewWindowParent) + Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent) Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled) public: - QFxWebView(QFxItem *parent=0); - ~QFxWebView(); + QmlGraphicsWebView(QmlGraphicsItem *parent=0); + ~QmlGraphicsWebView(); QUrl url() const; void setUrl(const QUrl &); @@ -162,7 +162,7 @@ public: QWebHistory *history() const; QWebSettings *settings() const; - QFxWebSettings *settingsObject() const; + QmlGraphicsWebSettings *settingsObject() const; int pixelCacheSize() const; void setPixelCacheSize(int pixels); @@ -172,12 +172,12 @@ public: QmlList *javaScriptWindowObjects(); - static QFxWebViewAttached *qmlAttachedProperties(QObject *); + static QmlGraphicsWebViewAttached *qmlAttachedProperties(QObject *); QmlComponent *newWindowComponent() const; void setNewWindowComponent(QmlComponent *newWindow); - QFxItem *newWindowParent() const; - void setNewWindowParent(QFxItem *newWindow); + QmlGraphicsItem *newWindowParent() const; + void setNewWindowParent(QmlGraphicsItem *newWindow); Q_SIGNALS: void preferredWidthChanged(); @@ -214,7 +214,7 @@ private Q_SLOTS: void contentsSizeChanged(const QSize&); protected: - QFxWebView(QFxWebViewPrivate &dd, QFxItem *parent); + QmlGraphicsWebView(QmlGraphicsWebViewPrivate &dd, QmlGraphicsItem *parent); void drawContents(QPainter *, const QRect &); @@ -229,21 +229,21 @@ protected: const QRectF &oldGeometry); virtual void focusChanged(bool); virtual bool sceneEvent(QEvent *event); - QFxWebView *createWindow(QWebPage::WebWindowType type); + QmlGraphicsWebView *createWindow(QWebPage::WebWindowType type); QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; private: void init(); virtual void componentComplete(); - Q_DISABLE_COPY(QFxWebView) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxWebView) - friend class QFxWebPage; + Q_DISABLE_COPY(QmlGraphicsWebView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsWebView) + friend class QmlGraphicsWebPage; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxWebView) -QML_DECLARE_TYPEINFO(QFxWebView, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QmlGraphicsWebView) +QML_DECLARE_TYPEINFO(QmlGraphicsWebView, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QAction) QT_END_HEADER diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index 83ca65b..fa971a3 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -138,7 +138,7 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) Q_D(QmlBinding); #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer bu; + QmlPerfTimer bu; #endif QmlBindingData *data = d->bindingData(); diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp index d715309..f4cecec 100644 --- a/src/declarative/qml/qmlboundsignal.cpp +++ b/src/declarative/qml/qmlboundsignal.cpp @@ -102,7 +102,7 @@ QmlBoundSignal::QmlBoundSignal(QObject *scope, const QMetaMethod &signal, // is that they both do the work to figure it out. Boo hoo. if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount(); - QFx_setParent_noEvent(this, parent); + QmlGraphics_setParent_noEvent(this, parent); QMetaObject::connect(scope, m_idx, this, evaluateIdx); if (!signal.parameterTypes().isEmpty()) @@ -121,7 +121,7 @@ QmlBoundSignal::QmlBoundSignal(QmlContext *ctxt, const QString &val, // is that they both do the work to figure it out. Boo hoo. if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount(); - QFx_setParent_noEvent(this, parent); + QmlGraphics_setParent_noEvent(this, parent); QMetaObject::connect(scope, m_idx, this, evaluateIdx); m_expression = new QmlExpression(ctxt, val, scope); diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 8f3d6a2..5d2bd12 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -562,7 +562,7 @@ bool QmlCompiler::compile(QmlEngine *engine, QmlCompiledData *out) { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer pc; + QmlPerfTimer pc; #endif exceptions.clear(); diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 72ead87..c856680 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -648,7 +648,7 @@ QmlComponentPrivate::beginCreate(QmlContext *context, const QBitField &bindings) if (rv) { - QFx_setParent_noEvent(ctxt, rv); + QmlGraphics_setParent_noEvent(ctxt, rv); } else { delete ctxt; } @@ -676,7 +676,7 @@ void QmlComponentPrivate::completeCreate() if (completePending) { { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer bi; + QmlPerfTimer bi; #endif for (int ii = 0; ii < bindValues.count(); ++ii) { QmlEnginePrivate::SimpleList bv = diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 21eeb7c..efc8e98 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -218,7 +218,7 @@ QList QmlDomDocument::errors() const Returns the document's root object, or an invalid QmlDomObject if the document has no root. - In the sample QML below, the root object will be the QFxItem type. + In the sample QML below, the root object will be the QmlGraphicsItem type. \qml Item { Text { diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 2f7f3e5..463bd93 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -268,7 +268,7 @@ QmlEnginePrivate::CapturedProperty::CapturedProperty(const QmlMetaProperty &p) \code QmlEngine engine; QmlComponent component(&engine, "Text { text: \"Hello world!\" }"); - QFxItem *item = qobject_cast(component.create()); + QmlGraphicsItem *item = qobject_cast(component.create()); //add item to view, etc ... @@ -1233,7 +1233,7 @@ void QmlEngine::addImportPath(const QString& path) Returns the directory where SQL and other offline storage is placed. - QFxWebView and the SQL databases created with openDatabase() + QmlGraphicsWebView and the SQL databases created with openDatabase() are stored here. The default is QML/OfflineStorage/ in the platform-standard diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 7c69c16..69cfc3a 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -252,7 +252,7 @@ void QmlExpression::setExpression(const QString &expression) QVariant QmlExpressionPrivate::evalSSE() { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer perfsse; + QmlPerfTimer perfsse; #endif QVariant rv = data->sse.run(data->context(), data->me); @@ -290,7 +290,7 @@ void QmlExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine, QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUndefined) { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer perfqt; + QmlPerfTimer perfqt; #endif QmlExpressionData *data = this->data; @@ -382,7 +382,7 @@ QVariant QmlExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) return rv; #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer perf; + QmlPerfTimer perf; #endif QmlEnginePrivate *ep = QmlEnginePrivate::get(q->engine()); diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index fb84651..95dfe5b 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -824,7 +824,7 @@ public: bool QmlScriptParser::parse(const QByteArray &qmldata, const QUrl &url) { #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer pt; + QmlPerfTimer pt; #endif clear(); diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h index 9b4aee1..67eff6c 100644 --- a/src/declarative/util/qfxglobal.h +++ b/src/declarative/util/qfxglobal.h @@ -67,7 +67,7 @@ QT_MODULE(Declarative) return status == Yes; \ } -struct QFx_DerivedObject : public QObject +struct QmlGraphics_DerivedObject : public QObject { void setParent_noEvent(QObject *parent) { bool sce = d_ptr->sendChildEvents; @@ -82,9 +82,9 @@ struct QFx_DerivedObject : public QObject neither \a parent nor the object's previous parent (if it had one) will receive ChildRemoved or ChildAdded events. */ -inline void QFx_setParent_noEvent(QObject *object, QObject *parent) +inline void QmlGraphics_setParent_noEvent(QObject *object, QObject *parent) { - static_cast(object)->setParent_noEvent(parent); + static_cast(object)->setParent_noEvent(parent); } QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index 739e480..97f195b 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE -Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { +Q_DEFINE_PERFORMANCE_LOG(QmlPerf, "QmlGraphics") { Q_DEFINE_PERFORMANCE_METRIC(QmlParsing, "Compilation: QML Parsing") Q_DEFINE_PERFORMANCE_METRIC(Compilation, " QML Compilation") Q_DEFINE_PERFORMANCE_METRIC(VMEExecution, "Execution: QML VME Execution") @@ -54,13 +54,13 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QmlBinding::update") Q_DEFINE_PERFORMANCE_METRIC(PixmapLoad, "Pixmap loading") Q_DEFINE_PERFORMANCE_METRIC(FontDatabase, "Font database creation") - Q_DEFINE_PERFORMANCE_METRIC(QFxPathViewPathCache, "FX Items: QFxPathView: Path cache") - Q_DEFINE_PERFORMANCE_METRIC(CreateParticle, " QFxParticles: Particle creation") - Q_DEFINE_PERFORMANCE_METRIC(ItemComponentComplete, " QFxItem::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(ImageComponentComplete, " QFxImage::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, " QFxBasePositioner::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, " QFxText::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(QFxText_setText, " QFxText::setText") + Q_DEFINE_PERFORMANCE_METRIC(QmlGraphicsPathViewPathCache, "FX Items: QmlGraphicsPathView: Path cache") + Q_DEFINE_PERFORMANCE_METRIC(CreateParticle, " QmlGraphicsParticles: Particle creation") + Q_DEFINE_PERFORMANCE_METRIC(ItemComponentComplete, " QmlGraphicsItem::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(ImageComponentComplete, " QmlGraphicsImage::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, " QmlGraphicsBasePositioner::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, " QmlGraphicsText::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(QmlGraphicsText_setText, " QmlGraphicsText::setText") Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QmlScript::addScriptToEngine") } diff --git a/src/declarative/util/qfxperf_p.h b/src/declarative/util/qfxperf_p.h index cea7e80..37bfc32 100644 --- a/src/declarative/util/qfxperf_p.h +++ b/src/declarative/util/qfxperf_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { +Q_DECLARE_PERFORMANCE_LOG(QmlPerf) { Q_DECLARE_PERFORMANCE_METRIC(QmlParsing) Q_DECLARE_PERFORMANCE_METRIC(Compilation) @@ -73,13 +73,13 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate) Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad) Q_DECLARE_PERFORMANCE_METRIC(FontDatabase) - Q_DECLARE_PERFORMANCE_METRIC(QFxPathViewPathCache) + Q_DECLARE_PERFORMANCE_METRIC(QmlGraphicsPathViewPathCache) Q_DECLARE_PERFORMANCE_METRIC(CreateParticle) Q_DECLARE_PERFORMANCE_METRIC(ItemComponentComplete) Q_DECLARE_PERFORMANCE_METRIC(ImageComponentComplete) Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete) Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText) + Q_DECLARE_PERFORMANCE_METRIC(QmlGraphicsText_setText) Q_DECLARE_PERFORMANCE_METRIC(AddScript) } diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index f103a6b..e00a1c8 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -663,7 +663,7 @@ void QmlPauseAnimationPrivate::init() { Q_Q(QmlPauseAnimation); pa = new QPauseAnimation; - QFx_setParent_noEvent(pa, q); + QmlGraphics_setParent_noEvent(pa, q); } /*! @@ -786,7 +786,7 @@ void QmlScriptActionPrivate::init() { Q_Q(QmlScriptAction); rsa = new QActionAnimation(&proxy); - QFx_setParent_noEvent(rsa, q); + QmlGraphics_setParent_noEvent(rsa, q); } /*! @@ -904,7 +904,7 @@ void QmlPropertyActionPrivate::init() { Q_Q(QmlPropertyAction); spa = new QActionAnimation; - QFx_setParent_noEvent(spa, q); + QmlGraphics_setParent_noEvent(spa, q); } /*! @@ -1097,28 +1097,28 @@ void QmlParentActionPrivate::init() { Q_Q(QmlParentAction); cpa = new QActionAnimation; - QFx_setParent_noEvent(cpa, q); + QmlGraphics_setParent_noEvent(cpa, q); } -QFxItem *QmlParentAction::object() const +QmlGraphicsItem *QmlParentAction::object() const { Q_D(const QmlParentAction); return d->pcTarget; } -void QmlParentAction::setObject(QFxItem *target) +void QmlParentAction::setObject(QmlGraphicsItem *target) { Q_D(QmlParentAction); d->pcTarget = target; } -QFxItem *QmlParentAction::parent() const +QmlGraphicsItem *QmlParentAction::parent() const { Q_D(const QmlParentAction); return d->pcParent; } -void QmlParentAction::setParent(QFxItem *parent) +void QmlParentAction::setParent(QmlGraphicsItem *parent) { Q_D(QmlParentAction); d->pcParent = parent; @@ -1516,7 +1516,7 @@ void QmlPropertyAnimationPrivate::init() { Q_Q(QmlPropertyAnimation); va = new QmlTimeLineValueAnimator; - QFx_setParent_noEvent(va, q); + QmlGraphics_setParent_noEvent(va, q); va->setStartValue(QVariant(0.0f)); va->setEndValue(QVariant(1.0f)); diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h index f4f9f38..4e94aa0 100644 --- a/src/declarative/util/qmlanimation.h +++ b/src/declarative/util/qmlanimation.h @@ -221,25 +221,25 @@ protected: virtual void prepare(QmlMetaProperty &); }; -class QFxItem; +class QmlGraphicsItem; class QmlParentActionPrivate; class QmlParentAction : public QmlAbstractAnimation { Q_OBJECT Q_DECLARE_PRIVATE(QmlParentAction) - Q_PROPERTY(QFxItem *target READ object WRITE setObject) - Q_PROPERTY(QFxItem *parent READ parent WRITE setParent) + Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) + Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) public: QmlParentAction(QObject *parent=0); virtual ~QmlParentAction(); - QFxItem *object() const; - void setObject(QFxItem *); + QmlGraphicsItem *object() const; + void setObject(QmlGraphicsItem *); - QFxItem *parent() const; - void setParent(QFxItem *); + QmlGraphicsItem *parent() const; + void setParent(QmlGraphicsItem *); protected: virtual void transition(QmlStateActions &actions, diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 1f52fcd..38b92ae 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -275,8 +275,8 @@ public: void init(); - QFxItem *pcTarget; - QFxItem *pcParent; + QmlGraphicsItem *pcTarget; + QmlGraphicsItem *pcParent; void doAction(); QActionAnimation *cpa; diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index bb40a8b..b07def1 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -274,7 +274,7 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state, } if (oldState == 0 || newState == 0) { - if (!nullState) { nullState = new QmlState; QFx_setParent_noEvent(nullState, q); } + if (!nullState) { nullState = new QmlState; QmlGraphics_setParent_noEvent(nullState, q); } if (!oldState) oldState = nullState; if (!newState) newState = nullState; } diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 4d469f9..1bd9199 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -59,15 +59,15 @@ class QmlParentChangePrivate : public QObjectPrivate public: QmlParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0) {} - QFxItem *target; - QFxItem *parent; - QGuard origParent; - QGuard origStackBefore; + QmlGraphicsItem *target; + QmlGraphicsItem *parent; + QGuard origParent; + QGuard origStackBefore; - void doChange(QFxItem *targetParent, QFxItem *stackBefore = 0); + void doChange(QmlGraphicsItem *targetParent, QmlGraphicsItem *stackBefore = 0); }; -void QmlParentChangePrivate::doChange(QFxItem *targetParent, QFxItem *stackBefore) +void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphicsItem *stackBefore) { if (targetParent && target && target->parentItem()) { //### for backwards direction, can we just restore original x, y, scale, rotation @@ -105,7 +105,7 @@ void QmlParentChangePrivate::doChange(QFxItem *targetParent, QFxItem *stackBefor qreal xt = transform.dx(); qreal yt = transform.dy(); - if (target->transformOrigin() != QFxItem::TopLeft) { + if (target->transformOrigin() != QmlGraphicsItem::TopLeft) { qreal tempxt = target->transformOriginPoint().x(); qreal tempyt = target->transformOriginPoint().y(); QTransform t; @@ -166,13 +166,13 @@ QmlParentChange::~QmlParentChange() This property holds the item to be reparented */ -QFxItem *QmlParentChange::object() const +QmlGraphicsItem *QmlParentChange::object() const { Q_D(const QmlParentChange); return d->target; } -void QmlParentChange::setObject(QFxItem *target) +void QmlParentChange::setObject(QmlGraphicsItem *target) { Q_D(QmlParentChange); d->target = target; @@ -183,13 +183,13 @@ void QmlParentChange::setObject(QFxItem *target) This property holds the parent for the item in this state */ -QFxItem *QmlParentChange::parent() const +QmlGraphicsItem *QmlParentChange::parent() const { Q_D(const QmlParentChange); return d->parent; } -void QmlParentChange::setParent(QFxItem *parent) +void QmlParentChange::setParent(QmlGraphicsItem *parent) { Q_D(QmlParentChange); d->parent = parent; @@ -207,13 +207,13 @@ QmlStateOperation::ActionList QmlParentChange::actions() return ActionList() << a; } -class AccessibleFxItem : public QFxItem +class AccessibleFxItem : public QmlGraphicsItem { Q_OBJECT - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsItem) public: int siblingIndex() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return d->siblingIndex; } }; @@ -238,7 +238,7 @@ void QmlParentChange::saveOriginals() int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1; QList children = d->origParent->childItems(); for (int i = 0; i < children.count(); ++i) { - QFxItem *child = qobject_cast(children.at(i)); + QmlGraphicsItem *child = qobject_cast(children.at(i)); if (!child) continue; if (((AccessibleFxItem*)child)->siblingIndex() == siblingIndex) { @@ -368,24 +368,24 @@ public: QmlAnchorChangesPrivate() : target(0) {} QString name; - QFxItem *target; + QmlGraphicsItem *target; QString resetString; QStringList resetList; - QFxAnchorLine left; - QFxAnchorLine right; - QFxAnchorLine horizontalCenter; - QFxAnchorLine top; - QFxAnchorLine bottom; - QFxAnchorLine verticalCenter; - QFxAnchorLine baseline; - - QFxAnchorLine origLeft; - QFxAnchorLine origRight; - QFxAnchorLine origHCenter; - QFxAnchorLine origTop; - QFxAnchorLine origBottom; - QFxAnchorLine origVCenter; - QFxAnchorLine origBaseline; + QmlGraphicsAnchorLine left; + QmlGraphicsAnchorLine right; + QmlGraphicsAnchorLine horizontalCenter; + QmlGraphicsAnchorLine top; + QmlGraphicsAnchorLine bottom; + QmlGraphicsAnchorLine verticalCenter; + QmlGraphicsAnchorLine baseline; + + QmlGraphicsAnchorLine origLeft; + QmlGraphicsAnchorLine origRight; + QmlGraphicsAnchorLine origHCenter; + QmlGraphicsAnchorLine origTop; + QmlGraphicsAnchorLine origBottom; + QmlGraphicsAnchorLine origVCenter; + QmlGraphicsAnchorLine origBaseline; qreal origX; qreal origY; qreal origWidth; @@ -413,13 +413,13 @@ QmlAnchorChanges::ActionList QmlAnchorChanges::actions() return ActionList() << a; } -QFxItem *QmlAnchorChanges::object() const +QmlGraphicsItem *QmlAnchorChanges::object() const { Q_D(const QmlAnchorChanges); return d->target; } -void QmlAnchorChanges::setObject(QFxItem *target) +void QmlAnchorChanges::setObject(QmlGraphicsItem *target) { Q_D(QmlAnchorChanges); d->target = target; @@ -450,85 +450,85 @@ void QmlAnchorChanges::setReset(const QString &reset) These properties change the respective anchors of the item. */ -QFxAnchorLine QmlAnchorChanges::left() const +QmlGraphicsAnchorLine QmlAnchorChanges::left() const { Q_D(const QmlAnchorChanges); return d->left; } -void QmlAnchorChanges::setLeft(const QFxAnchorLine &edge) +void QmlAnchorChanges::setLeft(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->left = edge; } -QFxAnchorLine QmlAnchorChanges::right() const +QmlGraphicsAnchorLine QmlAnchorChanges::right() const { Q_D(const QmlAnchorChanges); return d->right; } -void QmlAnchorChanges::setRight(const QFxAnchorLine &edge) +void QmlAnchorChanges::setRight(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->right = edge; } -QFxAnchorLine QmlAnchorChanges::horizontalCenter() const +QmlGraphicsAnchorLine QmlAnchorChanges::horizontalCenter() const { Q_D(const QmlAnchorChanges); return d->horizontalCenter; } -void QmlAnchorChanges::setHorizontalCenter(const QFxAnchorLine &edge) +void QmlAnchorChanges::setHorizontalCenter(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->horizontalCenter = edge; } -QFxAnchorLine QmlAnchorChanges::top() const +QmlGraphicsAnchorLine QmlAnchorChanges::top() const { Q_D(const QmlAnchorChanges); return d->top; } -void QmlAnchorChanges::setTop(const QFxAnchorLine &edge) +void QmlAnchorChanges::setTop(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->top = edge; } -QFxAnchorLine QmlAnchorChanges::bottom() const +QmlGraphicsAnchorLine QmlAnchorChanges::bottom() const { Q_D(const QmlAnchorChanges); return d->bottom; } -void QmlAnchorChanges::setBottom(const QFxAnchorLine &edge) +void QmlAnchorChanges::setBottom(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->bottom = edge; } -QFxAnchorLine QmlAnchorChanges::verticalCenter() const +QmlGraphicsAnchorLine QmlAnchorChanges::verticalCenter() const { Q_D(const QmlAnchorChanges); return d->verticalCenter; } -void QmlAnchorChanges::setVerticalCenter(const QFxAnchorLine &edge) +void QmlAnchorChanges::setVerticalCenter(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->verticalCenter = edge; } -QFxAnchorLine QmlAnchorChanges::baseline() const +QmlGraphicsAnchorLine QmlAnchorChanges::baseline() const { Q_D(const QmlAnchorChanges); return d->baseline; } -void QmlAnchorChanges::setBaseline(const QFxAnchorLine &edge) +void QmlAnchorChanges::setBaseline(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->baseline = edge; @@ -541,19 +541,19 @@ void QmlAnchorChanges::execute() return; //set any anchors that have been specified - if (d->left.anchorLine != QFxAnchorLine::Invalid) + if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setLeft(d->left); - if (d->right.anchorLine != QFxAnchorLine::Invalid) + if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setRight(d->right); - if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setHorizontalCenter(d->horizontalCenter); - if (d->top.anchorLine != QFxAnchorLine::Invalid) + if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setTop(d->top); - if (d->bottom.anchorLine != QFxAnchorLine::Invalid) + if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBottom(d->bottom); - if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setVerticalCenter(d->verticalCenter); - if (d->baseline.anchorLine != QFxAnchorLine::Invalid) + if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBaseline(d->baseline); } @@ -569,19 +569,19 @@ void QmlAnchorChanges::reverse() return; //restore previous anchors - if (d->origLeft.anchorLine != QFxAnchorLine::Invalid) + if (d->origLeft.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setLeft(d->origLeft); - if (d->origRight.anchorLine != QFxAnchorLine::Invalid) + if (d->origRight.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setRight(d->origRight); - if (d->origHCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setHorizontalCenter(d->origHCenter); - if (d->origTop.anchorLine != QFxAnchorLine::Invalid) + if (d->origTop.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setTop(d->origTop); - if (d->origBottom.anchorLine != QFxAnchorLine::Invalid) + if (d->origBottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBottom(d->origBottom); - if (d->origVCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setVerticalCenter(d->origVCenter); - if (d->origBaseline.anchorLine != QFxAnchorLine::Invalid) + if (d->origBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBaseline(d->origBaseline); } @@ -662,19 +662,19 @@ void QmlAnchorChanges::clearForwardBindings() d->target->anchors()->resetBaseline(); //reset any anchors that we'll be setting in the state - if (d->left.anchorLine != QFxAnchorLine::Invalid) + if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetLeft(); - if (d->right.anchorLine != QFxAnchorLine::Invalid) + if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetRight(); - if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetHorizontalCenter(); - if (d->top.anchorLine != QFxAnchorLine::Invalid) + if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetTop(); - if (d->bottom.anchorLine != QFxAnchorLine::Invalid) + if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBottom(); - if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetVerticalCenter(); - if (d->baseline.anchorLine != QFxAnchorLine::Invalid) + if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBaseline(); } @@ -687,35 +687,35 @@ void QmlAnchorChanges::clearReverseBindings() d->origHeight = d->target->height(); //reset any anchors that were set in the state - if (d->left.anchorLine != QFxAnchorLine::Invalid) + if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetLeft(); - if (d->right.anchorLine != QFxAnchorLine::Invalid) + if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetRight(); - if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetHorizontalCenter(); - if (d->top.anchorLine != QFxAnchorLine::Invalid) + if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetTop(); - if (d->bottom.anchorLine != QFxAnchorLine::Invalid) + if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBottom(); - if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetVerticalCenter(); - if (d->baseline.anchorLine != QFxAnchorLine::Invalid) + if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBaseline(); //reset any anchors that were set in the original state - if (d->origLeft.anchorLine != QFxAnchorLine::Invalid) + if (d->origLeft.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetLeft(); - if (d->origRight.anchorLine != QFxAnchorLine::Invalid) + if (d->origRight.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetRight(); - if (d->origHCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetHorizontalCenter(); - if (d->origTop.anchorLine != QFxAnchorLine::Invalid) + if (d->origTop.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetTop(); - if (d->origBottom.anchorLine != QFxAnchorLine::Invalid) + if (d->origBottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBottom(); - if (d->origVCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetVerticalCenter(); - if (d->origBaseline.anchorLine != QFxAnchorLine::Invalid) + if (d->origBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBaseline(); } diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h index 237e3e8..903998d 100644 --- a/src/declarative/util/qmlstateoperations.h +++ b/src/declarative/util/qmlstateoperations.h @@ -59,17 +59,17 @@ class Q_DECLARATIVE_EXPORT QmlParentChange : public QmlStateOperation, public Ac Q_OBJECT Q_DECLARE_PRIVATE(QmlParentChange) - Q_PROPERTY(QFxItem *target READ object WRITE setObject) - Q_PROPERTY(QFxItem *parent READ parent WRITE setParent) + Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) + Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) public: QmlParentChange(QObject *parent=0); ~QmlParentChange(); - QFxItem *object() const; - void setObject(QFxItem *); + QmlGraphicsItem *object() const; + void setObject(QmlGraphicsItem *); - QFxItem *parent() const; - void setParent(QFxItem *); + QmlGraphicsItem *parent() const; + void setParent(QmlGraphicsItem *); virtual ActionList actions(); @@ -111,15 +111,15 @@ class Q_DECLARATIVE_EXPORT QmlAnchorChanges : public QmlStateOperation, public A Q_OBJECT Q_DECLARE_PRIVATE(QmlAnchorChanges) - Q_PROPERTY(QFxItem *target READ object WRITE setObject) + Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) Q_PROPERTY(QString reset READ reset WRITE setReset) - Q_PROPERTY(QFxAnchorLine left READ left WRITE setLeft) - Q_PROPERTY(QFxAnchorLine right READ right WRITE setRight) - Q_PROPERTY(QFxAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter) - Q_PROPERTY(QFxAnchorLine top READ top WRITE setTop) - Q_PROPERTY(QFxAnchorLine bottom READ bottom WRITE setBottom) - Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter) - Q_PROPERTY(QFxAnchorLine baseline READ baseline WRITE setBaseline) + Q_PROPERTY(QmlGraphicsAnchorLine left READ left WRITE setLeft) + Q_PROPERTY(QmlGraphicsAnchorLine right READ right WRITE setRight) + Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter) + Q_PROPERTY(QmlGraphicsAnchorLine top READ top WRITE setTop) + Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom WRITE setBottom) + Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter) + Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline WRITE setBaseline) public: QmlAnchorChanges(QObject *parent=0); @@ -127,32 +127,32 @@ public: virtual ActionList actions(); - QFxItem *object() const; - void setObject(QFxItem *); + QmlGraphicsItem *object() const; + void setObject(QmlGraphicsItem *); QString reset() const; void setReset(const QString &); - QFxAnchorLine left() const; - void setLeft(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine left() const; + void setLeft(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine right() const; - void setRight(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine right() const; + void setRight(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine horizontalCenter() const; - void setHorizontalCenter(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine horizontalCenter() const; + void setHorizontalCenter(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine top() const; - void setTop(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine top() const; + void setTop(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine bottom() const; - void setBottom(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine bottom() const; + void setBottom(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine verticalCenter() const; - void setVerticalCenter(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine verticalCenter() const; + void setVerticalCenter(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine baseline() const; - void setBaseline(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine baseline() const; + void setBaseline(const QmlGraphicsAnchorLine &edge); virtual void execute(); virtual bool isReversable(); diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index f1991f5..1d90051 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -66,7 +66,7 @@ public: }; /*! - \qmlclass Timer QFxTimer + \qmlclass Timer QmlGraphicsTimer \brief The Timer item triggers a handler at a specified interval. A timer can be used to trigger an action either once, or repeatedly diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index 329a9b2..ac67cb8 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -136,7 +136,7 @@ public: : q(w), root(0), component(0), resizable(false) {} QmlView *q; - QFxItem *root; + QmlGraphicsItem *root; QUrl source; QString qml; @@ -193,7 +193,7 @@ void QmlViewPrivate::init() QmlMetaType::registerCustomStringConverter(QVariant::KeySequence, &stringToKeySequence); #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer perf; + QmlPerfTimer perf; #endif QFontDatabase database; @@ -213,7 +213,7 @@ void QmlViewPrivate::init() } /*! - The destructor clears the view's \l {QFxItem} {items} and + The destructor clears the view's \l {QmlGraphicsItem} {items} and deletes the internal representation. \sa clearItems() @@ -337,7 +337,7 @@ void QmlView::continueExecute() } if (obj) { - if (QFxItem *item = qobject_cast(obj)) { + if (QmlGraphicsItem *item = qobject_cast(obj)) { d->scene.addItem(item); @@ -476,11 +476,11 @@ QSize QmlView::sizeHint() const /*! Creates a \l{QmlComponent} {component} from the \a qml - string, and returns it as an \l {QFxItem} {item}. If the + string, and returns it as an \l {QmlGraphicsItem} {item}. If the \a parent item is provided, it becomes the new item's parent. \a parent should be in this view's item hierarchy. */ -QFxItem* QmlView::addItem(const QString &qml, QFxItem* parent) +QmlGraphicsItem* QmlView::addItem(const QString &qml, QmlGraphicsItem* parent) { if (!d->root) return 0; @@ -508,7 +508,7 @@ QFxItem* QmlView::addItem(const QString &qml, QFxItem* parent) } if (obj){ - QFxItem *item = static_cast(obj); + QmlGraphicsItem *item = static_cast(obj); if (!parent) parent = d->root; @@ -519,7 +519,7 @@ QFxItem* QmlView::addItem(const QString &qml, QFxItem* parent) } /*! - Deletes the view's \l {QFxItem} {items} and the \l {QmlEngine} + Deletes the view's \l {QmlGraphicsItem} {items} and the \l {QmlEngine} {QML engine's} Component cache. */ void QmlView::reset() @@ -530,7 +530,7 @@ void QmlView::reset() } /*! - Deletes the view's \l {QFxItem} {items}. + Deletes the view's \l {QmlGraphicsItem} {items}. */ void QmlView::clearItems() { @@ -541,9 +541,9 @@ void QmlView::clearItems() } /*! - Returns the view's root \l {QFxItem} {item}. + Returns the view's root \l {QmlGraphicsItem} {item}. */ -QFxItem *QmlView::root() const +QmlGraphicsItem *QmlView::root() const { return d->root; } diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qmlview.h index 822827a..4b2dd1c 100644 --- a/src/declarative/util/qmlview.h +++ b/src/declarative/util/qmlview.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxItem; +class QmlGraphicsItem; class QmlEngine; class QmlContext; class QmlError; @@ -78,10 +78,10 @@ public: virtual void execute(); virtual void reset(); - virtual QFxItem* addItem(const QString &qml, QFxItem* parent=0); + virtual QmlGraphicsItem* addItem(const QString &qml, QmlGraphicsItem* parent=0); virtual void clearItems(); - virtual QFxItem *root() const; + virtual QmlGraphicsItem *root() const; void setContentResizable(bool); bool contentResizable() const; diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 7c3c4f0..8fc9610 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -604,7 +604,7 @@ public: inline bool isPixmap() const { return (item->type() == QGraphicsPixmapItem::Type); - //|| (item->d_ptr->isObject && qobject_cast(q_func())); + //|| (item->d_ptr->isObject && qobject_cast(q_func())); } inline const QStyleOption *styleOption() const diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index ec977da..fea6ef3 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -13,7 +13,7 @@ public: tst_anchors() {} template - T *findItem(QFxItem *parent, const QString &id); + T *findItem(QmlGraphicsItem *parent, const QString &id); private slots: void basicAnchors(); @@ -27,12 +27,12 @@ private slots: Find an item with the specified id. */ template -T *tst_anchors::findItem(QFxItem *parent, const QString &objectName) +T *tst_anchors::findItem(QmlGraphicsItem *parent, const QString &objectName) { const QMetaObject &mo = T::staticMetaObject; QList children = parent->childItems(); for (int i = 0; i < children.count(); ++i) { - QFxItem *item = qobject_cast(children.at(i)->toGraphicsObject()); + QmlGraphicsItem *item = qobject_cast(children.at(i)->toGraphicsObject()); if (item) { if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { return static_cast(item); @@ -55,41 +55,41 @@ void tst_anchors::basicAnchors() qApp->processEvents(); //sibling horizontal - QCOMPARE(findItem(view->root(), QLatin1String("Rect1"))->x(), 26.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect2"))->x(), 122.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect3"))->x(), 74.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect4"))->x(), 16.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect5"))->x(), 112.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect6"))->x(), 64.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect1"))->x(), 26.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect2"))->x(), 122.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect3"))->x(), 74.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect4"))->x(), 16.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect5"))->x(), 112.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect6"))->x(), 64.0); //parent horizontal - QCOMPARE(findItem(view->root(), QLatin1String("Rect7"))->x(), 0.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect8"))->x(), 240.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect9"))->x(), 120.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect10"))->x(), -10.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect11"))->x(), 230.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect12"))->x(), 110.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect7"))->x(), 0.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect8"))->x(), 240.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect9"))->x(), 120.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect10"))->x(), -10.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect11"))->x(), 230.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect12"))->x(), 110.0); //vertical - QCOMPARE(findItem(view->root(), QLatin1String("Rect13"))->y(), 20.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect14"))->y(), 155.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect13"))->y(), 20.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect14"))->y(), 155.0); //stretch - QCOMPARE(findItem(view->root(), QLatin1String("Rect15"))->x(), 26.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect15"))->width(), 96.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect16"))->x(), 26.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect16"))->width(), 192.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect17"))->x(), -70.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect17"))->width(), 192.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect15"))->x(), 26.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect15"))->width(), 96.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect16"))->x(), 26.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect16"))->width(), 192.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect17"))->x(), -70.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect17"))->width(), 192.0); //vertical stretch - QCOMPARE(findItem(view->root(), QLatin1String("Rect18"))->y(), 20.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect18"))->height(), 40.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect18"))->y(), 20.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect18"))->height(), 40.0); //more parent horizontal - QCOMPARE(findItem(view->root(), QLatin1String("Rect19"))->x(), 115.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect20"))->x(), 235.0); - QCOMPARE(findItem(view->root(), QLatin1String("Rect21"))->x(), -5.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect19"))->x(), 115.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect20"))->x(), 235.0); + QCOMPARE(findItem(view->root(), QLatin1String("Rect21"))->x(), -5.0); delete view; } @@ -102,7 +102,7 @@ void tst_anchors::loops() view->setUrl(QUrl("file://" SRCDIR "/data/loop1.qml")); - QString expect = "QML QFxText (" + view->url().toString() + ":7:5" + ") Possible anchor loop detected on horizontal anchor."; + QString expect = "QML QmlGraphicsText (" + view->url().toString() + ":7:5" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); @@ -117,7 +117,7 @@ void tst_anchors::loops() view->setUrl(QUrl("file://" SRCDIR "/data/loop2.qml")); - QString expect = "QML QFxImage (" + view->url().toString() + ":14:3" + ") Possible anchor loop detected on horizontal anchor."; + QString expect = "QML QmlGraphicsImage (" + view->url().toString() + ":14:3" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); qApp->processEvents(); @@ -133,7 +133,7 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml")); - QString expect = "QML QFxRect (" + view->url().toString() + ":7:5" + ") Can't specify left, right, and hcenter anchors."; + QString expect = "QML QmlGraphicsRect (" + view->url().toString() + ":7:5" + ") Can't specify left, right, and hcenter anchors."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); qApp->processEvents(); @@ -146,7 +146,7 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml")); - QString expect = "QML QFxText (" + view->url().toString() + ":7:5" + ") Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."; + QString expect = "QML QmlGraphicsText (" + view->url().toString() + ":7:5" + ") Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); //qApp->processEvents(); @@ -159,7 +159,7 @@ void tst_anchors::illegalSets() view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml")); - QString expect = "QML QFxRect (" + view->url().toString() + ":9:5" + ") Can't anchor to an item that isn't a parent or sibling."; + QString expect = "QML QmlGraphicsRect (" + view->url().toString() + ":9:5" + ") Can't anchor to an item that isn't a parent or sibling."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); view->execute(); //qApp->processEvents(); @@ -170,25 +170,25 @@ void tst_anchors::illegalSets() void tst_anchors::reset() { - QFxItem *aItem = new QFxItem; - QFxAnchorLine anchor; + QmlGraphicsItem *aItem = new QmlGraphicsItem; + QmlGraphicsAnchorLine anchor; anchor.item = aItem; - anchor.anchorLine = QFxAnchorLine::Top; + anchor.anchorLine = QmlGraphicsAnchorLine::Top; - QFxItem *item = new QFxItem; + QmlGraphicsItem *item = new QmlGraphicsItem; item->anchors()->setBottom(anchor); - QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), true); + QCOMPARE(item->anchors()->usedAnchors().testFlag(QmlGraphicsAnchors::HasBottomAnchor), true); item->anchors()->resetBottom(); - QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), false); + QCOMPARE(item->anchors()->usedAnchors().testFlag(QmlGraphicsAnchors::HasBottomAnchor), false); } void tst_anchors::nullItem() { - QFxAnchorLine anchor; + QmlGraphicsAnchorLine anchor; - QTest::ignoreMessage(QtWarningMsg, "QML QFxItem (unknown location) Can't anchor to a null item."); - QFxItem *item = new QFxItem; + QTest::ignoreMessage(QtWarningMsg, "QML QmlGraphicsItem (unknown location) Can't anchor to a null item."); + QmlGraphicsItem *item = new QmlGraphicsItem; item->anchors()->setBottom(anchor); } diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp index 5c71731..46c953d 100644 --- a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp +++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp @@ -21,14 +21,14 @@ private slots: void tst_animatedimage::play() { - QFxAnimatedImageItem anim; + QmlGraphicsAnimatedImageItem anim; anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif")); QVERIFY(anim.isPlaying()); } void tst_animatedimage::pause() { - QFxAnimatedImageItem anim; + QmlGraphicsAnimatedImageItem anim; anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif")); anim.setPaused(true); QVERIFY(!anim.isPlaying()); @@ -36,7 +36,7 @@ void tst_animatedimage::pause() void tst_animatedimage::setFrame() { - QFxAnimatedImageItem anim; + QmlGraphicsAnimatedImageItem anim; anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif")); anim.setPaused(true); QVERIFY(!anim.isPlaying()); @@ -46,7 +46,7 @@ void tst_animatedimage::setFrame() void tst_animatedimage::frameCount() { - QFxAnimatedImageItem anim; + QmlGraphicsAnimatedImageItem anim; anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif")); QCOMPARE(anim.frameCount(), 299); } diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp index a6f67b8..b5cc9d4 100644 --- a/tests/auto/declarative/animations/tst_animations.cpp +++ b/tests/auto/declarative/animations/tst_animations.cpp @@ -32,7 +32,7 @@ private slots: void tst_animations::simpleNumber() { - QFxRect rect; + QmlGraphicsRect rect; QmlNumberAnimation animation; animation.setTarget(&rect); animation.setProperty("x"); @@ -50,7 +50,7 @@ void tst_animations::simpleNumber() void tst_animations::simpleColor() { - QFxRect rect; + QmlGraphicsRect rect; QmlColorAnimation animation; animation.setTarget(&rect); animation.setProperty("color"); @@ -68,7 +68,7 @@ void tst_animations::simpleColor() void tst_animations::alwaysRunToEnd() { - QFxRect rect; + QmlGraphicsRect rect; QmlPropertyAnimation animation; animation.setTarget(&rect); animation.setProperty("x"); @@ -86,7 +86,7 @@ void tst_animations::alwaysRunToEnd() void tst_animations::dotProperty() { - QFxRect rect; + QmlGraphicsRect rect; QmlNumberAnimation animation; animation.setTarget(&rect); animation.setProperty("border.width"); @@ -141,12 +141,12 @@ void tst_animations::badTypes() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype4.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("state1"); QTest::qWait(1000 + 50); - QFxRect *myRect = qobject_cast(rect->QGraphicsObject::children().at(3)); //### not robust + QmlGraphicsRect *myRect = qobject_cast(rect->QGraphicsObject::children().at(3)); //### not robust QVERIFY(myRect); QCOMPARE(myRect->x(),qreal(200)); } @@ -158,7 +158,7 @@ void tst_animations::badProperties() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badproperty1.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty1.qml:22:9) Cannot animate non-existant property \"pen.colr\""); @@ -174,12 +174,12 @@ void tst_animations::mixedTypes() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/mixedtype1.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("state1"); QTest::qWait(500); - QFxRect *myRect = qobject_cast(rect->QGraphicsObject::children().at(3)); //### not robust + QmlGraphicsRect *myRect = qobject_cast(rect->QGraphicsObject::children().at(3)); //### not robust QVERIFY(myRect); //rather inexact -- is there a better way? @@ -190,12 +190,12 @@ void tst_animations::mixedTypes() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/mixedtype2.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("state1"); QTest::qWait(500); - QFxRect *myRect = qobject_cast(rect->QGraphicsObject::children().at(3)); //### not robust + QmlGraphicsRect *myRect = qobject_cast(rect->QGraphicsObject::children().at(3)); //### not robust QVERIFY(myRect); //rather inexact -- is there a better way? diff --git a/tests/auto/declarative/behaviors/tst_behaviors.cpp b/tests/auto/declarative/behaviors/tst_behaviors.cpp index 7bfadf6..079e2e7 100644 --- a/tests/auto/declarative/behaviors/tst_behaviors.cpp +++ b/tests/auto/declarative/behaviors/tst_behaviors.cpp @@ -26,12 +26,12 @@ void tst_behaviors::simpleBehavior() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/simple.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - qreal x = qobject_cast(rect->findChild("MyRect"))->x(); + qreal x = qobject_cast(rect->findChild("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } @@ -39,12 +39,12 @@ void tst_behaviors::scriptTriggered() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/scripttrigger.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setColor(QColor("red")); QTest::qWait(100); - qreal x = qobject_cast(rect->findChild("MyRect"))->x(); + qreal x = qobject_cast(rect->findChild("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } @@ -52,10 +52,10 @@ void tst_behaviors::cppTriggered() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/cpptrigger.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); - QFxRect *innerRect = qobject_cast(rect->findChild("MyRect")); + QmlGraphicsRect *innerRect = qobject_cast(rect->findChild("MyRect")); QVERIFY(innerRect); innerRect->setProperty("x", 200); @@ -68,7 +68,7 @@ void tst_behaviors::loop() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/loop.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); //don't crash @@ -79,12 +79,12 @@ void tst_behaviors::colorBehavior() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/color.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("red"); QTest::qWait(100); - QColor color = qobject_cast(rect->findChild("MyRect"))->color(); + QColor color = qobject_cast(rect->findChild("MyRect"))->color(); QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered } @@ -92,12 +92,12 @@ void tst_behaviors::replaceBinding() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/binding.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - QFxRect *innerRect = qobject_cast(rect->findChild("MyRect")); + QmlGraphicsRect *innerRect = qobject_cast(rect->findChild("MyRect")); QVERIFY(innerRect); qreal x = innerRect->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered @@ -127,24 +127,24 @@ void tst_behaviors::group() { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/groupProperty.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - qreal x = qobject_cast(rect->findChild("MyRect"))->x(); + qreal x = qobject_cast(rect->findChild("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } { QmlEngine engine; QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/groupProperty2.qml")); - QFxRect *rect = qobject_cast(c.create()); + QmlGraphicsRect *rect = qobject_cast(c.create()); QVERIFY(rect); rect->setState("moved"); QTest::qWait(100); - qreal x = qobject_cast(rect->findChild("MyRect"))->x(); + qreal x = qobject_cast(rect->findChild("MyRect"))->x(); QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered } } diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index d1e6aab..70755ff 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -4,11 +4,11 @@ #include #include -class tst_QFxLayouts : public QObject +class tst_QmlGraphicsLayouts : public QObject { Q_OBJECT public: - tst_QFxLayouts(); + tst_QmlGraphicsLayouts(); private slots: void test_horizontal(); @@ -22,24 +22,24 @@ private: QmlView *createView(const QString &filename); }; -tst_QFxLayouts::tst_QFxLayouts() +tst_QmlGraphicsLayouts::tst_QmlGraphicsLayouts() { } -void tst_QFxLayouts::test_horizontal() +void tst_QmlGraphicsLayouts::test_horizontal() { QmlView *canvas = createView(SRCDIR "/data/horizontal.qml"); canvas->execute(); qApp->processEvents(); - QFxRect *one = canvas->root()->findChild("one"); + QmlGraphicsRect *one = canvas->root()->findChild("one"); QVERIFY(one != 0); - QFxRect *two = canvas->root()->findChild("two"); + QmlGraphicsRect *two = canvas->root()->findChild("two"); QVERIFY(two != 0); - QFxRect *three = canvas->root()->findChild("three"); + QmlGraphicsRect *three = canvas->root()->findChild("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -50,20 +50,20 @@ void tst_QFxLayouts::test_horizontal() QCOMPARE(three->y(), 0.0); } -void tst_QFxLayouts::test_horizontal_spacing() +void tst_QmlGraphicsLayouts::test_horizontal_spacing() { QmlView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); canvas->execute(); qApp->processEvents(); - QFxRect *one = canvas->root()->findChild("one"); + QmlGraphicsRect *one = canvas->root()->findChild("one"); QVERIFY(one != 0); - QFxRect *two = canvas->root()->findChild("two"); + QmlGraphicsRect *two = canvas->root()->findChild("two"); QVERIFY(two != 0); - QFxRect *three = canvas->root()->findChild("three"); + QmlGraphicsRect *three = canvas->root()->findChild("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -74,20 +74,20 @@ void tst_QFxLayouts::test_horizontal_spacing() QCOMPARE(three->y(), 0.0); } -void tst_QFxLayouts::test_vertical() +void tst_QmlGraphicsLayouts::test_vertical() { QmlView *canvas = createView(SRCDIR "/data/vertical.qml"); canvas->execute(); qApp->processEvents(); - QFxRect *one = canvas->root()->findChild("one"); + QmlGraphicsRect *one = canvas->root()->findChild("one"); QVERIFY(one != 0); - QFxRect *two = canvas->root()->findChild("two"); + QmlGraphicsRect *two = canvas->root()->findChild("two"); QVERIFY(two != 0); - QFxRect *three = canvas->root()->findChild("three"); + QmlGraphicsRect *three = canvas->root()->findChild("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -98,20 +98,20 @@ void tst_QFxLayouts::test_vertical() QCOMPARE(three->y(), 60.0); } -void tst_QFxLayouts::test_vertical_spacing() +void tst_QmlGraphicsLayouts::test_vertical_spacing() { QmlView *canvas = createView(SRCDIR "/data/vertical-spacing.qml"); canvas->execute(); qApp->processEvents(); - QFxRect *one = canvas->root()->findChild("one"); + QmlGraphicsRect *one = canvas->root()->findChild("one"); QVERIFY(one != 0); - QFxRect *two = canvas->root()->findChild("two"); + QmlGraphicsRect *two = canvas->root()->findChild("two"); QVERIFY(two != 0); - QFxRect *three = canvas->root()->findChild("three"); + QmlGraphicsRect *three = canvas->root()->findChild("three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); @@ -122,22 +122,22 @@ void tst_QFxLayouts::test_vertical_spacing() QCOMPARE(three->y(), 80.0); } -void tst_QFxLayouts::test_grid() +void tst_QmlGraphicsLayouts::test_grid() { QmlView *canvas = createView("data/grid.qml"); canvas->execute(); qApp->processEvents(); - QFxRect *one = canvas->root()->findChild("one"); + QmlGraphicsRect *one = canvas->root()->findChild("one"); QVERIFY(one != 0); - QFxRect *two = canvas->root()->findChild("two"); + QmlGraphicsRect *two = canvas->root()->findChild("two"); QVERIFY(two != 0); - QFxRect *three = canvas->root()->findChild("three"); + QmlGraphicsRect *three = canvas->root()->findChild("three"); QVERIFY(three != 0); - QFxRect *four = canvas->root()->findChild("four"); + QmlGraphicsRect *four = canvas->root()->findChild("four"); QVERIFY(four != 0); - QFxRect *five = canvas->root()->findChild("five"); + QmlGraphicsRect *five = canvas->root()->findChild("five"); QVERIFY(five != 0); QCOMPARE(one->x(), 0.0); @@ -152,22 +152,22 @@ void tst_QFxLayouts::test_grid() QCOMPARE(five->y(), 50.0); } -void tst_QFxLayouts::test_grid_spacing() +void tst_QmlGraphicsLayouts::test_grid_spacing() { QmlView *canvas = createView("data/grid-spacing.qml"); canvas->execute(); qApp->processEvents(); - QFxRect *one = canvas->root()->findChild("one"); + QmlGraphicsRect *one = canvas->root()->findChild("one"); QVERIFY(one != 0); - QFxRect *two = canvas->root()->findChild("two"); + QmlGraphicsRect *two = canvas->root()->findChild("two"); QVERIFY(two != 0); - QFxRect *three = canvas->root()->findChild("three"); + QmlGraphicsRect *three = canvas->root()->findChild("three"); QVERIFY(three != 0); - QFxRect *four = canvas->root()->findChild("four"); + QmlGraphicsRect *four = canvas->root()->findChild("four"); QVERIFY(four != 0); - QFxRect *five = canvas->root()->findChild("five"); + QmlGraphicsRect *five = canvas->root()->findChild("five"); QVERIFY(five != 0); QCOMPARE(one->x(), 0.0); @@ -182,7 +182,7 @@ void tst_QFxLayouts::test_grid_spacing() QCOMPARE(five->y(), 54.0); } -QmlView *tst_QFxLayouts::createView(const QString &filename) +QmlView *tst_QmlGraphicsLayouts::createView(const QString &filename) { QmlView *canvas = new QmlView(0); @@ -195,6 +195,6 @@ QmlView *tst_QFxLayouts::createView(const QString &filename) } -QTEST_MAIN(tst_QFxLayouts) +QTEST_MAIN(tst_QmlGraphicsLayouts) #include "tst_layouts.moc" diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp index 1875836..be65338 100644 --- a/tests/auto/declarative/listview/tst_listview.cpp +++ b/tests/auto/declarative/listview/tst_listview.cpp @@ -6,11 +6,11 @@ #include #include -class tst_QFxListView : public QObject +class tst_QmlGraphicsListView : public QObject { Q_OBJECT public: - tst_QFxListView(); + tst_QmlGraphicsListView(); private slots: // Test both QListModelInterface and QAbstractItemModel model types @@ -33,9 +33,9 @@ private: template void removed(); QmlView *createView(const QString &filename); template - T *findItem(QFxItem *parent, const QString &id, int index=-1); + T *findItem(QmlGraphicsItem *parent, const QString &id, int index=-1); template - QList findItems(QFxItem *parent, const QString &objectName); + QList findItems(QmlGraphicsItem *parent, const QString &objectName); }; class TestModel : public QListModelInterface @@ -164,12 +164,12 @@ private: QList > list; }; -tst_QFxListView::tst_QFxListView() +tst_QmlGraphicsListView::tst_QmlGraphicsListView() { } template -void tst_QFxListView::items() +void tst_QmlGraphicsListView::items() { QmlView *canvas = createView(SRCDIR "/data/listview.qml"); @@ -184,19 +184,19 @@ void tst_QFxListView::items() canvas->execute(); qApp->processEvents(); - QFxFlickable *listview = findItem(canvas->root(), "list"); + QmlGraphicsFlickable *listview = findItem(canvas->root(), "list"); QVERIFY(listview != 0); - QFxItem *viewport = listview->viewport(); + QmlGraphicsItem *viewport = listview->viewport(); QVERIFY(viewport != 0); QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item for (int i = 0; i < model.count(); ++i) { - QFxText *name = findItem(viewport, "textName", i); + QmlGraphicsText *name = findItem(viewport, "textName", i); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(i)); - QFxText *number = findItem(viewport, "textNumber", i); + QmlGraphicsText *number = findItem(viewport, "textNumber", i); QVERIFY(number != 0); QCOMPARE(number->text(), model.number(i)); } @@ -205,7 +205,7 @@ void tst_QFxListView::items() } template -void tst_QFxListView::changed() +void tst_QmlGraphicsListView::changed() { QmlView *canvas = createView(SRCDIR "/data/listview.qml"); @@ -220,17 +220,17 @@ void tst_QFxListView::changed() canvas->execute(); qApp->processEvents(); - QFxFlickable *listview = findItem(canvas->root(), "list"); + QmlGraphicsFlickable *listview = findItem(canvas->root(), "list"); QVERIFY(listview != 0); - QFxItem *viewport = listview->viewport(); + QmlGraphicsItem *viewport = listview->viewport(); QVERIFY(viewport != 0); model.modifyItem(1, "Will", "9876"); - QFxText *name = findItem(viewport, "textName", 1); + QmlGraphicsText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(1)); - QFxText *number = findItem(viewport, "textNumber", 1); + QmlGraphicsText *number = findItem(viewport, "textNumber", 1); QVERIFY(number != 0); QCOMPARE(number->text(), model.number(1)); @@ -238,7 +238,7 @@ void tst_QFxListView::changed() } template -void tst_QFxListView::inserted() +void tst_QmlGraphicsListView::inserted() { QmlView *canvas = createView(SRCDIR "/data/listview.qml"); @@ -253,10 +253,10 @@ void tst_QFxListView::inserted() canvas->execute(); qApp->processEvents(); - QFxListView *listview = findItem(canvas->root(), "list"); + QmlGraphicsListView *listview = findItem(canvas->root(), "list"); QVERIFY(listview != 0); - QFxItem *viewport = listview->viewport(); + QmlGraphicsItem *viewport = listview->viewport(); QVERIFY(viewport != 0); model.insertItem(1, "Will", "9876"); @@ -266,16 +266,16 @@ void tst_QFxListView::inserted() QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - QFxText *name = findItem(viewport, "textName", 1); + QmlGraphicsText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(1)); - QFxText *number = findItem(viewport, "textNumber", 1); + QmlGraphicsText *number = findItem(viewport, "textNumber", 1); QVERIFY(number != 0); QCOMPARE(number->text(), model.number(1)); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { - QFxItem *item = findItem(viewport, "wrapper", i); + QmlGraphicsItem *item = findItem(viewport, "wrapper", i); QVERIFY(item->y() == i*20); } @@ -286,10 +286,10 @@ void tst_QFxListView::inserted() QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - name = findItem(viewport, "textName", 0); + name = findItem(viewport, "textName", 0); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(0)); - number = findItem(viewport, "textNumber", 0); + number = findItem(viewport, "textNumber", 0); QVERIFY(number != 0); QCOMPARE(number->text(), model.number(0)); @@ -297,7 +297,7 @@ void tst_QFxListView::inserted() // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { - QFxItem *item = findItem(viewport, "wrapper", i); + QmlGraphicsItem *item = findItem(viewport, "wrapper", i); QVERIFY(item->y() == i*20); } @@ -305,7 +305,7 @@ void tst_QFxListView::inserted() } template -void tst_QFxListView::removed() +void tst_QmlGraphicsListView::removed() { QmlView *canvas = createView(SRCDIR "/data/listview.qml"); @@ -319,10 +319,10 @@ void tst_QFxListView::removed() canvas->execute(); qApp->processEvents(); - QFxListView *listview = findItem(canvas->root(), "list"); + QmlGraphicsListView *listview = findItem(canvas->root(), "list"); QVERIFY(listview != 0); - QFxItem *viewport = listview->viewport(); + QmlGraphicsItem *viewport = listview->viewport(); QVERIFY(viewport != 0); model.removeItem(1); @@ -330,17 +330,17 @@ void tst_QFxListView::removed() // let transitions settle. QTest::qWait(1000); - QFxText *name = findItem(viewport, "textName", 1); + QmlGraphicsText *name = findItem(viewport, "textName", 1); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(1)); - QFxText *number = findItem(viewport, "textNumber", 1); + QmlGraphicsText *number = findItem(viewport, "textNumber", 1); QVERIFY(number != 0); QCOMPARE(number->text(), model.number(1)); // Confirm items positioned correctly - int itemCount = findItems(viewport, "wrapper").count(); + int itemCount = findItems(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { - QFxItem *item = findItem(viewport, "wrapper", i); + QmlGraphicsItem *item = findItem(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; QVERIFY(item); QVERIFY(item->y() == i*20); @@ -352,17 +352,17 @@ void tst_QFxListView::removed() // let transitions settle. QTest::qWait(1000); - name = findItem(viewport, "textName", 0); + name = findItem(viewport, "textName", 0); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(0)); - number = findItem(viewport, "textNumber", 0); + number = findItem(viewport, "textNumber", 0); QVERIFY(number != 0); QCOMPARE(number->text(), model.number(0)); // Confirm items positioned correctly - itemCount = findItems(viewport, "wrapper").count(); + itemCount = findItems(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { - QFxItem *item = findItem(viewport, "wrapper", i); + QmlGraphicsItem *item = findItem(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; QVERIFY(item); QCOMPARE(item->y(),i*20.0 + 20.0); @@ -374,9 +374,9 @@ void tst_QFxListView::removed() QTest::qWait(1000); // Confirm items positioned correctly - itemCount = findItems(viewport, "wrapper").count(); + itemCount = findItems(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { - QFxItem *item = findItem(viewport, "wrapper", i); + QmlGraphicsItem *item = findItem(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; QVERIFY(item); QCOMPARE(item->y(),i*20.0+20.0); @@ -392,7 +392,7 @@ void tst_QFxListView::removed() // Confirm items positioned correctly for (int i = 2; i < 18; ++i) { - QFxItem *item = findItem(viewport, "wrapper", i); + QmlGraphicsItem *item = findItem(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; QVERIFY(item); QCOMPARE(item->y(),40+i*20.0); @@ -403,9 +403,9 @@ void tst_QFxListView::removed() QTest::qWait(1000); // Confirm items positioned correctly - itemCount = findItems(viewport, "wrapper").count(); + itemCount = findItems(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { - QFxItem *item = findItem(viewport, "wrapper", i); + QmlGraphicsItem *item = findItem(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; QVERIFY(item); QCOMPARE(item->y(),40+i*20.0); @@ -414,47 +414,47 @@ void tst_QFxListView::removed() delete canvas; } -void tst_QFxListView::qListModelInterface_items() +void tst_QmlGraphicsListView::qListModelInterface_items() { items(); } -void tst_QFxListView::qAbstractItemModel_items() +void tst_QmlGraphicsListView::qAbstractItemModel_items() { items(); } -void tst_QFxListView::qListModelInterface_changed() +void tst_QmlGraphicsListView::qListModelInterface_changed() { changed(); } -void tst_QFxListView::qAbstractItemModel_changed() +void tst_QmlGraphicsListView::qAbstractItemModel_changed() { changed(); } -void tst_QFxListView::qListModelInterface_inserted() +void tst_QmlGraphicsListView::qListModelInterface_inserted() { inserted(); } -void tst_QFxListView::qAbstractItemModel_inserted() +void tst_QmlGraphicsListView::qAbstractItemModel_inserted() { inserted(); } -void tst_QFxListView::qListModelInterface_removed() +void tst_QmlGraphicsListView::qListModelInterface_removed() { removed(); } -void tst_QFxListView::qAbstractItemModel_removed() +void tst_QmlGraphicsListView::qAbstractItemModel_removed() { removed(); } -QmlView *tst_QFxListView::createView(const QString &filename) +QmlView *tst_QmlGraphicsListView::createView(const QString &filename) { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); @@ -472,12 +472,12 @@ QmlView *tst_QFxListView::createView(const QString &filename) item must also evaluate the {index} expression equal to index */ template -T *tst_QFxListView::findItem(QFxItem *parent, const QString &objectName, int index) +T *tst_QmlGraphicsListView::findItem(QmlGraphicsItem *parent, const QString &objectName, int index) { const QMetaObject &mo = T::staticMetaObject; //qDebug() << parent->QGraphicsObject::children().count() << "children"; for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) { - QFxItem *item = qobject_cast(parent->QGraphicsObject::children().at(i)); + QmlGraphicsItem *item = qobject_cast(parent->QGraphicsObject::children().at(i)); if(!item) continue; //qDebug() << "try" << item; @@ -500,13 +500,13 @@ T *tst_QFxListView::findItem(QFxItem *parent, const QString &objectName, int ind } template -QList tst_QFxListView::findItems(QFxItem *parent, const QString &objectName) +QList tst_QmlGraphicsListView::findItems(QmlGraphicsItem *parent, const QString &objectName) { QList items; const QMetaObject &mo = T::staticMetaObject; //qDebug() << parent->QGraphicsObject::children().count() << "children"; for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) { - QFxItem *item = qobject_cast(parent->QGraphicsObject::children().at(i)); + QmlGraphicsItem *item = qobject_cast(parent->QGraphicsObject::children().at(i)); if(!item) continue; //qDebug() << "try" << item; @@ -519,6 +519,6 @@ QList tst_QFxListView::findItems(QFxItem *parent, const QString &objectName) } -QTEST_MAIN(tst_QFxListView) +QTEST_MAIN(tst_QmlGraphicsListView) #include "tst_listview.moc" diff --git a/tests/auto/declarative/pathview/tst_pathview.cpp b/tests/auto/declarative/pathview/tst_pathview.cpp index 6e670bf..d5b922a 100644 --- a/tests/auto/declarative/pathview/tst_pathview.cpp +++ b/tests/auto/declarative/pathview/tst_pathview.cpp @@ -7,11 +7,11 @@ #include #include -class tst_QFxPathView : public QObject +class tst_QmlGraphicsPathView : public QObject { Q_OBJECT public: - tst_QFxPathView(); + tst_QmlGraphicsPathView(); private slots: void items(); @@ -21,7 +21,7 @@ private slots: private: QmlView *createView(const QString &filename); template - T *findItem(QFxItem *parent, const QString &id, int index=-1); + T *findItem(QmlGraphicsItem *parent, const QString &id, int index=-1); }; class TestModel : public QListModelInterface @@ -95,11 +95,11 @@ private: QList > list; }; -tst_QFxPathView::tst_QFxPathView() +tst_QmlGraphicsPathView::tst_QmlGraphicsPathView() { } -void tst_QFxPathView::items() +void tst_QmlGraphicsPathView::items() { QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); @@ -114,16 +114,16 @@ void tst_QFxPathView::items() canvas->execute(); qApp->processEvents(); - QFxPathView *pathview = findItem(canvas->root(), "view"); + QmlGraphicsPathView *pathview = findItem(canvas->root(), "view"); QVERIFY(pathview != 0); QCOMPARE(pathview->childItems().count(), model.count()); // assumes all are visible for (int i = 0; i < model.count(); ++i) { - QFxText *name = findItem(pathview, "textName", i); + QmlGraphicsText *name = findItem(pathview, "textName", i); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(i)); - QFxText *number = findItem(pathview, "textNumber", i); + QmlGraphicsText *number = findItem(pathview, "textNumber", i); QVERIFY(number != 0); QCOMPARE(number->text(), model.number(i)); } @@ -131,7 +131,7 @@ void tst_QFxPathView::items() delete canvas; } -void tst_QFxPathView::pathMoved() +void tst_QmlGraphicsPathView::pathMoved() { QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); @@ -147,12 +147,12 @@ void tst_QFxPathView::pathMoved() canvas->execute(); qApp->processEvents(); - QFxPathView *pathview = findItem(canvas->root(), "view"); + QmlGraphicsPathView *pathview = findItem(canvas->root(), "view"); QVERIFY(pathview != 0); - QFxRect *firstItem = findItem(pathview, "wrapper", 0); + QmlGraphicsRect *firstItem = findItem(pathview, "wrapper", 0); QVERIFY(firstItem); - QFxPath *path = qobject_cast(pathview->path()); + QmlGraphicsPath *path = qobject_cast(pathview->path()); QVERIFY(path); QPointF start = path->pointAt(0.0); QPointF offset;//Center of item is at point, but pos is from corner @@ -163,7 +163,7 @@ void tst_QFxPathView::pathMoved() QTest::qWait(1000);//Moving is animated? for(int i=0; i(pathview, "wrapper", i); + QmlGraphicsRect *curItem = findItem(pathview, "wrapper", i); QCOMPARE(curItem->pos() + offset, path->pointAt(0.1 + i*0.25)); } @@ -174,7 +174,7 @@ void tst_QFxPathView::pathMoved() delete canvas; } -void tst_QFxPathView::limitedItems() +void tst_QmlGraphicsPathView::limitedItems() { QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); @@ -188,32 +188,32 @@ void tst_QFxPathView::limitedItems() canvas->execute(); qApp->processEvents(); - QFxPathView *pathview = findItem(canvas->root(), "view"); + QmlGraphicsPathView *pathview = findItem(canvas->root(), "view"); QVERIFY(pathview != 0); pathview->setPathItemCount(10); QCOMPARE(pathview->pathItemCount(), 10); - QFxRect *testItem = findItem(pathview, "wrapper", 0); + QmlGraphicsRect *testItem = findItem(pathview, "wrapper", 0); QVERIFY(testItem != 0); - testItem = findItem(pathview, "wrapper", 9); + testItem = findItem(pathview, "wrapper", 9); QVERIFY(testItem != 0); - testItem = findItem(pathview, "wrapper", 10); + testItem = findItem(pathview, "wrapper", 10); QVERIFY(testItem == 0); pathview->setCurrentIndex(50); QTest::qWait(5100);//Moving is animated and it's travelling far - should be reconsidered. - testItem = findItem(pathview, "wrapper", 0); + testItem = findItem(pathview, "wrapper", 0); QVERIFY(testItem == 0); - testItem = findItem(pathview, "wrapper", 1); + testItem = findItem(pathview, "wrapper", 1); QVERIFY(testItem == 0); - testItem = findItem(pathview, "wrapper", 9); + testItem = findItem(pathview, "wrapper", 9); QVERIFY(testItem == 0); - testItem = findItem(pathview, "wrapper", 50); + testItem = findItem(pathview, "wrapper", 50); QVERIFY(testItem != 0); } -QmlView *tst_QFxPathView::createView(const QString &filename) +QmlView *tst_QmlGraphicsPathView::createView(const QString &filename) { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); @@ -231,11 +231,11 @@ QmlView *tst_QFxPathView::createView(const QString &filename) item must also evaluate the {index} expression equal to index */ template -T *tst_QFxPathView::findItem(QFxItem *parent, const QString &objectName, int index) +T *tst_QmlGraphicsPathView::findItem(QmlGraphicsItem *parent, const QString &objectName, int index) { const QMetaObject &mo = T::staticMetaObject; for (int i = 0; i < parent->children().count(); ++i) { - QFxItem *item = qobject_cast(parent->children().at(i)); + QmlGraphicsItem *item = qobject_cast(parent->children().at(i)); if(!item) continue; if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { @@ -256,6 +256,6 @@ T *tst_QFxPathView::findItem(QFxItem *parent, const QString &objectName, int ind return 0; } -QTEST_MAIN(tst_QFxPathView) +QTEST_MAIN(tst_QmlGraphicsPathView) #include "tst_pathview.moc" diff --git a/tests/auto/declarative/qfxloader/tst_qfxloader.cpp b/tests/auto/declarative/qfxloader/tst_qfxloader.cpp index 2109898..99fecc3 100644 --- a/tests/auto/declarative/qfxloader/tst_qfxloader.cpp +++ b/tests/auto/declarative/qfxloader/tst_qfxloader.cpp @@ -41,7 +41,7 @@ tst_qfxloader::tst_qfxloader() void tst_qfxloader::url() { QmlComponent component(&engine, QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), QUrl("file://" SRCDIR "/")); - QFxLoader *loader = qobject_cast(component.create()); + QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); @@ -51,10 +51,10 @@ void tst_qfxloader::url() void tst_qfxloader::component() { QmlComponent component(&engine, QUrl("file://" SRCDIR "/SetSourceComponent.qml")); - QFxItem *item = qobject_cast(component.create()); + QmlGraphicsItem *item = qobject_cast(component.create()); QVERIFY(item); - QFxLoader *loader = qobject_cast(item->QGraphicsObject::children().at(1)); + QmlGraphicsLoader *loader = qobject_cast(item->QGraphicsObject::children().at(1)); QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); @@ -64,7 +64,7 @@ void tst_qfxloader::component() void tst_qfxloader::sizeLoaderToItem() { QmlComponent component(&engine, QUrl("file://" SRCDIR "/SizeToItem.qml")); - QFxLoader *loader = qobject_cast(component.create()); + QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QCOMPARE(loader->width(), 120.0); QCOMPARE(loader->height(), 60.0); @@ -73,12 +73,12 @@ void tst_qfxloader::sizeLoaderToItem() void tst_qfxloader::sizeItemToLoader() { QmlComponent component(&engine, QUrl("file://" SRCDIR "/SizeToLoader.qml")); - QFxLoader *loader = qobject_cast(component.create()); + QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QCOMPARE(loader->width(), 200.0); QCOMPARE(loader->height(), 80.0); - QFxItem *rect = loader->item(); + QmlGraphicsItem *rect = loader->item(); QVERIFY(rect); QCOMPARE(rect->width(), 200.0); QCOMPARE(rect->height(), 80.0); @@ -87,12 +87,12 @@ void tst_qfxloader::sizeItemToLoader() void tst_qfxloader::noResize() { QmlComponent component(&engine, QUrl("file://" SRCDIR "/NoResize.qml")); - QFxLoader *loader = qobject_cast(component.create()); + QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QCOMPARE(loader->width(), 200.0); QCOMPARE(loader->height(), 80.0); - QFxItem *rect = loader->item(); + QmlGraphicsItem *rect = loader->item(); QVERIFY(rect); QCOMPARE(rect->width(), 120.0); QCOMPARE(rect->height(), 60.0); diff --git a/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp b/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp index 5e24831..e735066 100644 --- a/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp +++ b/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp @@ -59,7 +59,7 @@ static const bool localfile_optimized = false; void tst_qfxpixmapcache::single_data() { - // Note, since QFxPixmapCache is shared, tests affect each other! + // Note, since QmlGraphicsPixmapCache is shared, tests affect each other! // so use different files fore all test functions. QTest::addColumn("target"); @@ -90,7 +90,7 @@ void tst_qfxpixmapcache::single() QPixmap pixmap; QVERIFY(pixmap.width() <= 0); // Check Qt assumption - QNetworkReply *reply= QFxPixmapCache::get(&engine, target, &pixmap); + QNetworkReply *reply= QmlGraphicsPixmapCache::get(&engine, target, &pixmap); if (incache) { QVERIFY(!reply); @@ -108,20 +108,20 @@ void tst_qfxpixmapcache::single() QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(getter.gotslot); if (exists) { - QVERIFY(QFxPixmapCache::find(target, &pixmap)); + QVERIFY(QmlGraphicsPixmapCache::find(target, &pixmap)); QVERIFY(pixmap.width() > 0); } else { - QVERIFY(!QFxPixmapCache::find(target, &pixmap)); + QVERIFY(!QmlGraphicsPixmapCache::find(target, &pixmap)); QVERIFY(pixmap.width() <= 0); } } - QCOMPARE(QFxPixmapCache::pendingRequests(), 0); + QCOMPARE(QmlGraphicsPixmapCache::pendingRequests(), 0); } void tst_qfxpixmapcache::parallel_data() { - // Note, since QFxPixmapCache is shared, tests affect each other! + // Note, since QmlGraphicsPixmapCache is shared, tests affect each other! // so use different files fore all test functions. QTest::addColumn("target1"); @@ -187,7 +187,7 @@ void tst_qfxpixmapcache::parallel() for (int i=0; i 0); @@ -200,10 +200,10 @@ void tst_qfxpixmapcache::parallel() } QCOMPARE(incache+slotters, targets.count()); - QCOMPARE(QFxPixmapCache::pendingRequests(), requests); + QCOMPARE(QmlGraphicsPixmapCache::pendingRequests(), requests); if (cancel >= 0) { - QFxPixmapCache::cancelGet(targets.at(cancel), getters[cancel]); + QmlGraphicsPixmapCache::cancelGet(targets.at(cancel), getters[cancel]); slotters--; } @@ -220,14 +220,14 @@ void tst_qfxpixmapcache::parallel() } else { QVERIFY(getters[i]->gotslot); QPixmap pixmap; - QVERIFY(QFxPixmapCache::find(targets[i], &pixmap)); + QVERIFY(QmlGraphicsPixmapCache::find(targets[i], &pixmap)); QVERIFY(pixmap.width() > 0); } delete getters[i]; } } - QCOMPARE(QFxPixmapCache::pendingRequests(), 0); + QCOMPARE(QmlGraphicsPixmapCache::pendingRequests(), 0); } QTEST_MAIN(tst_qfxpixmapcache) diff --git a/tests/auto/declarative/qfxtext/tst_qfxtext.cpp b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp index cae85a4..12cac68 100644 --- a/tests/auto/declarative/qfxtext/tst_qfxtext.cpp +++ b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp @@ -36,7 +36,7 @@ private: QList horizontalAlignmentments; QStringList styleStrings; - QList styles; + QList styles; QStringList colorStrings; @@ -72,10 +72,10 @@ tst_qfxtext::tst_qfxtext() << "Raised" << "Sunken"; - styles << QFxText::Normal - << QFxText::Outline - << QFxText::Raised - << QFxText::Sunken; + styles << QmlGraphicsText::Normal + << QmlGraphicsText::Outline + << QmlGraphicsText::Raised + << QmlGraphicsText::Sunken; colorStrings << "aliceblue" << "antiquewhite" @@ -100,7 +100,7 @@ void tst_qfxtext::text() { { QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); QCOMPARE(textObject->text(), QString("")); @@ -110,7 +110,7 @@ void tst_qfxtext::text() { QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); QCOMPARE(textObject->text(), standard.at(i)); @@ -120,7 +120,7 @@ void tst_qfxtext::text() { QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); QString expected = richText.at(i); @@ -133,7 +133,7 @@ void tst_qfxtext::width() // uses Font metrics to find the width for standard and document to find the width for rich { QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), 0.); } @@ -146,7 +146,7 @@ void tst_qfxtext::width() QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), qreal(metricWidth)); } @@ -161,7 +161,7 @@ void tst_qfxtext::width() QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), qreal(documentWidth)); } @@ -174,7 +174,7 @@ void tst_qfxtext::wrap() // for specified width and wrap set true { QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\"; wrap: true; width: 300 }", QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), 300.); } @@ -183,7 +183,7 @@ void tst_qfxtext::wrap() { QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), 300.); } @@ -192,7 +192,7 @@ void tst_qfxtext::wrap() { QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), 300.); } @@ -209,7 +209,7 @@ void tst_qfxtext::elide() { QmlComponent textComponent(&engine, ("import Qt 4.6\nText { text: \"\"; "+elide+" width: 300 }").toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), 300.); } @@ -218,7 +218,7 @@ void tst_qfxtext::elide() { QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), 300.); } @@ -228,7 +228,7 @@ void tst_qfxtext::elide() { QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->width(), 300.); } @@ -246,7 +246,7 @@ void tst_qfxtext::horizontalAlignment() { QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); } @@ -258,7 +258,7 @@ void tst_qfxtext::horizontalAlignment() { QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); } @@ -276,7 +276,7 @@ void tst_qfxtext::verticalAlignment() { QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); } @@ -288,7 +288,7 @@ void tst_qfxtext::verticalAlignment() { QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); } @@ -302,7 +302,7 @@ void tst_qfxtext::font() { QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().pointSize(), 40); QCOMPARE(textObject->font().bold(), false); @@ -312,7 +312,7 @@ void tst_qfxtext::font() { QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().bold(), true); QCOMPARE(textObject->font().italic(), false); @@ -321,7 +321,7 @@ void tst_qfxtext::font() { QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().italic(), true); QCOMPARE(textObject->font().bold(), false); @@ -330,7 +330,7 @@ void tst_qfxtext::font() { QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().family(), QString("Helvetica")); QCOMPARE(textObject->font().bold(), false); @@ -340,7 +340,7 @@ void tst_qfxtext::font() { QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().family(), QString("")); } @@ -353,7 +353,7 @@ void tst_qfxtext::style() { QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->style(), (int)styles.at(i)); QCOMPARE(textObject->styleColor(), QColor()); @@ -367,7 +367,7 @@ void tst_qfxtext::color() { QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); QCOMPARE(textObject->styleColor(), QColor()); @@ -377,7 +377,7 @@ void tst_qfxtext::color() { QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i))); // default color to black? @@ -390,7 +390,7 @@ void tst_qfxtext::color() { QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(j))); @@ -403,7 +403,7 @@ void tst_qfxtext::color() QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); - QFxText *textObject = qobject_cast(textComponent.create()); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->color(), testColor); } diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp index f78e564..0565fd4 100644 --- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp +++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp @@ -97,7 +97,7 @@ void tst_qfxtextedit::text() { { QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->text(), QString("")); @@ -107,7 +107,7 @@ void tst_qfxtextedit::text() { QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->text(), standard.at(i)); @@ -117,7 +117,7 @@ void tst_qfxtextedit::text() { QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QString actual = textEditObject->text(); @@ -134,7 +134,7 @@ void tst_qfxtextedit::width() // uses Font metrics to find the width for standard and document to find the width for rich { QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->width(), 1.);//+1 for cursor @@ -148,7 +148,7 @@ void tst_qfxtextedit::width() QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->width(), qreal(metricWidth + 1 + 3));//+3 is the current way of accounting for space between cursor and last character. @@ -164,7 +164,7 @@ void tst_qfxtextedit::width() QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->width(), qreal(documentWidth + 1 + 3)); @@ -176,7 +176,7 @@ void tst_qfxtextedit::wrap() // for specified width and wrap set true { QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->width(), 300.); @@ -186,7 +186,7 @@ void tst_qfxtextedit::wrap() { QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->width(), 300.); @@ -196,7 +196,7 @@ void tst_qfxtextedit::wrap() { QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->width(), 300.); @@ -215,7 +215,7 @@ void tst_qfxtextedit::hAlign() { QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); @@ -228,7 +228,7 @@ void tst_qfxtextedit::hAlign() { QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); @@ -247,7 +247,7 @@ void tst_qfxtextedit::vAlign() { QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); @@ -260,7 +260,7 @@ void tst_qfxtextedit::vAlign() { QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); @@ -275,7 +275,7 @@ void tst_qfxtextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->font().pointSize(), 40); @@ -286,7 +286,7 @@ void tst_qfxtextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->font().bold(), true); @@ -296,7 +296,7 @@ void tst_qfxtextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->font().italic(), true); @@ -306,7 +306,7 @@ void tst_qfxtextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->font().family(), QString("Helvetica")); @@ -317,7 +317,7 @@ void tst_qfxtextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->font().family(), QString("")); @@ -331,7 +331,7 @@ void tst_qfxtextedit::color() { QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i)); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->color(), QColor(colorStrings.at(i))); @@ -344,7 +344,7 @@ void tst_qfxtextedit::color() QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->color(), testColor); @@ -356,7 +356,7 @@ void tst_qfxtextedit::selection() QString testStr = standard[0];//TODO: What should happen for multiline/rich text? QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextEdit *textEditObject = qobject_cast(texteditComponent.create()); + QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -437,12 +437,12 @@ void tst_qfxtextedit::cursorDelegate() view->execute(); view->show(); view->setFocus(); - QFxTextEdit *textEditObject = view->root()->findChild("textEditObject"); + QmlGraphicsTextEdit *textEditObject = view->root()->findChild("textEditObject"); QVERIFY(textEditObject != 0); - QVERIFY(textEditObject->findChild("cursorInstance")); + QVERIFY(textEditObject->findChild("cursorInstance")); //Test Delegate gets created textEditObject->setFocus(true); - QFxItem* delegateObject = textEditObject->findChild("cursorInstance"); + QmlGraphicsItem* delegateObject = textEditObject->findChild("cursorInstance"); QVERIFY(delegateObject); //Test Delegate gets moved for(int i=0; i<= textEditObject->text().length(); i++){ @@ -455,7 +455,7 @@ void tst_qfxtextedit::cursorDelegate() QCOMPARE(textEditObject->cursorRect().y(), qRound(delegateObject->y())); //Test Delegate gets deleted textEditObject->setCursorDelegate(0); - QVERIFY(!textEditObject->findChild("cursorInstance")); + QVERIFY(!textEditObject->findChild("cursorInstance")); } /* @@ -471,7 +471,7 @@ void tst_qfxtextedit::navigation() QVERIFY(canvas->root() != 0); - QFxItem *input = qobject_cast(qvariant_cast(canvas->root()->property("myInput"))); + QmlGraphicsItem *input = qobject_cast(qvariant_cast(canvas->root()->property("myInput"))); QVERIFY(input != 0); QTRY_VERIFY(input->hasFocus() == true); diff --git a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp index 069574c..e4930f6 100644 --- a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp +++ b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include class tst_qfxtextinput : public QObject @@ -60,7 +60,7 @@ void tst_qfxtextinput::text() { { QmlComponent textinputComponent(&engine, "import Qt 4.6\nTextInput { text: \"\" }", QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->text(), QString("")); @@ -70,7 +70,7 @@ void tst_qfxtextinput::text() { QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->text(), standard.at(i)); @@ -83,7 +83,7 @@ void tst_qfxtextinput::width() // uses Font metrics to find the width for standard { QmlComponent textinputComponent(&engine, "import Qt 4.6\nTextInput { text: \"\" }", QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->width(), 1.);//1 for the cursor @@ -97,7 +97,7 @@ void tst_qfxtextinput::width() QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor @@ -110,7 +110,7 @@ void tst_qfxtextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().pointSize(), 40); @@ -121,7 +121,7 @@ void tst_qfxtextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.bold: true; text: \"Hello World\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().bold(), true); @@ -131,7 +131,7 @@ void tst_qfxtextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.italic: true; text: \"Hello World\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().italic(), true); @@ -141,7 +141,7 @@ void tst_qfxtextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().family(), QString("Helvetica")); @@ -152,7 +152,7 @@ void tst_qfxtextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.family: \"\"; text: \"Hello World\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().family(), QString("")); @@ -166,7 +166,7 @@ void tst_qfxtextinput::color() { QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); //qDebug() << "textinputObject: " << textinputObject->color() << "vs. " << QColor(colorStrings.at(i)); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i))); @@ -179,7 +179,7 @@ void tst_qfxtextinput::color() QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->color(), testColor); @@ -191,7 +191,7 @@ void tst_qfxtextinput::selection() QString testStr = standard[0]; QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -270,7 +270,7 @@ void tst_qfxtextinput::maxLength() { QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QVERIFY(textinputObject->text().isEmpty()); foreach(const QString &str, standard){ @@ -285,7 +285,7 @@ void tst_qfxtextinput::masks() { QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); //TODO: Me @@ -295,7 +295,7 @@ void tst_qfxtextinput::validators() { QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); - QFxTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); //TODO: Me @@ -314,7 +314,7 @@ void tst_qfxtextinput::navigation() QVERIFY(canvas->root() != 0); - QFxItem *input = qobject_cast(qvariant_cast(canvas->root()->property("myInput"))); + QmlGraphicsItem *input = qobject_cast(qvariant_cast(canvas->root()->property("myInput"))); QVERIFY(input != 0); QTRY_VERIFY(input->hasFocus() == true); @@ -334,12 +334,12 @@ void tst_qfxtextinput::cursorDelegate() view->execute(); view->show(); view->setFocus(); - QFxTextInput *textInputObject = view->root()->findChild("textInputObject"); + QmlGraphicsTextInput *textInputObject = view->root()->findChild("textInputObject"); QVERIFY(textInputObject != 0); - QVERIFY(textInputObject->findChild("cursorInstance")); + QVERIFY(textInputObject->findChild("cursorInstance")); //Test Delegate gets created textInputObject->setFocus(true); - QFxItem* delegateObject = textInputObject->findChild("cursorInstance"); + QmlGraphicsItem* delegateObject = textInputObject->findChild("cursorInstance"); QVERIFY(delegateObject); //Test Delegate gets moved for(int i=0; i<= textInputObject->text().length(); i++){ @@ -353,7 +353,7 @@ void tst_qfxtextinput::cursorDelegate() QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y())); //Test Delegate gets deleted textInputObject->setCursorDelegate(0); - QVERIFY(!textInputObject->findChild("cursorInstance")); + QVERIFY(!textInputObject->findChild("cursorInstance")); } void tst_qfxtextinput::simulateKey(QmlView *view, int key) diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp index dc124ce..6e3336c 100644 --- a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp +++ b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp @@ -68,7 +68,7 @@ void tst_qfxwebview::testBasicProperties() checkNoErrors(component); QWebSettings::enablePersistentStorage(tmpDir()); - QFxWebView *wv = qobject_cast(component.create()); + QmlGraphicsWebView *wv = qobject_cast(component.create()); QVERIFY(wv != 0); QTRY_COMPARE(wv->progress(), 1.0); QCOMPARE(wv->title(),QString("Basic")); @@ -87,7 +87,7 @@ void tst_qfxwebview::testBasicProperties() QCOMPARE(wv->preferredWidth(), 0); QCOMPARE(wv->zoomFactor(), 1.0); QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/basic.html")); - QCOMPARE(wv->status(), QFxWebView::Ready); + QCOMPARE(wv->status(), QmlGraphicsWebView::Ready); QVERIFY(wv->reloadAction()); QVERIFY(wv->reloadAction()->isEnabled()); QVERIFY(wv->backAction()); diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 6494c40..e2a4142 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -947,11 +947,11 @@ void tst_qmllanguage::importsLocal_data() QTest::newRow("local import") << "import \"subdir\"\n" // QT-613 "Test {}" - << "QFxRect"; + << "QmlGraphicsRect"; QTest::newRow("local import as") << "import \"subdir\" as T\n" "T.Test {}" - << "QFxRect"; + << "QmlGraphicsRect"; QTest::newRow("wrong local import as") << "import \"subdir\" as T\n" "Test {}" @@ -979,9 +979,9 @@ void tst_qmllanguage::importsRemote_data() + QtNetworkSettings::serverName() + "/qtest/declarative/qmllanguage"; - QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QFxRect"; - QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QFxText"; - QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QFxImage"; + QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QmlGraphicsRect"; + QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QmlGraphicsText"; + QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QmlGraphicsImage"; } void tst_qmllanguage::importsRemote() @@ -1002,11 +1002,11 @@ void tst_qmllanguage::importsInstalled_data() QTest::newRow("installed import 1") << "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QFxRect"; + << "QmlGraphicsRect"; QTest::newRow("installed import 2") << "import com.nokia.installedtest 1.4\n" "InstalledTest {}" - << "QFxText"; + << "QmlGraphicsText"; QTest::newRow("installed import visibility") // QT-614 << "import com.nokia.installedtest 1.4\n" "PrivateType {}" @@ -1030,36 +1030,36 @@ void tst_qmllanguage::importsOrder_data() "import com.nokia.installedtest 1.0\n" "import com.nokia.installedtest 1.4\n" "InstalledTest {}" - << "QFxText"; + << "QmlGraphicsText"; QTest::newRow("installed import overrides 2") << "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QFxRect"; + << "QmlGraphicsRect"; QTest::newRow("installed import re-overrides 1") << "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "import com.nokia.installedtest 1.4\n" "InstalledTest {}" - << "QFxText"; + << "QmlGraphicsText"; QTest::newRow("installed import re-overrides 2") << "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QFxRect"; + << "QmlGraphicsRect"; QTest::newRow("installed import versus builtin 1") << "import com.nokia.installedtest 1.5\n" "import Qt 4.6\n" "Rectangle {}" - << "QFxRect"; + << "QmlGraphicsRect"; QTest::newRow("installed import versus builtin 2") << "import Qt 4.6\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" - << "QFxText"; + << "QmlGraphicsText"; QTest::newRow("namespaces cannot be overridden by types 1") << "import Qt 4.6 as Rectangle\n" "import com.nokia.installedtest 1.5\n" @@ -1069,7 +1069,7 @@ void tst_qmllanguage::importsOrder_data() "import Qt 4.6 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle.Image {}" - << "QFxImage"; + << "QmlGraphicsImage"; } void tst_qmllanguage::importsOrder() diff --git a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp index 7d3cc43..d11771c 100644 --- a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp +++ b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp @@ -79,7 +79,7 @@ void tst_QmlPropertyMap::changed() QmlComponent component(&engine, "import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", QUrl("file://")); QVERIFY(component.isReady()); - QFxText *txt = qobject_cast(component.create()); + QmlGraphicsText *txt = qobject_cast(component.create()); QVERIFY(txt); QCOMPARE(txt->text(), QString('X')); QCOMPARE(spy.count(), 1); diff --git a/tests/auto/declarative/repeater/tst_repeater.cpp b/tests/auto/declarative/repeater/tst_repeater.cpp index 68007a6..0622028 100644 --- a/tests/auto/declarative/repeater/tst_repeater.cpp +++ b/tests/auto/declarative/repeater/tst_repeater.cpp @@ -5,11 +5,11 @@ #include #include -class tst_QFxRepeater : public QObject +class tst_QmlGraphicsRepeater : public QObject { Q_OBJECT public: - tst_QFxRepeater(); + tst_QmlGraphicsRepeater(); private slots: void stringList(); @@ -20,7 +20,7 @@ private: T *findItem(QObject *parent, const QString &id); }; -tst_QFxRepeater::tst_QFxRepeater() +tst_QmlGraphicsRepeater::tst_QmlGraphicsRepeater() { } @@ -29,7 +29,7 @@ The Repeater element creates children at its own position in its parent's stacking order. In this test we insert a repeater between two other Text elements to test this. */ -void tst_QFxRepeater::stringList() +void tst_QmlGraphicsRepeater::stringList() { QmlView *canvas = createView(SRCDIR "/data/repeater.qml"); @@ -45,10 +45,10 @@ void tst_QFxRepeater::stringList() canvas->execute(); qApp->processEvents(); - QFxRepeater *repeater = findItem(canvas->root(), "repeater"); + QmlGraphicsRepeater *repeater = findItem(canvas->root(), "repeater"); QVERIFY(repeater != 0); - QFxItem *container = findItem(canvas->root(), "container"); + QmlGraphicsItem *container = findItem(canvas->root(), "container"); QVERIFY(container != 0); QCOMPARE(container->childItems().count(), data.count() + 3); @@ -57,21 +57,21 @@ void tst_QFxRepeater::stringList() for (int i = 0; i < container->childItems().count(); ++i) { if (i == 0) { - QFxText *name = qobject_cast(container->childItems().at(i)); + QmlGraphicsText *name = qobject_cast(container->childItems().at(i)); QVERIFY(name != 0); QCOMPARE(name->text(), QLatin1String("Zero")); } else if (i == container->childItems().count() - 2) { // The repeater itself - QFxRepeater *rep = qobject_cast(container->childItems().at(i)); + QmlGraphicsRepeater *rep = qobject_cast(container->childItems().at(i)); QCOMPARE(rep, repeater); saw_repeater = true; continue; } else if (i == container->childItems().count() - 1) { - QFxText *name = qobject_cast(container->childItems().at(i)); + QmlGraphicsText *name = qobject_cast(container->childItems().at(i)); QVERIFY(name != 0); QCOMPARE(name->text(), QLatin1String("Last")); } else { - QFxText *name = qobject_cast(container->childItems().at(i)); + QmlGraphicsText *name = qobject_cast(container->childItems().at(i)); QVERIFY(name != 0); QCOMPARE(name->text(), data.at(i-1)); } @@ -82,7 +82,7 @@ void tst_QFxRepeater::stringList() } -QmlView *tst_QFxRepeater::createView(const QString &filename) +QmlView *tst_QmlGraphicsRepeater::createView(const QString &filename) { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); @@ -96,13 +96,13 @@ QmlView *tst_QFxRepeater::createView(const QString &filename) } template -T *tst_QFxRepeater::findItem(QObject *parent, const QString &objectName) +T *tst_QmlGraphicsRepeater::findItem(QObject *parent, const QString &objectName) { const QMetaObject &mo = T::staticMetaObject; if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName)) return static_cast(parent); for (int i = 0; i < parent->children().count(); ++i) { - QFxItem *item = findItem(parent->children().at(i), objectName); + QmlGraphicsItem *item = findItem(parent->children().at(i), objectName); if (item) return static_cast(item); } @@ -110,6 +110,6 @@ T *tst_QFxRepeater::findItem(QObject *parent, const QString &objectName) return 0; } -QTEST_MAIN(tst_QFxRepeater) +QTEST_MAIN(tst_QmlGraphicsRepeater) #include "tst_repeater.moc" diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 0ebdccd..e938ee4 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -157,7 +157,7 @@ void tst_sql::testQml() engine->setOfflineStoragePath(dbDir()); QmlComponent component(engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports - QFxText *text = qobject_cast(component.create()); + QmlGraphicsText *text = qobject_cast(component.create()); QVERIFY(text != 0); QCOMPARE(text->text(),result); QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).count(), databases*2); // *2 = .ini file + .sqlite file diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index b2532a2..91b6d0b 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -22,7 +22,7 @@ void tst_states::basicChanges() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -36,7 +36,7 @@ void tst_states::basicChanges() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -56,7 +56,7 @@ void tst_states::basicChanges() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -92,7 +92,7 @@ void tst_states::basicExtension() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -125,7 +125,7 @@ void tst_states::basicExtension() { QmlComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -156,7 +156,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -183,7 +183,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -213,7 +213,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -237,7 +237,7 @@ void tst_states::basicBinding() { QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml"); - QFxRect *rect = qobject_cast(rectComponent.create()); + QmlGraphicsRect *rect = qobject_cast(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); @@ -263,7 +263,7 @@ void tst_states::basicBinding() } } -class MyRect : public QFxRect +class MyRect : public QmlGraphicsRect { Q_OBJECT public: @@ -303,7 +303,7 @@ void tst_states::signalOverride() rect->doSomething(); QCOMPARE(rect->color(),QColor("blue")); - QFxRect *innerRect = qobject_cast(rect->findChild("extendedRect")); + QmlGraphicsRect *innerRect = qobject_cast(rect->findChild("extendedRect")); innerRect->setState("green"); rect->doSomething(); diff --git a/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp index ae6f9a3..b115445 100644 --- a/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp +++ b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp @@ -327,7 +327,7 @@ void tst_QmlPainting::drawTransformedImageRoundedRect() surface.save("ti.png"); } -//code from QFxRect for drawing rounded rects +//code from QmlGraphicsRect for drawing rounded rects void tst_QmlPainting::drawScaleGridRoundedRect() { //setup image @@ -422,7 +422,7 @@ void tst_QmlPainting::drawScaledScaleGridRoundedRect_data() // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied; } -//code from QFxRect for drawing rounded rects +//code from QmlGraphicsRect for drawing rounded rects void tst_QmlPainting::drawScaledScaleGridRoundedRect() { QFETCH(float, scale); @@ -522,7 +522,7 @@ void tst_QmlPainting::drawTransformedScaleGridRoundedRect_data() } -//code from QFxRect for drawing rounded rects +//code from QmlGraphicsRect for drawing rounded rects void tst_QmlPainting::drawTransformedScaleGridRoundedRect() { QFETCH(QTransform, transform); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 18c7916..c5ea308 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4276,7 +4276,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, } /*! - Output the "[Xxx instantiates the C++ class QFxXxx]" + Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. If there is no class node, or if the class node status @@ -4306,7 +4306,7 @@ void HtmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, } /*! - Output the "[QFxXxx is instantiated by QML element Xxx]" + Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" line for the class, if there should be one. If there is no QML element, or if the class node status diff --git a/tools/qmlviewer/qfxtester.cpp b/tools/qmlviewer/qfxtester.cpp index 0ccc9c0..a105701 100644 --- a/tools/qmlviewer/qfxtester.cpp +++ b/tools/qmlviewer/qfxtester.cpp @@ -24,12 +24,12 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, VisualTest, QFxVisualTest); -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Frame, QFxVisualTestFrame); -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Mouse, QFxVisualTestMouse); -QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Key, QFxVisualTestKey); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, VisualTest, QmlGraphicsVisualTest); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Frame, QmlGraphicsVisualTestFrame); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Mouse, QmlGraphicsVisualTestMouse); +QML_DEFINE_TYPE(Qt.VisualTest, 4, 6, (QT_VERSION&0x00ff00)>>8, Key, QmlGraphicsVisualTestKey); -QFxTester::QFxTester(const QString &script, QmlViewer::ScriptOptions opts, +QmlGraphicsTester::QmlGraphicsTester(const QString &script, QmlViewer::ScriptOptions opts, QmlView *parent) : QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), testscript(0), hasCompleted(false), hasFailed(false) @@ -42,7 +42,7 @@ QFxTester::QFxTester(const QString &script, QmlViewer::ScriptOptions opts, start(); } -QFxTester::~QFxTester() +QmlGraphicsTester::~QmlGraphicsTester() { if (!hasFailed && options & QmlViewer::Record && @@ -50,26 +50,26 @@ QFxTester::~QFxTester() save(); } -int QFxTester::duration() const +int QmlGraphicsTester::duration() const { return -1; } -void QFxTester::addMouseEvent(Destination dest, QMouseEvent *me) +void QmlGraphicsTester::addMouseEvent(Destination dest, QMouseEvent *me) { MouseEvent e(me); e.destination = dest; m_mouseEvents << e; } -void QFxTester::addKeyEvent(Destination dest, QKeyEvent *ke) +void QmlGraphicsTester::addKeyEvent(Destination dest, QKeyEvent *ke) { KeyEvent e(ke); e.destination = dest; m_keyEvents << e; } -bool QFxTester::eventFilter(QObject *o, QEvent *e) +bool QmlGraphicsTester::eventFilter(QObject *o, QEvent *e) { if (!filterEvents) return false; @@ -100,7 +100,7 @@ bool QFxTester::eventFilter(QObject *o, QEvent *e) return false; } -void QFxTester::executefailure() +void QmlGraphicsTester::executefailure() { hasFailed = true; @@ -108,7 +108,7 @@ void QFxTester::executefailure() exit(-1); } -void QFxTester::imagefailure() +void QmlGraphicsTester::imagefailure() { hasFailed = true; @@ -116,7 +116,7 @@ void QFxTester::imagefailure() exit(-1); } -void QFxTester::complete() +void QmlGraphicsTester::complete() { if (options & QmlViewer::ExitOnComplete) QApplication::exit(hasFailed?-1:0); @@ -129,17 +129,17 @@ void QFxTester::complete() qWarning("Script playback complete"); } -void QFxTester::run() +void QmlGraphicsTester::run() { QmlComponent c(m_view->engine(), m_script + QLatin1String(".qml")); - testscript = qobject_cast(c.create()); + testscript = qobject_cast(c.create()); if (testscript) testscript->setParent(this); else executefailure(); testscriptidx = 0; } -void QFxTester::save() +void QmlGraphicsTester::save() { QString filename = m_script + QLatin1String(".qml"); QFileInfo filenameInfo(filename); @@ -206,9 +206,9 @@ void QFxTester::save() file.close(); } -void QFxTester::updateCurrentTime(int msec) +void QmlGraphicsTester::updateCurrentTime(int msec) { - QFxItemPrivate::setConsistentTime(msec); + QmlGraphicsItemPrivate::setConsistentTime(msec); QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); @@ -268,17 +268,17 @@ void QFxTester::updateCurrentTime(int msec) QObject *event = testscript->event(testscriptidx); - if (QFxVisualTestFrame *frame = qobject_cast(event)) { + if (QmlGraphicsVisualTestFrame *frame = qobject_cast(event)) { if (frame->msec() < msec) { if (options & QmlViewer::TestImages) { - qWarning() << "QFxTester: Extra frame. Seen:" + qWarning() << "QmlGraphicsTester: Extra frame. Seen:" << msec << "Expected:" << frame->msec(); imagefailure(); } } else if (frame->msec() == msec) { if (frame->hash().toUtf8() != fe.hash.toHex()) { if (options & QmlViewer::TestImages) { - qWarning() << "QFxTester: Mismatched frame hash. Seen:" + qWarning() << "QmlGraphicsTester: Mismatched frame hash. Seen:" << fe.hash.toHex() << "Expected:" << frame->hash().toUtf8(); imagefailure(); @@ -292,13 +292,13 @@ void QFxTester::updateCurrentTime(int msec) QImage goodImage(frame->image().toLocalFile()); if (goodImage != img) { QString reject(frame->image().toLocalFile() + ".reject.png"); - qWarning() << "QFxTester: Image mismatch. Reject saved to:" + qWarning() << "QmlGraphicsTester: Image mismatch. Reject saved to:" << reject; img.save(reject); imagefailure(); } } - } else if (QFxVisualTestMouse *mouse = qobject_cast(event)) { + } else if (QmlGraphicsVisualTestMouse *mouse = qobject_cast(event)) { QPoint pos(mouse->x(), mouse->y()); QPoint globalPos = m_view->mapToGlobal(QPoint(0, 0)) + pos; QMouseEvent event((QEvent::Type)mouse->type(), pos, globalPos, (Qt::MouseButton)mouse->button(), (Qt::MouseButtons)mouse->buttons(), (Qt::KeyboardModifiers)mouse->modifiers()); @@ -313,7 +313,7 @@ void QFxTester::updateCurrentTime(int msec) me.destination = ViewPort; } m_savedMouseEvents.append(me); - } else if (QFxVisualTestKey *key = qobject_cast(event)) { + } else if (QmlGraphicsVisualTestKey *key = qobject_cast(event)) { QKeyEvent event((QEvent::Type)key->type(), key->key(), (Qt::KeyboardModifiers)key->modifiers(), QString::fromUtf8(QByteArray::fromHex(key->text().toUtf8())), key->autorep(), key->count()); diff --git a/tools/qmlviewer/qfxtester.h b/tools/qmlviewer/qfxtester.h index 52987db..c3a6f01 100644 --- a/tools/qmlviewer/qfxtester.h +++ b/tools/qmlviewer/qfxtester.h @@ -21,13 +21,13 @@ QT_BEGIN_NAMESPACE -class QFxVisualTest : public QObject +class QmlGraphicsVisualTest : public QObject { Q_OBJECT Q_PROPERTY(QList* events READ events CONSTANT) Q_CLASSINFO("DefaultProperty", "events") public: - QFxVisualTest() {} + QmlGraphicsVisualTest() {} QList *events() { return &m_events; } @@ -37,16 +37,16 @@ public: private: QList m_events; }; -QML_DECLARE_TYPE(QFxVisualTest) +QML_DECLARE_TYPE(QmlGraphicsVisualTest) -class QFxVisualTestFrame : public QObject +class QmlGraphicsVisualTestFrame : public QObject { Q_OBJECT Q_PROPERTY(int msec READ msec WRITE setMsec) Q_PROPERTY(QString hash READ hash WRITE setHash) Q_PROPERTY(QUrl image READ image WRITE setImage) public: - QFxVisualTestFrame() : m_msec(-1) {} + QmlGraphicsVisualTestFrame() : m_msec(-1) {} int msec() const { return m_msec; } void setMsec(int m) { m_msec = m; } @@ -62,9 +62,9 @@ private: QString m_hash; QUrl m_image; }; -QML_DECLARE_TYPE(QFxVisualTestFrame) +QML_DECLARE_TYPE(QmlGraphicsVisualTestFrame) -class QFxVisualTestMouse : public QObject +class QmlGraphicsVisualTestMouse : public QObject { Q_OBJECT Q_PROPERTY(int type READ type WRITE setType) @@ -75,7 +75,7 @@ class QFxVisualTestMouse : public QObject Q_PROPERTY(int modifiers READ modifiers WRITE setModifiers) Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) public: - QFxVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} + QmlGraphicsVisualTestMouse() : m_type(0), m_button(0), m_buttons(0), m_x(0), m_y(0), m_modifiers(0), m_viewport(false) {} int type() const { return m_type; } void setType(int t) { m_type = t; } @@ -106,9 +106,9 @@ private: int m_modifiers; bool m_viewport; }; -QML_DECLARE_TYPE(QFxVisualTestMouse) +QML_DECLARE_TYPE(QmlGraphicsVisualTestMouse) -class QFxVisualTestKey : public QObject +class QmlGraphicsVisualTestKey : public QObject { Q_OBJECT Q_PROPERTY(int type READ type WRITE setType) @@ -119,7 +119,7 @@ class QFxVisualTestKey : public QObject Q_PROPERTY(int count READ count WRITE setCount) Q_PROPERTY(bool sendToViewport READ sendToViewport WRITE setSendToViewport) public: - QFxVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} + QmlGraphicsVisualTestKey() : m_type(0), m_key(0), m_modifiers(0), m_autorep(false), m_count(0), m_viewport(false) {} int type() const { return m_type; } void setType(int t) { m_type = t; } @@ -150,13 +150,13 @@ private: int m_count; bool m_viewport; }; -QML_DECLARE_TYPE(QFxVisualTestKey) +QML_DECLARE_TYPE(QmlGraphicsVisualTestKey) -class QFxTester : public QAbstractAnimation +class QmlGraphicsTester : public QAbstractAnimation { public: - QFxTester(const QString &script, QmlViewer::ScriptOptions options, QmlView *parent); - ~QFxTester(); + QmlGraphicsTester(const QString &script, QmlViewer::ScriptOptions options, QmlView *parent); + ~QmlGraphicsTester(); virtual int duration() const; @@ -222,7 +222,7 @@ private: QmlViewer::ScriptOptions options; int testscriptidx; - QFxVisualTest *testscript; + QmlGraphicsVisualTest *testscript; bool hasCompleted; bool hasFailed; diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 3aeb0da..93470eb 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -637,7 +637,7 @@ void QmlViewer::openQml(const QString& file_or_url) setWindowTitle(tr("%1 - Qt Declarative UI Viewer").arg(file_or_url)); if (!m_script.isEmpty()) - tester = new QFxTester(m_script, m_scriptOptions, canvas); + tester = new QmlGraphicsTester(m_script, m_scriptOptions, canvas); canvas->reset(); diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index e1f53f9..bc8fe11 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -23,10 +23,10 @@ QT_BEGIN_NAMESPACE class QmlView; class PreviewDeviceSkin; -class QFxTestEngine; +class QmlGraphicsTestEngine; class QProcess; class RecordingDialog; -class QFxTester; +class QmlGraphicsTester; class QmlViewer : public QWidget { @@ -126,7 +126,7 @@ private: QString m_script; ScriptOptions m_scriptOptions; - QFxTester *tester; + QmlGraphicsTester *tester; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QmlViewer::ScriptOptions) -- cgit v0.12