diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-30 06:12:18 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-30 06:12:18 (GMT) |
commit | 564894627debad93433f16506ccf32afeb23d004 (patch) | |
tree | a96a4c6cc7cf4f8032bb915e08bbd0092a890e9c /src | |
parent | 44a0c19eae2099e6cdb44825123a4b8ee9a5bf20 (diff) | |
download | Qt-564894627debad93433f16506ccf32afeb23d004.zip Qt-564894627debad93433f16506ccf32afeb23d004.tar.gz Qt-564894627debad93433f16506ccf32afeb23d004.tar.bz2 |
Make private headers _p
Diffstat (limited to 'src')
189 files changed, 4556 insertions, 4555 deletions
diff --git a/src/declarative/3rdparty/3rdparty.pri b/src/declarative/3rdparty/3rdparty.pri index fc78cb2..09cf0bb 100644 --- a/src/declarative/3rdparty/3rdparty.pri +++ b/src/declarative/3rdparty/3rdparty.pri @@ -1,5 +1,5 @@ HEADERS += \ - 3rdparty/qlistmodelinterface.h\ + 3rdparty/qlistmodelinterface_p.h\ SOURCES += \ 3rdparty/qlistmodelinterface.cpp \ diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/3rdparty/qlistmodelinterface.cpp index b47ed8b..cfd4cff 100644 --- a/src/declarative/3rdparty/qlistmodelinterface.cpp +++ b/src/declarative/3rdparty/qlistmodelinterface.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qlistmodelinterface.h" +#include "qlistmodelinterface_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/3rdparty/qlistmodelinterface.h b/src/declarative/3rdparty/qlistmodelinterface_p.h index 44c4a24..44c4a24 100644 --- a/src/declarative/3rdparty/qlistmodelinterface.h +++ b/src/declarative/3rdparty/qlistmodelinterface_p.h diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 82746fc..6cffb28 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -4,8 +4,8 @@ SOURCES += debugger/qmldebuggerstatus.cpp \ debugger/qmldebugclient.cpp \ debugger/qmldebug.cpp -HEADERS += debugger/qmldebuggerstatus.h \ - debugger/qpacketprotocol.h \ - debugger/qmldebugservice.h \ - debugger/qmldebugclient.h \ - debugger/qmldebug.h +HEADERS += debugger/qmldebuggerstatus_p.h \ + debugger/qpacketprotocol_p.h \ + debugger/qmldebugservice_p.h \ + debugger/qmldebugclient_p.h \ + debugger/qmldebug_p.h diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp index 5a8cda0..69a7326 100644 --- a/src/declarative/debugger/qmldebug.cpp +++ b/src/declarative/debugger/qmldebug.cpp @@ -1,5 +1,5 @@ -#include "qmldebug.h" -#include "qmldebugclient.h" +#include "qmldebug_p.h" +#include "qmldebugclient_p.h" #include <private/qobject_p.h> #include <private/qmlenginedebug_p.h> diff --git a/src/declarative/debugger/qmldebug.h b/src/declarative/debugger/qmldebug_p.h index bd076ff..bd076ff 100644 --- a/src/declarative/debugger/qmldebug.h +++ b/src/declarative/debugger/qmldebug_p.h diff --git a/src/declarative/debugger/qmldebugclient.cpp b/src/declarative/debugger/qmldebugclient.cpp index 3171808..7264e14 100644 --- a/src/declarative/debugger/qmldebugclient.cpp +++ b/src/declarative/debugger/qmldebugclient.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qmldebugclient.h" +#include "qmldebugclient_p.h" #include <private/qobject_p.h> -#include <QtDeclarative/qpacketprotocol.h> +#include <private/qpacketprotocol_p.h> #include <QtCore/qdebug.h> #include <QtCore/qstringlist.h> diff --git a/src/declarative/debugger/qmldebugclient.h b/src/declarative/debugger/qmldebugclient_p.h index 6397670..6397670 100644 --- a/src/declarative/debugger/qmldebugclient.h +++ b/src/declarative/debugger/qmldebugclient_p.h diff --git a/src/declarative/debugger/qmldebuggerstatus.cpp b/src/declarative/debugger/qmldebuggerstatus.cpp index d46a21d..d4404a5 100644 --- a/src/declarative/debugger/qmldebuggerstatus.cpp +++ b/src/declarative/debugger/qmldebuggerstatus.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmldebuggerstatus.h" +#include "qmldebuggerstatus_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/debugger/qmldebuggerstatus.h b/src/declarative/debugger/qmldebuggerstatus_p.h index a8480f4..a8480f4 100644 --- a/src/declarative/debugger/qmldebuggerstatus.h +++ b/src/declarative/debugger/qmldebuggerstatus_p.h diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qmldebugservice.cpp index 6913def..241eee2 100644 --- a/src/declarative/debugger/qmldebugservice.cpp +++ b/src/declarative/debugger/qmldebugservice.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qmldebugservice.h" +#include "qmldebugservice_p.h" #include <QtCore/qdebug.h> #include <QtNetwork/qtcpserver.h> #include <QtNetwork/qtcpsocket.h> #include <private/qobject_p.h> -#include <QtDeclarative/qpacketprotocol.h> +#include <private/qpacketprotocol_p.h> #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/debugger/qmldebugservice.h b/src/declarative/debugger/qmldebugservice_p.h index 5d20ba0..5d20ba0 100644 --- a/src/declarative/debugger/qmldebugservice.h +++ b/src/declarative/debugger/qmldebugservice_p.h diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 84882dd..604c8f6 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qpacketprotocol.h" +#include "qpacketprotocol_p.h" #include <QBuffer> QT_BEGIN_NAMESPACE diff --git a/src/declarative/debugger/qpacketprotocol.h b/src/declarative/debugger/qpacketprotocol_p.h index f3fb44b..f3fb44b 100644 --- a/src/declarative/debugger/qpacketprotocol.h +++ b/src/declarative/debugger/qpacketprotocol_p.h diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri index 47cc8f8..9d0e760 100644 --- a/src/declarative/extra/extra.pri +++ b/src/declarative/extra/extra.pri @@ -9,19 +9,19 @@ SOURCES += \ extra/qmlfontloader.cpp HEADERS += \ - extra/qnumberformat.h \ - extra/qmlnumberformatter.h \ - extra/qmldatetimeformatter.h \ - extra/qmlgraphicsintegermodel.h \ - extra/qmlgraphicsanimatedimageitem.h \ + extra/qnumberformat_p.h \ + extra/qmlnumberformatter_p.h \ + extra/qmldatetimeformatter_p.h \ + extra/qmlgraphicsintegermodel_p.h \ extra/qmlgraphicsanimatedimageitem_p.h \ - extra/qmlgraphicsparticles.h \ - extra/qmlbehavior.h \ - extra/qmlfontloader.h + extra/qmlgraphicsanimatedimageitem_p_p.h \ + extra/qmlgraphicsparticles_p.h \ + extra/qmlbehavior_p.h \ + extra/qmlfontloader_p.h contains(QT_CONFIG, xmlpatterns) { QT+=xmlpatterns SOURCES += extra/qmlxmllistmodel.cpp - HEADERS += extra/qmlxmllistmodel.h + HEADERS += extra/qmlxmllistmodel_p.h } diff --git a/src/declarative/extra/qmlbehavior.cpp b/src/declarative/extra/qmlbehavior.cpp index 654cb4e..eac4220 100644 --- a/src/declarative/extra/qmlbehavior.cpp +++ b/src/declarative/extra/qmlbehavior.cpp @@ -40,9 +40,9 @@ ****************************************************************************/ #include <private/qobject_p.h> -#include "qmlanimation.h" -#include "qmltransition.h" -#include "qmlbehavior.h" +#include <private/qmlanimation_p.h> +#include <private/qmltransition_p.h> +#include "qmlbehavior_p.h" #include <QtDeclarative/qmlcontext.h> #include <QtDeclarative/qmlinfo.h> #include <QtCore/qparallelanimationgroup.h> diff --git a/src/declarative/extra/qmlbehavior.h b/src/declarative/extra/qmlbehavior_p.h index 6508455..0c8fdfd 100644 --- a/src/declarative/extra/qmlbehavior.h +++ b/src/declarative/extra/qmlbehavior_p.h @@ -45,7 +45,7 @@ #include <QtDeclarative/qmlpropertyvaluesource.h> #include <QtDeclarative/qmlpropertyvalueinterceptor.h> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlstate.h> +#include <private/qmlstate_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/extra/qmldatetimeformatter.cpp b/src/declarative/extra/qmldatetimeformatter.cpp index 9b3d37a..8d5deff 100644 --- a/src/declarative/extra/qmldatetimeformatter.cpp +++ b/src/declarative/extra/qmldatetimeformatter.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmldatetimeformatter.h" +#include "qmldatetimeformatter_p.h" #include "private/qobject_p.h" #include <QtCore/qlocale.h> diff --git a/src/declarative/extra/qmldatetimeformatter.h b/src/declarative/extra/qmldatetimeformatter_p.h index be0ae02..be0ae02 100644 --- a/src/declarative/extra/qmldatetimeformatter.h +++ b/src/declarative/extra/qmldatetimeformatter_p.h diff --git a/src/declarative/extra/qmlfontloader.cpp b/src/declarative/extra/qmlfontloader.cpp index f9857f6..dffbc3f 100644 --- a/src/declarative/extra/qmlfontloader.cpp +++ b/src/declarative/extra/qmlfontloader.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlfontloader.h" +#include "qmlfontloader_p.h" #include <QUrl> #include <QDebug> #include <QNetworkRequest> diff --git a/src/declarative/extra/qmlfontloader.h b/src/declarative/extra/qmlfontloader_p.h index c2c7a16..c2c7a16 100644 --- a/src/declarative/extra/qmlfontloader.h +++ b/src/declarative/extra/qmlfontloader_p.h diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp b/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp index c22e56d..b781e75 100644 --- a/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp +++ b/src/declarative/extra/qmlgraphicsanimatedimageitem.cpp @@ -42,8 +42,8 @@ #include <QMovie> #include <QtDeclarative/qmlcontext.h> #include <QtDeclarative/qmlengine.h> -#include "qmlgraphicsanimatedimageitem.h" #include "qmlgraphicsanimatedimageitem_p.h" +#include "qmlgraphicsanimatedimageitem_p_p.h" #include <QNetworkRequest> #include <QNetworkReply> diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem.h b/src/declarative/extra/qmlgraphicsanimatedimageitem.h deleted file mode 100644 index c62a98e..0000000 --- a/src/declarative/extra/qmlgraphicsanimatedimageitem.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSANIMATEDIMAGEITEM_H -#define QMLGRAPHICSANIMATEDIMAGEITEM_H - -#include <QtDeclarative/qmlgraphicsimage.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QMovie; -class QmlGraphicsAnimatedImageItemPrivate; - -class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImageItem : public QmlGraphicsImage -{ - Q_OBJECT - - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged) - Q_PROPERTY(int frameCount READ frameCount) -public: - QmlGraphicsAnimatedImageItem(QmlGraphicsItem *parent=0); - ~QmlGraphicsAnimatedImageItem(); - - bool isPlaying() const; - void setPlaying(bool play); - - bool isPaused() const; - void setPaused(bool pause); - - int currentFrame() const; - void setCurrentFrame(int frame); - - int frameCount() const; - - // Extends QmlGraphicsImage's src property*/ - virtual void setSource(const QUrl&); - -Q_SIGNALS: - void playingChanged(); - void pausedChanged(); - void frameChanged(); - -private Q_SLOTS: - void movieUpdate(); - void movieRequestFinished(); - void playingStatusChanged(); - -protected: - QmlGraphicsAnimatedImageItem(QmlGraphicsAnimatedImageItemPrivate &dd, QmlGraphicsItem *parent); - -private: - Q_DISABLE_COPY(QmlGraphicsAnimatedImageItem) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsAnimatedImageItem) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsAnimatedImageItem) - -QT_END_HEADER - -#endif diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem_p.h b/src/declarative/extra/qmlgraphicsanimatedimageitem_p.h index 04f1b6e..b0b6f14 100644 --- a/src/declarative/extra/qmlgraphicsanimatedimageitem_p.h +++ b/src/declarative/extra/qmlgraphicsanimatedimageitem_p.h @@ -39,43 +39,68 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSANIMATEDIMAGE_P_H -#define QMLGRAPHICSANIMATEDIMAGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// +#ifndef QMLGRAPHICSANIMATEDIMAGEITEM_H +#define QMLGRAPHICSANIMATEDIMAGEITEM_H #include <private/qmlgraphicsimage_p.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE +QT_MODULE(Declarative) + class QMovie; -class QNetworkReply; +class QmlGraphicsAnimatedImageItemPrivate; -class QmlGraphicsAnimatedImageItemPrivate : public QmlGraphicsImagePrivate +class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImageItem : public QmlGraphicsImage { - Q_DECLARE_PUBLIC(QmlGraphicsAnimatedImageItem) + Q_OBJECT + Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) + Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged) + Q_PROPERTY(int frameCount READ frameCount) public: - QmlGraphicsAnimatedImageItemPrivate() - : playing(true), paused(false), _movie(0), reply(0) - { - } - - bool playing; - bool paused; - QMovie *_movie; - QNetworkReply *reply; + QmlGraphicsAnimatedImageItem(QmlGraphicsItem *parent=0); + ~QmlGraphicsAnimatedImageItem(); + + bool isPlaying() const; + void setPlaying(bool play); + + bool isPaused() const; + void setPaused(bool pause); + + int currentFrame() const; + void setCurrentFrame(int frame); + + int frameCount() const; + + // Extends QmlGraphicsImage's src property*/ + virtual void setSource(const QUrl&); + +Q_SIGNALS: + void playingChanged(); + void pausedChanged(); + void frameChanged(); + +private Q_SLOTS: + void movieUpdate(); + void movieRequestFinished(); + void playingStatusChanged(); + +protected: + QmlGraphicsAnimatedImageItem(QmlGraphicsAnimatedImageItemPrivate &dd, QmlGraphicsItem *parent); + +private: + Q_DISABLE_COPY(QmlGraphicsAnimatedImageItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsAnimatedImageItem) }; QT_END_NAMESPACE -#endif // QMLGRAPHICSANIMATEDIMAGE_P_H +QML_DECLARE_TYPE(QmlGraphicsAnimatedImageItem) + +QT_END_HEADER + +#endif diff --git a/src/declarative/extra/qmlgraphicsanimatedimageitem_p_p.h b/src/declarative/extra/qmlgraphicsanimatedimageitem_p_p.h new file mode 100644 index 0000000..b43175f --- /dev/null +++ b/src/declarative/extra/qmlgraphicsanimatedimageitem_p_p.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSANIMATEDIMAGE_P_H +#define QMLGRAPHICSANIMATEDIMAGE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qmlgraphicsimage_p_p.h> + +QT_BEGIN_NAMESPACE + +class QMovie; +class QNetworkReply; + +class QmlGraphicsAnimatedImageItemPrivate : public QmlGraphicsImagePrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsAnimatedImageItem) + +public: + QmlGraphicsAnimatedImageItemPrivate() + : playing(true), paused(false), _movie(0), reply(0) + { + } + + bool playing; + bool paused; + QMovie *_movie; + QNetworkReply *reply; +}; + +QT_END_NAMESPACE + +#endif // QMLGRAPHICSANIMATEDIMAGE_P_H diff --git a/src/declarative/extra/qmlgraphicsintegermodel.cpp b/src/declarative/extra/qmlgraphicsintegermodel.cpp index e83b9c9..2bbb19d 100644 --- a/src/declarative/extra/qmlgraphicsintegermodel.cpp +++ b/src/declarative/extra/qmlgraphicsintegermodel.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsintegermodel.h" +#include "qmlgraphicsintegermodel_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/extra/qmlgraphicsintegermodel.h b/src/declarative/extra/qmlgraphicsintegermodel_p.h index 3cad05e..706e478 100644 --- a/src/declarative/extra/qmlgraphicsintegermodel.h +++ b/src/declarative/extra/qmlgraphicsintegermodel_p.h @@ -44,7 +44,7 @@ #include <QtCore/QObject> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qlistmodelinterface.h> +#include <private/qlistmodelinterface_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/extra/qmlgraphicsparticles.cpp b/src/declarative/extra/qmlgraphicsparticles.cpp index dba3ac4..5a23126 100644 --- a/src/declarative/extra/qmlgraphicsparticles.cpp +++ b/src/declarative/extra/qmlgraphicsparticles.cpp @@ -50,12 +50,12 @@ #ifndef INT_MAX #define INT_MAX 2147483647 #endif -#include <qmlgraphicspixmapcache.h> -#include <private/qfxperf_p.h> -#include <private/qmlanimation_p.h> +#include <private/qmlgraphicspixmapcache_p.h> +#include <private/qfxperf_p_p.h> +#include <private/qmlanimation_p_p.h> #include <QNetworkReply> -#include "qmlgraphicsparticles.h" +#include "qmlgraphicsparticles_p.h" #include <QPainter> #include <QtGui/qdrawutil.h> #include <QVarLengthArray> diff --git a/src/declarative/extra/qmlgraphicsparticles.h b/src/declarative/extra/qmlgraphicsparticles_p.h index eed0d62..eed0d62 100644 --- a/src/declarative/extra/qmlgraphicsparticles.h +++ b/src/declarative/extra/qmlgraphicsparticles_p.h diff --git a/src/declarative/extra/qmlnumberformatter.cpp b/src/declarative/extra/qmlnumberformatter.cpp index 5b76e45..8b477bb 100644 --- a/src/declarative/extra/qmlnumberformatter.cpp +++ b/src/declarative/extra/qmlnumberformatter.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlnumberformatter.h" +#include "qmlnumberformatter_p.h" #include "private/qobject_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/extra/qmlnumberformatter.h b/src/declarative/extra/qmlnumberformatter_p.h index d9abee7..515f71a 100644 --- a/src/declarative/extra/qmlnumberformatter.h +++ b/src/declarative/extra/qmlnumberformatter_p.h @@ -43,7 +43,7 @@ #define QMLNUMBERFORMATTER_H #include <QtDeclarative/qml.h> -#include <QtDeclarative/qnumberformat.h> +#include <private/qnumberformat_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index a3c96fd..98d836b 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlxmllistmodel.h" +#include "qmlxmllistmodel_p.h" #include "private/qobject_p.h" #include <QtDeclarative/qmlcontext.h> diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel_p.h index 1bcc008..1bcc008 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel_p.h diff --git a/src/declarative/extra/qnumberformat.cpp b/src/declarative/extra/qnumberformat.cpp index cde2fb0..7e28491 100644 --- a/src/declarative/extra/qnumberformat.cpp +++ b/src/declarative/extra/qnumberformat.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qnumberformat.h" +#include "qnumberformat_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/extra/qnumberformat.h b/src/declarative/extra/qnumberformat_p.h index 830cf79..830cf79 100644 --- a/src/declarative/extra/qnumberformat.h +++ b/src/declarative/extra/qnumberformat_p.h diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 7759ab1..20e1503 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -1,49 +1,49 @@ HEADERS += \ - fx/qmlgraphicsanchors.h \ fx/qmlgraphicsanchors_p.h \ - fx/qmlgraphicsevents_p.h \ - fx/qmlgraphicsflickable.h \ + fx/qmlgraphicsanchors_p_p.h \ + fx/qmlgraphicsevents_p_p.h \ fx/qmlgraphicsflickable_p.h \ - fx/qmlgraphicsflipable.h \ - fx/qmlgraphicsgridview.h \ - fx/qmlgraphicsimage.h \ - fx/qmlgraphicsimagebase.h \ - fx/qmlgraphicsborderimage.h \ - fx/qmlgraphicspainteditem.h \ - fx/qmlgraphicspainteditem_p.h \ + fx/qmlgraphicsflickable_p_p.h \ + fx/qmlgraphicsflipable_p.h \ + fx/qmlgraphicsgridview_p.h \ fx/qmlgraphicsimage_p.h \ - fx/qmlgraphicsborderimage_p.h \ fx/qmlgraphicsimagebase_p.h \ + fx/qmlgraphicsborderimage_p.h \ + fx/qmlgraphicspainteditem_p.h \ + fx/qmlgraphicspainteditem_p_p.h \ + fx/qmlgraphicsimage_p_p.h \ + fx/qmlgraphicsborderimage_p_p.h \ + fx/qmlgraphicsimagebase_p_p.h \ fx/qmlgraphicsitem.h \ fx/qmlgraphicsitem_p.h \ - fx/qmlgraphicsfocuspanel.h \ - fx/qmlgraphicsfocusscope.h \ - fx/qmlgraphicspositioners.h \ + fx/qmlgraphicsfocuspanel_p.h \ + fx/qmlgraphicsfocusscope_p.h \ fx/qmlgraphicspositioners_p.h \ - fx/qmlgraphicsloader.h \ + fx/qmlgraphicspositioners_p_p.h \ fx/qmlgraphicsloader_p.h \ - fx/qmlgraphicsmouseregion.h \ + fx/qmlgraphicsloader_p_p.h \ fx/qmlgraphicsmouseregion_p.h \ - fx/qmlgraphicspath.h \ + fx/qmlgraphicsmouseregion_p_p.h \ fx/qmlgraphicspath_p.h \ - fx/qmlgraphicspathview.h \ + fx/qmlgraphicspath_p_p.h \ fx/qmlgraphicspathview_p.h \ - fx/qmlgraphicsrect.h \ + fx/qmlgraphicspathview_p_p.h \ fx/qmlgraphicsrect_p.h \ - fx/qmlgraphicsrepeater.h \ + fx/qmlgraphicsrect_p_p.h \ fx/qmlgraphicsrepeater_p.h \ - fx/qmlgraphicsscalegrid_p.h \ - fx/qmlgraphicstextinput.h \ + fx/qmlgraphicsrepeater_p_p.h \ + fx/qmlgraphicsscalegrid_p_p.h \ fx/qmlgraphicstextinput_p.h \ - fx/qmlgraphicstextedit.h \ + fx/qmlgraphicstextinput_p_p.h \ fx/qmlgraphicstextedit_p.h \ - fx/qmlgraphicstext.h \ + fx/qmlgraphicstextedit_p_p.h \ fx/qmlgraphicstext_p.h \ - fx/qmlgraphicspixmapcache.h \ - fx/qmlgraphicsvisualitemmodel.h \ - fx/qmlgraphicslistview.h \ - fx/qmlgraphicsgraphicsobjectcontainer.h \ - fx/qmlgraphicslayoutitem.h \ + fx/qmlgraphicstext_p_p.h \ + fx/qmlgraphicspixmapcache_p.h \ + fx/qmlgraphicsvisualitemmodel_p.h \ + fx/qmlgraphicslistview_p.h \ + fx/qmlgraphicsgraphicsobjectcontainer_p.h \ + fx/qmlgraphicslayoutitem_p.h \ fx/qmlgraphicseffects.cpp SOURCES += \ @@ -79,6 +79,6 @@ SOURCES += \ contains(QT_CONFIG, webkit) { QT+=webkit SOURCES += fx/qmlgraphicswebview.cpp - HEADERS += fx/qmlgraphicswebview.h + HEADERS += fx/qmlgraphicswebview_p.h } diff --git a/src/declarative/fx/qmlgraphicsanchors.cpp b/src/declarative/fx/qmlgraphicsanchors.cpp index d0e26d8..fc1a1c6 100644 --- a/src/declarative/fx/qmlgraphicsanchors.cpp +++ b/src/declarative/fx/qmlgraphicsanchors.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsanchors_p.h" +#include "qmlgraphicsanchors_p_p.h" #include "qmlgraphicsitem.h" #include "qmlgraphicsitem_p.h" #include <QDebug> @@ -956,7 +956,7 @@ bool QmlGraphicsAnchorsPrivate::checkVAnchorValid(QmlGraphicsAnchorLine anchor) return true; } -QT_END_NAMESPACE +#include "moc_qmlgraphicsanchors_p.cpp" -#include "moc_qmlgraphicsanchors.cpp" +QT_END_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicsanchors.h b/src/declarative/fx/qmlgraphicsanchors.h deleted file mode 100644 index de7214d..0000000 --- a/src/declarative/fx/qmlgraphicsanchors.h +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSANCHORS_H -#define QMLGRAPHICSANCHORS_H - -#include <QtCore/QObject> -#include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlgraphicsitem.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlGraphicsAnchorsPrivate; -class QmlGraphicsAnchorLine; -class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject -{ - Q_OBJECT - - 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()) - Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged) - 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(QmlGraphicsItem *fill READ fill WRITE setFill) - Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn) - -public: - QmlGraphicsAnchors(QObject *parent=0); - virtual ~QmlGraphicsAnchors(); - - enum UsedAnchor { - HasLeftAnchor = 0x01, - HasRightAnchor = 0x02, - HasTopAnchor = 0x04, - HasBottomAnchor = 0x08, - HasHCenterAnchor = 0x10, - HasVCenterAnchor = 0x20, - HasBaselineAnchor = 0x40, - Horizontal_Mask = HasLeftAnchor | HasRightAnchor | HasHCenterAnchor, - Vertical_Mask = HasTopAnchor | HasBottomAnchor | HasVCenterAnchor | HasBaselineAnchor - }; - Q_DECLARE_FLAGS(UsedAnchors, UsedAnchor) - - QmlGraphicsAnchorLine left() const; - void setLeft(const QmlGraphicsAnchorLine &edge); - void resetLeft(); - - QmlGraphicsAnchorLine right() const; - void setRight(const QmlGraphicsAnchorLine &edge); - void resetRight(); - - QmlGraphicsAnchorLine horizontalCenter() const; - void setHorizontalCenter(const QmlGraphicsAnchorLine &edge); - void resetHorizontalCenter(); - - QmlGraphicsAnchorLine top() const; - void setTop(const QmlGraphicsAnchorLine &edge); - void resetTop(); - - QmlGraphicsAnchorLine bottom() const; - void setBottom(const QmlGraphicsAnchorLine &edge); - void resetBottom(); - - QmlGraphicsAnchorLine verticalCenter() const; - void setVerticalCenter(const QmlGraphicsAnchorLine &edge); - void resetVerticalCenter(); - - QmlGraphicsAnchorLine baseline() const; - void setBaseline(const QmlGraphicsAnchorLine &edge); - void resetBaseline(); - - qreal leftMargin() const; - void setLeftMargin(qreal); - - qreal rightMargin() const; - void setRightMargin(qreal); - - qreal horizontalCenterOffset() const; - void setHorizontalCenterOffset(qreal); - - qreal topMargin() const; - void setTopMargin(qreal); - - qreal bottomMargin() const; - void setBottomMargin(qreal); - - qreal verticalCenterOffset() const; - void setVerticalCenterOffset(qreal); - - qreal baselineOffset() const; - void setBaselineOffset(qreal); - - QmlGraphicsItem *fill() const; - void setFill(QmlGraphicsItem *); - - QmlGraphicsItem *centerIn() const; - void setCenterIn(QmlGraphicsItem *); - - UsedAnchors usedAnchors() const; - - void setItem(QmlGraphicsItem *item); - - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - void leftMarginChanged(); - void rightMarginChanged(); - void topMarginChanged(); - void bottomMarginChanged(); - void verticalCenterOffsetChanged(); - void horizontalCenterOffsetChanged(); - void baselineOffsetChanged(); - -private: - friend class QmlGraphicsItem; - Q_DISABLE_COPY(QmlGraphicsAnchors) - Q_DECLARE_PRIVATE(QmlGraphicsAnchors) -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(QmlGraphicsAnchors::UsedAnchors) - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsAnchors) - -QT_END_HEADER - -#endif diff --git a/src/declarative/fx/qmlgraphicsanchors_p.h b/src/declarative/fx/qmlgraphicsanchors_p.h index 3986cd6..de7214d 100644 --- a/src/declarative/fx/qmlgraphicsanchors_p.h +++ b/src/declarative/fx/qmlgraphicsanchors_p.h @@ -39,122 +39,142 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSANCHORS_P_H -#define QMLGRAPHICSANCHORS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlgraphicsanchors.h" -#include "private/qobject_p.h" +#ifndef QMLGRAPHICSANCHORS_H +#define QMLGRAPHICSANCHORS_H + +#include <QtCore/QObject> +#include <QtDeclarative/qfxglobal.h> +#include <QtDeclarative/qml.h> +#include <QtDeclarative/qmlgraphicsitem.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsAnchorLine +QT_MODULE(Declarative) + +class QmlGraphicsAnchorsPrivate; +class QmlGraphicsAnchorLine; +class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject { + Q_OBJECT + + 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()) + Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged) + 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(QmlGraphicsItem *fill READ fill WRITE setFill) + Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn) + public: - QmlGraphicsAnchorLine() : item(0), anchorLine(Invalid) - { - } - - enum AnchorLine { - Invalid = 0x0, - Left = 0x01, - Right = 0x02, - Top = 0x04, - Bottom = 0x08, - HCenter = 0x10, - VCenter = 0x20, - Baseline = 0x40, - Horizontal_Mask = Left | Right | HCenter, - Vertical_Mask = Top | Bottom | VCenter | Baseline + QmlGraphicsAnchors(QObject *parent=0); + virtual ~QmlGraphicsAnchors(); + + enum UsedAnchor { + HasLeftAnchor = 0x01, + HasRightAnchor = 0x02, + HasTopAnchor = 0x04, + HasBottomAnchor = 0x08, + HasHCenterAnchor = 0x10, + HasVCenterAnchor = 0x20, + HasBaselineAnchor = 0x40, + Horizontal_Mask = HasLeftAnchor | HasRightAnchor | HasHCenterAnchor, + Vertical_Mask = HasTopAnchor | HasBottomAnchor | HasVCenterAnchor | HasBaselineAnchor }; + Q_DECLARE_FLAGS(UsedAnchors, UsedAnchor) - QmlGraphicsItem *item; - AnchorLine anchorLine; -}; -Q_DECLARE_METATYPE(QmlGraphicsAnchorLine) + QmlGraphicsAnchorLine left() const; + void setLeft(const QmlGraphicsAnchorLine &edge); + void resetLeft(); -class QmlGraphicsAnchorsPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QmlGraphicsAnchors) -public: - QmlGraphicsAnchorsPrivate() - : updatingMe(false), updatingHorizontalAnchor(0), - updatingVerticalAnchor(0), item(0), usedAnchors(0), fill(0), - centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), - bottomMargin(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0), - componentComplete(true) - { - } - - void init() - { - } - - void clearItem(QmlGraphicsItem *); - - void addDepend(QmlGraphicsItem *); - void remDepend(QmlGraphicsItem *); - bool isItemComplete() const; - - bool updatingMe; - int updatingHorizontalAnchor; - int updatingVerticalAnchor; - - void setItemHeight(qreal); - void setItemWidth(qreal); - void setItemX(qreal); - void setItemY(qreal); - void setItemPos(const QPointF &); - - void updateOnComplete(); - void updateMe(); - void update(QmlGraphicsItem *, const QRectF &, const QRectF &); - - bool checkHValid() const; - bool checkVValid() const; - 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(); - - QmlGraphicsItem *item; - QmlGraphicsAnchors::UsedAnchors usedAnchors; - - QmlGraphicsItem *fill; - QmlGraphicsItem *centerIn; - - QmlGraphicsAnchorLine left; - QmlGraphicsAnchorLine right; - QmlGraphicsAnchorLine top; - QmlGraphicsAnchorLine bottom; - QmlGraphicsAnchorLine vCenter; - QmlGraphicsAnchorLine hCenter; - QmlGraphicsAnchorLine baseline; - - qreal leftMargin; - qreal rightMargin; - qreal topMargin; - qreal bottomMargin; - qreal vCenterOffset; - qreal hCenterOffset; - qreal baselineOffset; - - bool componentComplete; + QmlGraphicsAnchorLine right() const; + void setRight(const QmlGraphicsAnchorLine &edge); + void resetRight(); + + QmlGraphicsAnchorLine horizontalCenter() const; + void setHorizontalCenter(const QmlGraphicsAnchorLine &edge); + void resetHorizontalCenter(); + + QmlGraphicsAnchorLine top() const; + void setTop(const QmlGraphicsAnchorLine &edge); + void resetTop(); + + QmlGraphicsAnchorLine bottom() const; + void setBottom(const QmlGraphicsAnchorLine &edge); + void resetBottom(); + + QmlGraphicsAnchorLine verticalCenter() const; + void setVerticalCenter(const QmlGraphicsAnchorLine &edge); + void resetVerticalCenter(); + + QmlGraphicsAnchorLine baseline() const; + void setBaseline(const QmlGraphicsAnchorLine &edge); + void resetBaseline(); + + qreal leftMargin() const; + void setLeftMargin(qreal); + + qreal rightMargin() const; + void setRightMargin(qreal); + + qreal horizontalCenterOffset() const; + void setHorizontalCenterOffset(qreal); + + qreal topMargin() const; + void setTopMargin(qreal); + + qreal bottomMargin() const; + void setBottomMargin(qreal); + + qreal verticalCenterOffset() const; + void setVerticalCenterOffset(qreal); + + qreal baselineOffset() const; + void setBaselineOffset(qreal); + + QmlGraphicsItem *fill() const; + void setFill(QmlGraphicsItem *); + + QmlGraphicsItem *centerIn() const; + void setCenterIn(QmlGraphicsItem *); + + UsedAnchors usedAnchors() const; + + void setItem(QmlGraphicsItem *item); + + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + void leftMarginChanged(); + void rightMarginChanged(); + void topMarginChanged(); + void bottomMarginChanged(); + void verticalCenterOffsetChanged(); + void horizontalCenterOffsetChanged(); + void baselineOffsetChanged(); + +private: + friend class QmlGraphicsItem; + Q_DISABLE_COPY(QmlGraphicsAnchors) + Q_DECLARE_PRIVATE(QmlGraphicsAnchors) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QmlGraphicsAnchors::UsedAnchors) QT_END_NAMESPACE + +QML_DECLARE_TYPE(QmlGraphicsAnchors) + +QT_END_HEADER + #endif diff --git a/src/declarative/fx/qmlgraphicsanchors_p_p.h b/src/declarative/fx/qmlgraphicsanchors_p_p.h new file mode 100644 index 0000000..7a3a9d2 --- /dev/null +++ b/src/declarative/fx/qmlgraphicsanchors_p_p.h @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSANCHORS_P_H +#define QMLGRAPHICSANCHORS_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsanchors_p.h" +#include "private/qobject_p.h" + +QT_BEGIN_NAMESPACE + +class QmlGraphicsAnchorLine +{ +public: + QmlGraphicsAnchorLine() : item(0), anchorLine(Invalid) + { + } + + enum AnchorLine { + Invalid = 0x0, + Left = 0x01, + Right = 0x02, + Top = 0x04, + Bottom = 0x08, + HCenter = 0x10, + VCenter = 0x20, + Baseline = 0x40, + Horizontal_Mask = Left | Right | HCenter, + Vertical_Mask = Top | Bottom | VCenter | Baseline + }; + + QmlGraphicsItem *item; + AnchorLine anchorLine; +}; +Q_DECLARE_METATYPE(QmlGraphicsAnchorLine) + +class QmlGraphicsAnchorsPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsAnchors) +public: + QmlGraphicsAnchorsPrivate() + : updatingMe(false), updatingHorizontalAnchor(0), + updatingVerticalAnchor(0), item(0), usedAnchors(0), fill(0), + centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), + bottomMargin(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0), + componentComplete(true) + { + } + + void init() + { + } + + void clearItem(QmlGraphicsItem *); + + void addDepend(QmlGraphicsItem *); + void remDepend(QmlGraphicsItem *); + bool isItemComplete() const; + + bool updatingMe; + int updatingHorizontalAnchor; + int updatingVerticalAnchor; + + void setItemHeight(qreal); + void setItemWidth(qreal); + void setItemX(qreal); + void setItemY(qreal); + void setItemPos(const QPointF &); + + void updateOnComplete(); + void updateMe(); + void update(QmlGraphicsItem *, const QRectF &, const QRectF &); + + bool checkHValid() const; + bool checkVValid() const; + 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(); + + QmlGraphicsItem *item; + QmlGraphicsAnchors::UsedAnchors usedAnchors; + + QmlGraphicsItem *fill; + QmlGraphicsItem *centerIn; + + QmlGraphicsAnchorLine left; + QmlGraphicsAnchorLine right; + QmlGraphicsAnchorLine top; + QmlGraphicsAnchorLine bottom; + QmlGraphicsAnchorLine vCenter; + QmlGraphicsAnchorLine hCenter; + QmlGraphicsAnchorLine baseline; + + qreal leftMargin; + qreal rightMargin; + qreal topMargin; + qreal bottomMargin; + qreal vCenterOffset; + qreal hCenterOffset; + qreal baselineOffset; + + bool componentComplete; +}; + +QT_END_NAMESPACE +#endif diff --git a/src/declarative/fx/qmlgraphicsborderimage.cpp b/src/declarative/fx/qmlgraphicsborderimage.cpp index c346366..daa8085 100644 --- a/src/declarative/fx/qmlgraphicsborderimage.cpp +++ b/src/declarative/fx/qmlgraphicsborderimage.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicsborderimage.h" #include "qmlgraphicsborderimage_p.h" +#include "qmlgraphicsborderimage_p_p.h" #include <QNetworkRequest> #include <QNetworkReply> #include <QFile> diff --git a/src/declarative/fx/qmlgraphicsborderimage.h b/src/declarative/fx/qmlgraphicsborderimage.h deleted file mode 100644 index e3c50bb..0000000 --- a/src/declarative/fx/qmlgraphicsborderimage.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSBORDERIMAGE_H -#define QMLGRAPHICSBORDERIMAGE_H - -#include <QtNetwork/qnetworkreply.h> -#include "qmlgraphicsimagebase.h" - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlGraphicsScaleGrid; -class QmlGraphicsGridScaledImage; -class QmlGraphicsBorderImagePrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsBorderImage : public QmlGraphicsImageBase -{ - Q_OBJECT - Q_ENUMS(TileMode) - - 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: - QmlGraphicsBorderImage(QmlGraphicsItem *parent=0); - ~QmlGraphicsBorderImage(); - - QmlGraphicsScaleGrid *border(); - - enum TileMode { Stretch = Qt::StretchTile, Repeat = Qt::RepeatTile, Round = Qt::RoundTile }; - - TileMode horizontalTileMode() const; - void setHorizontalTileMode(TileMode); - - TileMode verticalTileMode() const; - void setVerticalTileMode(TileMode); - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - void setSource(const QUrl &url); - -Q_SIGNALS: - void horizontalTileModeChanged(); - void verticalTileModeChanged(); - -protected: - QmlGraphicsBorderImage(QmlGraphicsBorderImagePrivate &dd, QmlGraphicsItem *parent); - -private: - void setGridScaledImage(const QmlGraphicsGridScaledImage& sci); - -private Q_SLOTS: - void requestFinished(); - void sciRequestFinished(); - -private: - Q_DISABLE_COPY(QmlGraphicsBorderImage) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBorderImage) -}; - -QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsBorderImage) -QT_END_HEADER - -#endif // QMLGRAPHICSBORDERIMAGE_H diff --git a/src/declarative/fx/qmlgraphicsborderimage_p.h b/src/declarative/fx/qmlgraphicsborderimage_p.h index fb905cd..da43a23 100644 --- a/src/declarative/fx/qmlgraphicsborderimage_p.h +++ b/src/declarative/fx/qmlgraphicsborderimage_p.h @@ -39,59 +39,67 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSBORDERIMAGE_P_H -#define QMLGRAPHICSBORDERIMAGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// +#ifndef QMLGRAPHICSBORDERIMAGE_H +#define QMLGRAPHICSBORDERIMAGE_H +#include <QtNetwork/qnetworkreply.h> #include "qmlgraphicsimagebase_p.h" -#include "qmlgraphicsscalegrid_p.h" +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QNetworkReply; -class QmlGraphicsBorderImagePrivate : public QmlGraphicsImageBasePrivate +QT_MODULE(Declarative) + +class QmlGraphicsScaleGrid; +class QmlGraphicsGridScaledImage; +class QmlGraphicsBorderImagePrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsBorderImage : public QmlGraphicsImageBase { - Q_DECLARE_PUBLIC(QmlGraphicsBorderImage) + Q_OBJECT + Q_ENUMS(TileMode) + + 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: - QmlGraphicsBorderImagePrivate() - : border(0), sciReply(0), - sciPendingPixmapCache(false), - horizontalTileMode(QmlGraphicsBorderImage::Stretch), - verticalTileMode(QmlGraphicsBorderImage::Stretch) - { - } - - ~QmlGraphicsBorderImagePrivate() - { - } - - QmlGraphicsScaleGrid *getScaleGrid() - { - Q_Q(QmlGraphicsBorderImage); - if (!border) - border = new QmlGraphicsScaleGrid(q); - return border; - } - - QmlGraphicsScaleGrid *border; - QUrl sciurl; - QNetworkReply *sciReply; - bool sciPendingPixmapCache; - QmlGraphicsBorderImage::TileMode horizontalTileMode; - QmlGraphicsBorderImage::TileMode verticalTileMode; + QmlGraphicsBorderImage(QmlGraphicsItem *parent=0); + ~QmlGraphicsBorderImage(); + + QmlGraphicsScaleGrid *border(); + + enum TileMode { Stretch = Qt::StretchTile, Repeat = Qt::RepeatTile, Round = Qt::RoundTile }; + + TileMode horizontalTileMode() const; + void setHorizontalTileMode(TileMode); + + TileMode verticalTileMode() const; + void setVerticalTileMode(TileMode); + + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + void setSource(const QUrl &url); + +Q_SIGNALS: + void horizontalTileModeChanged(); + void verticalTileModeChanged(); + +protected: + QmlGraphicsBorderImage(QmlGraphicsBorderImagePrivate &dd, QmlGraphicsItem *parent); + +private: + void setGridScaledImage(const QmlGraphicsGridScaledImage& sci); + +private Q_SLOTS: + void requestFinished(); + void sciRequestFinished(); + +private: + Q_DISABLE_COPY(QmlGraphicsBorderImage) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBorderImage) }; QT_END_NAMESPACE +QML_DECLARE_TYPE(QmlGraphicsBorderImage) +QT_END_HEADER -#endif // QMLGRAPHICSBORDERIMAGE_P_H +#endif // QMLGRAPHICSBORDERIMAGE_H diff --git a/src/declarative/fx/qmlgraphicsborderimage_p_p.h b/src/declarative/fx/qmlgraphicsborderimage_p_p.h new file mode 100644 index 0000000..06ac38b --- /dev/null +++ b/src/declarative/fx/qmlgraphicsborderimage_p_p.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSBORDERIMAGE_P_H +#define QMLGRAPHICSBORDERIMAGE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsimagebase_p_p.h" +#include "qmlgraphicsscalegrid_p_p.h" + +QT_BEGIN_NAMESPACE + +class QNetworkReply; +class QmlGraphicsBorderImagePrivate : public QmlGraphicsImageBasePrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsBorderImage) + +public: + QmlGraphicsBorderImagePrivate() + : border(0), sciReply(0), + sciPendingPixmapCache(false), + horizontalTileMode(QmlGraphicsBorderImage::Stretch), + verticalTileMode(QmlGraphicsBorderImage::Stretch) + { + } + + ~QmlGraphicsBorderImagePrivate() + { + } + + QmlGraphicsScaleGrid *getScaleGrid() + { + Q_Q(QmlGraphicsBorderImage); + if (!border) + border = new QmlGraphicsScaleGrid(q); + return border; + } + + QmlGraphicsScaleGrid *border; + QUrl sciurl; + QNetworkReply *sciReply; + bool sciPendingPixmapCache; + QmlGraphicsBorderImage::TileMode horizontalTileMode; + QmlGraphicsBorderImage::TileMode verticalTileMode; +}; + +QT_END_NAMESPACE + +#endif // QMLGRAPHICSBORDERIMAGE_P_H diff --git a/src/declarative/fx/qmlgraphicsevents.cpp b/src/declarative/fx/qmlgraphicsevents.cpp index 468b223..a4d243f 100644 --- a/src/declarative/fx/qmlgraphicsevents.cpp +++ b/src/declarative/fx/qmlgraphicsevents.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsevents_p.h" +#include "qmlgraphicsevents_p_p.h" QT_BEGIN_NAMESPACE /*! diff --git a/src/declarative/fx/qmlgraphicsevents_p.h b/src/declarative/fx/qmlgraphicsevents_p_p.h index f093932..f093932 100644 --- a/src/declarative/fx/qmlgraphicsevents_p.h +++ b/src/declarative/fx/qmlgraphicsevents_p_p.h diff --git a/src/declarative/fx/qmlgraphicsflickable.cpp b/src/declarative/fx/qmlgraphicsflickable.cpp index ed964aa..3f317d1 100644 --- a/src/declarative/fx/qmlgraphicsflickable.cpp +++ b/src/declarative/fx/qmlgraphicsflickable.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicsflickable.h" #include "qmlgraphicsflickable_p.h" +#include "qmlgraphicsflickable_p_p.h" #include <QGraphicsSceneMouseEvent> #include <QPointer> @@ -1280,4 +1280,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QmlGraphicsFlickableVisibleArea) QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisibleArea,QmlGraphicsFlickableVisibleArea) -#include "qfxflickable.moc" +#include "qmlgraphicsflickable.moc" diff --git a/src/declarative/fx/qmlgraphicsflickable.h b/src/declarative/fx/qmlgraphicsflickable.h deleted file mode 100644 index f7ef0088..0000000 --- a/src/declarative/fx/qmlgraphicsflickable.h +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSFLICKABLE_H -#define QMLGRAPHICSFLICKABLE_H - -#include <QtDeclarative/qmlgraphicsitem.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlGraphicsFlickablePrivate; -class QmlGraphicsFlickableVisibleArea; -class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem -{ - Q_OBJECT - - Q_PROPERTY(qreal viewportWidth READ viewportWidth WRITE setViewportWidth NOTIFY viewportWidthChanged) - Q_PROPERTY(qreal viewportHeight READ viewportHeight WRITE setViewportHeight NOTIFY viewportHeightChanged) - Q_PROPERTY(qreal viewportX READ viewportX WRITE setViewportX NOTIFY positionXChanged) - Q_PROPERTY(qreal viewportY READ viewportY WRITE setViewportY NOTIFY positionYChanged) - - Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) - Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) - Q_PROPERTY(qreal reportedVelocitySmoothing READ reportedVelocitySmoothing WRITE setReportedVelocitySmoothing NOTIFY reportedVelocitySmoothingChanged) - - Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot) - Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity) - Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration) - Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) - Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) - - Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive) - Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay) - - Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged) - Q_PROPERTY(bool atYEnd READ isAtYEnd NOTIFY isAtBoundaryChanged) - Q_PROPERTY(bool atXBeginning READ isAtXBeginning NOTIFY isAtBoundaryChanged) - Q_PROPERTY(bool atYBeginning READ isAtYBeginning NOTIFY isAtBoundaryChanged) - - Q_PROPERTY(QmlGraphicsFlickableVisibleArea *visibleArea READ visibleArea CONSTANT) - - Q_PROPERTY(QmlList<QObject *>* flickableData READ flickableData) - Q_PROPERTY(QmlList<QmlGraphicsItem *>* flickableChildren READ flickableChildren) - Q_CLASSINFO("DefaultProperty", "flickableData") - -public: - QmlGraphicsFlickable(QmlGraphicsItem *parent=0); - ~QmlGraphicsFlickable(); - - QmlList<QObject *> *flickableData(); - QmlList<QmlGraphicsItem *> *flickableChildren(); - - bool overShoot() const; - void setOverShoot(bool); - - qreal viewportWidth() const; - void setViewportWidth(qreal); - - qreal viewportHeight() const; - void setViewportHeight(qreal); - - qreal viewportX() const; - void setViewportX(qreal pos); - - qreal viewportY() const; - void setViewportY(qreal pos); - - bool isMoving() const; - bool isFlicking() const; - - int pressDelay() const; - void setPressDelay(int delay); - - qreal reportedVelocitySmoothing() const; - void setReportedVelocitySmoothing(qreal); - - qreal maximumFlickVelocity() const; - void setMaximumFlickVelocity(qreal); - - qreal flickDeceleration() const; - void setFlickDeceleration(qreal); - - bool isInteractive() const; - void setInteractive(bool); - - qreal horizontalVelocity() const; - qreal verticalVelocity() const; - - bool isAtXEnd() const; - bool isAtXBeginning() const; - bool isAtYEnd() const; - bool isAtYBeginning() const; - - QmlGraphicsItem *viewport(); - -Q_SIGNALS: - void viewportWidthChanged(); - void viewportHeightChanged(); - void positionXChanged(); - void positionYChanged(); - void movingChanged(); - void flickingChanged(); - void movementStarted(); - void movementEnded(); - void flickStarted(); - void flickEnded(); - void reportedVelocitySmoothingChanged(int); - void horizontalVelocityChanged(); - void verticalVelocityChanged(); - void isAtBoundaryChanged(); - void pageChanged(); - -protected: - virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void timerEvent(QTimerEvent *event); - - qreal visibleX() const; - qreal visibleY() const; - - QmlGraphicsFlickableVisibleArea *visibleArea(); - -protected Q_SLOTS: - virtual void ticked(); - void movementStarting(); - void movementEnding(); - void heightChange(); - void widthChange(); - -protected: - virtual qreal minXExtent() const; - virtual qreal minYExtent() const; - virtual qreal maxXExtent() const; - virtual qreal maxYExtent() const; - qreal vWidth() const; - qreal vHeight() const; - virtual void viewportMoved(); - bool sendMouseEvent(QGraphicsSceneMouseEvent *event); - - bool xflick() const; - bool yflick() const; - void cancelFlick(); - -protected: - QmlGraphicsFlickable(QmlGraphicsFlickablePrivate &dd, QmlGraphicsItem *parent); - -private: - Q_DISABLE_COPY(QmlGraphicsFlickable) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsFlickable) - friend class QmlGraphicsFlickableVisibleArea; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsFlickable) - -QT_END_HEADER - -#endif diff --git a/src/declarative/fx/qmlgraphicsflickable_p.h b/src/declarative/fx/qmlgraphicsflickable_p.h index d9f917d..f7ef0088 100644 --- a/src/declarative/fx/qmlgraphicsflickable_p.h +++ b/src/declarative/fx/qmlgraphicsflickable_p.h @@ -39,118 +39,165 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSFLICKABLE_P_H -#define QMLGRAPHICSFLICKABLE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdatetime.h" -#include "qmlgraphicsflickable.h" -#include "qmlgraphicsitem_p.h" -#include "qml.h" -#include "private/qmltimeline_p.h" -#include "private/qmlanimation_p.h" +#ifndef QMLGRAPHICSFLICKABLE_H +#define QMLGRAPHICSFLICKABLE_H + +#include <QtDeclarative/qmlgraphicsitem.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Declarative) + +class QmlGraphicsFlickablePrivate; class QmlGraphicsFlickableVisibleArea; -class QmlGraphicsFlickablePrivate : public QmlGraphicsItemPrivate +class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsFlickable) + Q_OBJECT -public: - QmlGraphicsFlickablePrivate(); - void init(); - virtual void flickX(qreal velocity); - virtual void flickY(qreal velocity); - virtual void fixupX(); - virtual void fixupY(); - void updateBeginningEnd(); + Q_PROPERTY(qreal viewportWidth READ viewportWidth WRITE setViewportWidth NOTIFY viewportWidthChanged) + Q_PROPERTY(qreal viewportHeight READ viewportHeight WRITE setViewportHeight NOTIFY viewportHeightChanged) + Q_PROPERTY(qreal viewportX READ viewportX WRITE setViewportX NOTIFY positionXChanged) + Q_PROPERTY(qreal viewportY READ viewportY WRITE setViewportY NOTIFY positionYChanged) + + Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) + Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) + Q_PROPERTY(qreal reportedVelocitySmoothing READ reportedVelocitySmoothing WRITE setReportedVelocitySmoothing NOTIFY reportedVelocitySmoothingChanged) + + Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot) + Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity) + Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration) + Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) + Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) + + Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive) + Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay) + + Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged) + Q_PROPERTY(bool atYEnd READ isAtYEnd NOTIFY isAtBoundaryChanged) + Q_PROPERTY(bool atXBeginning READ isAtXBeginning NOTIFY isAtBoundaryChanged) + Q_PROPERTY(bool atYBeginning READ isAtYBeginning NOTIFY isAtBoundaryChanged) + + Q_PROPERTY(QmlGraphicsFlickableVisibleArea *visibleArea READ visibleArea CONSTANT) - void captureDelayedPress(QGraphicsSceneMouseEvent *event); - void clearDelayedPress(); + Q_PROPERTY(QmlList<QObject *>* flickableData READ flickableData) + Q_PROPERTY(QmlList<QmlGraphicsItem *>* flickableChildren READ flickableChildren) + Q_CLASSINFO("DefaultProperty", "flickableData") public: - QmlGraphicsItem *viewport; - QmlTimeLineValueProxy<QmlGraphicsItem> _moveX; - QmlTimeLineValueProxy<QmlGraphicsItem> _moveY; - QmlTimeLine timeline; - qreal vWidth; - qreal vHeight; - bool overShoot : 1; - bool flicked : 1; - bool moving : 1; - bool stealMouse : 1; - bool pressed : 1; - bool atXEnd : 1; - bool atXBeginning : 1; - bool atYEnd : 1; - bool atYBeginning : 1; - bool interactive : 1; - QTime lastPosTime; - QPointF lastPos; - QPointF pressPos; - qreal pressX; - qreal pressY; - qreal velocityX; - qreal velocityY; - QTime pressTime; - QmlTimeLineEvent fixupXEvent; - QmlTimeLineEvent fixupYEvent; - qreal deceleration; - qreal maxVelocity; - QTime velocityTime; - QPointF lastFlickablePosition; - qreal reportedVelocitySmoothing; - int flickTargetX; - int flickTargetY; - QGraphicsSceneMouseEvent *delayedPressEvent; - QGraphicsItem *delayedPressTarget; - QBasicTimer delayedPressTimer; - int pressDelay; - - void updateVelocity(); - struct Velocity : public QmlTimeLineValue - { - Velocity(QmlGraphicsFlickablePrivate *p) - : parent(p) {} - virtual void setValue(qreal v) { - QmlTimeLineValue::setValue(v); - parent->updateVelocity(); - } - QmlGraphicsFlickablePrivate *parent; - }; - Velocity horizontalVelocity; - Velocity verticalVelocity; - int vTime; - QmlTimeLine velocityTimeline; - QmlGraphicsFlickableVisibleArea *visibleArea; - - void handleMousePressEvent(QGraphicsSceneMouseEvent *); - void handleMouseMoveEvent(QGraphicsSceneMouseEvent *); - void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *); - - // flickableData property - void data_removeAt(int); - int data_count() const; - void data_append(QObject *); - void data_insert(int, QObject *); - QObject *data_at(int) const; - void data_clear(); + QmlGraphicsFlickable(QmlGraphicsItem *parent=0); + ~QmlGraphicsFlickable(); + + QmlList<QObject *> *flickableData(); + QmlList<QmlGraphicsItem *> *flickableChildren(); + + bool overShoot() const; + void setOverShoot(bool); + + qreal viewportWidth() const; + void setViewportWidth(qreal); + + qreal viewportHeight() const; + void setViewportHeight(qreal); + + qreal viewportX() const; + void setViewportX(qreal pos); + + qreal viewportY() const; + void setViewportY(qreal pos); + + bool isMoving() const; + bool isFlicking() const; + + int pressDelay() const; + void setPressDelay(int delay); + qreal reportedVelocitySmoothing() const; + void setReportedVelocitySmoothing(qreal); + + qreal maximumFlickVelocity() const; + void setMaximumFlickVelocity(qreal); + + qreal flickDeceleration() const; + void setFlickDeceleration(qreal); + + bool isInteractive() const; + void setInteractive(bool); + + qreal horizontalVelocity() const; + qreal verticalVelocity() const; + + bool isAtXEnd() const; + bool isAtXBeginning() const; + bool isAtYEnd() const; + bool isAtYBeginning() const; + + QmlGraphicsItem *viewport(); + +Q_SIGNALS: + void viewportWidthChanged(); + void viewportHeightChanged(); + void positionXChanged(); + void positionYChanged(); + void movingChanged(); + void flickingChanged(); + void movementStarted(); + void movementEnded(); + void flickStarted(); + void flickEnded(); + void reportedVelocitySmoothingChanged(int); + void horizontalVelocityChanged(); + void verticalVelocityChanged(); + void isAtBoundaryChanged(); + void pageChanged(); + +protected: + virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void timerEvent(QTimerEvent *event); + + qreal visibleX() const; + qreal visibleY() const; + + QmlGraphicsFlickableVisibleArea *visibleArea(); + +protected Q_SLOTS: + virtual void ticked(); + void movementStarting(); + void movementEnding(); + void heightChange(); + void widthChange(); + +protected: + virtual qreal minXExtent() const; + virtual qreal minYExtent() const; + virtual qreal maxXExtent() const; + virtual qreal maxYExtent() const; + qreal vWidth() const; + qreal vHeight() const; + virtual void viewportMoved(); + bool sendMouseEvent(QGraphicsSceneMouseEvent *event); + + bool xflick() const; + bool yflick() const; + void cancelFlick(); + +protected: + QmlGraphicsFlickable(QmlGraphicsFlickablePrivate &dd, QmlGraphicsItem *parent); + +private: + Q_DISABLE_COPY(QmlGraphicsFlickable) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsFlickable) friend class QmlGraphicsFlickableVisibleArea; - QML_DECLARE_LIST_PROXY(QmlGraphicsFlickablePrivate, QObject *, data) }; QT_END_NAMESPACE +QML_DECLARE_TYPE(QmlGraphicsFlickable) + +QT_END_HEADER + #endif diff --git a/src/declarative/fx/qmlgraphicsflickable_p_p.h b/src/declarative/fx/qmlgraphicsflickable_p_p.h new file mode 100644 index 0000000..6b8bf9f --- /dev/null +++ b/src/declarative/fx/qmlgraphicsflickable_p_p.h @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSFLICKABLE_P_H +#define QMLGRAPHICSFLICKABLE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qdatetime.h" +#include "qmlgraphicsflickable_p.h" +#include "qmlgraphicsitem_p.h" +#include "qml.h" +#include "private/qmltimeline_p_p.h" +#include "private/qmlanimation_p_p.h" + +QT_BEGIN_NAMESPACE + +class QmlGraphicsFlickableVisibleArea; +class QmlGraphicsFlickablePrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsFlickable) + +public: + QmlGraphicsFlickablePrivate(); + void init(); + virtual void flickX(qreal velocity); + virtual void flickY(qreal velocity); + virtual void fixupX(); + virtual void fixupY(); + void updateBeginningEnd(); + + void captureDelayedPress(QGraphicsSceneMouseEvent *event); + void clearDelayedPress(); + +public: + QmlGraphicsItem *viewport; + QmlTimeLineValueProxy<QmlGraphicsItem> _moveX; + QmlTimeLineValueProxy<QmlGraphicsItem> _moveY; + QmlTimeLine timeline; + qreal vWidth; + qreal vHeight; + bool overShoot : 1; + bool flicked : 1; + bool moving : 1; + bool stealMouse : 1; + bool pressed : 1; + bool atXEnd : 1; + bool atXBeginning : 1; + bool atYEnd : 1; + bool atYBeginning : 1; + bool interactive : 1; + QTime lastPosTime; + QPointF lastPos; + QPointF pressPos; + qreal pressX; + qreal pressY; + qreal velocityX; + qreal velocityY; + QTime pressTime; + QmlTimeLineEvent fixupXEvent; + QmlTimeLineEvent fixupYEvent; + qreal deceleration; + qreal maxVelocity; + QTime velocityTime; + QPointF lastFlickablePosition; + qreal reportedVelocitySmoothing; + int flickTargetX; + int flickTargetY; + QGraphicsSceneMouseEvent *delayedPressEvent; + QGraphicsItem *delayedPressTarget; + QBasicTimer delayedPressTimer; + int pressDelay; + + void updateVelocity(); + struct Velocity : public QmlTimeLineValue + { + Velocity(QmlGraphicsFlickablePrivate *p) + : parent(p) {} + virtual void setValue(qreal v) { + QmlTimeLineValue::setValue(v); + parent->updateVelocity(); + } + QmlGraphicsFlickablePrivate *parent; + }; + Velocity horizontalVelocity; + Velocity verticalVelocity; + int vTime; + QmlTimeLine velocityTimeline; + QmlGraphicsFlickableVisibleArea *visibleArea; + + void handleMousePressEvent(QGraphicsSceneMouseEvent *); + void handleMouseMoveEvent(QGraphicsSceneMouseEvent *); + void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *); + + // flickableData property + void data_removeAt(int); + int data_count() const; + void data_append(QObject *); + void data_insert(int, QObject *); + QObject *data_at(int) const; + void data_clear(); + + friend class QmlGraphicsFlickableVisibleArea; + QML_DECLARE_LIST_PROXY(QmlGraphicsFlickablePrivate, QObject *, data) +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/declarative/fx/qmlgraphicsflipable.cpp b/src/declarative/fx/qmlgraphicsflipable.cpp index 4df35f1..bec39ac 100644 --- a/src/declarative/fx/qmlgraphicsflipable.cpp +++ b/src/declarative/fx/qmlgraphicsflipable.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsflipable.h" +#include "qmlgraphicsflipable_p.h" #include "private/qmlgraphicsitem_p.h" #include "QtGui/qgraphicstransform.h" #include <QtDeclarative/qmlinfo.h> @@ -232,5 +232,3 @@ void QmlGraphicsFlipablePrivate::updateSceneTransformFromParent() } QT_END_NAMESPACE - -#include "moc_qmlgraphicsflipable.cpp" diff --git a/src/declarative/fx/qmlgraphicsflipable.h b/src/declarative/fx/qmlgraphicsflipable_p.h index 7f92d65..7f92d65 100644 --- a/src/declarative/fx/qmlgraphicsflipable.h +++ b/src/declarative/fx/qmlgraphicsflipable_p.h diff --git a/src/declarative/fx/qmlgraphicsfocuspanel.cpp b/src/declarative/fx/qmlgraphicsfocuspanel.cpp index db8fcdb..8de8832 100644 --- a/src/declarative/fx/qmlgraphicsfocuspanel.cpp +++ b/src/declarative/fx/qmlgraphicsfocuspanel.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsfocuspanel.h" +#include "qmlgraphicsfocuspanel_p.h" #include <QtGui/qgraphicsscene.h> #include <QEvent> diff --git a/src/declarative/fx/qmlgraphicsfocuspanel.h b/src/declarative/fx/qmlgraphicsfocuspanel_p.h index 2c4f792..2c4f792 100644 --- a/src/declarative/fx/qmlgraphicsfocuspanel.h +++ b/src/declarative/fx/qmlgraphicsfocuspanel_p.h diff --git a/src/declarative/fx/qmlgraphicsfocusscope.cpp b/src/declarative/fx/qmlgraphicsfocusscope.cpp index e957085..e7b01b0 100644 --- a/src/declarative/fx/qmlgraphicsfocusscope.cpp +++ b/src/declarative/fx/qmlgraphicsfocusscope.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsfocusscope.h" +#include "qmlgraphicsfocusscope_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicsfocusscope.h b/src/declarative/fx/qmlgraphicsfocusscope_p.h index 28d1f4f..28d1f4f 100644 --- a/src/declarative/fx/qmlgraphicsfocusscope.h +++ b/src/declarative/fx/qmlgraphicsfocusscope_p.h diff --git a/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.cpp b/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.cpp index 87193cd..e1f16d5 100644 --- a/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.cpp +++ b/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsgraphicsobjectcontainer.h" +#include "qmlgraphicsgraphicsobjectcontainer_p.h" #include <QGraphicsObject> #include <QGraphicsWidget> #include <QGraphicsSceneResizeEvent> @@ -225,6 +225,6 @@ void QmlGraphicsGraphicsObjectContainerPrivate::_q_updateSize() }*/ } -QT_END_NAMESPACE +#include "moc_qmlgraphicsgraphicsobjectcontainer_p.cpp" -#include "moc_qmlgraphicsgraphicsobjectcontainer.cpp" +QT_END_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.h b/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer_p.h index 0189e2f..0189e2f 100644 --- a/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.h +++ b/src/declarative/fx/qmlgraphicsgraphicsobjectcontainer_p.h diff --git a/src/declarative/fx/qmlgraphicsgridview.cpp b/src/declarative/fx/qmlgraphicsgridview.cpp index d512b8c..c191a84 100644 --- a/src/declarative/fx/qmlgraphicsgridview.cpp +++ b/src/declarative/fx/qmlgraphicsgridview.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qmlgraphicsvisualitemmodel.h" -#include "qlistmodelinterface.h" -#include "qmleasefollow.h" -#include "private/qmlgraphicsflickable_p.h" -#include "qmlgraphicsgridview.h" +#include "qmlgraphicsgridview_p.h" +#include <private/qmlgraphicsvisualitemmodel_p.h> +#include <private/qlistmodelinterface_p.h> +#include <private/qmleasefollow_p.h> +#include <private/qmlgraphicsflickable_p_p.h> #include <QKeyEvent> @@ -1582,4 +1582,4 @@ QML_DEFINE_TYPE(Qt, 4,6, (QT_VERSION&0x00ff00)>>8, GridView, QmlGraphicsGridView QT_END_NAMESPACE -#include "qfxgridview.moc" +#include "qmlgraphicsgridview.moc" diff --git a/src/declarative/fx/qmlgraphicsgridview.h b/src/declarative/fx/qmlgraphicsgridview_p.h index 1582529..d1aebf5 100644 --- a/src/declarative/fx/qmlgraphicsgridview.h +++ b/src/declarative/fx/qmlgraphicsgridview_p.h @@ -42,7 +42,7 @@ #ifndef QMLGRAPHICSGRIDVIEW_H #define QMLGRAPHICSGRIDVIEW_H -#include <QtDeclarative/qmlgraphicsflickable.h> +#include <private/qmlgraphicsflickable_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/fx/qmlgraphicsimage.cpp b/src/declarative/fx/qmlgraphicsimage.cpp index a6156ce..bc0db30 100644 --- a/src/declarative/fx/qmlgraphicsimage.cpp +++ b/src/declarative/fx/qmlgraphicsimage.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicsimage.h" #include "qmlgraphicsimage_p.h" +#include "qmlgraphicsimage_p_p.h" #include <QKeyEvent> #include <QPainter> diff --git a/src/declarative/fx/qmlgraphicsimage.h b/src/declarative/fx/qmlgraphicsimage.h deleted file mode 100644 index 167ecd4..0000000 --- a/src/declarative/fx/qmlgraphicsimage.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSIMAGE_H -#define QMLGRAPHICSIMAGE_H - -#include <QtNetwork/qnetworkreply.h> -#include "qmlgraphicsimagebase.h" - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlGraphicsImagePrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsImage : public QmlGraphicsImageBase -{ - Q_OBJECT - Q_ENUMS(FillMode) - - Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap DESIGNABLE false) - Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) - -public: - QmlGraphicsImage(QmlGraphicsItem *parent=0); - ~QmlGraphicsImage(); - - enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally }; - FillMode fillMode() const; - void setFillMode(FillMode); - - QPixmap pixmap() const; - void setPixmap(const QPixmap &); - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - -Q_SIGNALS: - void fillModeChanged(); - -protected: - QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent); - -private: - Q_DISABLE_COPY(QmlGraphicsImage) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImage) -}; - -QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsImage) -QT_END_HEADER - -#endif // QMLGRAPHICSIMAGE_H diff --git a/src/declarative/fx/qmlgraphicsimage_p.h b/src/declarative/fx/qmlgraphicsimage_p.h index c5bcf8e..0a00e99 100644 --- a/src/declarative/fx/qmlgraphicsimage_p.h +++ b/src/declarative/fx/qmlgraphicsimage_p.h @@ -39,39 +39,52 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSIMAGE_P_H -#define QMLGRAPHICSIMAGE_P_H +#ifndef QMLGRAPHICSIMAGE_H +#define QMLGRAPHICSIMAGE_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlgraphicsitem_p.h" +#include <QtNetwork/qnetworkreply.h> #include "qmlgraphicsimagebase_p.h" +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsImagePrivate : public QmlGraphicsImageBasePrivate +QT_MODULE(Declarative) + +class QmlGraphicsImagePrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsImage : public QmlGraphicsImageBase { - Q_DECLARE_PUBLIC(QmlGraphicsImage) + Q_OBJECT + Q_ENUMS(FillMode) + + Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap DESIGNABLE false) + Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) public: - QmlGraphicsImagePrivate() - : fillMode(QmlGraphicsImage::Stretch) - { - } + QmlGraphicsImage(QmlGraphicsItem *parent=0); + ~QmlGraphicsImage(); + + enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally }; + FillMode fillMode() const; + void setFillMode(FillMode); + + QPixmap pixmap() const; + void setPixmap(const QPixmap &); + + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + +Q_SIGNALS: + void fillModeChanged(); - QmlGraphicsImage::FillMode fillMode; +protected: + QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent); +private: + Q_DISABLE_COPY(QmlGraphicsImage) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImage) }; QT_END_NAMESPACE +QML_DECLARE_TYPE(QmlGraphicsImage) +QT_END_HEADER -#endif // QMLGRAPHICSIMAGE_P_H +#endif // QMLGRAPHICSIMAGE_H diff --git a/src/declarative/fx/qmlgraphicsimage_p_p.h b/src/declarative/fx/qmlgraphicsimage_p_p.h new file mode 100644 index 0000000..51c6096 --- /dev/null +++ b/src/declarative/fx/qmlgraphicsimage_p_p.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSIMAGE_P_H +#define QMLGRAPHICSIMAGE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsitem_p.h" +#include "qmlgraphicsimagebase_p_p.h" + +QT_BEGIN_NAMESPACE + +class QmlGraphicsImagePrivate : public QmlGraphicsImageBasePrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsImage) + +public: + QmlGraphicsImagePrivate() + : fillMode(QmlGraphicsImage::Stretch) + { + } + + QmlGraphicsImage::FillMode fillMode; + +}; + +QT_END_NAMESPACE + +#endif // QMLGRAPHICSIMAGE_P_H diff --git a/src/declarative/fx/qmlgraphicsimagebase.cpp b/src/declarative/fx/qmlgraphicsimagebase.cpp index d71438d..ccc5045 100644 --- a/src/declarative/fx/qmlgraphicsimagebase.cpp +++ b/src/declarative/fx/qmlgraphicsimagebase.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include "qmlgraphicsimagebase.h" #include "qmlgraphicsimagebase_p.h" +#include "qmlgraphicsimagebase_p_p.h" #include <QNetworkRequest> #include <QNetworkReply> #include <QFile> #include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlgraphicspixmapcache.h> +#include <private/qmlgraphicspixmapcache_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicsimagebase.h b/src/declarative/fx/qmlgraphicsimagebase.h deleted file mode 100644 index 3ad0e4b..0000000 --- a/src/declarative/fx/qmlgraphicsimagebase.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSIMAGEBASE_H -#define QMLGRAPHICSIMAGEBASE_H - -#include <QtDeclarative/qmlgraphicsitem.h> - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -class QmlGraphicsImageBasePrivate; -class QmlGraphicsImageBase : public QmlGraphicsItem -{ - Q_OBJECT - Q_ENUMS(Status) - - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - -public: - QmlGraphicsImageBase(QmlGraphicsItem *parent = 0); - ~QmlGraphicsImageBase(); - enum Status { Null, Ready, Loading, Error }; - Status status() const; - qreal progress() const; - - QUrl source() const; - virtual void setSource(const QUrl &url); - -Q_SIGNALS: - void sourceChanged(const QUrl &); - void statusChanged(Status); - void progressChanged(qreal progress); - -protected: - QmlGraphicsImageBase(QmlGraphicsImageBasePrivate &dd, QmlGraphicsItem *parent); - -private Q_SLOTS: - virtual void requestFinished(); - void requestProgress(qint64,qint64); - -private: - Q_DISABLE_COPY(QmlGraphicsImageBase) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImageBase) -}; - -QT_END_NAMESPACE -QT_END_HEADER - -#endif // QMLGRAPHICSIMAGEBASE_H diff --git a/src/declarative/fx/qmlgraphicsimagebase_p.h b/src/declarative/fx/qmlgraphicsimagebase_p.h index 5fd5f11..3ad0e4b 100644 --- a/src/declarative/fx/qmlgraphicsimagebase_p.h +++ b/src/declarative/fx/qmlgraphicsimagebase_p.h @@ -39,45 +39,52 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSIMAGEBASE_P_H -#define QMLGRAPHICSIMAGEBASE_P_H +#ifndef QMLGRAPHICSIMAGEBASE_H +#define QMLGRAPHICSIMAGEBASE_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlgraphicsitem_p.h" -#include <QtCore/QPointer> +#include <QtDeclarative/qmlgraphicsitem.h> +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QNetworkReply; -class QmlGraphicsImageBasePrivate : public QmlGraphicsItemPrivate +class QmlGraphicsImageBasePrivate; +class QmlGraphicsImageBase : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsImageBase) + Q_OBJECT + Q_ENUMS(Status) + + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) public: - QmlGraphicsImageBasePrivate() - : status(QmlGraphicsImageBase::Null), - progress(0.0), - pendingPixmapCache(false) - { - } + QmlGraphicsImageBase(QmlGraphicsItem *parent = 0); + ~QmlGraphicsImageBase(); + enum Status { Null, Ready, Loading, Error }; + Status status() const; + qreal progress() const; + + QUrl source() const; + virtual void setSource(const QUrl &url); + +Q_SIGNALS: + void sourceChanged(const QUrl &); + void statusChanged(Status); + void progressChanged(qreal progress); + +protected: + QmlGraphicsImageBase(QmlGraphicsImageBasePrivate &dd, QmlGraphicsItem *parent); + +private Q_SLOTS: + virtual void requestFinished(); + void requestProgress(qint64,qint64); - QPixmap pix; - QmlGraphicsImageBase::Status status; - QUrl url; - qreal progress; - bool pendingPixmapCache; +private: + Q_DISABLE_COPY(QmlGraphicsImageBase) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImageBase) }; QT_END_NAMESPACE +QT_END_HEADER -#endif +#endif // QMLGRAPHICSIMAGEBASE_H diff --git a/src/declarative/fx/qmlgraphicsimagebase_p_p.h b/src/declarative/fx/qmlgraphicsimagebase_p_p.h new file mode 100644 index 0000000..5fd5f11 --- /dev/null +++ b/src/declarative/fx/qmlgraphicsimagebase_p_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSIMAGEBASE_P_H +#define QMLGRAPHICSIMAGEBASE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsitem_p.h" +#include <QtCore/QPointer> + +QT_BEGIN_NAMESPACE + +class QNetworkReply; +class QmlGraphicsImageBasePrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsImageBase) + +public: + QmlGraphicsImageBasePrivate() + : status(QmlGraphicsImageBase::Null), + progress(0.0), + pendingPixmapCache(false) + { + } + + QPixmap pix; + QmlGraphicsImageBase::Status status; + QUrl url; + qreal progress; + bool pendingPixmapCache; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/declarative/fx/qmlgraphicsitem.cpp b/src/declarative/fx/qmlgraphicsitem.cpp index d5b31d0..b689c41 100644 --- a/src/declarative/fx/qmlgraphicsitem.cpp +++ b/src/declarative/fx/qmlgraphicsitem.cpp @@ -47,21 +47,21 @@ #include <QNetworkRequest> #include <QGraphicsSceneMouseEvent> #include <QtScript/qscriptengine.h> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <QtGui/qgraphicstransform.h> #include <QtGui/qgraphicseffect.h> #include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlopenmetaobject.h> -#include "qmlstate.h" -#include "qlistmodelinterface.h" +#include <private/qmlopenmetaobject_p.h> +#include <private/qmlstate_p.h> +#include <private/qlistmodelinterface_p.h> #include "qmlview.h" -#include "qmlstategroup.h" +#include <private/qmlstategroup_p.h> #include "qmlgraphicsitem_p.h" #include "qmlgraphicsitem.h" -#include "qmlgraphicsevents_p.h" +#include <private/qmlgraphicsevents_p_p.h> #include <qmlcomponent.h> QT_BEGIN_NAMESPACE @@ -2909,6 +2909,9 @@ int QmlGraphicsItemPrivate::restart(QTime &t) return n; } +#include "qmlgraphicsitem.moc" +#include "moc_qmlgraphicsitem.cpp" + QT_END_NAMESPACE QML_DECLARE_TYPE(QmlGraphicsKeysAttached) @@ -2917,5 +2920,3 @@ 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_qmlgraphicsitem.cpp" -#include "qfxitem.moc" diff --git a/src/declarative/fx/qmlgraphicsitem_p.h b/src/declarative/fx/qmlgraphicsitem_p.h index 799374a..83d87a7 100644 --- a/src/declarative/fx/qmlgraphicsitem_p.h +++ b/src/declarative/fx/qmlgraphicsitem_p.h @@ -54,10 +54,10 @@ // #include <QtDeclarative/qmlgraphicsitem.h> -#include <QtDeclarative/qmlstate.h> -#include <QtDeclarative/qmlgraphicsanchors.h> -#include <private/qmlnullablevalue_p.h> +#include <private/qmlstate_p.h> #include <private/qmlgraphicsanchors_p.h> +#include <private/qmlnullablevalue_p_p.h> +#include <private/qmlgraphicsanchors_p_p.h> #include <QtDeclarative/qml.h> #include <QtDeclarative/qmlcontext.h> #include <QtCore/qlist.h> diff --git a/src/declarative/fx/qmlgraphicslayoutitem.cpp b/src/declarative/fx/qmlgraphicslayoutitem.cpp index b75f787..940b4bd 100644 --- a/src/declarative/fx/qmlgraphicslayoutitem.cpp +++ b/src/declarative/fx/qmlgraphicslayoutitem.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicslayoutitem.h" +#include "qmlgraphicslayoutitem_p.h" #include <QDebug> #include <limits.h> diff --git a/src/declarative/fx/qmlgraphicslayoutitem.h b/src/declarative/fx/qmlgraphicslayoutitem_p.h index 184001a..184001a 100644 --- a/src/declarative/fx/qmlgraphicslayoutitem.h +++ b/src/declarative/fx/qmlgraphicslayoutitem_p.h diff --git a/src/declarative/fx/qmlgraphicslistview.cpp b/src/declarative/fx/qmlgraphicslistview.cpp index 62ca23d..f92b755 100644 --- a/src/declarative/fx/qmlgraphicslistview.cpp +++ b/src/declarative/fx/qmlgraphicslistview.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "private/qmlgraphicsflickable_p.h" -#include "qmleasefollow.h" -#include "qlistmodelinterface.h" -#include "qmlgraphicsvisualitemmodel.h" -#include "qmlgraphicslistview.h" +#include "private/qmlgraphicsflickable_p_p.h" +#include <private/qmleasefollow_p.h> +#include <private/qlistmodelinterface_p.h> +#include "qmlgraphicsvisualitemmodel_p.h" +#include "qmlgraphicslistview_p.h" #include <qmlexpression.h> #include <QKeyEvent> @@ -2032,4 +2032,5 @@ QmlGraphicsListViewAttached *QmlGraphicsListView::qmlAttachedProperties(QObject QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ListView,QmlGraphicsListView) QT_END_NAMESPACE -#include "qfxlistview.moc" + +#include "qmlgraphicslistview.moc" diff --git a/src/declarative/fx/qmlgraphicslistview.h b/src/declarative/fx/qmlgraphicslistview_p.h index 1c19c38..212d4f4 100644 --- a/src/declarative/fx/qmlgraphicslistview.h +++ b/src/declarative/fx/qmlgraphicslistview_p.h @@ -42,7 +42,7 @@ #ifndef QMLGRAPHICSLISTVIEW_H #define QMLGRAPHICSLISTVIEW_H -#include <QtDeclarative/qmlgraphicsflickable.h> +#include <private/qmlgraphicsflickable_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/fx/qmlgraphicsloader.cpp b/src/declarative/fx/qmlgraphicsloader.cpp index b2a9c4f..70839e1 100644 --- a/src/declarative/fx/qmlgraphicsloader.cpp +++ b/src/declarative/fx/qmlgraphicsloader.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlgraphicsloader_p.h" +#include "qmlgraphicsloader_p_p.h" #include <private/qmlengine_p.h> QT_BEGIN_NAMESPACE @@ -385,6 +385,6 @@ QmlGraphicsItem *QmlGraphicsLoader::item() const return d->item; } -QT_END_NAMESPACE +#include "moc_qmlgraphicsloader_p.cpp" -#include "moc_qmlgraphicsloader.cpp" +QT_END_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicsloader_p.h b/src/declarative/fx/qmlgraphicsloader_p.h index ea55334..98f764f 100644 --- a/src/declarative/fx/qmlgraphicsloader_p.h +++ b/src/declarative/fx/qmlgraphicsloader_p.h @@ -39,44 +39,69 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSLOADER_P_H -#define QMLGRAPHICSLOADER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlgraphicsitem_p.h" -#include "qmlgraphicsloader.h" +#ifndef QMLGRAPHICSLOADER_H +#define QMLGRAPHICSLOADER_H + +#include <QtDeclarative/qmlgraphicsitem.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlContext; -class QmlGraphicsLoaderPrivate : public QmlGraphicsItemPrivate +QT_MODULE(Declarative) + +class QmlGraphicsLoaderPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsLoader : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsLoader) + Q_OBJECT + Q_ENUMS(Status) + Q_ENUMS(ResizeMode) + + 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(QmlGraphicsItem *item READ item NOTIFY itemChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) + //### sourceItem public: - QmlGraphicsLoaderPrivate(); - ~QmlGraphicsLoaderPrivate(); + QmlGraphicsLoader(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsLoader(); + + QUrl source() const; + void setSource(const QUrl &); + + QmlComponent *sourceComponent() const; + void setSourceComponent(QmlComponent *); - QUrl source; - QmlGraphicsItem *item; - QmlComponent *component; - bool ownComponent; - QmlGraphicsLoader::ResizeMode resizeMode; + enum Status { Null, Ready, Loading, Error }; + Status status() const; + qreal progress() const; - void _q_sourceLoaded(); - void _q_updateSize(); + enum ResizeMode { NoResize, SizeLoaderToItem, SizeItemToLoader }; + ResizeMode resizeMode() const; + void setResizeMode(ResizeMode mode); + + QmlGraphicsItem *item() const; + +Q_SIGNALS: + void itemChanged(); + void sourceChanged(); + void statusChanged(); + void progressChanged(); + +private: + 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 -#endif // QMLGRAPHICSLOADER_P_H +QML_DECLARE_TYPE(QmlGraphicsLoader) + +QT_END_HEADER + +#endif // QMLGRAPHICSLOADER_H diff --git a/src/declarative/fx/qmlgraphicsloader_p_p.h b/src/declarative/fx/qmlgraphicsloader_p_p.h new file mode 100644 index 0000000..8761d5c --- /dev/null +++ b/src/declarative/fx/qmlgraphicsloader_p_p.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSLOADER_P_H +#define QMLGRAPHICSLOADER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsitem_p.h" +#include "qmlgraphicsloader_p.h" + +QT_BEGIN_NAMESPACE + +class QmlContext; +class QmlGraphicsLoaderPrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsLoader) + +public: + QmlGraphicsLoaderPrivate(); + ~QmlGraphicsLoaderPrivate(); + + QUrl source; + QmlGraphicsItem *item; + QmlComponent *component; + bool ownComponent; + QmlGraphicsLoader::ResizeMode resizeMode; + + void _q_sourceLoaded(); + void _q_updateSize(); +}; + +QT_END_NAMESPACE + +#endif // QMLGRAPHICSLOADER_P_H diff --git a/src/declarative/fx/qmlgraphicsmouseregion.cpp b/src/declarative/fx/qmlgraphicsmouseregion.cpp index 7ad1ac2..5bdb5f0 100644 --- a/src/declarative/fx/qmlgraphicsmouseregion.cpp +++ b/src/declarative/fx/qmlgraphicsmouseregion.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qmlgraphicsmouseregion.h" #include "qmlgraphicsmouseregion_p.h" -#include "qmlgraphicsevents_p.h" +#include "qmlgraphicsmouseregion_p_p.h" +#include "qmlgraphicsevents_p_p.h" #include <QGraphicsSceneMouseEvent> diff --git a/src/declarative/fx/qmlgraphicsmouseregion.h b/src/declarative/fx/qmlgraphicsmouseregion.h deleted file mode 100644 index 9874fbf..0000000 --- a/src/declarative/fx/qmlgraphicsmouseregion.h +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSMOUSEREGION_H -#define QMLGRAPHICSMOUSEREGION_H - -#include <QtDeclarative/qmlgraphicsitem.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class Q_DECLARATIVE_EXPORT QmlGraphicsDrag : public QObject -{ - Q_OBJECT - - Q_ENUMS(Axis) - 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) - Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin) - Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax) - //### consider drag and drop - -public: - QmlGraphicsDrag(QObject *parent=0); - ~QmlGraphicsDrag(); - - QmlGraphicsItem *target() const; - void setTarget(QmlGraphicsItem *); - - enum Axis { XAxis=0x01, YAxis=0x02, XandYAxis=0x03 }; - Axis axis() const; - void setAxis(Axis); - - qreal xmin() const; - void setXmin(qreal); - qreal xmax() const; - void setXmax(qreal); - qreal ymin() const; - void setYmin(qreal); - qreal ymax() const; - void setYmax(qreal); - -private: - QmlGraphicsItem *_target; - Axis _axis; - qreal _xmin; - qreal _xmax; - qreal _ymin; - qreal _ymax; - Q_DISABLE_COPY(QmlGraphicsDrag) -}; - -class QmlGraphicsMouseEvent; -class QmlGraphicsMouseRegionPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem -{ - Q_OBJECT - - Q_PROPERTY(qreal mouseX READ mouseX NOTIFY positionChanged) - Q_PROPERTY(qreal mouseY READ mouseY NOTIFY positionChanged) - Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged) - Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged) - Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) - 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(QmlGraphicsDrag *drag READ drag) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ??? - -public: - QmlGraphicsMouseRegion(QmlGraphicsItem *parent=0); - ~QmlGraphicsMouseRegion(); - - qreal mouseX() const; - qreal mouseY() const; - - bool isEnabled() const; - void setEnabled(bool); - - bool hovered() const; - bool pressed() const; - - Qt::MouseButtons pressedButtons() const; - - Qt::MouseButtons acceptedButtons() const; - void setAcceptedButtons(Qt::MouseButtons buttons); - - QmlGraphicsDrag *drag(); - -Q_SIGNALS: - void hoveredChanged(); - void pressedChanged(); - void enabledChanged(); - void acceptedButtonsChanged(); - void positionChanged(QmlGraphicsMouseEvent *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(); - -protected: - void setHovered(bool); - bool setPressed(bool); - - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void hoverEnterEvent(QGraphicsSceneHoverEvent *event); - void hoverMoveEvent(QGraphicsSceneHoverEvent *event); - void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); - bool sceneEvent(QEvent *); - void timerEvent(QTimerEvent *event); - -private: - void handlePress(); - void handleRelease(); - -protected: - QmlGraphicsMouseRegion(QmlGraphicsMouseRegionPrivate &dd, QmlGraphicsItem *parent); - -private: - Q_DISABLE_COPY(QmlGraphicsMouseRegion) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseRegion) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsDrag) -QML_DECLARE_TYPE(QmlGraphicsMouseRegion) - -QT_END_HEADER - -#endif // QMLGRAPHICSMOUSEREGION_H diff --git a/src/declarative/fx/qmlgraphicsmouseregion_p.h b/src/declarative/fx/qmlgraphicsmouseregion_p.h index 71b31b4..9874fbf 100644 --- a/src/declarative/fx/qmlgraphicsmouseregion_p.h +++ b/src/declarative/fx/qmlgraphicsmouseregion_p.h @@ -39,76 +39,142 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSMOUSEREGION_P_H -#define QMLGRAPHICSMOUSEREGION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdatetime.h" -#include "qbasictimer.h" -#include "qgraphicssceneevent.h" -#include "qmlgraphicsitem_p.h" +#ifndef QMLGRAPHICSMOUSEREGION_H +#define QMLGRAPHICSMOUSEREGION_H + +#include <QtDeclarative/qmlgraphicsitem.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsMouseRegionPrivate : public QmlGraphicsItemPrivate +QT_MODULE(Declarative) + +class Q_DECLARATIVE_EXPORT QmlGraphicsDrag : public QObject { - Q_DECLARE_PUBLIC(QmlGraphicsMouseRegion) + Q_OBJECT + + Q_ENUMS(Axis) + 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) + Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin) + Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax) + //### consider drag and drop public: - QmlGraphicsMouseRegionPrivate() - : absorb(true), hovered(false), pressed(false), longPress(false), drag(0) - { - } - - void init() - { - Q_Q(QmlGraphicsMouseRegion); - q->setAcceptedMouseButtons(Qt::LeftButton); - } - - void saveEvent(QGraphicsSceneMouseEvent *event) { - lastPos = event->pos(); - lastButton = event->button(); - lastButtons = event->buttons(); - lastModifiers = event->modifiers(); - } - - bool isConnected(const char *signal) { - Q_Q(QmlGraphicsMouseRegion); - int idx = QObjectPrivate::get(q)->signalIndex(signal); - return QObjectPrivate::get(q)->isSignalConnected(idx); - } - - bool absorb : 1; - bool hovered : 1; - bool pressed : 1; - bool longPress : 1; - bool moved : 1; - bool dragX : 1; - bool dragY : 1; - bool dragged : 1; - QmlGraphicsDrag drag; - QPointF start; - QPointF startScene; - qreal startX; - qreal startY; - QPointF lastPos; - Qt::MouseButton lastButton; - Qt::MouseButtons lastButtons; - Qt::KeyboardModifiers lastModifiers; - QBasicTimer pressAndHoldTimer; + QmlGraphicsDrag(QObject *parent=0); + ~QmlGraphicsDrag(); + + QmlGraphicsItem *target() const; + void setTarget(QmlGraphicsItem *); + + enum Axis { XAxis=0x01, YAxis=0x02, XandYAxis=0x03 }; + Axis axis() const; + void setAxis(Axis); + + qreal xmin() const; + void setXmin(qreal); + qreal xmax() const; + void setXmax(qreal); + qreal ymin() const; + void setYmin(qreal); + qreal ymax() const; + void setYmax(qreal); + +private: + QmlGraphicsItem *_target; + Axis _axis; + qreal _xmin; + qreal _xmax; + qreal _ymin; + qreal _ymax; + Q_DISABLE_COPY(QmlGraphicsDrag) +}; + +class QmlGraphicsMouseEvent; +class QmlGraphicsMouseRegionPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem +{ + Q_OBJECT + + Q_PROPERTY(qreal mouseX READ mouseX NOTIFY positionChanged) + Q_PROPERTY(qreal mouseY READ mouseY NOTIFY positionChanged) + Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged) + Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) + 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(QmlGraphicsDrag *drag READ drag) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ??? + +public: + QmlGraphicsMouseRegion(QmlGraphicsItem *parent=0); + ~QmlGraphicsMouseRegion(); + + qreal mouseX() const; + qreal mouseY() const; + + bool isEnabled() const; + void setEnabled(bool); + + bool hovered() const; + bool pressed() const; + + Qt::MouseButtons pressedButtons() const; + + Qt::MouseButtons acceptedButtons() const; + void setAcceptedButtons(Qt::MouseButtons buttons); + + QmlGraphicsDrag *drag(); + +Q_SIGNALS: + void hoveredChanged(); + void pressedChanged(); + void enabledChanged(); + void acceptedButtonsChanged(); + void positionChanged(QmlGraphicsMouseEvent *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(); + +protected: + void setHovered(bool); + bool setPressed(bool); + + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + bool sceneEvent(QEvent *); + void timerEvent(QTimerEvent *event); + +private: + void handlePress(); + void handleRelease(); + +protected: + QmlGraphicsMouseRegion(QmlGraphicsMouseRegionPrivate &dd, QmlGraphicsItem *parent); + +private: + Q_DISABLE_COPY(QmlGraphicsMouseRegion) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseRegion) }; QT_END_NAMESPACE -#endif // QMLGRAPHICSMOUSEREGION_P_H +QML_DECLARE_TYPE(QmlGraphicsDrag) +QML_DECLARE_TYPE(QmlGraphicsMouseRegion) + +QT_END_HEADER + +#endif // QMLGRAPHICSMOUSEREGION_H diff --git a/src/declarative/fx/qmlgraphicsmouseregion_p_p.h b/src/declarative/fx/qmlgraphicsmouseregion_p_p.h new file mode 100644 index 0000000..71b31b4 --- /dev/null +++ b/src/declarative/fx/qmlgraphicsmouseregion_p_p.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSMOUSEREGION_P_H +#define QMLGRAPHICSMOUSEREGION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qdatetime.h" +#include "qbasictimer.h" +#include "qgraphicssceneevent.h" +#include "qmlgraphicsitem_p.h" + +QT_BEGIN_NAMESPACE + +class QmlGraphicsMouseRegionPrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsMouseRegion) + +public: + QmlGraphicsMouseRegionPrivate() + : absorb(true), hovered(false), pressed(false), longPress(false), drag(0) + { + } + + void init() + { + Q_Q(QmlGraphicsMouseRegion); + q->setAcceptedMouseButtons(Qt::LeftButton); + } + + void saveEvent(QGraphicsSceneMouseEvent *event) { + lastPos = event->pos(); + lastButton = event->button(); + lastButtons = event->buttons(); + lastModifiers = event->modifiers(); + } + + bool isConnected(const char *signal) { + Q_Q(QmlGraphicsMouseRegion); + int idx = QObjectPrivate::get(q)->signalIndex(signal); + return QObjectPrivate::get(q)->isSignalConnected(idx); + } + + bool absorb : 1; + bool hovered : 1; + bool pressed : 1; + bool longPress : 1; + bool moved : 1; + bool dragX : 1; + bool dragY : 1; + bool dragged : 1; + QmlGraphicsDrag drag; + QPointF start; + QPointF startScene; + qreal startX; + qreal startY; + QPointF lastPos; + Qt::MouseButton lastButton; + Qt::MouseButtons lastButtons; + Qt::KeyboardModifiers lastModifiers; + QBasicTimer pressAndHoldTimer; +}; + +QT_END_NAMESPACE + +#endif // QMLGRAPHICSMOUSEREGION_P_H diff --git a/src/declarative/fx/qmlgraphicspainteditem.cpp b/src/declarative/fx/qmlgraphicspainteditem.cpp index 43d0318..5a8e711 100644 --- a/src/declarative/fx/qmlgraphicspainteditem.cpp +++ b/src/declarative/fx/qmlgraphicspainteditem.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicspainteditem.h" #include "qmlgraphicspainteditem_p.h" +#include "qmlgraphicspainteditem_p_p.h" #include <QDebug> #include <QPen> diff --git a/src/declarative/fx/qmlgraphicspainteditem_p.h b/src/declarative/fx/qmlgraphicspainteditem_p.h index d5cd673..7ff55a5 100644 --- a/src/declarative/fx/qmlgraphicspainteditem_p.h +++ b/src/declarative/fx/qmlgraphicspainteditem_p.h @@ -39,50 +39,67 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSIMAGEITEM_P_H -#define QMLGRAPHICSIMAGEITEM_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qmlgraphicsitem_p.h> +#ifndef QMLGRAPHICSIMAGEITEM_H +#define QMLGRAPHICSIMAGEITEM_H + +#include <QtDeclarative/qfxglobal.h> +#include <QtDeclarative/qmlgraphicsitem.h> + + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsPaintedItemPrivate : public QmlGraphicsItemPrivate +QT_MODULE(Declarative) + +class QmlGraphicsPaintedItemPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsPaintedItem : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsPaintedItem) + Q_OBJECT + + Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize) + Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged) + Q_PROPERTY(int cacheSize READ cacheSize WRITE setCacheSize) public: - QmlGraphicsPaintedItemPrivate() - : max_imagecache_size(100000), fillColor(Qt::transparent), cachefrozen(false) - { - } - - struct ImageCacheItem { - ImageCacheItem() : age(0) {} - ~ImageCacheItem() { } - int age; - QRect area; - QRect dirty; // one dirty area (allows optimization of common cases) - QPixmap image; - }; - - QList<ImageCacheItem*> imagecache; - - int max_imagecache_size; - QSize contentsSize; - QColor fillColor; - bool cachefrozen; + QmlGraphicsPaintedItem(QmlGraphicsItem *parent=0); + ~QmlGraphicsPaintedItem(); + + QSize contentsSize() const; + void setContentsSize(const QSize &); + + int cacheSize() const; + void setCacheSize(int pixels); + + QColor fillColor() const; + void setFillColor(const QColor&); + + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + +protected: + QmlGraphicsPaintedItem(QmlGraphicsPaintedItemPrivate &dd, QmlGraphicsItem *parent); + + virtual void drawContents(QPainter *p, const QRect &) = 0; + + void setCacheFrozen(bool); + +Q_SIGNALS: + void fillColorChanged(); + +protected Q_SLOTS: + void dirtyCache(const QRect &); + void clearCache(); + +private: + void init(); + Q_DISABLE_COPY(QmlGraphicsPaintedItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPaintedItem) }; QT_END_NAMESPACE + +QML_DECLARE_TYPE(QmlGraphicsPaintedItem) + +QT_END_HEADER + #endif diff --git a/src/declarative/fx/qmlgraphicspainteditem_p_p.h b/src/declarative/fx/qmlgraphicspainteditem_p_p.h new file mode 100644 index 0000000..d5cd673 --- /dev/null +++ b/src/declarative/fx/qmlgraphicspainteditem_p_p.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSIMAGEITEM_P_H +#define QMLGRAPHICSIMAGEITEM_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qmlgraphicsitem_p.h> + +QT_BEGIN_NAMESPACE + +class QmlGraphicsPaintedItemPrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsPaintedItem) + +public: + QmlGraphicsPaintedItemPrivate() + : max_imagecache_size(100000), fillColor(Qt::transparent), cachefrozen(false) + { + } + + struct ImageCacheItem { + ImageCacheItem() : age(0) {} + ~ImageCacheItem() { } + int age; + QRect area; + QRect dirty; // one dirty area (allows optimization of common cases) + QPixmap image; + }; + + QList<ImageCacheItem*> imagecache; + + int max_imagecache_size; + QSize contentsSize; + QColor fillColor; + bool cachefrozen; +}; + +QT_END_NAMESPACE +#endif diff --git a/src/declarative/fx/qmlgraphicspath.cpp b/src/declarative/fx/qmlgraphicspath.cpp index 15dbfef..193a2c6 100644 --- a/src/declarative/fx/qmlgraphicspath.cpp +++ b/src/declarative/fx/qmlgraphicspath.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qmlgraphicspath.h" #include "qmlgraphicspath_p.h" -#include <private/qfxperf_p.h> +#include "qmlgraphicspath_p_p.h" +#include <private/qfxperf_p_p.h> #include <private/qbezier_p.h> #include <QSet> diff --git a/src/declarative/fx/qmlgraphicspath.h b/src/declarative/fx/qmlgraphicspath.h deleted file mode 100644 index db6c84f..0000000 --- a/src/declarative/fx/qmlgraphicspath.h +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSPATH_H -#define QMLGRAPHICSPATH_H - -#include <QtCore/QObject> -#include <QtGui/QPainterPath> -#include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlgraphicsitem.h> - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QmlGraphicsPathElement : public QObject -{ - Q_OBJECT -public: - QmlGraphicsPathElement(QObject *parent=0) : QObject(parent) {} -Q_SIGNALS: - void changed(); -}; - -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: - QmlGraphicsPathAttribute(QObject *parent=0) : QmlGraphicsPathElement(parent), _value(0) {} - - - QString name() const; - void setName(const QString &name); - - qreal value() const; - void setValue(qreal value); - -private: - QString _name; - qreal _value; -}; - -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: - QmlGraphicsCurve(QObject *parent=0) : QmlGraphicsPathElement(parent), _x(0), _y(0) {} - - qreal x() const; - void setX(qreal x); - - qreal y() const; - void setY(qreal y); - - virtual void addToPath(QPainterPath &) {} - -private: - qreal _x; - qreal _y; -}; - -class Q_DECLARATIVE_EXPORT QmlGraphicsPathLine : public QmlGraphicsCurve -{ - Q_OBJECT -public: - QmlGraphicsPathLine(QObject *parent=0) : QmlGraphicsCurve(parent) {} - - void addToPath(QPainterPath &path); -}; - -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: - QmlGraphicsPathQuad(QObject *parent=0) : QmlGraphicsCurve(parent), _controlX(0), _controlY(0) {} - - qreal controlX() const; - void setControlX(qreal x); - - qreal controlY() const; - void setControlY(qreal y); - - void addToPath(QPainterPath &path); - -private: - qreal _controlX; - qreal _controlY; -}; - -class Q_DECLARATIVE_EXPORT QmlGraphicsPathCubic : public QmlGraphicsCurve -{ - Q_OBJECT - - Q_PROPERTY(qreal control1X READ control1X WRITE setControl1X NOTIFY changed) - Q_PROPERTY(qreal control1Y READ control1Y WRITE setControl1Y NOTIFY changed) - Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY changed) - Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY changed) -public: - QmlGraphicsPathCubic(QObject *parent=0) : QmlGraphicsCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {} - - qreal control1X() const; - void setControl1X(qreal x); - - qreal control1Y() const; - void setControl1Y(qreal y); - - qreal control2X() const; - void setControl2X(qreal x); - - qreal control2Y() const; - void setControl2Y(qreal y); - - void addToPath(QPainterPath &path); - -private: - int _control1X; - int _control1Y; - int _control2X; - int _control2Y; -}; - -class Q_DECLARATIVE_EXPORT QmlGraphicsPathPercent : public QmlGraphicsPathElement -{ - Q_OBJECT - Q_PROPERTY(qreal value READ value WRITE setValue) -public: - QmlGraphicsPathPercent(QObject *parent=0) : QmlGraphicsPathElement(parent) {} - - qreal value() const; - void setValue(qreal value); - -private: - qreal _value; -}; - -class QmlGraphicsPathPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsPath : public QObject, public QmlParserStatus -{ - Q_OBJECT - - Q_INTERFACES(QmlParserStatus) - Q_PROPERTY(QList<QmlGraphicsPathElement *>* 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: - QmlGraphicsPath(QObject *parent=0); - ~QmlGraphicsPath(); - - QList<QmlGraphicsPathElement *>* pathElements(); - - qreal startX() const; - void setStartX(qreal x); - - qreal startY() const; - void setStartY(qreal y); - - QPainterPath path() const; - QStringList attributes() const; - qreal attributeAt(const QString &, qreal) const; - QPointF pointAt(qreal) const; - -Q_SIGNALS: - void changed(); - -protected: - virtual void componentComplete(); - QmlGraphicsPath(QmlGraphicsPathPrivate &dd, QObject *parent); - -private Q_SLOTS: - void processPath(); - -private: - struct AttributePoint { - AttributePoint() : percent(0), scale(1), origpercent(0) {} - AttributePoint(const AttributePoint &other) - : percent(other.percent), scale(other.scale), origpercent(other.origpercent), values(other.values) {} - AttributePoint &operator=(const AttributePoint &other) { - percent = other.percent; scale = other.scale; origpercent = other.origpercent; values = other.values; return *this; - } - qreal percent; //massaged percent along the painter path - qreal scale; - qreal origpercent; //'real' percent along the painter path - QHash<QString, qreal> values; - }; - - void interpolate(int idx, const QString &name, qreal value); - void endpoint(const QString &name); - void createPointCache() const; - -private: - Q_DISABLE_COPY(QmlGraphicsPath) - Q_DECLARE_PRIVATE(QmlGraphicsPath) -}; - -QT_END_NAMESPACE - -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 - -#endif // QMLGRAPHICSPATH_H diff --git a/src/declarative/fx/qmlgraphicspath_p.h b/src/declarative/fx/qmlgraphicspath_p.h index 7c0e1ea..db6c84f 100644 --- a/src/declarative/fx/qmlgraphicspath_p.h +++ b/src/declarative/fx/qmlgraphicspath_p.h @@ -39,41 +39,221 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSPATH_P_H -#define QMLGRAPHICSPATH_P_H +#ifndef QMLGRAPHICSPATH_H +#define QMLGRAPHICSPATH_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// +#include <QtCore/QObject> +#include <QtGui/QPainterPath> +#include <QtDeclarative/qml.h> +#include <QtDeclarative/qmlgraphicsitem.h> -#include "private/qobject_p.h" -#include "qmlgraphicspath.h" -#include "qml.h" +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsPathPrivate : public QObjectPrivate + +QT_MODULE(Declarative) +class Q_DECLARATIVE_EXPORT QmlGraphicsPathElement : public QObject +{ + Q_OBJECT +public: + QmlGraphicsPathElement(QObject *parent=0) : QObject(parent) {} +Q_SIGNALS: + void changed(); +}; + +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: + QmlGraphicsPathAttribute(QObject *parent=0) : QmlGraphicsPathElement(parent), _value(0) {} + + + QString name() const; + void setName(const QString &name); + + qreal value() const; + void setValue(qreal value); + +private: + QString _name; + qreal _value; +}; + +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: + QmlGraphicsCurve(QObject *parent=0) : QmlGraphicsPathElement(parent), _x(0), _y(0) {} + + qreal x() const; + void setX(qreal x); + + qreal y() const; + void setY(qreal y); + + virtual void addToPath(QPainterPath &) {} + +private: + qreal _x; + qreal _y; +}; + +class Q_DECLARATIVE_EXPORT QmlGraphicsPathLine : public QmlGraphicsCurve { - Q_DECLARE_PUBLIC(QmlGraphicsPath) + Q_OBJECT +public: + QmlGraphicsPathLine(QObject *parent=0) : QmlGraphicsCurve(parent) {} + + void addToPath(QPainterPath &path); +}; +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: - QmlGraphicsPathPrivate() : startX(0), startY(0) { } - - QPainterPath _path; - QList<QmlGraphicsPathElement*> _pathElements; - mutable QVector<QPointF> _pointCache; - QList<QmlGraphicsPath::AttributePoint> _attributePoints; - QStringList _attributes; - int startX; - int startY; + QmlGraphicsPathQuad(QObject *parent=0) : QmlGraphicsCurve(parent), _controlX(0), _controlY(0) {} + + qreal controlX() const; + void setControlX(qreal x); + + qreal controlY() const; + void setControlY(qreal y); + + void addToPath(QPainterPath &path); + +private: + qreal _controlX; + qreal _controlY; +}; + +class Q_DECLARATIVE_EXPORT QmlGraphicsPathCubic : public QmlGraphicsCurve +{ + Q_OBJECT + + Q_PROPERTY(qreal control1X READ control1X WRITE setControl1X NOTIFY changed) + Q_PROPERTY(qreal control1Y READ control1Y WRITE setControl1Y NOTIFY changed) + Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY changed) + Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY changed) +public: + QmlGraphicsPathCubic(QObject *parent=0) : QmlGraphicsCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {} + + qreal control1X() const; + void setControl1X(qreal x); + + qreal control1Y() const; + void setControl1Y(qreal y); + + qreal control2X() const; + void setControl2X(qreal x); + + qreal control2Y() const; + void setControl2Y(qreal y); + + void addToPath(QPainterPath &path); + +private: + int _control1X; + int _control1Y; + int _control2X; + int _control2Y; +}; + +class Q_DECLARATIVE_EXPORT QmlGraphicsPathPercent : public QmlGraphicsPathElement +{ + Q_OBJECT + Q_PROPERTY(qreal value READ value WRITE setValue) +public: + QmlGraphicsPathPercent(QObject *parent=0) : QmlGraphicsPathElement(parent) {} + + qreal value() const; + void setValue(qreal value); + +private: + qreal _value; +}; + +class QmlGraphicsPathPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsPath : public QObject, public QmlParserStatus +{ + Q_OBJECT + + Q_INTERFACES(QmlParserStatus) + Q_PROPERTY(QList<QmlGraphicsPathElement *>* 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: + QmlGraphicsPath(QObject *parent=0); + ~QmlGraphicsPath(); + + QList<QmlGraphicsPathElement *>* pathElements(); + + qreal startX() const; + void setStartX(qreal x); + + qreal startY() const; + void setStartY(qreal y); + + QPainterPath path() const; + QStringList attributes() const; + qreal attributeAt(const QString &, qreal) const; + QPointF pointAt(qreal) const; + +Q_SIGNALS: + void changed(); + +protected: + virtual void componentComplete(); + QmlGraphicsPath(QmlGraphicsPathPrivate &dd, QObject *parent); + +private Q_SLOTS: + void processPath(); + +private: + struct AttributePoint { + AttributePoint() : percent(0), scale(1), origpercent(0) {} + AttributePoint(const AttributePoint &other) + : percent(other.percent), scale(other.scale), origpercent(other.origpercent), values(other.values) {} + AttributePoint &operator=(const AttributePoint &other) { + percent = other.percent; scale = other.scale; origpercent = other.origpercent; values = other.values; return *this; + } + qreal percent; //massaged percent along the painter path + qreal scale; + qreal origpercent; //'real' percent along the painter path + QHash<QString, qreal> values; + }; + + void interpolate(int idx, const QString &name, qreal value); + void endpoint(const QString &name); + void createPointCache() const; + +private: + Q_DISABLE_COPY(QmlGraphicsPath) + Q_DECLARE_PRIVATE(QmlGraphicsPath) }; QT_END_NAMESPACE -#endif + +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 + +#endif // QMLGRAPHICSPATH_H diff --git a/src/declarative/fx/qmlgraphicspath_p_p.h b/src/declarative/fx/qmlgraphicspath_p_p.h new file mode 100644 index 0000000..c974318 --- /dev/null +++ b/src/declarative/fx/qmlgraphicspath_p_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSPATH_P_H +#define QMLGRAPHICSPATH_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qobject_p.h" +#include "qmlgraphicspath_p.h" +#include "qml.h" + + +QT_BEGIN_NAMESPACE +class QmlGraphicsPathPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsPath) + +public: + QmlGraphicsPathPrivate() : startX(0), startY(0) { } + + QPainterPath _path; + QList<QmlGraphicsPathElement*> _pathElements; + mutable QVector<QPointF> _pointCache; + QList<QmlGraphicsPath::AttributePoint> _attributePoints; + QStringList _attributes; + int startX; + int startY; +}; + +QT_END_NAMESPACE +#endif diff --git a/src/declarative/fx/qmlgraphicspathview.cpp b/src/declarative/fx/qmlgraphicspathview.cpp index 48d9fc8..74b8a97 100644 --- a/src/declarative/fx/qmlgraphicspathview.cpp +++ b/src/declarative/fx/qmlgraphicspathview.cpp @@ -42,12 +42,12 @@ #include <math.h> #include <QDebug> #include <QEvent> -#include "qmlstate.h" -#include "qlistmodelinterface.h" -#include "qmlopenmetaobject.h" +#include <private/qmlstate_p.h> +#include <private/qlistmodelinterface_p.h> +#include <private/qmlopenmetaobject_p.h> -#include "qmlgraphicspathview.h" -#include "qmlgraphicspathview_p.h" +#include <private/qmlgraphicspathview_p.h> +#include <private/qmlgraphicspathview_p_p.h> #include <QGraphicsSceneEvent> static const int FlickThreshold = 5; @@ -910,4 +910,4 @@ QObject *QmlGraphicsPathView::qmlAttachedProperties(QObject *obj) QT_END_NAMESPACE -#include "qfxpathview.moc" +#include "qmlgraphicspathview.moc" diff --git a/src/declarative/fx/qmlgraphicspathview.h b/src/declarative/fx/qmlgraphicspathview.h deleted file mode 100644 index 3bb5d1f..0000000 --- a/src/declarative/fx/qmlgraphicspathview.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSPATHVIEW_H -#define QMLGRAPHICSPATHVIEW_H - -#include <QtDeclarative/qmlgraphicsitem.h> -#include <QtDeclarative/qmlgraphicspath.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QListModelInterface; -class QmlGraphicsPathViewPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsPathView : public QmlGraphicsItem -{ - Q_OBJECT - - Q_PROPERTY(QVariant model READ model WRITE setModel) - 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) - Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin) - Q_PROPERTY(int count READ count) - Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) - Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount) - -public: - QmlGraphicsPathView(QmlGraphicsItem *parent=0); - virtual ~QmlGraphicsPathView(); - - QVariant model() const; - void setModel(const QVariant &); - - QmlGraphicsPath *path() const; - void setPath(QmlGraphicsPath *); - - int currentIndex() const; - void setCurrentIndex(int idx); - - qreal offset() const; - void setOffset(qreal offset); - - qreal snapPosition() const; - void setSnapPosition(qreal pos); - - qreal dragMargin() const; - void setDragMargin(qreal margin); - - int count() const; - - QmlComponent *delegate() const; - void setDelegate(QmlComponent *); - - int pathItemCount() const; - void setPathItemCount(int); - - static QObject *qmlAttachedProperties(QObject *); - -Q_SIGNALS: - void currentIndexChanged(); - void offsetChanged(); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *); - bool sendMouseEvent(QGraphicsSceneMouseEvent *event); - bool sceneEventFilter(QGraphicsItem *, QEvent *); - void componentComplete(); - -private Q_SLOTS: - void refill(); - void ticked(); - void itemsInserted(int index, int count); - void itemsRemoved(int index, int count); - void createdItem(int index, QmlGraphicsItem *item); - void destroyingItem(QmlGraphicsItem *item); - -protected: - QmlGraphicsPathView(QmlGraphicsPathViewPrivate &dd, QmlGraphicsItem *parent); - -private: - friend class QmlGraphicsPathViewAttached; - static QHash<QObject*, QObject*> attachedProperties; - Q_DISABLE_COPY(QmlGraphicsPathView) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPathView) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsPathView) -QML_DECLARE_TYPEINFO(QmlGraphicsPathView, QML_HAS_ATTACHED_PROPERTIES) -QT_END_HEADER - -#endif // QMLGRAPHICSPATHVIEW_H diff --git a/src/declarative/fx/qmlgraphicspathview_p.h b/src/declarative/fx/qmlgraphicspathview_p.h index 22ee075..e2edcc9 100644 --- a/src/declarative/fx/qmlgraphicspathview_p.h +++ b/src/declarative/fx/qmlgraphicspathview_p.h @@ -39,113 +39,100 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSPATHVIEW_P_H -#define QMLGRAPHICSPATHVIEW_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qdatetime.h" -#include "qmlgraphicspathview.h" -#include "qmlgraphicsitem_p.h" -#include "qmlgraphicsvisualitemmodel.h" -#include "qml.h" -#include "private/qmlanimation_p.h" +#ifndef QMLGRAPHICSPATHVIEW_H +#define QMLGRAPHICSPATHVIEW_H + +#include <QtDeclarative/qmlgraphicsitem.h> +#include <private/qmlgraphicspath_p.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -typedef struct PathViewItem{ - int index; - QmlGraphicsItem* item; -}PathViewItem; +QT_MODULE(Declarative) -class QmlGraphicsPathViewPrivate : public QmlGraphicsItemPrivate +class QListModelInterface; +class QmlGraphicsPathViewPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsPathView : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsPathView) + Q_OBJECT + + Q_PROPERTY(QVariant model READ model WRITE setModel) + 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) + Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin) + Q_PROPERTY(int count READ count) + Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) + Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount) public: - QmlGraphicsPathViewPrivate() - : path(0), currentIndex(0), startPc(0), lastDist(0) - , lastElapsed(0), stealMouse(false), ownModel(false), activeItem(0) - , snapPos(0), dragMargin(0), moveOffset(this, &QmlGraphicsPathViewPrivate::setOffset) - , firstIndex(0), pathItems(-1), pathOffset(0), requestedIndex(-1), model(0) - , moveReason(Other) - { - fixupOffsetEvent = QmlTimeLineEvent::timeLineEvent<QmlGraphicsPathViewPrivate, &QmlGraphicsPathViewPrivate::fixOffset>(&moveOffset, this); - } - - void init() - { - Q_Q(QmlGraphicsPathView); - _offset = 0; - q->setAcceptedMouseButtons(Qt::LeftButton); - q->setFlag(QGraphicsItem::ItemIsFocusScope); - q->setFiltersChildEvents(true); - q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); - } - - QmlGraphicsItem *getItem(int modelIndex) { - Q_Q(QmlGraphicsPathView); - requestedIndex = modelIndex; - QmlGraphicsItem *item = model->item(modelIndex); - if (item) - item->setParentItem(q); - requestedIndex = -1; - return item; - } - void releaseItem(QmlGraphicsItem *item) { - model->release(item); - } - - bool isValid() const { - return model && model->count() > 0 && model->isValid() && path; - } - - int calcCurrentIndex(); - void updateCurrent(); - void fixOffset(); + QmlGraphicsPathView(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsPathView(); + + QVariant model() const; + void setModel(const QVariant &); + + QmlGraphicsPath *path() const; + void setPath(QmlGraphicsPath *); + + int currentIndex() const; + void setCurrentIndex(int idx); + + qreal offset() const; void setOffset(qreal offset); - void regenerate(); - void updateItem(QmlGraphicsItem *, qreal); - void snapToCurrent(); - QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const; - - QmlGraphicsPath *path; - int currentIndex; - qreal startPc; - QPointF startPoint; - qreal lastDist; - int lastElapsed; - qreal _offset; - bool stealMouse : 1; - bool ownModel : 1; - QTime lastPosTime; - QPointF lastPos; - QmlGraphicsItem *activeItem; - qreal snapPos; - qreal dragMargin; - QmlTimeLine tl; - QmlTimeLineValueProxy<QmlGraphicsPathViewPrivate> moveOffset; - QmlTimeLineEvent fixupOffsetEvent; - int firstIndex; - int pathItems; - int pathOffset; - int requestedIndex; - QList<QmlGraphicsItem *> items; - QmlGraphicsVisualModel *model; - QVariant modelVariant; - enum MovementReason { Other, Key, Mouse }; - MovementReason moveReason; + + qreal snapPosition() const; + void setSnapPosition(qreal pos); + + qreal dragMargin() const; + void setDragMargin(qreal margin); + + int count() const; + + QmlComponent *delegate() const; + void setDelegate(QmlComponent *); + + int pathItemCount() const; + void setPathItemCount(int); + + static QObject *qmlAttachedProperties(QObject *); + +Q_SIGNALS: + void currentIndexChanged(); + void offsetChanged(); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *); + bool sendMouseEvent(QGraphicsSceneMouseEvent *event); + bool sceneEventFilter(QGraphicsItem *, QEvent *); + void componentComplete(); + +private Q_SLOTS: + void refill(); + void ticked(); + void itemsInserted(int index, int count); + void itemsRemoved(int index, int count); + void createdItem(int index, QmlGraphicsItem *item); + void destroyingItem(QmlGraphicsItem *item); + +protected: + QmlGraphicsPathView(QmlGraphicsPathViewPrivate &dd, QmlGraphicsItem *parent); + +private: + friend class QmlGraphicsPathViewAttached; + static QHash<QObject*, QObject*> attachedProperties; + Q_DISABLE_COPY(QmlGraphicsPathView) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPathView) }; QT_END_NAMESPACE -#endif +QML_DECLARE_TYPE(QmlGraphicsPathView) +QML_DECLARE_TYPEINFO(QmlGraphicsPathView, QML_HAS_ATTACHED_PROPERTIES) +QT_END_HEADER + +#endif // QMLGRAPHICSPATHVIEW_H diff --git a/src/declarative/fx/qmlgraphicspathview_p_p.h b/src/declarative/fx/qmlgraphicspathview_p_p.h new file mode 100644 index 0000000..87a5090 --- /dev/null +++ b/src/declarative/fx/qmlgraphicspathview_p_p.h @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSPATHVIEW_P_H +#define QMLGRAPHICSPATHVIEW_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qdatetime.h" +#include "qmlgraphicspathview_p.h" +#include "qmlgraphicsitem_p.h" +#include "qmlgraphicsvisualitemmodel_p.h" +#include "qml.h" +#include "private/qmlanimation_p_p.h" + +QT_BEGIN_NAMESPACE + +typedef struct PathViewItem{ + int index; + QmlGraphicsItem* item; +}PathViewItem; + +class QmlGraphicsPathViewPrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsPathView) + +public: + QmlGraphicsPathViewPrivate() + : path(0), currentIndex(0), startPc(0), lastDist(0) + , lastElapsed(0), stealMouse(false), ownModel(false), activeItem(0) + , snapPos(0), dragMargin(0), moveOffset(this, &QmlGraphicsPathViewPrivate::setOffset) + , firstIndex(0), pathItems(-1), pathOffset(0), requestedIndex(-1), model(0) + , moveReason(Other) + { + fixupOffsetEvent = QmlTimeLineEvent::timeLineEvent<QmlGraphicsPathViewPrivate, &QmlGraphicsPathViewPrivate::fixOffset>(&moveOffset, this); + } + + void init() + { + Q_Q(QmlGraphicsPathView); + _offset = 0; + q->setAcceptedMouseButtons(Qt::LeftButton); + q->setFlag(QGraphicsItem::ItemIsFocusScope); + q->setFiltersChildEvents(true); + q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); + } + + QmlGraphicsItem *getItem(int modelIndex) { + Q_Q(QmlGraphicsPathView); + requestedIndex = modelIndex; + QmlGraphicsItem *item = model->item(modelIndex); + if (item) + item->setParentItem(q); + requestedIndex = -1; + return item; + } + void releaseItem(QmlGraphicsItem *item) { + model->release(item); + } + + bool isValid() const { + return model && model->count() > 0 && model->isValid() && path; + } + + int calcCurrentIndex(); + void updateCurrent(); + void fixOffset(); + void setOffset(qreal offset); + void regenerate(); + void updateItem(QmlGraphicsItem *, qreal); + void snapToCurrent(); + QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const; + + QmlGraphicsPath *path; + int currentIndex; + qreal startPc; + QPointF startPoint; + qreal lastDist; + int lastElapsed; + qreal _offset; + bool stealMouse : 1; + bool ownModel : 1; + QTime lastPosTime; + QPointF lastPos; + QmlGraphicsItem *activeItem; + qreal snapPos; + qreal dragMargin; + QmlTimeLine tl; + QmlTimeLineValueProxy<QmlGraphicsPathViewPrivate> moveOffset; + QmlTimeLineEvent fixupOffsetEvent; + int firstIndex; + int pathItems; + int pathOffset; + int requestedIndex; + QList<QmlGraphicsItem *> items; + QmlGraphicsVisualModel *model; + QVariant modelVariant; + enum MovementReason { Other, Key, Mouse }; + MovementReason moveReason; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/declarative/fx/qmlgraphicspixmapcache.cpp b/src/declarative/fx/qmlgraphicspixmapcache.cpp index e347a8b..37a1e20 100644 --- a/src/declarative/fx/qmlgraphicspixmapcache.cpp +++ b/src/declarative/fx/qmlgraphicspixmapcache.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qmlgraphicspixmapcache.h" +#include "qmlgraphicspixmapcache_p.h" #include <QImageReader> #include <QHash> #include <QNetworkReply> #include <QPixmapCache> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <QtDeclarative/qmlengine.h> #include <QFile> #include <QtCore/qdebug.h> diff --git a/src/declarative/fx/qmlgraphicspixmapcache.h b/src/declarative/fx/qmlgraphicspixmapcache_p.h index 5094665..5094665 100644 --- a/src/declarative/fx/qmlgraphicspixmapcache.h +++ b/src/declarative/fx/qmlgraphicspixmapcache_p.h diff --git a/src/declarative/fx/qmlgraphicspositioners.cpp b/src/declarative/fx/qmlgraphicspositioners.cpp index 31950e6..3f8a915 100644 --- a/src/declarative/fx/qmlgraphicspositioners.cpp +++ b/src/declarative/fx/qmlgraphicspositioners.cpp @@ -42,12 +42,12 @@ #include <QDebug> #include <QCoreApplication> #include "qml.h" -#include "qmlstate.h" -#include "qmlstategroup.h" -#include "qmlstateoperations.h" -#include "private/qfxperf_p.h" -#include "qmlgraphicspositioners.h" -#include "qmlgraphicspositioners_p.h" +#include <private/qmlstate_p.h> +#include <private/qmlstategroup_p.h> +#include <private/qmlstateoperations_p.h> +#include <private/qfxperf_p_p.h> +#include <private/qmlgraphicspositioners_p.h> +#include <private/qmlgraphicspositioners_p_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicspositioners.h b/src/declarative/fx/qmlgraphicspositioners.h deleted file mode 100644 index e252ed8..0000000 --- a/src/declarative/fx/qmlgraphicspositioners.h +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSLAYOUTS_H -#define QMLGRAPHICSLAYOUTS_H - -#include <QtCore/QObject> -#include <QtCore/QString> -#include <QtDeclarative/qmlgraphicsitem.h> -#include <QtDeclarative/qmlstate.h> - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QmlGraphicsBasePositionerPrivate; - -class Q_DECLARATIVE_EXPORT QmlGraphicsBasePositioner : public QmlGraphicsItem -{ - Q_OBJECT - - Q_PROPERTY(int spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) - Q_PROPERTY(QmlTransition *move READ move WRITE setMove) - Q_PROPERTY(QmlTransition *add READ add WRITE setAdd) - Q_PROPERTY(QmlTransition *remove READ remove WRITE setRemove) -public: - enum AutoUpdateType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; - QmlGraphicsBasePositioner(AutoUpdateType, QmlGraphicsItem *parent); - - int spacing() const; - void setSpacing(int); - - QmlTransition *move() const; - void setMove(QmlTransition *); - - QmlTransition *add() const; - void setAdd(QmlTransition *); - - QmlTransition *remove() const; - void setRemove(QmlTransition *); - -protected: - virtual void componentComplete(); - virtual QVariant itemChange(GraphicsItemChange, const QVariant &); - virtual bool event(QEvent *); - QSet<QmlGraphicsItem *>* newItems(); - QSet<QmlGraphicsItem *>* leavingItems(); - QSet<QmlGraphicsItem *>* items(); - void applyAdd(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target); - void applyMove(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target); - void applyRemove(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target); - void finishApplyTransitions(); - -Q_SIGNALS: - void layoutItemChanged(); - void spacingChanged(); - -protected Q_SLOTS: - virtual void doPositioning()=0; - -private Q_SLOTS: - void prePositioning(); - -protected: - QmlGraphicsBasePositioner(QmlGraphicsBasePositionerPrivate &dd, AutoUpdateType at, QmlGraphicsItem *parent); - void setMovingItem(QmlGraphicsItem *); - -private: - void applyTransition(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target, - QmlStateOperation::ActionList &actions); - Q_DISABLE_COPY(QmlGraphicsBasePositioner) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBasePositioner) -}; - -class Q_DECLARATIVE_EXPORT QmlGraphicsColumn : public QmlGraphicsBasePositioner -{ - Q_OBJECT -public: - QmlGraphicsColumn(QmlGraphicsItem *parent=0); -protected Q_SLOTS: - virtual void doPositioning(); -private: - Q_DISABLE_COPY(QmlGraphicsColumn) -}; - -class Q_DECLARATIVE_EXPORT QmlGraphicsRow: public QmlGraphicsBasePositioner -{ - Q_OBJECT -public: - QmlGraphicsRow(QmlGraphicsItem *parent=0); -protected Q_SLOTS: - virtual void doPositioning(); -private: - Q_DISABLE_COPY(QmlGraphicsRow) -}; - -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: - QmlGraphicsGrid(QmlGraphicsItem *parent=0); - - int rows() const {return _rows;} - void setRows(const int rows){_rows = rows;} - - int columns() const {return _columns;} - void setcolumns(const int columns){_columns = columns;} -protected Q_SLOTS: - virtual void doPositioning(); - -private: - int _rows; - int _columns; - Q_DISABLE_COPY(QmlGraphicsGrid) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsColumn) -QML_DECLARE_TYPE(QmlGraphicsRow) -QML_DECLARE_TYPE(QmlGraphicsGrid) - -QT_END_HEADER - -#endif diff --git a/src/declarative/fx/qmlgraphicspositioners_p.h b/src/declarative/fx/qmlgraphicspositioners_p.h index f8ca6fd..3304e76 100644 --- a/src/declarative/fx/qmlgraphicspositioners_p.h +++ b/src/declarative/fx/qmlgraphicspositioners_p.h @@ -39,67 +39,129 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSLAYOUTS_P_H -#define QMLGRAPHICSLAYOUTS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qmlgraphicsitem_p.h> +#ifndef QMLGRAPHICSLAYOUTS_H +#define QMLGRAPHICSLAYOUTS_H + #include <QtCore/QObject> #include <QtCore/QString> -#include <QtDeclarative/qmlgraphicspositioners.h> -#include <QtDeclarative/qmlstate.h> -#include <private/qmltransitionmanager_p.h> -#include <QtDeclarative/qmlstateoperations.h> +#include <QtDeclarative/qmlgraphicsitem.h> +#include <private/qmlstate_p.h> + + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsBasePositionerPrivate : public QmlGraphicsItemPrivate + +QT_MODULE(Declarative) +class QmlGraphicsBasePositionerPrivate; + +class Q_DECLARATIVE_EXPORT QmlGraphicsBasePositioner : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsBasePositioner) + Q_OBJECT + Q_PROPERTY(int spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) + Q_PROPERTY(QmlTransition *move READ move WRITE setMove) + Q_PROPERTY(QmlTransition *add READ add WRITE setAdd) + Q_PROPERTY(QmlTransition *remove READ remove WRITE setRemove) public: - QmlGraphicsBasePositionerPrivate() - : _ep(false), _componentComplete(false), _spacing(0), - aut(QmlGraphicsBasePositioner::None), moveTransition(0), addTransition(0), - removeTransition(0), _movingItem(0) - { - } - - void init(QmlGraphicsBasePositioner::AutoUpdateType at) - { - aut = at; - } - - bool _ep; - bool _componentComplete; - int _spacing; - QmlGraphicsBasePositioner::AutoUpdateType aut; - QmlTransition *moveTransition; - QmlTransition *addTransition; - QmlTransition *removeTransition; - QSet<QmlGraphicsItem *> _items; - QSet<QmlGraphicsItem *> _leavingItems; - QSet<QmlGraphicsItem *> _stableItems; - QSet<QmlGraphicsItem *> _newItems; - QSet<QmlGraphicsItem *> _animated; - QmlStateOperation::ActionList addActions; - QmlStateOperation::ActionList moveActions; - QmlStateOperation::ActionList removeActions; - QmlTransitionManager addTransitionManager; - QmlTransitionManager moveTransitionManager; - QmlTransitionManager removeTransitionManager; -// QmlStateGroup *stateGroup; - QmlGraphicsItem *_movingItem; + enum AutoUpdateType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; + QmlGraphicsBasePositioner(AutoUpdateType, QmlGraphicsItem *parent); + + int spacing() const; + void setSpacing(int); + + QmlTransition *move() const; + void setMove(QmlTransition *); + + QmlTransition *add() const; + void setAdd(QmlTransition *); + + QmlTransition *remove() const; + void setRemove(QmlTransition *); + +protected: + virtual void componentComplete(); + virtual QVariant itemChange(GraphicsItemChange, const QVariant &); + virtual bool event(QEvent *); + QSet<QmlGraphicsItem *>* newItems(); + QSet<QmlGraphicsItem *>* leavingItems(); + QSet<QmlGraphicsItem *>* items(); + void applyAdd(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target); + void applyMove(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target); + void applyRemove(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target); + void finishApplyTransitions(); + +Q_SIGNALS: + void layoutItemChanged(); + void spacingChanged(); + +protected Q_SLOTS: + virtual void doPositioning()=0; + +private Q_SLOTS: + void prePositioning(); + +protected: + QmlGraphicsBasePositioner(QmlGraphicsBasePositionerPrivate &dd, AutoUpdateType at, QmlGraphicsItem *parent); + void setMovingItem(QmlGraphicsItem *); + +private: + void applyTransition(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target, + QmlStateOperation::ActionList &actions); + Q_DISABLE_COPY(QmlGraphicsBasePositioner) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBasePositioner) +}; + +class Q_DECLARATIVE_EXPORT QmlGraphicsColumn : public QmlGraphicsBasePositioner +{ + Q_OBJECT +public: + QmlGraphicsColumn(QmlGraphicsItem *parent=0); +protected Q_SLOTS: + virtual void doPositioning(); +private: + Q_DISABLE_COPY(QmlGraphicsColumn) +}; + +class Q_DECLARATIVE_EXPORT QmlGraphicsRow: public QmlGraphicsBasePositioner +{ + Q_OBJECT +public: + QmlGraphicsRow(QmlGraphicsItem *parent=0); +protected Q_SLOTS: + virtual void doPositioning(); +private: + Q_DISABLE_COPY(QmlGraphicsRow) +}; + +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: + QmlGraphicsGrid(QmlGraphicsItem *parent=0); + + int rows() const {return _rows;} + void setRows(const int rows){_rows = rows;} + + int columns() const {return _columns;} + void setcolumns(const int columns){_columns = columns;} +protected Q_SLOTS: + virtual void doPositioning(); + +private: + int _rows; + int _columns; + Q_DISABLE_COPY(QmlGraphicsGrid) }; QT_END_NAMESPACE + +QML_DECLARE_TYPE(QmlGraphicsColumn) +QML_DECLARE_TYPE(QmlGraphicsRow) +QML_DECLARE_TYPE(QmlGraphicsGrid) + +QT_END_HEADER + #endif diff --git a/src/declarative/fx/qmlgraphicspositioners_p_p.h b/src/declarative/fx/qmlgraphicspositioners_p_p.h new file mode 100644 index 0000000..571b815 --- /dev/null +++ b/src/declarative/fx/qmlgraphicspositioners_p_p.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSLAYOUTS_P_H +#define QMLGRAPHICSLAYOUTS_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qmlgraphicsitem_p.h> +#include <QtCore/QObject> +#include <QtCore/QString> +#include <private/qmlgraphicspositioners_p.h> +#include <private/qmlstate_p.h> +#include <private/qmltransitionmanager_p_p.h> +#include <private/qmlstateoperations_p.h> + +QT_BEGIN_NAMESPACE +class QmlGraphicsBasePositionerPrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsBasePositioner) + +public: + QmlGraphicsBasePositionerPrivate() + : _ep(false), _componentComplete(false), _spacing(0), + aut(QmlGraphicsBasePositioner::None), moveTransition(0), addTransition(0), + removeTransition(0), _movingItem(0) + { + } + + void init(QmlGraphicsBasePositioner::AutoUpdateType at) + { + aut = at; + } + + bool _ep; + bool _componentComplete; + int _spacing; + QmlGraphicsBasePositioner::AutoUpdateType aut; + QmlTransition *moveTransition; + QmlTransition *addTransition; + QmlTransition *removeTransition; + QSet<QmlGraphicsItem *> _items; + QSet<QmlGraphicsItem *> _leavingItems; + QSet<QmlGraphicsItem *> _stableItems; + QSet<QmlGraphicsItem *> _newItems; + QSet<QmlGraphicsItem *> _animated; + QmlStateOperation::ActionList addActions; + QmlStateOperation::ActionList moveActions; + QmlStateOperation::ActionList removeActions; + QmlTransitionManager addTransitionManager; + QmlTransitionManager moveTransitionManager; + QmlTransitionManager removeTransitionManager; +// QmlStateGroup *stateGroup; + QmlGraphicsItem *_movingItem; +}; + +QT_END_NAMESPACE +#endif diff --git a/src/declarative/fx/qmlgraphicsrect.cpp b/src/declarative/fx/qmlgraphicsrect.cpp index 1784ae1..e5c226c 100644 --- a/src/declarative/fx/qmlgraphicsrect.cpp +++ b/src/declarative/fx/qmlgraphicsrect.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicsrect.h" #include "qmlgraphicsrect_p.h" +#include "qmlgraphicsrect_p_p.h" #include <QPainter> #include <QtCore/qmath.h> diff --git a/src/declarative/fx/qmlgraphicsrect.h b/src/declarative/fx/qmlgraphicsrect.h deleted file mode 100644 index 454b2f1..0000000 --- a/src/declarative/fx/qmlgraphicsrect.h +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSRECT_H -#define QMLGRAPHICSRECT_H - -#include <QtDeclarative/qmlgraphicsitem.h> -#include <QtGui/qbrush.h> - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -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: - QmlGraphicsPen(QObject *parent=0) - : QObject(parent), _width(1), _color("#000000"), _valid(false) - {} - - int width() const { return _width; } - void setWidth(int w); - - QColor color() const { return _color; } - void setColor(const QColor &c); - - bool isValid() { return _valid; }; - -Q_SIGNALS: - void penChanged(); - -private: - int _width; - QColor _color; - bool _valid; -}; - -class Q_DECLARATIVE_EXPORT QmlGraphicsGradientStop : public QObject -{ - Q_OBJECT - - Q_PROPERTY(qreal position READ position WRITE setPosition) - Q_PROPERTY(QColor color READ color WRITE setColor) - -public: - QmlGraphicsGradientStop(QObject *parent=0) : QObject(parent) {} - - qreal position() const { return m_position; } - void setPosition(qreal position) { m_position = position; updateGradient(); } - - QColor color() const { return m_color; } - void setColor(const QColor &color) { m_color = color; updateGradient(); } - -private: - void updateGradient(); - -private: - qreal m_position; - QColor m_color; -}; - -class Q_DECLARATIVE_EXPORT QmlGraphicsGradient : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QList<QmlGraphicsGradientStop *> *stops READ stops) - Q_CLASSINFO("DefaultProperty", "stops") - -public: - QmlGraphicsGradient(QObject *parent=0) : QObject(parent), m_gradient(0) {} - ~QmlGraphicsGradient() { delete m_gradient; } - - QList<QmlGraphicsGradientStop *> *stops() { return &m_stops; } - - const QGradient *gradient() const; - -Q_SIGNALS: - void updated(); - -private: - void doUpdate(); - -private: - QList<QmlGraphicsGradientStop *> m_stops; - mutable QGradient *m_gradient; - friend class QmlGraphicsGradientStop; -}; - -class QmlGraphicsRectPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsRect : public QmlGraphicsItem -{ - Q_OBJECT - - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) - 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: - QmlGraphicsRect(QmlGraphicsItem *parent=0); - - QColor color() const; - void setColor(const QColor &); - - QmlGraphicsPen *border(); - - QmlGraphicsGradient *gradient() const; - void setGradient(QmlGraphicsGradient *gradient); - - qreal radius() const; - void setRadius(qreal radius); - - QRectF boundingRect() const; - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - -Q_SIGNALS: - void colorChanged(); - void radiusChanged(); - -private Q_SLOTS: - void doUpdate(); - -private: - void generateRoundedRect(); - void generateBorderedRect(); - void drawRect(QPainter &painter); - -protected: - QmlGraphicsRect(QmlGraphicsRectPrivate &dd, QmlGraphicsItem *parent); - -private: - Q_DISABLE_COPY(QmlGraphicsRect) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRect) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsPen) -QML_DECLARE_TYPE(QmlGraphicsGradientStop) -QML_DECLARE_TYPE(QmlGraphicsGradient) -QML_DECLARE_TYPE(QmlGraphicsRect) - -QT_END_HEADER - -#endif // QMLGRAPHICSRECT_H diff --git a/src/declarative/fx/qmlgraphicsrect_p.h b/src/declarative/fx/qmlgraphicsrect_p.h index f44e8de..454b2f1 100644 --- a/src/declarative/fx/qmlgraphicsrect_p.h +++ b/src/declarative/fx/qmlgraphicsrect_p.h @@ -39,71 +39,151 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSRECT_P_H -#define QMLGRAPHICSRECT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlgraphicsitem_p.h" +#ifndef QMLGRAPHICSRECT_H +#define QMLGRAPHICSRECT_H + +#include <QtDeclarative/qmlgraphicsitem.h> +#include <QtGui/qbrush.h> + + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsGradient; -class QmlGraphicsRect; -class QmlGraphicsRectPrivate : public QmlGraphicsItemPrivate +QT_MODULE(Declarative) +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: + QmlGraphicsPen(QObject *parent=0) + : QObject(parent), _width(1), _color("#000000"), _valid(false) + {} + + int width() const { return _width; } + void setWidth(int w); + + QColor color() const { return _color; } + void setColor(const QColor &c); + + bool isValid() { return _valid; }; + +Q_SIGNALS: + void penChanged(); + +private: + int _width; + QColor _color; + bool _valid; +}; + +class Q_DECLARATIVE_EXPORT QmlGraphicsGradientStop : public QObject { - Q_DECLARE_PUBLIC(QmlGraphicsRect) + Q_OBJECT + + Q_PROPERTY(qreal position READ position WRITE setPosition) + Q_PROPERTY(QColor color READ color WRITE setColor) public: - QmlGraphicsRectPrivate() : - color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0) - { - } - - ~QmlGraphicsRectPrivate() - { - delete pen; - } - - void init() - { - } - - QColor getColor(); - QColor color; - QmlGraphicsGradient *gradient; - QmlGraphicsPen *getPen() { - if (!pen) { - Q_Q(QmlGraphicsRect); - pen = new QmlGraphicsPen; - QObject::connect(pen, SIGNAL(penChanged()), q, SLOT(doUpdate())); - } - return pen; - } - QmlGraphicsPen *pen; - qreal radius; - qreal paintmargin; - QPixmap rectImage; - - void setPaintMargin(qreal margin) - { - Q_Q(QmlGraphicsRect); - if (margin == paintmargin) - return; - q->prepareGeometryChange(); - paintmargin = margin; - } + QmlGraphicsGradientStop(QObject *parent=0) : QObject(parent) {} + + qreal position() const { return m_position; } + void setPosition(qreal position) { m_position = position; updateGradient(); } + + QColor color() const { return m_color; } + void setColor(const QColor &color) { m_color = color; updateGradient(); } + +private: + void updateGradient(); + +private: + qreal m_position; + QColor m_color; +}; + +class Q_DECLARATIVE_EXPORT QmlGraphicsGradient : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QList<QmlGraphicsGradientStop *> *stops READ stops) + Q_CLASSINFO("DefaultProperty", "stops") + +public: + QmlGraphicsGradient(QObject *parent=0) : QObject(parent), m_gradient(0) {} + ~QmlGraphicsGradient() { delete m_gradient; } + + QList<QmlGraphicsGradientStop *> *stops() { return &m_stops; } + + const QGradient *gradient() const; + +Q_SIGNALS: + void updated(); + +private: + void doUpdate(); + +private: + QList<QmlGraphicsGradientStop *> m_stops; + mutable QGradient *m_gradient; + friend class QmlGraphicsGradientStop; +}; + +class QmlGraphicsRectPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsRect : public QmlGraphicsItem +{ + Q_OBJECT + + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + 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: + QmlGraphicsRect(QmlGraphicsItem *parent=0); + + QColor color() const; + void setColor(const QColor &); + + QmlGraphicsPen *border(); + + QmlGraphicsGradient *gradient() const; + void setGradient(QmlGraphicsGradient *gradient); + + qreal radius() const; + void setRadius(qreal radius); + + QRectF boundingRect() const; + + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + +Q_SIGNALS: + void colorChanged(); + void radiusChanged(); + +private Q_SLOTS: + void doUpdate(); + +private: + void generateRoundedRect(); + void generateBorderedRect(); + void drawRect(QPainter &painter); + +protected: + QmlGraphicsRect(QmlGraphicsRectPrivate &dd, QmlGraphicsItem *parent); + +private: + Q_DISABLE_COPY(QmlGraphicsRect) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRect) }; QT_END_NAMESPACE -#endif // QMLGRAPHICSRECT_P_H +QML_DECLARE_TYPE(QmlGraphicsPen) +QML_DECLARE_TYPE(QmlGraphicsGradientStop) +QML_DECLARE_TYPE(QmlGraphicsGradient) +QML_DECLARE_TYPE(QmlGraphicsRect) + +QT_END_HEADER + +#endif // QMLGRAPHICSRECT_H diff --git a/src/declarative/fx/qmlgraphicsrect_p_p.h b/src/declarative/fx/qmlgraphicsrect_p_p.h new file mode 100644 index 0000000..f44e8de --- /dev/null +++ b/src/declarative/fx/qmlgraphicsrect_p_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSRECT_P_H +#define QMLGRAPHICSRECT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsitem_p.h" + +QT_BEGIN_NAMESPACE + +class QmlGraphicsGradient; +class QmlGraphicsRect; +class QmlGraphicsRectPrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsRect) + +public: + QmlGraphicsRectPrivate() : + color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0) + { + } + + ~QmlGraphicsRectPrivate() + { + delete pen; + } + + void init() + { + } + + QColor getColor(); + QColor color; + QmlGraphicsGradient *gradient; + QmlGraphicsPen *getPen() { + if (!pen) { + Q_Q(QmlGraphicsRect); + pen = new QmlGraphicsPen; + QObject::connect(pen, SIGNAL(penChanged()), q, SLOT(doUpdate())); + } + return pen; + } + QmlGraphicsPen *pen; + qreal radius; + qreal paintmargin; + QPixmap rectImage; + + void setPaintMargin(qreal margin) + { + Q_Q(QmlGraphicsRect); + if (margin == paintmargin) + return; + q->prepareGeometryChange(); + paintmargin = margin; + } +}; + +QT_END_NAMESPACE + +#endif // QMLGRAPHICSRECT_P_H diff --git a/src/declarative/fx/qmlgraphicsrepeater.cpp b/src/declarative/fx/qmlgraphicsrepeater.cpp index 608f948..c50c220 100644 --- a/src/declarative/fx/qmlgraphicsrepeater.cpp +++ b/src/declarative/fx/qmlgraphicsrepeater.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qmlgraphicsrepeater.h" #include "qmlgraphicsrepeater_p.h" -#include "qmllistaccessor.h" -#include "qmlgraphicsvisualitemmodel.h" -#include <qlistmodelinterface.h> +#include "qmlgraphicsrepeater_p_p.h" +#include <private/qmllistaccessor_p.h> +#include <private/qmlgraphicsvisualitemmodel_p.h> +#include <private/qlistmodelinterface_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicsrepeater.h b/src/declarative/fx/qmlgraphicsrepeater.h deleted file mode 100644 index 9cb7d45..0000000 --- a/src/declarative/fx/qmlgraphicsrepeater.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSREPEATER_H -#define QMLGRAPHICSREPEATER_H - -#include <QtDeclarative/qmlgraphicsitem.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlGraphicsRepeaterPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsRepeater : public QmlGraphicsItem -{ - Q_OBJECT - - Q_PROPERTY(QVariant model READ model WRITE setModel) - Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_CLASSINFO("DefaultProperty", "delegate") - -public: - QmlGraphicsRepeater(QmlGraphicsItem *parent=0); - virtual ~QmlGraphicsRepeater(); - - QVariant model() const; - void setModel(const QVariant &); - - QmlComponent *delegate() const; - void setDelegate(QmlComponent *); - - int count() const; - -Q_SIGNALS: - void countChanged(); - -private: - void clear(); - void regenerate(); - -protected: - virtual void componentComplete(); - QVariant itemChange(GraphicsItemChange change, const QVariant &value); - QmlGraphicsRepeater(QmlGraphicsRepeaterPrivate &dd, QmlGraphicsItem *parent); - -private Q_SLOTS: - void itemsInserted(int,int); - void itemsRemoved(int,int); - void itemsMoved(int,int,int); - -private: - Q_DISABLE_COPY(QmlGraphicsRepeater) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRepeater) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsRepeater) - -QT_END_HEADER - -#endif // QMLGRAPHICSREPEATER_H diff --git a/src/declarative/fx/qmlgraphicsrepeater_p.h b/src/declarative/fx/qmlgraphicsrepeater_p.h index 7c111da..9cb7d45 100644 --- a/src/declarative/fx/qmlgraphicsrepeater_p.h +++ b/src/declarative/fx/qmlgraphicsrepeater_p.h @@ -39,43 +39,65 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSREPEATER_P_H -#define QMLGRAPHICSREPEATER_P_H +#ifndef QMLGRAPHICSREPEATER_H +#define QMLGRAPHICSREPEATER_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlgraphicsitem_p.h" -#include "qmlgraphicsrepeater.h" -#include <QPointer> +#include <QtDeclarative/qmlgraphicsitem.h> +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlContext; -class QmlGraphicsVisualModel; -class QmlGraphicsRepeaterPrivate : public QmlGraphicsItemPrivate +QT_MODULE(Declarative) + +class QmlGraphicsRepeaterPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsRepeater : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsRepeater) + Q_OBJECT + + Q_PROPERTY(QVariant model READ model WRITE setModel) + Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_CLASSINFO("DefaultProperty", "delegate") public: - QmlGraphicsRepeaterPrivate(); - ~QmlGraphicsRepeaterPrivate(); + QmlGraphicsRepeater(QmlGraphicsItem *parent=0); + virtual ~QmlGraphicsRepeater(); + + QVariant model() const; + void setModel(const QVariant &); + + QmlComponent *delegate() const; + void setDelegate(QmlComponent *); + + int count() const; - QmlGraphicsVisualModel *model; - QVariant dataSource; - bool ownModel; +Q_SIGNALS: + void countChanged(); - QList<QPointer<QmlGraphicsItem> > deletables; +private: + void clear(); + void regenerate(); + +protected: + virtual void componentComplete(); + QVariant itemChange(GraphicsItemChange change, const QVariant &value); + QmlGraphicsRepeater(QmlGraphicsRepeaterPrivate &dd, QmlGraphicsItem *parent); + +private Q_SLOTS: + void itemsInserted(int,int); + void itemsRemoved(int,int); + void itemsMoved(int,int,int); + +private: + Q_DISABLE_COPY(QmlGraphicsRepeater) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRepeater) }; QT_END_NAMESPACE -#endif // QMLGRAPHICSREPEATER_P_H + +QML_DECLARE_TYPE(QmlGraphicsRepeater) + +QT_END_HEADER + +#endif // QMLGRAPHICSREPEATER_H diff --git a/src/declarative/fx/qmlgraphicsrepeater_p_p.h b/src/declarative/fx/qmlgraphicsrepeater_p_p.h new file mode 100644 index 0000000..d8b83be --- /dev/null +++ b/src/declarative/fx/qmlgraphicsrepeater_p_p.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSREPEATER_P_H +#define QMLGRAPHICSREPEATER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsitem_p.h" +#include "qmlgraphicsrepeater_p.h" +#include <QPointer> + + +QT_BEGIN_NAMESPACE + +class QmlContext; +class QmlGraphicsVisualModel; +class QmlGraphicsRepeaterPrivate : public QmlGraphicsItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsRepeater) + +public: + QmlGraphicsRepeaterPrivate(); + ~QmlGraphicsRepeaterPrivate(); + + QmlGraphicsVisualModel *model; + QVariant dataSource; + bool ownModel; + + QList<QPointer<QmlGraphicsItem> > deletables; +}; + +QT_END_NAMESPACE +#endif // QMLGRAPHICSREPEATER_P_H diff --git a/src/declarative/fx/qmlgraphicsscalegrid.cpp b/src/declarative/fx/qmlgraphicsscalegrid.cpp index fdf44cf..251f823 100644 --- a/src/declarative/fx/qmlgraphicsscalegrid.cpp +++ b/src/declarative/fx/qmlgraphicsscalegrid.cpp @@ -42,7 +42,7 @@ #include <QBuffer> #include <qml.h> #include <QDebug> -#include "qmlgraphicsscalegrid_p.h" +#include "qmlgraphicsscalegrid_p_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/fx/qmlgraphicsscalegrid_p.h b/src/declarative/fx/qmlgraphicsscalegrid_p_p.h index 040db4c..d5acca2 100644 --- a/src/declarative/fx/qmlgraphicsscalegrid_p.h +++ b/src/declarative/fx/qmlgraphicsscalegrid_p_p.h @@ -45,9 +45,9 @@ #include <QtCore/QString> #include <QtCore/QObject> #include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qmlgraphicspixmapcache.h> +#include <private/qmlgraphicspixmapcache_p.h> #include <QtDeclarative/qml.h> -#include "qmlgraphicsborderimage.h" +#include "qmlgraphicsborderimage_p.h" QT_BEGIN_HEADER diff --git a/src/declarative/fx/qmlgraphicstext.cpp b/src/declarative/fx/qmlgraphicstext.cpp index f5ea55f..0b88cc5 100644 --- a/src/declarative/fx/qmlgraphicstext.cpp +++ b/src/declarative/fx/qmlgraphicstext.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qmlgraphicstext.h" #include "qmlgraphicstext_p.h" +#include "qmlgraphicstext_p_p.h" #include <private/qtextcontrol_p.h> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <QTextLayout> #include <QTextLine> #include <QTextDocument> diff --git a/src/declarative/fx/qmlgraphicstext.h b/src/declarative/fx/qmlgraphicstext.h deleted file mode 100644 index 619de87..0000000 --- a/src/declarative/fx/qmlgraphicstext.h +++ /dev/null @@ -1,151 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSTEXT_H -#define QMLGRAPHICSTEXT_H - -#include <QtDeclarative/qmlgraphicsitem.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QmlGraphicsTextPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsText : public QmlGraphicsItem -{ - Q_OBJECT - Q_ENUMS(HAlignment) - Q_ENUMS(VAlignment) - Q_ENUMS(TextStyle) - Q_ENUMS(TextFormat) - Q_ENUMS(TextElideMode) - - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QFont font READ font WRITE setFont) - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(TextStyle style READ style WRITE setStyle) - Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor) - Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) - Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign) - Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### there are several wrap modes in Qt - Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat) - Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode? - -public: - QmlGraphicsText(QmlGraphicsItem *parent=0); - ~QmlGraphicsText(); - - enum HAlignment { AlignLeft = Qt::AlignLeft, - AlignRight = Qt::AlignRight, - AlignHCenter = Qt::AlignHCenter }; - enum VAlignment { AlignTop = Qt::AlignTop, - AlignBottom = Qt::AlignBottom, - AlignVCenter = Qt::AlignVCenter }; - enum TextStyle { Normal, - Outline, - Raised, - Sunken }; - enum TextFormat { PlainText = Qt::PlainText, - RichText = Qt::RichText, - AutoText = Qt::AutoText }; - enum TextElideMode { ElideLeft = Qt::ElideLeft, - ElideRight = Qt::ElideRight, - ElideMiddle = Qt::ElideMiddle, - ElideNone = Qt::ElideNone }; - - QString text() const; - void setText(const QString &); - - QFont font() const; - void setFont(const QFont &font); - - QColor color() const; - void setColor(const QColor &c); - - TextStyle style() const; - void setStyle(TextStyle style); - - QColor styleColor() const; - void setStyleColor(const QColor &c); - - HAlignment hAlign() const; - void setHAlign(HAlignment align); - - VAlignment vAlign() const; - void setVAlign(VAlignment align); - - bool wrap() const; - void setWrap(bool w); - - TextFormat textFormat() const; - void setTextFormat(TextFormat format); - - TextElideMode elideMode() const; - void setElideMode(TextElideMode); - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - - virtual void componentComplete(); - -Q_SIGNALS: - void textChanged(const QString &text); - void linkActivated(const QString &link); - -protected: - 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(QmlGraphicsText) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsText) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsText) - -QT_END_HEADER - -#endif diff --git a/src/declarative/fx/qmlgraphicstext_p.h b/src/declarative/fx/qmlgraphicstext_p.h index bf14c6f..619de87 100644 --- a/src/declarative/fx/qmlgraphicstext_p.h +++ b/src/declarative/fx/qmlgraphicstext_p.h @@ -39,75 +39,113 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSTEXT_P_H -#define QMLGRAPHICSTEXT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlgraphicsitem.h" -#include "qmlgraphicsitem_p.h" -#include "qml.h" -#include <QtGui/qtextlayout.h> +#ifndef QMLGRAPHICSTEXT_H +#define QMLGRAPHICSTEXT_H -QT_BEGIN_NAMESPACE +#include <QtDeclarative/qmlgraphicsitem.h> + +QT_BEGIN_HEADER -class QTextLayout; -class QTextDocument; -class QTextControl; +QT_BEGIN_NAMESPACE -class QmlGraphicsTextPrivate : public QmlGraphicsItemPrivate +QT_MODULE(Declarative) +class QmlGraphicsTextPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsText : public QmlGraphicsItem { - Q_DECLARE_PUBLIC(QmlGraphicsText) + Q_OBJECT + Q_ENUMS(HAlignment) + Q_ENUMS(VAlignment) + Q_ENUMS(TextStyle) + Q_ENUMS(TextFormat) + Q_ENUMS(TextElideMode) + + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(TextStyle style READ style WRITE setStyle) + Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor) + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) + Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign) + Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### there are several wrap modes in Qt + Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat) + Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode? + public: - 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(QmlGraphicsText::AutoText) - { - } - - void updateSize(); - void checkImgCache(); - - void drawOutline(); - void drawOutline(int yOffset); - - QPixmap wrappedTextImage(bool drawStyle); - QPixmap richTextImage(bool drawStyle); - QSize setupTextLayout(QTextLayout *layout); - - QString text; - QFont font; - QColor color; - QmlGraphicsText::TextStyle style; - QColor styleColor; - QString activeLink; - bool imgDirty; - QPixmap imgCache; - QPixmap imgStyleCache; - QmlGraphicsText::HAlignment hAlign; - QmlGraphicsText::VAlignment vAlign; - QmlGraphicsText::TextElideMode elideMode; - bool dirty; - bool wrap; - bool richText; - bool singleline; - QTextControl *control; - QTextDocument *doc; - QTextLayout layout; - QSize cachedLayoutSize; - QmlGraphicsText::TextFormat format; + QmlGraphicsText(QmlGraphicsItem *parent=0); + ~QmlGraphicsText(); + + enum HAlignment { AlignLeft = Qt::AlignLeft, + AlignRight = Qt::AlignRight, + AlignHCenter = Qt::AlignHCenter }; + enum VAlignment { AlignTop = Qt::AlignTop, + AlignBottom = Qt::AlignBottom, + AlignVCenter = Qt::AlignVCenter }; + enum TextStyle { Normal, + Outline, + Raised, + Sunken }; + enum TextFormat { PlainText = Qt::PlainText, + RichText = Qt::RichText, + AutoText = Qt::AutoText }; + enum TextElideMode { ElideLeft = Qt::ElideLeft, + ElideRight = Qt::ElideRight, + ElideMiddle = Qt::ElideMiddle, + ElideNone = Qt::ElideNone }; + + QString text() const; + void setText(const QString &); + + QFont font() const; + void setFont(const QFont &font); + + QColor color() const; + void setColor(const QColor &c); + + TextStyle style() const; + void setStyle(TextStyle style); + + QColor styleColor() const; + void setStyleColor(const QColor &c); + + HAlignment hAlign() const; + void setHAlign(HAlignment align); + + VAlignment vAlign() const; + void setVAlign(VAlignment align); + + bool wrap() const; + void setWrap(bool w); + + TextFormat textFormat() const; + void setTextFormat(TextFormat format); + + TextElideMode elideMode() const; + void setElideMode(TextElideMode); + + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + + virtual void componentComplete(); + +Q_SIGNALS: + void textChanged(const QString &text); + void linkActivated(const QString &link); + +protected: + 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(QmlGraphicsText) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsText) }; QT_END_NAMESPACE + +QML_DECLARE_TYPE(QmlGraphicsText) + +QT_END_HEADER + #endif diff --git a/src/declarative/fx/qmlgraphicsloader.h b/src/declarative/fx/qmlgraphicstext_p_p.h index 98f764f..bf14c6f 100644 --- a/src/declarative/fx/qmlgraphicsloader.h +++ b/src/declarative/fx/qmlgraphicstext_p_p.h @@ -39,69 +39,75 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSLOADER_H -#define QMLGRAPHICSLOADER_H - -#include <QtDeclarative/qmlgraphicsitem.h> - -QT_BEGIN_HEADER +#ifndef QMLGRAPHICSTEXT_P_H +#define QMLGRAPHICSTEXT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsitem.h" +#include "qmlgraphicsitem_p.h" +#include "qml.h" +#include <QtGui/qtextlayout.h> QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) +class QTextLayout; +class QTextDocument; +class QTextControl; -class QmlGraphicsLoaderPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsLoader : public QmlGraphicsItem +class QmlGraphicsTextPrivate : public QmlGraphicsItemPrivate { - Q_OBJECT - Q_ENUMS(Status) - Q_ENUMS(ResizeMode) - - 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(QmlGraphicsItem *item READ item NOTIFY itemChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - //### sourceItem - + Q_DECLARE_PUBLIC(QmlGraphicsText) public: - QmlGraphicsLoader(QmlGraphicsItem *parent=0); - virtual ~QmlGraphicsLoader(); - - QUrl source() const; - void setSource(const QUrl &); - - QmlComponent *sourceComponent() const; - void setSourceComponent(QmlComponent *); - - enum Status { Null, Ready, Loading, Error }; - Status status() const; - qreal progress() const; - - enum ResizeMode { NoResize, SizeLoaderToItem, SizeItemToLoader }; - ResizeMode resizeMode() const; - void setResizeMode(ResizeMode mode); - - QmlGraphicsItem *item() const; - -Q_SIGNALS: - void itemChanged(); - void sourceChanged(); - void statusChanged(); - void progressChanged(); - -private: - 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()) + 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(QmlGraphicsText::AutoText) + { + } + + void updateSize(); + void checkImgCache(); + + void drawOutline(); + void drawOutline(int yOffset); + + QPixmap wrappedTextImage(bool drawStyle); + QPixmap richTextImage(bool drawStyle); + QSize setupTextLayout(QTextLayout *layout); + + QString text; + QFont font; + QColor color; + QmlGraphicsText::TextStyle style; + QColor styleColor; + QString activeLink; + bool imgDirty; + QPixmap imgCache; + QPixmap imgStyleCache; + QmlGraphicsText::HAlignment hAlign; + QmlGraphicsText::VAlignment vAlign; + QmlGraphicsText::TextElideMode elideMode; + bool dirty; + bool wrap; + bool richText; + bool singleline; + QTextControl *control; + QTextDocument *doc; + QTextLayout layout; + QSize cachedLayoutSize; + QmlGraphicsText::TextFormat format; }; QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsLoader) - -QT_END_HEADER - -#endif // QMLGRAPHICSLOADER_H +#endif diff --git a/src/declarative/fx/qmlgraphicstextedit.cpp b/src/declarative/fx/qmlgraphicstextedit.cpp index 24c64c1..a42ccdd 100644 --- a/src/declarative/fx/qmlgraphicstextedit.cpp +++ b/src/declarative/fx/qmlgraphicstextedit.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include <qmlgraphicstextedit.h> #include "qmlgraphicstextedit_p.h" +#include "qmlgraphicstextedit_p_p.h" #include <private/qtextcontrol_p.h> -#include <private/qfxperf_p.h> -#include "qmlgraphicsevents_p.h" +#include <private/qfxperf_p_p.h> +#include <private/qmlgraphicsevents_p_p.h> #include <QTextLayout> #include <QTextLine> #include <QTextDocument> diff --git a/src/declarative/fx/qmlgraphicstextedit.h b/src/declarative/fx/qmlgraphicstextedit.h deleted file mode 100644 index 57f7449..0000000 --- a/src/declarative/fx/qmlgraphicstextedit.h +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSTEXTEDIT_H -#define QMLGRAPHICSTEXTEDIT_H - -#include <QtDeclarative/qmlgraphicstext.h> -#include <QtDeclarative/qmlgraphicspainteditem.h> - -#include <QtGui/qtextdocument.h> -#include <QtGui/qtextoption.h> -#include <QtGui/qtextcursor.h> -#include <QtGui/qtextformat.h> - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - - -class QmlGraphicsTextEditPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsTextEdit : public QmlGraphicsPaintedItem -{ - Q_OBJECT - Q_ENUMS(VAlignment) - Q_ENUMS(HAlignment) - Q_ENUMS(TextFormat) - - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor) - Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) - Q_PROPERTY(QFont font READ font WRITE setFont) - Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) - Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign) - Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### other wrap modes - Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat) - Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) - Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) - Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) - Q_PROPERTY(QmlComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate) - Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged) - Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) - Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectionChanged) - Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) - Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection) - Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin) - -public: - QmlGraphicsTextEdit(QmlGraphicsItem *parent=0); - - enum HAlignment { - AlignLeft = Qt::AlignLeft, - AlignRight = Qt::AlignRight, - AlignHCenter = Qt::AlignHCenter - }; - - enum VAlignment { - AlignTop = Qt::AlignTop, - AlignBottom = Qt::AlignBottom, - AlignVCenter = Qt::AlignVCenter - }; - - enum TextFormat { - PlainText = Qt::PlainText, - RichText = Qt::RichText, - AutoText = Qt::AutoText - }; - - QString text() const; - void setText(const QString &); - - TextFormat textFormat() const; - void setTextFormat(TextFormat format); - - QFont font() const; - void setFont(const QFont &font); - - QColor color() const; - void setColor(const QColor &c); - - QColor selectionColor() const; - void setSelectionColor(const QColor &c); - - QColor selectedTextColor() const; - void setSelectedTextColor(const QColor &c); - - HAlignment hAlign() const; - void setHAlign(HAlignment align); - - VAlignment vAlign() const; - void setVAlign(VAlignment align); - - bool wrap() const; - void setWrap(bool w); - - bool isCursorVisible() const; - void setCursorVisible(bool on); - - int cursorPosition() const; - void setCursorPosition(int pos); - - QmlComponent* cursorDelegate() const; - void setCursorDelegate(QmlComponent*); - - int selectionStart() const; - void setSelectionStart(int); - - int selectionEnd() const; - void setSelectionEnd(int); - - QString selectedText() const; - - bool focusOnPress() const; - void setFocusOnPress(bool on); - - bool persistentSelection() const; - void setPersistentSelection(bool on); - - qreal textMargin() const; - void setTextMargin(qreal margin); - - virtual void componentComplete(); - - /* FROM EDIT */ - void setReadOnly(bool); - bool isReadOnly() const; - - void setTextInteractionFlags(Qt::TextInteractionFlags flags); - Qt::TextInteractionFlags textInteractionFlags() const; - - QTextCursor cursorForPosition(const QPoint &pos) const; - QRect cursorRect(const QTextCursor &cursor) const; - QRect cursorRect() const; - - void setTextCursor(const QTextCursor &cursor); - QTextCursor textCursor() const; - - void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); - - QVariant inputMethodQuery(Qt::InputMethodQuery property) const; - -Q_SIGNALS: - void textChanged(const QString &); - void cursorPositionChanged(); - void selectionStartChanged(); - void selectionEndChanged(); - void selectionChanged(); - -public Q_SLOTS: - void selectAll(); - -private Q_SLOTS: - void updateImgCache(const QRectF &rect); - void q_textChanged(); - void updateSelectionMarkers(); - void moveCursorDelegate(); - void loadCursorDelegate(); - -private: - void updateSize(); - -protected: - QmlGraphicsTextEdit(QmlGraphicsTextEditPrivate &dd, QmlGraphicsItem *parent); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - - bool event(QEvent *); - void keyPressEvent(QKeyEvent *); - void keyReleaseEvent(QKeyEvent *); - - void focusChanged(bool); - - // mouse filter? - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - - void inputMethodEvent(QInputMethodEvent *e); - - void drawContents(QPainter *, const QRect &); -private: - Q_DISABLE_COPY(QmlGraphicsTextEdit) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextEdit) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsTextEdit) - -QT_END_HEADER - -#endif diff --git a/src/declarative/fx/qmlgraphicstextedit_p.h b/src/declarative/fx/qmlgraphicstextedit_p.h index 7a163f8..57a9327 100644 --- a/src/declarative/fx/qmlgraphicstextedit_p.h +++ b/src/declarative/fx/qmlgraphicstextedit_p.h @@ -39,75 +39,196 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSTEXTEDIT_P_H -#define QMLGRAPHICSTEXTEDIT_P_H +#ifndef QMLGRAPHICSTEXTEDIT_H +#define QMLGRAPHICSTEXTEDIT_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// +#include <private/qmlgraphicstext_p.h> +#include <private/qmlgraphicspainteditem_p.h> -#include "qmlgraphicsitem.h" -#include "qmlgraphicspainteditem_p.h" -#include "qml.h" +#include <QtGui/qtextdocument.h> +#include <QtGui/qtextoption.h> +#include <QtGui/qtextcursor.h> +#include <QtGui/qtextformat.h> +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE -class QTextLayout; -class QTextDocument; -class QTextControl; -class QmlGraphicsTextEditPrivate : public QmlGraphicsPaintedItemPrivate + +QT_MODULE(Declarative) + + +class QmlGraphicsTextEditPrivate; +class Q_DECLARATIVE_EXPORT QmlGraphicsTextEdit : public QmlGraphicsPaintedItem { - Q_DECLARE_PUBLIC(QmlGraphicsTextEdit) + Q_OBJECT + Q_ENUMS(VAlignment) + Q_ENUMS(HAlignment) + Q_ENUMS(TextFormat) + + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor) + Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) + Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign) + Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### other wrap modes + Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat) + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) + Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) + Q_PROPERTY(QmlComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate) + Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged) + Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) + Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectionChanged) + Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) + Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection) + Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin) public: - 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(QmlGraphicsTextEdit::AutoText), document(0) - { - } - - void init(); - - void updateDefaultTextOption(); - void relayoutDocument(); - void updateSelection(); - - QString text; - QFont font; - QColor color; - QColor selectionColor; - QColor selectedTextColor; - QString style; - QColor styleColor; - bool imgDirty; - QPixmap imgCache; - QPixmap imgStyleCache; - QmlGraphicsTextEdit::HAlignment hAlign; - QmlGraphicsTextEdit::VAlignment vAlign; - bool dirty; - bool wrap; - bool richText; - bool cursorVisible; - bool focusOnPress; - bool persistentSelection; - qreal textMargin; - int lastSelectionStart; - int lastSelectionEnd; - QmlComponent* cursorComponent; - QmlGraphicsItem* cursor; - QmlGraphicsTextEdit::TextFormat format; - QTextDocument *document; - QTextControl *control; + QmlGraphicsTextEdit(QmlGraphicsItem *parent=0); + + enum HAlignment { + AlignLeft = Qt::AlignLeft, + AlignRight = Qt::AlignRight, + AlignHCenter = Qt::AlignHCenter + }; + + enum VAlignment { + AlignTop = Qt::AlignTop, + AlignBottom = Qt::AlignBottom, + AlignVCenter = Qt::AlignVCenter + }; + + enum TextFormat { + PlainText = Qt::PlainText, + RichText = Qt::RichText, + AutoText = Qt::AutoText + }; + + QString text() const; + void setText(const QString &); + + TextFormat textFormat() const; + void setTextFormat(TextFormat format); + + QFont font() const; + void setFont(const QFont &font); + + QColor color() const; + void setColor(const QColor &c); + + QColor selectionColor() const; + void setSelectionColor(const QColor &c); + + QColor selectedTextColor() const; + void setSelectedTextColor(const QColor &c); + + HAlignment hAlign() const; + void setHAlign(HAlignment align); + + VAlignment vAlign() const; + void setVAlign(VAlignment align); + + bool wrap() const; + void setWrap(bool w); + + bool isCursorVisible() const; + void setCursorVisible(bool on); + + int cursorPosition() const; + void setCursorPosition(int pos); + + QmlComponent* cursorDelegate() const; + void setCursorDelegate(QmlComponent*); + + int selectionStart() const; + void setSelectionStart(int); + + int selectionEnd() const; + void setSelectionEnd(int); + + QString selectedText() const; + + bool focusOnPress() const; + void setFocusOnPress(bool on); + + bool persistentSelection() const; + void setPersistentSelection(bool on); + + qreal textMargin() const; + void setTextMargin(qreal margin); + + virtual void componentComplete(); + + /* FROM EDIT */ + void setReadOnly(bool); + bool isReadOnly() const; + + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + + QTextCursor cursorForPosition(const QPoint &pos) const; + QRect cursorRect(const QTextCursor &cursor) const; + QRect cursorRect() const; + + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + + void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + + QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + +Q_SIGNALS: + void textChanged(const QString &); + void cursorPositionChanged(); + void selectionStartChanged(); + void selectionEndChanged(); + void selectionChanged(); + +public Q_SLOTS: + void selectAll(); + +private Q_SLOTS: + void updateImgCache(const QRectF &rect); + void q_textChanged(); + void updateSelectionMarkers(); + void moveCursorDelegate(); + void loadCursorDelegate(); + +private: + void updateSize(); + +protected: + QmlGraphicsTextEdit(QmlGraphicsTextEditPrivate &dd, QmlGraphicsItem *parent); + virtual void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry); + + bool event(QEvent *); + void keyPressEvent(QKeyEvent *); + void keyReleaseEvent(QKeyEvent *); + + void focusChanged(bool); + + // mouse filter? + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + + void inputMethodEvent(QInputMethodEvent *e); + + void drawContents(QPainter *, const QRect &); +private: + Q_DISABLE_COPY(QmlGraphicsTextEdit) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextEdit) }; QT_END_NAMESPACE + +QML_DECLARE_TYPE(QmlGraphicsTextEdit) + +QT_END_HEADER + #endif diff --git a/src/declarative/fx/qmlgraphicstextedit_p_p.h b/src/declarative/fx/qmlgraphicstextedit_p_p.h new file mode 100644 index 0000000..9cba17e --- /dev/null +++ b/src/declarative/fx/qmlgraphicstextedit_p_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLGRAPHICSTEXTEDIT_P_H +#define QMLGRAPHICSTEXTEDIT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlgraphicsitem.h" +#include "qmlgraphicspainteditem_p_p.h" +#include "qml.h" + + +QT_BEGIN_NAMESPACE +class QTextLayout; +class QTextDocument; +class QTextControl; +class QmlGraphicsTextEditPrivate : public QmlGraphicsPaintedItemPrivate +{ + Q_DECLARE_PUBLIC(QmlGraphicsTextEdit) + +public: + 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(QmlGraphicsTextEdit::AutoText), document(0) + { + } + + void init(); + + void updateDefaultTextOption(); + void relayoutDocument(); + void updateSelection(); + + QString text; + QFont font; + QColor color; + QColor selectionColor; + QColor selectedTextColor; + QString style; + QColor styleColor; + bool imgDirty; + QPixmap imgCache; + QPixmap imgStyleCache; + QmlGraphicsTextEdit::HAlignment hAlign; + QmlGraphicsTextEdit::VAlignment vAlign; + bool dirty; + bool wrap; + bool richText; + bool cursorVisible; + bool focusOnPress; + bool persistentSelection; + qreal textMargin; + int lastSelectionStart; + int lastSelectionEnd; + QmlComponent* cursorComponent; + QmlGraphicsItem* cursor; + QmlGraphicsTextEdit::TextFormat format; + QTextDocument *document; + QTextControl *control; +}; + +QT_END_NAMESPACE +#endif diff --git a/src/declarative/fx/qmlgraphicstextinput.cpp b/src/declarative/fx/qmlgraphicstextinput.cpp index 17e6f7c..5df2484 100644 --- a/src/declarative/fx/qmlgraphicstextinput.cpp +++ b/src/declarative/fx/qmlgraphicstextinput.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlgraphicstextinput.h" #include "qmlgraphicstextinput_p.h" +#include "qmlgraphicstextinput_p_p.h" #include "qmlinfo.h" #include <QValidator> #include <QApplication> diff --git a/src/declarative/fx/qmlgraphicstextinput.h b/src/declarative/fx/qmlgraphicstextinput.h deleted file mode 100644 index 1b143e0..0000000 --- a/src/declarative/fx/qmlgraphicstextinput.h +++ /dev/null @@ -1,209 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLGRAPHICSTEXTINPUT_H -#define QMLGRAPHICSTEXTINPUT_H - -#include "qmlgraphicstext.h" -#include "qmlgraphicspainteditem.h" -#include <QGraphicsSceneMouseEvent> -#include <QIntValidator> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlGraphicsTextInputPrivate; -class QValidator; -class Q_DECLARATIVE_EXPORT QmlGraphicsTextInput : public QmlGraphicsPaintedItem -{ - Q_OBJECT - Q_ENUMS(HAlignment) - Q_ENUMS(EchoMode) - - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor) - Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) - Q_PROPERTY(QFont font READ font WRITE setFont) - Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) - - Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) - Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) - Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) - Q_PROPERTY(QmlComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate) - Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged) - Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) - Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged) - - Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength) - Q_PROPERTY(QValidator* validator READ validator WRITE setValidator) - Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask) - Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) - Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode) - Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) - -public: - QmlGraphicsTextInput(QmlGraphicsItem* parent=0); - ~QmlGraphicsTextInput(); - - enum EchoMode {//To match QLineEdit::EchoMode - Normal, - NoEcho, - Password, - PasswordEchoOnEdit - }; - - enum HAlignment { - AlignLeft = Qt::AlignLeft, - AlignRight = Qt::AlignRight, - AlignHCenter = Qt::AlignHCenter - }; - - //### Should we have this function, x based properties, - //### or copy TextEdit with x instead of QTextCursor? - Q_INVOKABLE int xToPos(int x); - - QString text() const; - void setText(const QString &); - - QFont font() const; - void setFont(const QFont &font); - - QColor color() const; - void setColor(const QColor &c); - - QColor selectionColor() const; - void setSelectionColor(const QColor &c); - - QColor selectedTextColor() const; - void setSelectedTextColor(const QColor &c); - - HAlignment hAlign() const; - void setHAlign(HAlignment align); - - bool isReadOnly() const; - void setReadOnly(bool); - - bool isCursorVisible() const; - void setCursorVisible(bool on); - - int cursorPosition() const; - void setCursorPosition(int cp); - - QRect cursorRect() const; - - int selectionStart() const; - void setSelectionStart(int); - - int selectionEnd() const; - void setSelectionEnd(int); - - QString selectedText() const; - - int maxLength() const; - void setMaxLength(int ml); - - QValidator * validator() const; - void setValidator(QValidator* v); - - QString inputMask() const; - void setInputMask(const QString &im); - - EchoMode echoMode() const; - void setEchoMode(EchoMode echo); - - QmlComponent* cursorDelegate() const; - void setCursorDelegate(QmlComponent*); - - bool focusOnPress() const; - void setFocusOnPress(bool); - - bool hasAcceptableInput() const; - - void drawContents(QPainter *p,const QRect &r); -Q_SIGNALS: - void textChanged(); - void cursorPositionChanged(); - void selectionStartChanged(); - void selectionEndChanged(); - void selectedTextChanged(); - void accepted(); - void acceptableInputChanged(); - -protected: - QmlGraphicsTextInput(QmlGraphicsTextInputPrivate &dd, QmlGraphicsItem *parent); - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void keyPressEvent(QKeyEvent* ev); - bool event(QEvent *e); - - void focusChanged(bool hasFocus); - -public Q_SLOTS: - void selectAll(); - -private Q_SLOTS: - void updateSize(bool needsRedraw = true); - void q_textChanged(); - void selectionChanged(); - void createCursor(); - void moveCursor(); - void cursorPosChanged(); - void updateRect(const QRect &r = QRect()); - -private: - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextInput) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlGraphicsTextInput) -QML_DECLARE_TYPE(QValidator) -QML_DECLARE_TYPE(QIntValidator) - -QT_END_HEADER - -#endif // QMLGRAPHICSTEXTINPUT_H diff --git a/src/declarative/fx/qmlgraphicstextinput_p.h b/src/declarative/fx/qmlgraphicstextinput_p.h index 010dfe1..10939a8 100644 --- a/src/declarative/fx/qmlgraphicstextinput_p.h +++ b/src/declarative/fx/qmlgraphicstextinput_p.h @@ -39,71 +39,171 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSTEXTINPUT_P_H -#define QMLGRAPHICSTEXTINPUT_P_H +#ifndef QMLGRAPHICSTEXTINPUT_H +#define QMLGRAPHICSTEXTINPUT_H -#include "qmlgraphicstextinput.h" -#include "qml.h" +#include "qmlgraphicstext_p.h" #include "qmlgraphicspainteditem_p.h" -#include "private/qlinecontrol_p.h" -#include <QPointer> -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. +#include <QGraphicsSceneMouseEvent> +#include <QIntValidator> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlGraphicsTextInputPrivate : public QmlGraphicsPaintedItemPrivate +QT_MODULE(Declarative) + +class QmlGraphicsTextInputPrivate; +class QValidator; +class Q_DECLARATIVE_EXPORT QmlGraphicsTextInput : public QmlGraphicsPaintedItem { - Q_DECLARE_PUBLIC(QmlGraphicsTextInput) + Q_OBJECT + Q_ENUMS(HAlignment) + Q_ENUMS(EchoMode) + + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor) + Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) + Q_PROPERTY(QFont font READ font WRITE setFont) + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) + + Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) + Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) + Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) + Q_PROPERTY(QmlComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate) + Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged) + Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) + Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged) + + Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength) + Q_PROPERTY(QValidator* validator READ validator WRITE setValidator) + Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask) + Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) + Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode) + Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) + public: - 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) - { - } - - ~QmlGraphicsTextInputPrivate() - { - delete control; - } - - void init(); - void startCreatingCursor(); - - QLineControl* control; - - QFont font; - QColor color; - QColor selectionColor; - QColor selectedTextColor; - QmlGraphicsText::TextStyle style; - QColor styleColor; - QmlGraphicsTextInput::HAlignment hAlign; - QPointer<QmlComponent> cursorComponent; - QPointer<QmlGraphicsItem> cursorItem; - - int lastSelectionStart; - int lastSelectionEnd; - int oldHeight; - int oldWidth; - bool oldValidity; - int hscroll; - int oldScroll; - bool focused; - bool focusOnPress; - bool cursorVisible; + QmlGraphicsTextInput(QmlGraphicsItem* parent=0); + ~QmlGraphicsTextInput(); + + enum EchoMode {//To match QLineEdit::EchoMode + Normal, + NoEcho, + Password, + PasswordEchoOnEdit + }; + + enum HAlignment { + AlignLeft = Qt::AlignLeft, + AlignRight = Qt::AlignRight, + AlignHCenter = Qt::AlignHCenter + }; + + //### Should we have this function, x based properties, + //### or copy TextEdit with x instead of QTextCursor? + Q_INVOKABLE int xToPos(int x); + + QString text() const; + void setText(const QString &); + + QFont font() const; + void setFont(const QFont &font); + + QColor color() const; + void setColor(const QColor &c); + + QColor selectionColor() const; + void setSelectionColor(const QColor &c); + + QColor selectedTextColor() const; + void setSelectedTextColor(const QColor &c); + + HAlignment hAlign() const; + void setHAlign(HAlignment align); + + bool isReadOnly() const; + void setReadOnly(bool); + + bool isCursorVisible() const; + void setCursorVisible(bool on); + + int cursorPosition() const; + void setCursorPosition(int cp); + + QRect cursorRect() const; + + int selectionStart() const; + void setSelectionStart(int); + + int selectionEnd() const; + void setSelectionEnd(int); + + QString selectedText() const; + + int maxLength() const; + void setMaxLength(int ml); + + QValidator * validator() const; + void setValidator(QValidator* v); + + QString inputMask() const; + void setInputMask(const QString &im); + + EchoMode echoMode() const; + void setEchoMode(EchoMode echo); + + QmlComponent* cursorDelegate() const; + void setCursorDelegate(QmlComponent*); + + bool focusOnPress() const; + void setFocusOnPress(bool); + + bool hasAcceptableInput() const; + + void drawContents(QPainter *p,const QRect &r); +Q_SIGNALS: + void textChanged(); + void cursorPositionChanged(); + void selectionStartChanged(); + void selectionEndChanged(); + void selectedTextChanged(); + void accepted(); + void acceptableInputChanged(); + +protected: + QmlGraphicsTextInput(QmlGraphicsTextInputPrivate &dd, QmlGraphicsItem *parent); + virtual void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry); + + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void keyPressEvent(QKeyEvent* ev); + bool event(QEvent *e); + + void focusChanged(bool hasFocus); + +public Q_SLOTS: + void selectAll(); + +private Q_SLOTS: + void updateSize(bool needsRedraw = true); + void q_textChanged(); + void selectionChanged(); + void createCursor(); + void moveCursor(); + void cursorPosChanged(); + void updateRect(const QRect &r = QRect()); + +private: + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextInput) }; QT_END_NAMESPACE -#endif +QML_DECLARE_TYPE(QmlGraphicsTextInput) +QML_DECLARE_TYPE(QValidator) +QML_DECLARE_TYPE(QIntValidator) + +QT_END_HEADER +#endif // QMLGRAPHICSTEXTINPUT_H diff --git a/src/declarative/fx/qmlgraphicspainteditem.h b/src/declarative/fx/qmlgraphicstextinput_p_p.h index 7ff55a5..d17707f 100644 --- a/src/declarative/fx/qmlgraphicspainteditem.h +++ b/src/declarative/fx/qmlgraphicstextinput_p_p.h @@ -39,67 +39,71 @@ ** ****************************************************************************/ -#ifndef QMLGRAPHICSIMAGEITEM_H -#define QMLGRAPHICSIMAGEITEM_H - -#include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qmlgraphicsitem.h> - - -QT_BEGIN_HEADER +#ifndef QMLGRAPHICSTEXTINPUT_P_H +#define QMLGRAPHICSTEXTINPUT_P_H + +#include "qmlgraphicstextinput_p.h" +#include "qml.h" +#include "qmlgraphicspainteditem_p_p.h" +#include "private/qlinecontrol_p.h" +#include <QPointer> +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) - -class QmlGraphicsPaintedItemPrivate; -class Q_DECLARATIVE_EXPORT QmlGraphicsPaintedItem : public QmlGraphicsItem +class QmlGraphicsTextInputPrivate : public QmlGraphicsPaintedItemPrivate { - Q_OBJECT - - Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize) - Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged) - Q_PROPERTY(int cacheSize READ cacheSize WRITE setCacheSize) - + Q_DECLARE_PUBLIC(QmlGraphicsTextInput) public: - QmlGraphicsPaintedItem(QmlGraphicsItem *parent=0); - ~QmlGraphicsPaintedItem(); - - QSize contentsSize() const; - void setContentsSize(const QSize &); - - int cacheSize() const; - void setCacheSize(int pixels); - - QColor fillColor() const; - void setFillColor(const QColor&); + 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) + { + } + + ~QmlGraphicsTextInputPrivate() + { + delete control; + } - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - -protected: - QmlGraphicsPaintedItem(QmlGraphicsPaintedItemPrivate &dd, QmlGraphicsItem *parent); - - virtual void drawContents(QPainter *p, const QRect &) = 0; - - void setCacheFrozen(bool); - -Q_SIGNALS: - void fillColorChanged(); - -protected Q_SLOTS: - void dirtyCache(const QRect &); - void clearCache(); - -private: void init(); - Q_DISABLE_COPY(QmlGraphicsPaintedItem) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPaintedItem) + void startCreatingCursor(); + + QLineControl* control; + + QFont font; + QColor color; + QColor selectionColor; + QColor selectedTextColor; + QmlGraphicsText::TextStyle style; + QColor styleColor; + QmlGraphicsTextInput::HAlignment hAlign; + QPointer<QmlComponent> cursorComponent; + QPointer<QmlGraphicsItem> cursorItem; + + int lastSelectionStart; + int lastSelectionEnd; + int oldHeight; + int oldWidth; + bool oldValidity; + int hscroll; + int oldScroll; + bool focused; + bool focusOnPress; + bool cursorVisible; }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QmlGraphicsPaintedItem) - -QT_END_HEADER - #endif + diff --git a/src/declarative/fx/qmlgraphicsvisualitemmodel.cpp b/src/declarative/fx/qmlgraphicsvisualitemmodel.cpp index b9b0237..3e8dfb4 100644 --- a/src/declarative/fx/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/fx/qmlgraphicsvisualitemmodel.cpp @@ -39,19 +39,19 @@ ** ****************************************************************************/ -#include "qlistmodelinterface.h" +#include <private/qlistmodelinterface_p.h> #include "qmlgraphicsitem.h" #include <qmlcontext.h> #include <qmlexpression.h> -#include "qmlpackage.h" +#include <private/qmlpackage_p.h> #include "qhash.h" #include "qlist.h" #include "private/qobject_p.h" #include "private/qmetaobjectbuilder_p.h" -#include "qmlopenmetaobject.h" -#include "qmllistaccessor.h" +#include <private/qmlopenmetaobject_p.h> +#include <private/qmllistaccessor_p.h> #include "qmlinfo.h" -#include "qmlgraphicsvisualitemmodel.h" +#include "qmlgraphicsvisualitemmodel_p.h" #include "private/qguard_p.h" #include <QtCore/qdebug.h> @@ -1029,4 +1029,5 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisualItemModel,QmlGraphicsVisua QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VisualDataModel,QmlGraphicsVisualDataModel) QT_END_NAMESPACE -#include "qfxvisualitemmodel.moc" + +#include "qmlgraphicsvisualitemmodel.moc" diff --git a/src/declarative/fx/qmlgraphicsvisualitemmodel.h b/src/declarative/fx/qmlgraphicsvisualitemmodel_p.h index fb36531..fb36531 100644 --- a/src/declarative/fx/qmlgraphicsvisualitemmodel.h +++ b/src/declarative/fx/qmlgraphicsvisualitemmodel_p.h diff --git a/src/declarative/fx/qmlgraphicswebview.cpp b/src/declarative/fx/qmlgraphicswebview.cpp index d9044cf..a307bc2 100644 --- a/src/declarative/fx/qmlgraphicswebview.cpp +++ b/src/declarative/fx/qmlgraphicswebview.cpp @@ -55,11 +55,11 @@ #include "qml.h" #include "qmlengine.h" -#include "qmlstate.h" -#include "qlistmodelinterface.h" +#include "qmlstate_p.h" +#include "qlistmodelinterface_p.h" -#include "qmlgraphicswebview.h" -#include <private/qmlgraphicspainteditem_p.h> +#include "qmlgraphicswebview_p.h" +#include <private/qmlgraphicspainteditem_p_p.h> QT_BEGIN_NAMESPACE QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,WebView,QmlGraphicsWebView) @@ -1385,4 +1385,4 @@ QWebPage *QmlGraphicsWebPage::createWindow(WebWindowType type) QT_END_NAMESPACE -#include "qfxwebview.moc" +#include "qmlgraphicswebview.moc" diff --git a/src/declarative/fx/qmlgraphicswebview.h b/src/declarative/fx/qmlgraphicswebview_p.h index 81f7bcd..0398b0d 100644 --- a/src/declarative/fx/qmlgraphicswebview.h +++ b/src/declarative/fx/qmlgraphicswebview_p.h @@ -45,7 +45,7 @@ #include <QtGui/QAction> #include <QtCore/QUrl> #include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qmlgraphicspainteditem.h> +#include <private/qmlgraphicspainteditem_p.h> #include <QtNetwork/qnetworkaccessmanager.h> #include <QtWebKit/QWebPage> diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index eba4307..0eb897b 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -45,7 +45,7 @@ #include <private/qmlengine_p.h> #include <private/qmlcontext_p.h> #include <QStack> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <private/qmlrefcount_p.h> #include <private/qmljsast_p.h> #include <private/qmljsengine_p.h> diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index fa971a3..045b45a 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -45,7 +45,7 @@ #include <qmlcontext.h> #include <qmlinfo.h> #include <QVariant> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <QtCore/qdebug.h> #include <private/qmlcontext_p.h> #include <private/qmldeclarativedata_p.h> diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 5d2bd12..f7bd027 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -41,7 +41,7 @@ #include "private/qmlcompiler_p.h" #include "private/qmlcompositetypedata_p.h" -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include "qmlparser_p.h" #include "private/qmlscriptparser_p.h" #include <qmlpropertyvaluesource.h> diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index c856680..f2268a7 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -48,7 +48,7 @@ #include "qmlvme_p.h" #include "qml.h" #include <QStack> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <QStringList> #include <qmlengine.h> #include <QFileInfo> diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 463bd93..6f60b4f 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -62,7 +62,7 @@ #include <QDebug> #include <QMetaObject> #include "qml.h" -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <QStack> #include "private/qmlbasicscript_p.h" #include "qmlengine.h" diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qmlenginedebug_p.h index a8572eb..c381033 100644 --- a/src/declarative/qml/qmlenginedebug_p.h +++ b/src/declarative/qml/qmlenginedebug_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtDeclarative/qmldebugservice.h> +#include <private/qmldebugservice_p.h> #include <QtCore/qurl.h> #include <QtCore/qvariant.h> diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index edec988..a76c36b 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -43,7 +43,7 @@ #include "qmlmetaproperty_p.h" #include "qmlcompositetypedata_p.h" #include <qml.h> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <QStringList> #include "qmlbinding.h" #include <qmlcontext.h> diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp index f9e3c50..dfedae5 100644 --- a/src/declarative/qml/qmlparser.cpp +++ b/src/declarative/qml/qmlparser.cpp @@ -47,7 +47,7 @@ #include <QSizeF> #include <QRectF> #include <private/qmlvme_p.h> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <qml.h> #include "private/qmlcomponent_p.h" #include <qmlcomponent.h> diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 95dfe5b..2dfda37 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -55,7 +55,7 @@ #include <QCoreApplication> #include <QtDebug> -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index b986b60..e112f25 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -41,7 +41,7 @@ #include "qmlvme_p.h" #include "qmlcompiler_p.h" -#include <private/qfxperf_p.h> +#include <private/qfxperf_p_p.h> #include <private/qmlboundsignal_p.h> #include <private/qmlstringconverters_p.h> #include "private/qmetaobjectbuilder_p.h" diff --git a/src/declarative/qml/qmlwatcher.cpp b/src/declarative/qml/qmlwatcher.cpp index 8cd51e0..a9d3dad 100644 --- a/src/declarative/qml/qmlwatcher.cpp +++ b/src/declarative/qml/qmlwatcher.cpp @@ -42,7 +42,7 @@ #include <QtCore/qmetaobject.h> #include <QtCore/qdebug.h> #include <QtDeclarative/qmlexpression.h> -#include <QtDeclarative/qmldebugservice.h> +#include <private/qmldebugservice_p.h> #include <QtDeclarative/qmlcontext.h> #include <QtDeclarative/qml.h> diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index 97f195b..a21f2ed 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "private/qfxperf_p.h" +#include "private/qfxperf_p_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qfxperf_p.h b/src/declarative/util/qfxperf_p_p.h index 37bfc32..e4424b0 100644 --- a/src/declarative/util/qfxperf_p.h +++ b/src/declarative/util/qfxperf_p_p.h @@ -52,7 +52,7 @@ // We mean it. // -#include "private/qperformancelog_p.h" +#include "private/qperformancelog_p_p.h" QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index e00a1c8..cc46a9c 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qmlanimation.h" +#include "qmlanimation_p.h" #include "qvariant.h" #include "qcolor.h" #include "qfile.h" #include "qmlpropertyvaluesource.h" #include "qml.h" #include "qmlinfo.h" -#include "qmlanimation_p.h" -#include "qmlbehavior.h" +#include "qmlanimation_p_p.h" +#include <private/qmlbehavior_p.h> #include <QParallelAnimationGroup> #include <QSequentialAnimationGroup> #include <QtCore/qset.h> @@ -55,7 +55,7 @@ #include <QtCore/qpoint.h> #include <QtCore/qsize.h> #include <QtDeclarative/qmlexpression.h> -#include <QtDeclarative/qmlstateoperations.h> +#include <private/qmlstateoperations_p.h> #include <private/qmlstringconverters_p.h> #include <private/qvariantanimation_p.h> diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h deleted file mode 100644 index 4e94aa0..0000000 --- a/src/declarative/util/qmlanimation.h +++ /dev/null @@ -1,407 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLANIMATION_H -#define QMLANIMATION_H - -#include <QtCore/qvariant.h> -#include <QtCore/QAbstractAnimation> -#include <QtGui/qcolor.h> -#include <QtDeclarative/qmltransition.h> -#include <QtDeclarative/qmlpropertyvaluesource.h> -#include <QtDeclarative/qmlstate.h> -#include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlscriptstring.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlAbstractAnimationPrivate; -class QmlAnimationGroup; -class Q_AUTOTEST_EXPORT QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, public QmlParserStatus -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAbstractAnimation) - - Q_INTERFACES(QmlParserStatus) - Q_INTERFACES(QmlPropertyValueSource) - Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged()) - Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged) - Q_CLASSINFO("DefaultMethod", "start()") - Q_INTERFACES(QmlParserStatus) - -public: - QmlAbstractAnimation(QObject *parent=0); - virtual ~QmlAbstractAnimation(); - - bool isRunning() const; - void setRunning(bool); - bool isPaused() const; - void setPaused(bool); - bool alwaysRunToEnd() const; - void setAlwaysRunToEnd(bool); - bool repeat() const; - void setRepeat(bool); - - int currentTime(); - void setCurrentTime(int); - - QmlAnimationGroup *group() const; - void setGroup(QmlAnimationGroup *); - - //### these belong at a lower level in the hierarchy - QObject *target() const; - void setTarget(QObject *); - QString property() const; - void setProperty(const QString &); - - virtual void setTarget(const QmlMetaProperty &); - - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - void started(); - void completed(); - void runningChanged(bool); - void pausedChanged(bool); - void repeatChanged(bool); - void targetChanged(QObject *, const QString &); - void alwaysRunToEndChanged(bool); - -public Q_SLOTS: - void restart(); - void start(); - void pause(); - void resume(); - void stop(); - void complete(); - -protected: - QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObject *parent); - -public: - enum TransitionDirection { Forward, Backward }; - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual void prepare(QmlMetaProperty &); - virtual QAbstractAnimation *qtAnimation() = 0; - -private Q_SLOTS: - void timelineComplete(); -}; - -class QmlPauseAnimationPrivate; -class QmlPauseAnimation : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPauseAnimation) - - Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) - -public: - QmlPauseAnimation(QObject *parent=0); - virtual ~QmlPauseAnimation(); - - int duration() const; - void setDuration(int); - -Q_SIGNALS: - void durationChanged(int); - -protected: - virtual QAbstractAnimation *qtAnimation(); -}; - -class QmlScriptActionPrivate; -class QmlScriptAction : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlScriptAction) - - Q_PROPERTY(QmlScriptString script READ script WRITE setScript) - Q_PROPERTY(QString stateChangeScriptName READ stateChangeScriptName WRITE setStateChangeScriptName) - -public: - QmlScriptAction(QObject *parent=0); - virtual ~QmlScriptAction(); - - QmlScriptString script() const; - void setScript(const QmlScriptString &); - - QString stateChangeScriptName() const; - void setStateChangeScriptName(const QString &); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); -}; - -class QmlPropertyActionPrivate; -class QmlPropertyAction : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAction) - - Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) - Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) - Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) - Q_PROPERTY(QList<QObject *>* targets READ targets) - Q_PROPERTY(QList<QObject *>* exclude READ exclude) - Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) - -public: - QmlPropertyAction(QObject *parent=0); - virtual ~QmlPropertyAction(); - - QString properties() const; - void setProperties(const QString &); - - QList<QObject *> *targets(); - QList<QObject *> *exclude(); - - QVariant value() const; - void setValue(const QVariant &); - -Q_SIGNALS: - void valueChanged(const QVariant &); - void propertiesChanged(const QString &); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); -}; - -class QmlGraphicsItem; -class QmlParentActionPrivate; -class QmlParentAction : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlParentAction) - - Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) - Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) - -public: - QmlParentAction(QObject *parent=0); - virtual ~QmlParentAction(); - - QmlGraphicsItem *object() const; - void setObject(QmlGraphicsItem *); - - QmlGraphicsItem *parent() const; - void setParent(QmlGraphicsItem *); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); -}; - -class QmlPropertyAnimationPrivate; -class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAnimation) - - Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) - Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged) - Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged) - Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) - Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) - Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) - Q_PROPERTY(QList<QObject *>* targets READ targets) - Q_PROPERTY(QList<QObject *>* exclude READ exclude) - -public: - QmlPropertyAnimation(QObject *parent=0); - virtual ~QmlPropertyAnimation(); - - int duration() const; - void setDuration(int); - - QVariant from() const; - void setFrom(const QVariant &); - - QVariant to() const; - void setTo(const QVariant &); - - QString easing() const; - void setEasing(const QString &); - - QString properties() const; - void setProperties(const QString &); - - QList<QObject *> *targets(); - QList<QObject *> *exclude(); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); - -Q_SIGNALS: - void durationChanged(int); - void fromChanged(QVariant); - void toChanged(QVariant); - void easingChanged(const QString &); - void propertiesChanged(const QString &); -}; - -class Q_AUTOTEST_EXPORT QmlColorAnimation : public QmlPropertyAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAnimation) - Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged) - -public: - QmlColorAnimation(QObject *parent=0); - virtual ~QmlColorAnimation(); - - QColor from() const; - void setFrom(const QColor &); - - QColor to() const; - void setTo(const QColor &); -}; - -class Q_AUTOTEST_EXPORT QmlNumberAnimation : public QmlPropertyAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAnimation) - - Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) - -public: - QmlNumberAnimation(QObject *parent=0); - virtual ~QmlNumberAnimation(); - - qreal from() const; - void setFrom(qreal); - - qreal to() const; - void setTo(qreal); -}; - -class QmlAnimationGroupPrivate; -class QmlAnimationGroup : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAnimationGroup) - - Q_CLASSINFO("DefaultProperty", "animations") - Q_PROPERTY(QmlList<QmlAbstractAnimation *> *animations READ animations) - -public: - QmlAnimationGroup(QObject *parent); - virtual ~QmlAnimationGroup(); - - QmlList<QmlAbstractAnimation *>* animations(); - friend class QmlAbstractAnimation; -}; - -class QmlSequentialAnimation : public QmlAnimationGroup -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAnimationGroup) - -public: - QmlSequentialAnimation(QObject *parent=0); - virtual ~QmlSequentialAnimation(); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); -}; - -class QmlParallelAnimation : public QmlAnimationGroup -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAnimationGroup) - -public: - QmlParallelAnimation(QObject *parent=0); - virtual ~QmlParallelAnimation(); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlAbstractAnimation) -QML_DECLARE_TYPE(QmlPauseAnimation) -QML_DECLARE_TYPE(QmlScriptAction) -QML_DECLARE_TYPE(QmlPropertyAction) -QML_DECLARE_TYPE(QmlParentAction) -QML_DECLARE_TYPE(QmlPropertyAnimation) -QML_DECLARE_TYPE(QmlColorAnimation) -QML_DECLARE_TYPE(QmlNumberAnimation) -QML_DECLARE_TYPE(QmlSequentialAnimation) -QML_DECLARE_TYPE(QmlParallelAnimation) - -QT_END_HEADER - -#endif // QMLANIMATION_H diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 38b92ae..5f9f907 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -39,324 +39,369 @@ ** ****************************************************************************/ -#ifndef QMLANIMATION_P_H -#define QMLANIMATION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qobject_p.h> -#include <private/qmlnullablevalue_p.h> -#include <private/qvariantanimation_p.h> -#include <QtCore/QPauseAnimation> -#include <QtCore/QVariantAnimation> -#include <QtCore/QAnimationGroup> -#include <QtGui/QColor> -#include <QtDeclarative/qmlanimation.h> +#ifndef QMLANIMATION_H +#define QMLANIMATION_H + +#include <QtCore/qvariant.h> +#include <QtCore/QAbstractAnimation> +#include <QtGui/qcolor.h> +#include <private/qmltransition_p.h> +#include <QtDeclarative/qmlpropertyvaluesource.h> +#include <private/qmlstate_p.h> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlcontext.h> -#include <private/qmltimeline_p.h> +#include <QtDeclarative/qmlscriptstring.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -//interface for classes that provide animation actions for QActionAnimation -class QAbstractAnimationAction -{ -public: - virtual ~QAbstractAnimationAction() {} - virtual void doAction() = 0; -}; +QT_MODULE(Declarative) -//templated animation action -//allows us to specify an action that calls a function of a class. -//(so that class doesn't have to inherit QmlAbstractAnimationAction) -template<class T, void (T::*method)()> -class QAnimationActionProxy : public QAbstractAnimationAction +class QmlAbstractAnimationPrivate; +class QmlAnimationGroup; +class Q_AUTOTEST_EXPORT QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, public QmlParserStatus { + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAbstractAnimation) + + Q_INTERFACES(QmlParserStatus) + Q_INTERFACES(QmlPropertyValueSource) + Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) + Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged()) + Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged) + Q_CLASSINFO("DefaultMethod", "start()") + Q_INTERFACES(QmlParserStatus) + public: - QAnimationActionProxy(T *p) : m_p(p) {} - virtual void doAction() { (m_p->*method)(); } + QmlAbstractAnimation(QObject *parent=0); + virtual ~QmlAbstractAnimation(); + + bool isRunning() const; + void setRunning(bool); + bool isPaused() const; + void setPaused(bool); + bool alwaysRunToEnd() const; + void setAlwaysRunToEnd(bool); + bool repeat() const; + void setRepeat(bool); + + int currentTime(); + void setCurrentTime(int); + + QmlAnimationGroup *group() const; + void setGroup(QmlAnimationGroup *); + + //### these belong at a lower level in the hierarchy + QObject *target() const; + void setTarget(QObject *); + QString property() const; + void setProperty(const QString &); + + virtual void setTarget(const QmlMetaProperty &); + + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + void started(); + void completed(); + void runningChanged(bool); + void pausedChanged(bool); + void repeatChanged(bool); + void targetChanged(QObject *, const QString &); + void alwaysRunToEndChanged(bool); + +public Q_SLOTS: + void restart(); + void start(); + void pause(); + void resume(); + void stop(); + void complete(); + +protected: + QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObject *parent); -private: - T *m_p; +public: + enum TransitionDirection { Forward, Backward }; + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual void prepare(QmlMetaProperty &); + virtual QAbstractAnimation *qtAnimation() = 0; + +private Q_SLOTS: + void timelineComplete(); }; -//performs an action of type QAbstractAnimationAction -class QActionAnimation : public QAbstractAnimation +class QmlPauseAnimationPrivate; +class QmlPauseAnimation : public QmlAbstractAnimation { Q_OBJECT + Q_DECLARE_PRIVATE(QmlPauseAnimation) + + Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + public: - QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped) {} - QActionAnimation(QAbstractAnimationAction *action, QObject *parent = 0) - : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped) {} - virtual int duration() const { return 0; } - void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) - { - if (state() == Running) - stop(); - animAction = action; - policy = p; - } + QmlPauseAnimation(QObject *parent=0); + virtual ~QmlPauseAnimation(); + + int duration() const; + void setDuration(int); + +Q_SIGNALS: + void durationChanged(int); + protected: - virtual void updateCurrentTime(int) {} - - virtual void updateState(State /*oldState*/, State newState) - { - if (newState == Running) { - if (animAction) - animAction->doAction(); - } else if (newState == Stopped && policy == DeleteWhenStopped) { - delete animAction; - animAction = 0; - } - } - -private: - QAbstractAnimationAction *animAction; - DeletionPolicy policy; + virtual QAbstractAnimation *qtAnimation(); }; -//animates QmlTimeLineValue (assumes start and end values will be reals or compatible) -class QmlTimeLineValueAnimator : public QVariantAnimation +class QmlScriptActionPrivate; +class QmlScriptAction : public QmlAbstractAnimation { Q_OBJECT + Q_DECLARE_PRIVATE(QmlScriptAction) + + Q_PROPERTY(QmlScriptString script READ script WRITE setScript) + Q_PROPERTY(QString stateChangeScriptName READ stateChangeScriptName WRITE setStateChangeScriptName) + public: - QmlTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} - void setAnimValue(QmlTimeLineValue *value, DeletionPolicy p) - { - if (state() == Running) - stop(); - animValue = value; - policy = p; - } - void setFromSourcedValue(bool *value) - { - fromSourced = value; - } + QmlScriptAction(QObject *parent=0); + virtual ~QmlScriptAction(); + + QmlScriptString script() const; + void setScript(const QmlScriptString &); + + QString stateChangeScriptName() const; + void setStateChangeScriptName(const QString &); + protected: - virtual void updateCurrentValue(const QVariant &value) - { - if (animValue) - animValue->setValue(value.toDouble()); - } - virtual void updateState(State oldState, State newState) - { - QVariantAnimation::updateState(oldState, newState); - if (newState == Running) { - //check for new from every loop - if (fromSourced) - *fromSourced = false; - } else if (newState == Stopped && policy == DeleteWhenStopped) { - delete animValue; - animValue = 0; - } - } - -private: - QmlTimeLineValue *animValue; - bool *fromSourced; - DeletionPolicy policy; + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); }; -//an animation that just gives a tick -template<class T, void (T::*method)(int)> -class QTickAnimationProxy : public QAbstractAnimation +class QmlPropertyActionPrivate; +class QmlPropertyAction : public QmlAbstractAnimation { - //Q_OBJECT //doesn't work with templating -public: - QTickAnimationProxy(T *p, QObject *parent = 0) : QAbstractAnimation(parent), m_p(p) {} - virtual int duration() const { return -1; } -protected: - virtual void updateCurrentTime(int msec) { (m_p->*method)(msec); } + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAction) -private: - T *m_p; -}; + Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) + Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) + Q_PROPERTY(QList<QObject *>* targets READ targets) + Q_PROPERTY(QList<QObject *>* exclude READ exclude) + Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) -class QmlAbstractAnimationPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QmlAbstractAnimation) public: - QmlAbstractAnimationPrivate() - : running(false), paused(false), alwaysRunToEnd(false), repeat(false), - connectedTimeLine(false), componentComplete(true), startOnCompletion(false), - target(0), group(0) {} - - bool running; - bool paused; - bool alwaysRunToEnd; - bool repeat; - bool connectedTimeLine; + QmlPropertyAction(QObject *parent=0); + virtual ~QmlPropertyAction(); - bool componentComplete; - bool startOnCompletion; + QString properties() const; + void setProperties(const QString &); - void commence(); + QList<QObject *> *targets(); + QList<QObject *> *exclude(); - QmlNullableValue<QmlMetaProperty> userProperty; - QObject *target; - QString propertyName; + QVariant value() const; + void setValue(const QVariant &); - QmlMetaProperty property; - QmlAnimationGroup *group; +Q_SIGNALS: + void valueChanged(const QVariant &); + void propertiesChanged(const QString &); - QmlMetaProperty createProperty(QObject *obj, const QString &str); +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); }; -class QmlPauseAnimationPrivate : public QmlAbstractAnimationPrivate +class QmlGraphicsItem; +class QmlParentActionPrivate; +class QmlParentAction : public QmlAbstractAnimation { - Q_DECLARE_PUBLIC(QmlPauseAnimation) -public: - QmlPauseAnimationPrivate() - : QmlAbstractAnimationPrivate(), pa(0) {} - - void init(); + Q_OBJECT + Q_DECLARE_PRIVATE(QmlParentAction) - QPauseAnimation *pa; -}; + Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) + Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) -class QmlScriptActionPrivate : public QmlAbstractAnimationPrivate -{ - Q_DECLARE_PUBLIC(QmlScriptAction) public: - QmlScriptActionPrivate() - : QmlAbstractAnimationPrivate(), hasRunScriptScript(false), proxy(this), rsa(0) {} + QmlParentAction(QObject *parent=0); + virtual ~QmlParentAction(); - void init(); + QmlGraphicsItem *object() const; + void setObject(QmlGraphicsItem *); - QmlScriptString script; - QString name; - QmlScriptString runScriptScript; - bool hasRunScriptScript; + QmlGraphicsItem *parent() const; + void setParent(QmlGraphicsItem *); - void execute(); - - QAnimationActionProxy<QmlScriptActionPrivate, - &QmlScriptActionPrivate::execute> proxy; - QActionAnimation *rsa; +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); }; -class QmlPropertyActionPrivate : public QmlAbstractAnimationPrivate +class QmlPropertyAnimationPrivate; +class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation { - Q_DECLARE_PUBLIC(QmlPropertyAction) + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAnimation) + + Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged) + Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged) + Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) + Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) + Q_PROPERTY(QList<QObject *>* targets READ targets) + Q_PROPERTY(QList<QObject *>* exclude READ exclude) + public: - QmlPropertyActionPrivate() - : QmlAbstractAnimationPrivate(), proxy(this), spa(0) {} + QmlPropertyAnimation(QObject *parent=0); + virtual ~QmlPropertyAnimation(); - void init(); + int duration() const; + void setDuration(int); - QString properties; - QList<QObject *> targets; - QList<QObject *> exclude; + QVariant from() const; + void setFrom(const QVariant &); - QmlNullableValue<QVariant> value; + QVariant to() const; + void setTo(const QVariant &); - void doAction(); + QString easing() const; + void setEasing(const QString &); - QAnimationActionProxy<QmlPropertyActionPrivate, - &QmlPropertyActionPrivate::doAction> proxy; - QActionAnimation *spa; + QString properties() const; + void setProperties(const QString &); + + QList<QObject *> *targets(); + QList<QObject *> *exclude(); + +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); + +Q_SIGNALS: + void durationChanged(int); + void fromChanged(QVariant); + void toChanged(QVariant); + void easingChanged(const QString &); + void propertiesChanged(const QString &); }; -class QmlParentActionPrivate : public QmlAbstractAnimationPrivate +class Q_AUTOTEST_EXPORT QmlColorAnimation : public QmlPropertyAnimation { - Q_DECLARE_PUBLIC(QmlParentAction) -public: - QmlParentActionPrivate() - : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {} + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAnimation) + Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged) + Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged) - void init(); +public: + QmlColorAnimation(QObject *parent=0); + virtual ~QmlColorAnimation(); - QmlGraphicsItem *pcTarget; - QmlGraphicsItem *pcParent; + QColor from() const; + void setFrom(const QColor &); - void doAction(); - QActionAnimation *cpa; + QColor to() const; + void setTo(const QColor &); }; -class QmlAnimationGroupPrivate : public QmlAbstractAnimationPrivate +class Q_AUTOTEST_EXPORT QmlNumberAnimation : public QmlPropertyAnimation { - Q_DECLARE_PUBLIC(QmlAnimationGroup) + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAnimation) + + Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) + Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + public: - QmlAnimationGroupPrivate() - : QmlAbstractAnimationPrivate(), animations(this), ag(0) {} - - struct AnimationList : public QmlConcreteList<QmlAbstractAnimation *> - { - AnimationList(QmlAnimationGroupPrivate *p) - : anim(p) {} - virtual void append(QmlAbstractAnimation *a) { - QmlConcreteList<QmlAbstractAnimation *>::append(a); - a->setGroup(anim->q_func()); - } - virtual void clear() - { - for (int i = 0; i < count(); ++i) - at(i)->setGroup(0); - QmlConcreteList<QmlAbstractAnimation *>::clear(); - } - virtual void removeAt(int i) - { - at(i)->setGroup(0); - QmlConcreteList<QmlAbstractAnimation *>::removeAt(i); - } - virtual void insert(int i, QmlAbstractAnimation *a) - { - QmlConcreteList<QmlAbstractAnimation *>::insert(i, a); - a->setGroup(anim->q_func()); - } - - QmlAnimationGroupPrivate *anim; - }; - - AnimationList animations; - QAnimationGroup *ag; + QmlNumberAnimation(QObject *parent=0); + virtual ~QmlNumberAnimation(); + + qreal from() const; + void setFrom(qreal); + + qreal to() const; + void setTo(qreal); }; -class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate +class QmlAnimationGroupPrivate; +class QmlAnimationGroup : public QmlAbstractAnimation { - Q_DECLARE_PUBLIC(QmlPropertyAnimation) -public: - QmlPropertyAnimationPrivate() - : QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false), - defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0), - value(this, &QmlPropertyAnimationPrivate::valueChanged) {} + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAnimationGroup) - void init(); + Q_CLASSINFO("DefaultProperty", "animations") + Q_PROPERTY(QmlList<QmlAbstractAnimation *> *animations READ animations) - QVariant from; - QVariant to; +public: + QmlAnimationGroup(QObject *parent); + virtual ~QmlAnimationGroup(); - QString easing; + QmlList<QmlAbstractAnimation *>* animations(); + friend class QmlAbstractAnimation; +}; - QString properties; - QList<QObject *> targets; - QList<QObject *> exclude; +class QmlSequentialAnimation : public QmlAnimationGroup +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAnimationGroup) - bool fromSourced; - bool fromIsDefined; - bool toIsDefined; - bool defaultToInterpolatorType; - int interpolatorType; - QVariantAnimation::Interpolator interpolator; +public: + QmlSequentialAnimation(QObject *parent=0); + virtual ~QmlSequentialAnimation(); - QmlTimeLineValueAnimator *va; - virtual void valueChanged(qreal); +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); +}; - QmlTimeLineValueProxy<QmlPropertyAnimationPrivate> value; +class QmlParallelAnimation : public QmlAnimationGroup +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAnimationGroup) + +public: + QmlParallelAnimation(QObject *parent=0); + virtual ~QmlParallelAnimation(); - static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); - static void convertVariant(QVariant &variant, int type); +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); }; QT_END_NAMESPACE -#endif // QMLANIMATION_P_H +QML_DECLARE_TYPE(QmlAbstractAnimation) +QML_DECLARE_TYPE(QmlPauseAnimation) +QML_DECLARE_TYPE(QmlScriptAction) +QML_DECLARE_TYPE(QmlPropertyAction) +QML_DECLARE_TYPE(QmlParentAction) +QML_DECLARE_TYPE(QmlPropertyAnimation) +QML_DECLARE_TYPE(QmlColorAnimation) +QML_DECLARE_TYPE(QmlNumberAnimation) +QML_DECLARE_TYPE(QmlSequentialAnimation) +QML_DECLARE_TYPE(QmlParallelAnimation) + +QT_END_HEADER + +#endif // QMLANIMATION_H diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h new file mode 100644 index 0000000..1372343 --- /dev/null +++ b/src/declarative/util/qmlanimation_p_p.h @@ -0,0 +1,362 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLANIMATION_P_H +#define QMLANIMATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qobject_p.h> +#include <private/qmlnullablevalue_p_p.h> +#include <private/qvariantanimation_p.h> +#include <QtCore/QPauseAnimation> +#include <QtCore/QVariantAnimation> +#include <QtCore/QAnimationGroup> +#include <QtGui/QColor> +#include <private/qmlanimation_p.h> +#include <QtDeclarative/qml.h> +#include <QtDeclarative/qmlcontext.h> +#include <private/qmltimeline_p_p.h> + +QT_BEGIN_NAMESPACE + +//interface for classes that provide animation actions for QActionAnimation +class QAbstractAnimationAction +{ +public: + virtual ~QAbstractAnimationAction() {} + virtual void doAction() = 0; +}; + +//templated animation action +//allows us to specify an action that calls a function of a class. +//(so that class doesn't have to inherit QmlAbstractAnimationAction) +template<class T, void (T::*method)()> +class QAnimationActionProxy : public QAbstractAnimationAction +{ +public: + QAnimationActionProxy(T *p) : m_p(p) {} + virtual void doAction() { (m_p->*method)(); } + +private: + T *m_p; +}; + +//performs an action of type QAbstractAnimationAction +class QActionAnimation : public QAbstractAnimation +{ + Q_OBJECT +public: + QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped) {} + QActionAnimation(QAbstractAnimationAction *action, QObject *parent = 0) + : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped) {} + virtual int duration() const { return 0; } + void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) + { + if (state() == Running) + stop(); + animAction = action; + policy = p; + } +protected: + virtual void updateCurrentTime(int) {} + + virtual void updateState(State /*oldState*/, State newState) + { + if (newState == Running) { + if (animAction) + animAction->doAction(); + } else if (newState == Stopped && policy == DeleteWhenStopped) { + delete animAction; + animAction = 0; + } + } + +private: + QAbstractAnimationAction *animAction; + DeletionPolicy policy; +}; + +//animates QmlTimeLineValue (assumes start and end values will be reals or compatible) +class QmlTimeLineValueAnimator : public QVariantAnimation +{ + Q_OBJECT +public: + QmlTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} + void setAnimValue(QmlTimeLineValue *value, DeletionPolicy p) + { + if (state() == Running) + stop(); + animValue = value; + policy = p; + } + void setFromSourcedValue(bool *value) + { + fromSourced = value; + } +protected: + virtual void updateCurrentValue(const QVariant &value) + { + if (animValue) + animValue->setValue(value.toDouble()); + } + virtual void updateState(State oldState, State newState) + { + QVariantAnimation::updateState(oldState, newState); + if (newState == Running) { + //check for new from every loop + if (fromSourced) + *fromSourced = false; + } else if (newState == Stopped && policy == DeleteWhenStopped) { + delete animValue; + animValue = 0; + } + } + +private: + QmlTimeLineValue *animValue; + bool *fromSourced; + DeletionPolicy policy; +}; + +//an animation that just gives a tick +template<class T, void (T::*method)(int)> +class QTickAnimationProxy : public QAbstractAnimation +{ + //Q_OBJECT //doesn't work with templating +public: + QTickAnimationProxy(T *p, QObject *parent = 0) : QAbstractAnimation(parent), m_p(p) {} + virtual int duration() const { return -1; } +protected: + virtual void updateCurrentTime(int msec) { (m_p->*method)(msec); } + +private: + T *m_p; +}; + +class QmlAbstractAnimationPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlAbstractAnimation) +public: + QmlAbstractAnimationPrivate() + : running(false), paused(false), alwaysRunToEnd(false), repeat(false), + connectedTimeLine(false), componentComplete(true), startOnCompletion(false), + target(0), group(0) {} + + bool running; + bool paused; + bool alwaysRunToEnd; + bool repeat; + bool connectedTimeLine; + + bool componentComplete; + bool startOnCompletion; + + void commence(); + + QmlNullableValue<QmlMetaProperty> userProperty; + QObject *target; + QString propertyName; + + QmlMetaProperty property; + QmlAnimationGroup *group; + + QmlMetaProperty createProperty(QObject *obj, const QString &str); +}; + +class QmlPauseAnimationPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlPauseAnimation) +public: + QmlPauseAnimationPrivate() + : QmlAbstractAnimationPrivate(), pa(0) {} + + void init(); + + QPauseAnimation *pa; +}; + +class QmlScriptActionPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlScriptAction) +public: + QmlScriptActionPrivate() + : QmlAbstractAnimationPrivate(), hasRunScriptScript(false), proxy(this), rsa(0) {} + + void init(); + + QmlScriptString script; + QString name; + QmlScriptString runScriptScript; + bool hasRunScriptScript; + + void execute(); + + QAnimationActionProxy<QmlScriptActionPrivate, + &QmlScriptActionPrivate::execute> proxy; + QActionAnimation *rsa; +}; + +class QmlPropertyActionPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlPropertyAction) +public: + QmlPropertyActionPrivate() + : QmlAbstractAnimationPrivate(), proxy(this), spa(0) {} + + void init(); + + QString properties; + QList<QObject *> targets; + QList<QObject *> exclude; + + QmlNullableValue<QVariant> value; + + void doAction(); + + QAnimationActionProxy<QmlPropertyActionPrivate, + &QmlPropertyActionPrivate::doAction> proxy; + QActionAnimation *spa; +}; + +class QmlParentActionPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlParentAction) +public: + QmlParentActionPrivate() + : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {} + + void init(); + + QmlGraphicsItem *pcTarget; + QmlGraphicsItem *pcParent; + + void doAction(); + QActionAnimation *cpa; +}; + +class QmlAnimationGroupPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlAnimationGroup) +public: + QmlAnimationGroupPrivate() + : QmlAbstractAnimationPrivate(), animations(this), ag(0) {} + + struct AnimationList : public QmlConcreteList<QmlAbstractAnimation *> + { + AnimationList(QmlAnimationGroupPrivate *p) + : anim(p) {} + virtual void append(QmlAbstractAnimation *a) { + QmlConcreteList<QmlAbstractAnimation *>::append(a); + a->setGroup(anim->q_func()); + } + virtual void clear() + { + for (int i = 0; i < count(); ++i) + at(i)->setGroup(0); + QmlConcreteList<QmlAbstractAnimation *>::clear(); + } + virtual void removeAt(int i) + { + at(i)->setGroup(0); + QmlConcreteList<QmlAbstractAnimation *>::removeAt(i); + } + virtual void insert(int i, QmlAbstractAnimation *a) + { + QmlConcreteList<QmlAbstractAnimation *>::insert(i, a); + a->setGroup(anim->q_func()); + } + + QmlAnimationGroupPrivate *anim; + }; + + AnimationList animations; + QAnimationGroup *ag; +}; + +class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlPropertyAnimation) +public: + QmlPropertyAnimationPrivate() + : QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false), + defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0), + value(this, &QmlPropertyAnimationPrivate::valueChanged) {} + + void init(); + + QVariant from; + QVariant to; + + QString easing; + + QString properties; + QList<QObject *> targets; + QList<QObject *> exclude; + + bool fromSourced; + bool fromIsDefined; + bool toIsDefined; + bool defaultToInterpolatorType; + int interpolatorType; + QVariantAnimation::Interpolator interpolator; + + QmlTimeLineValueAnimator *va; + virtual void valueChanged(qreal); + + QmlTimeLineValueProxy<QmlPropertyAnimationPrivate> value; + + static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); + static void convertVariant(QVariant &variant, int type); +}; + +QT_END_NAMESPACE + +#endif // QMLANIMATION_P_H diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp index d18ef47..98ec7cf 100644 --- a/src/declarative/util/qmlbind.cpp +++ b/src/declarative/util/qmlbind.cpp @@ -47,8 +47,8 @@ #include <QtScript/qscriptvalue.h> #include <QtScript/qscriptcontext.h> #include <QtScript/qscriptengine.h> -#include <private/qmlnullablevalue_p.h> -#include "qmlbind.h" +#include <private/qmlnullablevalue_p_p.h> +#include "qmlbind_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlbind.h b/src/declarative/util/qmlbind_p.h index 731cdf8..731cdf8 100644 --- a/src/declarative/util/qmlbind.h +++ b/src/declarative/util/qmlbind_p.h diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp index 5475fb2..c52732f 100644 --- a/src/declarative/util/qmlconnection.cpp +++ b/src/declarative/util/qmlconnection.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlconnection.h" +#include "qmlconnection_p.h" #include <QtDeclarative/qmlexpression.h> #include "private/qmlboundsignal_p.h" #include "private/qobject_p.h" diff --git a/src/declarative/util/qmlconnection.h b/src/declarative/util/qmlconnection_p.h index 3d69c6f..3d69c6f 100644 --- a/src/declarative/util/qmlconnection.h +++ b/src/declarative/util/qmlconnection_p.h diff --git a/src/declarative/util/qmleasefollow.cpp b/src/declarative/util/qmleasefollow.cpp index 9d17d25..96654c6 100644 --- a/src/declarative/util/qmleasefollow.cpp +++ b/src/declarative/util/qmleasefollow.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qmleasefollow.h" +#include "qmleasefollow_p.h" #include <QtDeclarative/qmlmetaproperty.h> #include <math.h> #include <QtCore/qdebug.h> -#include <private/qmlanimation_p.h> +#include <private/qmlanimation_p_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmleasefollow.h b/src/declarative/util/qmleasefollow_p.h index a653ea6..a653ea6 100644 --- a/src/declarative/util/qmleasefollow.h +++ b/src/declarative/util/qmleasefollow_p.h diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp index 3e4cb64..80709f1 100644 --- a/src/declarative/util/qmllistaccessor.cpp +++ b/src/declarative/util/qmllistaccessor.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmllistaccessor.h" +#include "qmllistaccessor_p.h" #include <QStringList> #include <qmlmetatype.h> #include <QtCore/qdebug.h> diff --git a/src/declarative/util/qmllistaccessor.h b/src/declarative/util/qmllistaccessor_p.h index c3ff632..c3ff632 100644 --- a/src/declarative/util/qmllistaccessor.h +++ b/src/declarative/util/qmllistaccessor_p.h diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 9c9fa6a..d5202c5 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -44,9 +44,9 @@ #include <QXmlStreamReader> #include <private/qmlcustomparser_p.h> #include <private/qmlparser_p.h> -#include "qmlopenmetaobject.h" +#include "qmlopenmetaobject_p.h" #include <qmlcontext.h> -#include "qmllistmodel.h" +#include "qmllistmodel_p.h" #include <QtScript/qscriptvalueiterator.h> Q_DECLARE_METATYPE(QListModelInterface *) diff --git a/src/declarative/util/qmllistmodel.h b/src/declarative/util/qmllistmodel_p.h index 7bb94cf..b376e59 100644 --- a/src/declarative/util/qmllistmodel.h +++ b/src/declarative/util/qmllistmodel_p.h @@ -49,7 +49,7 @@ #include <QtCore/QVariant> #include <QtDeclarative/qfxglobal.h> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qlistmodelinterface.h> +#include <private/qlistmodelinterface_p.h> #include <QtScript/qscriptvalue.h> diff --git a/src/declarative/util/qmlnullablevalue_p.h b/src/declarative/util/qmlnullablevalue_p_p.h index 6455642..6455642 100644 --- a/src/declarative/util/qmlnullablevalue_p.h +++ b/src/declarative/util/qmlnullablevalue_p_p.h diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qmlopenmetaobject.cpp index 11648f6..c348ced 100644 --- a/src/declarative/util/qmlopenmetaobject.cpp +++ b/src/declarative/util/qmlopenmetaobject.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlopenmetaobject.h" +#include "qmlopenmetaobject_p.h" #include "private/qmetaobjectbuilder_p.h" #include <QDebug> diff --git a/src/declarative/util/qmlopenmetaobject.h b/src/declarative/util/qmlopenmetaobject_p.h index be0490d..be0490d 100644 --- a/src/declarative/util/qmlopenmetaobject.h +++ b/src/declarative/util/qmlopenmetaobject_p.h diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index 7df8453..05b6cbc 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlpackage.h" +#include "qmlpackage_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage_p.h index 7cceaa7..7cceaa7 100644 --- a/src/declarative/util/qmlpackage.h +++ b/src/declarative/util/qmlpackage_p.h diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 0ac168b..57db897 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlopenmetaobject.h" -#include "qmlpropertychanges.h" +#include "qmlopenmetaobject_p.h" +#include "qmlpropertychanges_p.h" #include <QtCore/qdebug.h> #include <QtDeclarative/qmlinfo.h> #include <private/qmlcustomparser_p.h> diff --git a/src/declarative/util/qmlpropertychanges.h b/src/declarative/util/qmlpropertychanges_p.h index 2931cdb..cb93eb3 100644 --- a/src/declarative/util/qmlpropertychanges.h +++ b/src/declarative/util/qmlpropertychanges_p.h @@ -42,7 +42,7 @@ #ifndef QMLPROPERTYCHANGES_H #define QMLPROPERTYCHANGES_H -#include <QtDeclarative/qmlstateoperations.h> +#include <private/qmlstateoperations_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlpropertymap.cpp b/src/declarative/util/qmlpropertymap.cpp index a587af3..c54135c 100644 --- a/src/declarative/util/qmlpropertymap.cpp +++ b/src/declarative/util/qmlpropertymap.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlpropertymap.h" -#include <qmlopenmetaobject.h> +#include "qmlpropertymap_p.h" +#include <private/qmlopenmetaobject_p.h> #include <QDebug> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlpropertymap.h b/src/declarative/util/qmlpropertymap_p.h index 24b4395..24b4395 100644 --- a/src/declarative/util/qmlpropertymap.h +++ b/src/declarative/util/qmlpropertymap_p.h diff --git a/src/declarative/util/qmlspringfollow.cpp b/src/declarative/util/qmlspringfollow.cpp index 3b2526b..354110e 100644 --- a/src/declarative/util/qmlspringfollow.cpp +++ b/src/declarative/util/qmlspringfollow.cpp @@ -43,8 +43,8 @@ #include <math.h> #include <QtCore/qdebug.h> #include "private/qobject_p.h" -#include "qmlspringfollow.h" -#include "private/qmlanimation_p.h" +#include "qmlspringfollow_p.h" +#include "private/qmlanimation_p_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlspringfollow.h b/src/declarative/util/qmlspringfollow_p.h index 1b77861..1b77861 100644 --- a/src/declarative/util/qmlspringfollow.h +++ b/src/declarative/util/qmlspringfollow_p.h diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index 425480c..6908175 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -39,14 +39,14 @@ ** ****************************************************************************/ -#include "qmltransition.h" -#include "qmlstategroup.h" -#include "qmlstate_p.h" +#include "qmltransition_p.h" +#include "qmlstategroup_p.h" +#include "qmlstate_p_p.h" #include "qmlbinding.h" -#include "qmlstateoperations.h" -#include "qmlanimation.h" +#include "qmlstateoperations_p.h" #include "qmlanimation_p.h" -#include "qmlstate.h" +#include "qmlanimation_p_p.h" +#include "qmlstate_p.h" #include <QtCore/qdebug.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h deleted file mode 100644 index 50128c0..0000000 --- a/src/declarative/util/qmlstate.h +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLSTATE_H -#define QMLSTATE_H - -#include <QtCore/qobject.h> -#include <QtCore/QSequentialAnimationGroup> -#include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qml.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class ActionEvent; -class QmlBinding; -class Action -{ -public: - Action(); - Action(QObject *, const QString &, const QVariant &); - - bool restore:1; - bool actionDone:1; - bool reverseEvent:1; - bool deletableToBinding:1; - - QmlMetaProperty property; - QVariant fromValue; - QVariant toValue; - - QmlAbstractBinding *fromBinding; - QmlAbstractBinding *toBinding; - ActionEvent *event; - - //strictly for matching - QObject *specifiedObject; - QString specifiedProperty; - - void deleteFromBinding(); -}; - -class ActionEvent -{ -public: - virtual ~ActionEvent(); - virtual QString typeName() const; - - virtual void execute(); - virtual bool isReversable(); - virtual void reverse(); - virtual void saveOriginals() {} - - //virtual bool hasExtraActions(); - virtual QList<Action> extraActions(); - - virtual bool changesBindings(); - virtual void clearForwardBindings(); - virtual void clearReverseBindings(); - virtual bool override(ActionEvent*other); -}; - -//### rename to QmlStateChange? -class QmlStateGroup; -class Q_DECLARATIVE_EXPORT QmlStateOperation : public QObject -{ - Q_OBJECT -public: - QmlStateOperation(QObject *parent = 0) - : QObject(parent) {} - typedef QList<Action> ActionList; - - virtual ActionList actions(); - -protected: - QmlStateOperation(QObjectPrivate &dd, QObject *parent = 0); -}; - -typedef QmlStateOperation::ActionList QmlStateActions; - -class QmlTransition; -class QmlStatePrivate; -class Q_DECLARATIVE_EXPORT QmlState : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QmlBinding *when READ when WRITE setWhen) - Q_PROPERTY(QString extend READ extends WRITE setExtends) - Q_PROPERTY(QmlList<QmlStateOperation *>* changes READ changes) - Q_CLASSINFO("DefaultProperty", "changes") - -public: - QmlState(QObject *parent=0); - virtual ~QmlState(); - - QString name() const; - void setName(const QString &); - - /*'when' is a QmlBinding to limit state changes oscillation - due to the unpredictable order of evaluation of bound expressions*/ - bool isWhenKnown() const; - QmlBinding *when() const; - void setWhen(QmlBinding *); - - QString extends() const; - void setExtends(const QString &); - - QmlList<QmlStateOperation *> *changes(); - QmlState &operator<<(QmlStateOperation *); - - void apply(QmlStateGroup *, QmlTransition *, QmlState *revert); - void cancel(); - - QmlStateGroup *stateGroup() const; - void setStateGroup(QmlStateGroup *); - -Q_SIGNALS: - void completed(); - -private: - Q_DECLARE_PRIVATE(QmlState) - Q_DISABLE_COPY(QmlState) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlStateOperation) -QML_DECLARE_TYPE(QmlState) - -QT_END_HEADER - -#endif // QMLSTATE_H diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h index 63fc6da..50128c0 100644 --- a/src/declarative/util/qmlstate_p.h +++ b/src/declarative/util/qmlstate_p.h @@ -39,83 +39,136 @@ ** ****************************************************************************/ -#ifndef QMLSTATE_P_H -#define QMLSTATE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtDeclarative/qmlstate.h> -#include <private/qobject_p.h> -#include <private/qmlanimation_p.h> -#include <private/qmltransitionmanager_p.h> +#ifndef QMLSTATE_H +#define QMLSTATE_H + +#include <QtCore/qobject.h> +#include <QtCore/QSequentialAnimationGroup> +#include <QtDeclarative/qfxglobal.h> +#include <QtDeclarative/qml.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class SimpleAction +QT_MODULE(Declarative) + +class ActionEvent; +class QmlBinding; +class Action { public: - enum State { StartState, EndState }; - SimpleAction(const Action &a, State state = StartState) - { - property = a.property; - specifiedObject = a.specifiedObject; - specifiedProperty = a.specifiedProperty; - event = a.event; - if (state == StartState) { - value = a.fromValue; - binding = property.binding(); - reverseEvent = true; - } else { - value = a.toValue; - binding = a.toBinding; - reverseEvent = false; - } - } + Action(); + Action(QObject *, const QString &, const QVariant &); + + bool restore:1; + bool actionDone:1; + bool reverseEvent:1; + bool deletableToBinding:1; QmlMetaProperty property; - QVariant value; - QmlAbstractBinding *binding; + QVariant fromValue; + QVariant toValue; + + QmlAbstractBinding *fromBinding; + QmlAbstractBinding *toBinding; + ActionEvent *event; + + //strictly for matching QObject *specifiedObject; QString specifiedProperty; - ActionEvent *event; - bool reverseEvent; + + void deleteFromBinding(); }; -class QmlStatePrivate : public QObjectPrivate +class ActionEvent { - Q_DECLARE_PUBLIC(QmlState) +public: + virtual ~ActionEvent(); + virtual QString typeName() const; + + virtual void execute(); + virtual bool isReversable(); + virtual void reverse(); + virtual void saveOriginals() {} + + //virtual bool hasExtraActions(); + virtual QList<Action> extraActions(); + virtual bool changesBindings(); + virtual void clearForwardBindings(); + virtual void clearReverseBindings(); + virtual bool override(ActionEvent*other); +}; + +//### rename to QmlStateChange? +class QmlStateGroup; +class Q_DECLARATIVE_EXPORT QmlStateOperation : public QObject +{ + Q_OBJECT public: - QmlStatePrivate() - : when(0), inState(false), group(0) {} + QmlStateOperation(QObject *parent = 0) + : QObject(parent) {} + typedef QList<Action> ActionList; - typedef QList<SimpleAction> SimpleActionList; + virtual ActionList actions(); - QString name; - QmlBinding *when; - QmlConcreteList<QmlStateOperation *> operations; +protected: + QmlStateOperation(QObjectPrivate &dd, QObject *parent = 0); +}; + +typedef QmlStateOperation::ActionList QmlStateActions; + +class QmlTransition; +class QmlStatePrivate; +class Q_DECLARATIVE_EXPORT QmlState : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QmlBinding *when READ when WRITE setWhen) + Q_PROPERTY(QString extend READ extends WRITE setExtends) + Q_PROPERTY(QmlList<QmlStateOperation *>* changes READ changes) + Q_CLASSINFO("DefaultProperty", "changes") + +public: + QmlState(QObject *parent=0); + virtual ~QmlState(); - QmlTransitionManager transitionManager; + QString name() const; + void setName(const QString &); - SimpleActionList revertList; - QList<QmlMetaProperty> reverting; - QString extends; - mutable bool inState; - QmlStateGroup *group; + /*'when' is a QmlBinding to limit state changes oscillation + due to the unpredictable order of evaluation of bound expressions*/ + bool isWhenKnown() const; + QmlBinding *when() const; + void setWhen(QmlBinding *); - QmlStateOperation::ActionList generateActionList(QmlStateGroup *) const; - void complete(); + QString extends() const; + void setExtends(const QString &); + + QmlList<QmlStateOperation *> *changes(); + QmlState &operator<<(QmlStateOperation *); + + void apply(QmlStateGroup *, QmlTransition *, QmlState *revert); + void cancel(); + + QmlStateGroup *stateGroup() const; + void setStateGroup(QmlStateGroup *); + +Q_SIGNALS: + void completed(); + +private: + Q_DECLARE_PRIVATE(QmlState) + Q_DISABLE_COPY(QmlState) }; QT_END_NAMESPACE -#endif // QMLSTATE_P_H +QML_DECLARE_TYPE(QmlStateOperation) +QML_DECLARE_TYPE(QmlState) + +QT_END_HEADER + +#endif // QMLSTATE_H diff --git a/src/declarative/util/qmlstate_p_p.h b/src/declarative/util/qmlstate_p_p.h new file mode 100644 index 0000000..2b62213 --- /dev/null +++ b/src/declarative/util/qmlstate_p_p.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLSTATE_P_H +#define QMLSTATE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qmlstate_p.h> +#include <private/qobject_p.h> +#include <private/qmlanimation_p_p.h> +#include <private/qmltransitionmanager_p_p.h> + +QT_BEGIN_NAMESPACE + +class SimpleAction +{ +public: + enum State { StartState, EndState }; + SimpleAction(const Action &a, State state = StartState) + { + property = a.property; + specifiedObject = a.specifiedObject; + specifiedProperty = a.specifiedProperty; + event = a.event; + if (state == StartState) { + value = a.fromValue; + binding = property.binding(); + reverseEvent = true; + } else { + value = a.toValue; + binding = a.toBinding; + reverseEvent = false; + } + } + + QmlMetaProperty property; + QVariant value; + QmlAbstractBinding *binding; + QObject *specifiedObject; + QString specifiedProperty; + ActionEvent *event; + bool reverseEvent; +}; + +class QmlStatePrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlState) + +public: + QmlStatePrivate() + : when(0), inState(false), group(0) {} + + typedef QList<SimpleAction> SimpleActionList; + + QString name; + QmlBinding *when; + QmlConcreteList<QmlStateOperation *> operations; + + QmlTransitionManager transitionManager; + + SimpleActionList revertList; + QList<QmlMetaProperty> reverting; + QString extends; + mutable bool inState; + QmlStateGroup *group; + + QmlStateOperation::ActionList generateActionList(QmlStateGroup *) const; + void complete(); +}; + +QT_END_NAMESPACE + +#endif // QMLSTATE_P_H diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index b07def1..6ef8dce 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlstategroup.h" -#include "qmltransition.h" +#include "qmlstategroup_p.h" +#include "qmltransition_p.h" #include <QtDeclarative/qmlbinding.h> #include <QtCore/qdebug.h> diff --git a/src/declarative/util/qmlstategroup.h b/src/declarative/util/qmlstategroup_p.h index cf79eb4..3136b1e 100644 --- a/src/declarative/util/qmlstategroup.h +++ b/src/declarative/util/qmlstategroup_p.h @@ -42,7 +42,7 @@ #ifndef QMLSTATEGROUP_H #define QMLSTATEGROUP_H -#include <QtDeclarative/qmlstate.h> +#include <private/qmlstate_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 5c328cf..af8ba63 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -43,10 +43,10 @@ #include <qml.h> #include <QtDeclarative/qmlcontext.h> #include <QtDeclarative/qmlexpression.h> -#include "qmlstateoperations.h" +#include "qmlstateoperations_p.h" #include <QtCore/qdebug.h> #include <QtDeclarative/qmlinfo.h> -#include <private/qmlgraphicsanchors_p.h> +#include <private/qmlgraphicsanchors_p_p.h> #include <private/qmlgraphicsitem_p.h> #include <QtGui/qgraphicsitem.h> #include <QtCore/qmath.h> @@ -730,8 +730,8 @@ bool QmlAnchorChanges::override(ActionEvent*other) return false; } -QT_END_NAMESPACE - #include "qmlstateoperations.moc" -#include "moc_qmlstateoperations.cpp" +#include "moc_qmlstateoperations_p.cpp" + +QT_END_NAMESPACE diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations_p.h index f2bcd49..04ea781 100644 --- a/src/declarative/util/qmlstateoperations.h +++ b/src/declarative/util/qmlstateoperations_p.h @@ -42,9 +42,9 @@ #ifndef QMLSTATEOPERATIONS_H #define QMLSTATEOPERATIONS_H -#include <QtDeclarative/qmlstate.h> +#include <private/qmlstate_p.h> #include <QtDeclarative/qmlgraphicsitem.h> -#include <QtDeclarative/qmlgraphicsanchors.h> +#include <private/qmlgraphicsanchors_p.h> #include <QtDeclarative/qmlscriptstring.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlsystempalette.cpp b/src/declarative/util/qmlsystempalette.cpp index 014eca8..c5a0986 100644 --- a/src/declarative/util/qmlsystempalette.cpp +++ b/src/declarative/util/qmlsystempalette.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlsystempalette.h" +#include "qmlsystempalette_p.h" #include <QApplication> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlsystempalette.h b/src/declarative/util/qmlsystempalette_p.h index 6558c7e..6558c7e 100644 --- a/src/declarative/util/qmlsystempalette.h +++ b/src/declarative/util/qmlsystempalette_p.h diff --git a/src/declarative/util/qmltimeline.cpp b/src/declarative/util/qmltimeline.cpp index 5ba310d..55d9490 100644 --- a/src/declarative/util/qmltimeline.cpp +++ b/src/declarative/util/qmltimeline.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmltimeline_p.h" +#include "qmltimeline_p_p.h" #include <QDebug> #include <QMutex> #include <QThread> diff --git a/src/declarative/util/qmltimeline_p.h b/src/declarative/util/qmltimeline_p_p.h index abed80a..abed80a 100644 --- a/src/declarative/util/qmltimeline_p.h +++ b/src/declarative/util/qmltimeline_p_p.h diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index 1d90051..ff4c912 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -42,7 +42,7 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qpauseanimation.h" #include "private/qobject_p.h" -#include "qmltimer.h" +#include "qmltimer_p.h" #include "qdebug.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmltimer.h b/src/declarative/util/qmltimer_p.h index 22478cb..22478cb 100644 --- a/src/declarative/util/qmltimer.h +++ b/src/declarative/util/qmltimer_p.h diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp index 97a3b74..d752d1b 100644 --- a/src/declarative/util/qmltransition.cpp +++ b/src/declarative/util/qmltransition.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include "qmlstate.h" -#include "qmlstategroup.h" #include "qmlstate_p.h" -#include "qmlstateoperations.h" -#include "qmlanimation.h" +#include "qmlstategroup_p.h" +#include "qmlstate_p_p.h" +#include "qmlstateoperations_p.h" #include "qmlanimation_p.h" -#include "qmltransitionmanager_p.h" +#include "qmlanimation_p_p.h" +#include "qmltransitionmanager_p_p.h" #include <QParallelAnimationGroup> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmltransition.h b/src/declarative/util/qmltransition_p.h index b09341d..092cde9 100644 --- a/src/declarative/util/qmltransition.h +++ b/src/declarative/util/qmltransition_p.h @@ -44,7 +44,7 @@ #include <QtCore/qobject.h> #include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qmlstate.h> +#include <private/qmlstate_p.h> #include <QtDeclarative/qml.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp index 7eaccac..b33cae3 100644 --- a/src/declarative/util/qmltransitionmanager.cpp +++ b/src/declarative/util/qmltransitionmanager.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include <QtDeclarative/qmlbinding.h> -#include <private/qmltransitionmanager_p.h> -#include <private/qmlstate_p.h> +#include <private/qmltransitionmanager_p_p.h> +#include <private/qmlstate_p_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmltransitionmanager_p.h b/src/declarative/util/qmltransitionmanager_p_p.h index 74a3950..ab435aa 100644 --- a/src/declarative/util/qmltransitionmanager_p.h +++ b/src/declarative/util/qmltransitionmanager_p_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtDeclarative/qmlstateoperations.h> +#include <private/qmlstateoperations_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index 91d443a..f19ac98 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -53,14 +53,14 @@ #include "qml.h" #include "qmlgraphicsitem.h" -#include "private/qperformancelog_p.h" -#include "private/qfxperf_p.h" +#include "private/qperformancelog_p_p.h" +#include "private/qfxperf_p_p.h" #include "qmlview.h" #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmldebug.h> -#include <QtDeclarative/qmldebugservice.h> +#include <private/qmldebug_p.h> +#include <private/qmldebugservice_p.h> #include <QtCore/qabstractanimation.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp index 8e11997..1a9be90 100644 --- a/src/declarative/util/qperformancelog.cpp +++ b/src/declarative/util/qperformancelog.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qperformancelog_p.h" +#include "qperformancelog_p_p.h" #include <QHash> #include <QDebug> diff --git a/src/declarative/util/qperformancelog_p.h b/src/declarative/util/qperformancelog_p_p.h index 6655a8d..6655a8d 100644 --- a/src/declarative/util/qperformancelog_p.h +++ b/src/declarative/util/qperformancelog_p_p.h diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 01ad898..a60613e 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -24,28 +24,28 @@ SOURCES += \ HEADERS += \ util/qmlview.h \ - util/qfxperf_p.h \ + util/qfxperf_p_p.h \ util/qfxglobal.h \ - util/qperformancelog_p.h \ - util/qmlconnection.h \ - util/qmlpackage.h \ - util/qmlanimation.h \ + util/qperformancelog_p_p.h \ + util/qmlconnection_p.h \ + util/qmlpackage_p.h \ util/qmlanimation_p.h \ - util/qmlsystempalette.h \ - util/qmlspringfollow.h \ - util/qmleasefollow.h \ - util/qmlstate.h\ - util/qmlstateoperations.h \ - util/qmlpropertychanges.h \ + util/qmlanimation_p_p.h \ + util/qmlsystempalette_p.h \ + util/qmlspringfollow_p.h \ + util/qmleasefollow_p.h \ util/qmlstate_p.h\ - util/qmltransitionmanager_p.h \ - util/qmlstategroup.h \ - util/qmltransition.h \ - util/qmllistmodel.h\ - util/qmllistaccessor.h \ - util/qmlopenmetaobject.h \ - util/qmlnullablevalue_p.h \ - util/qmltimeline_p.h \ - util/qmltimer.h \ - util/qmlbind.h \ - util/qmlpropertymap.h + util/qmlstateoperations_p.h \ + util/qmlpropertychanges_p.h \ + util/qmlstate_p_p.h\ + util/qmltransitionmanager_p_p.h \ + util/qmlstategroup_p.h \ + util/qmltransition_p.h \ + util/qmllistmodel_p.h\ + util/qmllistaccessor_p.h \ + util/qmlopenmetaobject_p.h \ + util/qmlnullablevalue_p_p.h \ + util/qmltimeline_p_p.h \ + util/qmltimer_p.h \ + util/qmlbind_p.h \ + util/qmlpropertymap_p.h diff --git a/src/declarative/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp index 8707b94..e2f5370 100644 --- a/src/declarative/widgets/graphicslayouts.cpp +++ b/src/declarative/widgets/graphicslayouts.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "graphicslayouts.h" +#include "graphicslayouts_p.h" #include <QtGui/qgraphicswidget.h> #include <QtCore/qdebug.h> diff --git a/src/declarative/widgets/graphicslayouts.h b/src/declarative/widgets/graphicslayouts_p.h index 45f1439..9eeac24 100644 --- a/src/declarative/widgets/graphicslayouts.h +++ b/src/declarative/widgets/graphicslayouts_p.h @@ -42,7 +42,7 @@ #ifndef GRAPHICSLAYOUTS_H #define GRAPHICSLAYOUTS_H -#include <QtDeclarative/graphicswidgets.h> +#include <private/graphicswidgets_p.h> #include <QtGui/QGraphicsLinearLayout> #include <QtGui/QGraphicsGridLayout> diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp index cfcc87b..b631884 100644 --- a/src/declarative/widgets/graphicswidgets.cpp +++ b/src/declarative/widgets/graphicswidgets.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "graphicswidgets.h" +#include "graphicswidgets_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/widgets/graphicswidgets.h b/src/declarative/widgets/graphicswidgets_p.h index 8147400..8147400 100644 --- a/src/declarative/widgets/graphicswidgets.h +++ b/src/declarative/widgets/graphicswidgets_p.h diff --git a/src/declarative/widgets/widgets.pri b/src/declarative/widgets/widgets.pri index 41c50d8..4a8bc93 100644 --- a/src/declarative/widgets/widgets.pri +++ b/src/declarative/widgets/widgets.pri @@ -3,8 +3,8 @@ SOURCES += \ widgets/graphicslayouts.cpp \ HEADERS += \ - widgets/graphicswidgets.h \ - widgets/graphicslayouts.h \ + widgets/graphicswidgets_p.h \ + widgets/graphicslayouts_p.h \ |