summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-30 06:12:18 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-30 06:12:18 (GMT)
commit564894627debad93433f16506ccf32afeb23d004 (patch)
treea96a4c6cc7cf4f8032bb915e08bbd0092a890e9c /src/declarative/fx
parent44a0c19eae2099e6cdb44825123a4b8ee9a5bf20 (diff)
downloadQt-564894627debad93433f16506ccf32afeb23d004.zip
Qt-564894627debad93433f16506ccf32afeb23d004.tar.gz
Qt-564894627debad93433f16506ccf32afeb23d004.tar.bz2
Make private headers _p
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/fx.pri60
-rw-r--r--src/declarative/fx/qmlgraphicsanchors.cpp6
-rw-r--r--src/declarative/fx/qmlgraphicsanchors.h180
-rw-r--r--src/declarative/fx/qmlgraphicsanchors_p.h234
-rw-r--r--src/declarative/fx/qmlgraphicsanchors_p_p.h160
-rw-r--r--src/declarative/fx/qmlgraphicsborderimage.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicsborderimage.h105
-rw-r--r--src/declarative/fx/qmlgraphicsborderimage_p.h96
-rw-r--r--src/declarative/fx/qmlgraphicsborderimage_p_p.h (renamed from src/declarative/fx/qmlgraphicsimage.h)77
-rw-r--r--src/declarative/fx/qmlgraphicsevents.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicsevents_p_p.h (renamed from src/declarative/fx/qmlgraphicsevents_p.h)0
-rw-r--r--src/declarative/fx/qmlgraphicsflickable.cpp4
-rw-r--r--src/declarative/fx/qmlgraphicsflickable.h203
-rw-r--r--src/declarative/fx/qmlgraphicsflickable_p.h245
-rw-r--r--src/declarative/fx/qmlgraphicsflickable_p_p.h156
-rw-r--r--src/declarative/fx/qmlgraphicsflipable.cpp4
-rw-r--r--src/declarative/fx/qmlgraphicsflipable_p.h (renamed from src/declarative/fx/qmlgraphicsflipable.h)0
-rw-r--r--src/declarative/fx/qmlgraphicsfocuspanel.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicsfocuspanel_p.h (renamed from src/declarative/fx/qmlgraphicsfocuspanel.h)0
-rw-r--r--src/declarative/fx/qmlgraphicsfocusscope.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicsfocusscope_p.h (renamed from src/declarative/fx/qmlgraphicsfocusscope.h)0
-rw-r--r--src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.cpp6
-rw-r--r--src/declarative/fx/qmlgraphicsgraphicsobjectcontainer_p.h (renamed from src/declarative/fx/qmlgraphicsgraphicsobjectcontainer.h)0
-rw-r--r--src/declarative/fx/qmlgraphicsgridview.cpp12
-rw-r--r--src/declarative/fx/qmlgraphicsgridview_p.h (renamed from src/declarative/fx/qmlgraphicsgridview.h)2
-rw-r--r--src/declarative/fx/qmlgraphicsimage.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicsimage_p.h57
-rw-r--r--src/declarative/fx/qmlgraphicsimage_p_p.h77
-rw-r--r--src/declarative/fx/qmlgraphicsimagebase.cpp4
-rw-r--r--src/declarative/fx/qmlgraphicsimagebase.h90
-rw-r--r--src/declarative/fx/qmlgraphicsimagebase_p.h67
-rw-r--r--src/declarative/fx/qmlgraphicsimagebase_p_p.h83
-rw-r--r--src/declarative/fx/qmlgraphicsitem.cpp17
-rw-r--r--src/declarative/fx/qmlgraphicsitem_p.h6
-rw-r--r--src/declarative/fx/qmlgraphicslayoutitem.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicslayoutitem_p.h (renamed from src/declarative/fx/qmlgraphicslayoutitem.h)0
-rw-r--r--src/declarative/fx/qmlgraphicslistview.cpp13
-rw-r--r--src/declarative/fx/qmlgraphicslistview_p.h (renamed from src/declarative/fx/qmlgraphicslistview.h)2
-rw-r--r--src/declarative/fx/qmlgraphicsloader.cpp6
-rw-r--r--src/declarative/fx/qmlgraphicsloader_p.h83
-rw-r--r--src/declarative/fx/qmlgraphicsloader_p_p.h82
-rw-r--r--src/declarative/fx/qmlgraphicsmouseregion.cpp4
-rw-r--r--src/declarative/fx/qmlgraphicsmouseregion.h180
-rw-r--r--src/declarative/fx/qmlgraphicsmouseregion_p.h192
-rw-r--r--src/declarative/fx/qmlgraphicsmouseregion_p_p.h114
-rw-r--r--src/declarative/fx/qmlgraphicspainteditem.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicspainteditem_p.h91
-rw-r--r--src/declarative/fx/qmlgraphicspainteditem_p_p.h88
-rw-r--r--src/declarative/fx/qmlgraphicspath.cpp4
-rw-r--r--src/declarative/fx/qmlgraphicspath.h259
-rw-r--r--src/declarative/fx/qmlgraphicspath_p.h234
-rw-r--r--src/declarative/fx/qmlgraphicspath_p_p.h79
-rw-r--r--src/declarative/fx/qmlgraphicspathview.cpp12
-rw-r--r--src/declarative/fx/qmlgraphicspathview.h138
-rw-r--r--src/declarative/fx/qmlgraphicspathview_p.h183
-rw-r--r--src/declarative/fx/qmlgraphicspathview_p_p.h151
-rw-r--r--src/declarative/fx/qmlgraphicspixmapcache.cpp4
-rw-r--r--src/declarative/fx/qmlgraphicspixmapcache_p.h (renamed from src/declarative/fx/qmlgraphicspixmapcache.h)0
-rw-r--r--src/declarative/fx/qmlgraphicspositioners.cpp12
-rw-r--r--src/declarative/fx/qmlgraphicspositioners.h167
-rw-r--r--src/declarative/fx/qmlgraphicspositioners_p.h168
-rw-r--r--src/declarative/fx/qmlgraphicspositioners_p_p.h105
-rw-r--r--src/declarative/fx/qmlgraphicsrect.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicsrect.h189
-rw-r--r--src/declarative/fx/qmlgraphicsrect_p.h196
-rw-r--r--src/declarative/fx/qmlgraphicsrect_p_p.h109
-rw-r--r--src/declarative/fx/qmlgraphicsrepeater.cpp8
-rw-r--r--src/declarative/fx/qmlgraphicsrepeater.h103
-rw-r--r--src/declarative/fx/qmlgraphicsrepeater_p.h76
-rw-r--r--src/declarative/fx/qmlgraphicsrepeater_p_p.h81
-rw-r--r--src/declarative/fx/qmlgraphicsscalegrid.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicsscalegrid_p_p.h (renamed from src/declarative/fx/qmlgraphicsscalegrid_p.h)4
-rw-r--r--src/declarative/fx/qmlgraphicstext.cpp4
-rw-r--r--src/declarative/fx/qmlgraphicstext.h151
-rw-r--r--src/declarative/fx/qmlgraphicstext_p.h164
-rw-r--r--src/declarative/fx/qmlgraphicstext_p_p.h (renamed from src/declarative/fx/qmlgraphicsloader.h)120
-rw-r--r--src/declarative/fx/qmlgraphicstextedit.cpp6
-rw-r--r--src/declarative/fx/qmlgraphicstextedit.h234
-rw-r--r--src/declarative/fx/qmlgraphicstextedit_p.h241
-rw-r--r--src/declarative/fx/qmlgraphicstextedit_p_p.h113
-rw-r--r--src/declarative/fx/qmlgraphicstextinput.cpp2
-rw-r--r--src/declarative/fx/qmlgraphicstextinput.h209
-rw-r--r--src/declarative/fx/qmlgraphicstextinput_p.h212
-rw-r--r--src/declarative/fx/qmlgraphicstextinput_p_p.h (renamed from src/declarative/fx/qmlgraphicspainteditem.h)108
-rw-r--r--src/declarative/fx/qmlgraphicsvisualitemmodel.cpp13
-rw-r--r--src/declarative/fx/qmlgraphicsvisualitemmodel_p.h (renamed from src/declarative/fx/qmlgraphicsvisualitemmodel.h)0
-rw-r--r--src/declarative/fx/qmlgraphicswebview.cpp10
-rw-r--r--src/declarative/fx/qmlgraphicswebview_p.h (renamed from src/declarative/fx/qmlgraphicswebview.h)2
88 files changed, 3348 insertions, 3347 deletions
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/qmlgraphicsimage.h b/src/declarative/fx/qmlgraphicsborderimage_p_p.h
index 167ecd4..06ac38b 100644
--- a/src/declarative/fx/qmlgraphicsimage.h
+++ b/src/declarative/fx/qmlgraphicsborderimage_p_p.h
@@ -39,52 +39,59 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSIMAGE_H
-#define QMLGRAPHICSIMAGE_H
+#ifndef QMLGRAPHICSBORDERIMAGE_P_H
+#define QMLGRAPHICSBORDERIMAGE_P_H
-#include <QtNetwork/qnetworkreply.h>
-#include "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.
+//
-QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE
+#include "qmlgraphicsimagebase_p_p.h"
+#include "qmlgraphicsscalegrid_p_p.h"
-QT_MODULE(Declarative)
+QT_BEGIN_NAMESPACE
-class QmlGraphicsImagePrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsImage : public QmlGraphicsImageBase
+class QNetworkReply;
+class QmlGraphicsBorderImagePrivate : public QmlGraphicsImageBasePrivate
{
- 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)
+ Q_DECLARE_PUBLIC(QmlGraphicsBorderImage)
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 *);
+ QmlGraphicsBorderImagePrivate()
+ : border(0), sciReply(0),
+ sciPendingPixmapCache(false),
+ horizontalTileMode(QmlGraphicsBorderImage::Stretch),
+ verticalTileMode(QmlGraphicsBorderImage::Stretch)
+ {
+ }
-Q_SIGNALS:
- void fillModeChanged();
+ ~QmlGraphicsBorderImagePrivate()
+ {
+ }
-protected:
- QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent);
+ QmlGraphicsScaleGrid *getScaleGrid()
+ {
+ Q_Q(QmlGraphicsBorderImage);
+ if (!border)
+ border = new QmlGraphicsScaleGrid(q);
+ return border;
+ }
-private:
- Q_DISABLE_COPY(QmlGraphicsImage)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImage)
+ QmlGraphicsScaleGrid *border;
+ QUrl sciurl;
+ QNetworkReply *sciReply;
+ bool sciPendingPixmapCache;
+ QmlGraphicsBorderImage::TileMode horizontalTileMode;
+ QmlGraphicsBorderImage::TileMode verticalTileMode;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsImage)
-QT_END_HEADER
-#endif // QMLGRAPHICSIMAGE_H
+#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_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>