summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2009-07-01 15:48:33 (GMT)
committerErik Verbruggen <erik.verbruggen@nokia.com>2009-07-01 15:48:33 (GMT)
commit04a9ce0e3392563e3843588d7083dd92ad00bd83 (patch)
tree18b05a8e1801208ed8e8d26e1ffa92e4d83bfb34
parenteeccaca2875b675d9fabfe5cf03941fa1fd93511 (diff)
parent1924f31db80328b7445ac37bc8fd8a0263cf166b (diff)
downloadQt-04a9ce0e3392563e3843588d7083dd92ad00bd83.zip
Qt-04a9ce0e3392563e3843588d7083dd92ad00bd83.tar.gz
Qt-04a9ce0e3392563e3843588d7083dd92ad00bd83.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--doc/src/declarative/elements.qdoc1
-rw-r--r--examples/declarative/loader/Browser.qml41
-rw-r--r--examples/declarative/loader/loader.qml39
-rw-r--r--examples/declarative/loader/loader.qrc1
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder.cpp41
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder_p.h52
-rw-r--r--src/declarative/canvas/qsimplecanvas_p.h7
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.h7
-rw-r--r--src/declarative/declarative.pro1
-rw-r--r--src/declarative/extra/extra.pri2
-rw-r--r--src/declarative/extra/qbindablemap.h3
-rw-r--r--src/declarative/extra/qfxanimatedimageitem.h8
-rw-r--r--src/declarative/extra/qfxblendedimage.h5
-rw-r--r--src/declarative/extra/qfxflowview.cpp8
-rw-r--r--src/declarative/extra/qfxflowview.h4
-rw-r--r--src/declarative/extra/qfxintegermodel.cpp2
-rw-r--r--src/declarative/extra/qfxintegermodel.h8
-rw-r--r--src/declarative/extra/qfxparticles.cpp (renamed from src/declarative/fx/qfxparticles.cpp)2
-rw-r--r--src/declarative/extra/qfxparticles.h (renamed from src/declarative/fx/qfxparticles.h)11
-rw-r--r--src/declarative/extra/qmlbehaviour.cpp4
-rw-r--r--src/declarative/extra/qmlbehaviour.h4
-rw-r--r--src/declarative/extra/qmldatetimeformatter.cpp2
-rw-r--r--src/declarative/extra/qmldatetimeformatter.h5
-rw-r--r--src/declarative/extra/qmlfolderlistmodel.cpp50
-rw-r--r--src/declarative/extra/qmlfolderlistmodel.h6
-rw-r--r--src/declarative/extra/qmlnumberformatter.cpp4
-rw-r--r--src/declarative/extra/qmlnumberformatter.h8
-rw-r--r--src/declarative/extra/qmlsqlconnection.h6
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp2
-rw-r--r--src/declarative/extra/qmlsqlquery.h8
-rw-r--r--src/declarative/extra/qmltimer.h6
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp5
-rw-r--r--src/declarative/extra/qmlxmllistmodel.h6
-rw-r--r--src/declarative/extra/qnumberformat.cpp5
-rw-r--r--src/declarative/extra/qnumberformat.h5
-rw-r--r--src/declarative/fx/fx.pri2
-rw-r--r--src/declarative/fx/qfxanchors.h6
-rw-r--r--src/declarative/fx/qfxblurfilter.h7
-rw-r--r--src/declarative/fx/qfxcomponentinstance.h5
-rw-r--r--src/declarative/fx/qfxcontentwrapper.h7
-rw-r--r--src/declarative/fx/qfxevents_p.h7
-rw-r--r--src/declarative/fx/qfxflickable.cpp8
-rw-r--r--src/declarative/fx/qfxflickable.h7
-rw-r--r--src/declarative/fx/qfxflipable.cpp2
-rw-r--r--src/declarative/fx/qfxflipable.h3
-rw-r--r--src/declarative/fx/qfxfocuspanel.h6
-rw-r--r--src/declarative/fx/qfxfocusrealm.h6
-rw-r--r--src/declarative/fx/qfxgridview.h4
-rw-r--r--src/declarative/fx/qfxhighlightfilter.h5
-rw-r--r--src/declarative/fx/qfximage.h3
-rw-r--r--src/declarative/fx/qfxitem.cpp4
-rw-r--r--src/declarative/fx/qfxitem.h8
-rw-r--r--src/declarative/fx/qfxkeyactions.h6
-rw-r--r--src/declarative/fx/qfxkeyproxy.h5
-rw-r--r--src/declarative/fx/qfxlayouts.h8
-rw-r--r--src/declarative/fx/qfxlistview.h6
-rw-r--r--src/declarative/fx/qfxmouseregion.h5
-rw-r--r--src/declarative/fx/qfxpainteditem.h5
-rw-r--r--src/declarative/fx/qfxpath.h18
-rw-r--r--src/declarative/fx/qfxpathview.h3
-rw-r--r--src/declarative/fx/qfxrect.cpp4
-rw-r--r--src/declarative/fx/qfxrect.h9
-rw-r--r--src/declarative/fx/qfxreflectionfilter.h3
-rw-r--r--src/declarative/fx/qfxrepeater.h7
-rw-r--r--src/declarative/fx/qfxscalegrid.h5
-rw-r--r--src/declarative/fx/qfxshadowfilter.cpp4
-rw-r--r--src/declarative/fx/qfxshadowfilter.h7
-rw-r--r--src/declarative/fx/qfxtext.h5
-rw-r--r--src/declarative/fx/qfxtextedit.h5
-rw-r--r--src/declarative/fx/qfxtransform.cpp137
-rw-r--r--src/declarative/fx/qfxtransform.h58
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp2
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.h3
-rw-r--r--src/declarative/fx/qfxwebview.cpp4
-rw-r--r--src/declarative/fx/qfxwebview.h11
-rw-r--r--src/declarative/fx/qfxwidgetcontainer.h3
-rw-r--r--src/declarative/opengl/glbasicshaders.h5
-rw-r--r--src/declarative/qml/qml.h8
-rw-r--r--src/declarative/qml/qmlbindablevalue.cpp3
-rw-r--r--src/declarative/qml/qmlbindablevalue.h3
-rw-r--r--src/declarative/qml/qmlboundsignal.cpp2
-rw-r--r--src/declarative/qml/qmlcompiler.cpp10
-rw-r--r--src/declarative/qml/qmlcompiler_p.h3
-rw-r--r--src/declarative/qml/qmlcomponent.h5
-rw-r--r--src/declarative/qml/qmlcustomparser.cpp3
-rw-r--r--src/declarative/qml/qmlcustomparser_p.h5
-rw-r--r--src/declarative/qml/qmldom_p.h9
-rw-r--r--src/declarative/qml/qmlengine.cpp9
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp4
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h4
-rw-r--r--src/declarative/qml/qmlmetatype.cpp4
-rw-r--r--src/declarative/qml/qmlparser_p.h3
-rw-r--r--src/declarative/qml/qmlpropertyvaluesource.h3
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp3
-rw-r--r--src/declarative/test/qfxtestengine.h4
-rw-r--r--src/declarative/test/qfxtestobjects.cpp12
-rw-r--r--src/declarative/test/qfxtestobjects.h5
-rw-r--r--src/declarative/test/qfxtestview.h5
-rw-r--r--src/declarative/util/qmlanimation.cpp43
-rw-r--r--src/declarative/util/qmlanimation.h23
-rw-r--r--src/declarative/util/qmlanimation_p.h4
-rw-r--r--src/declarative/util/qmlbind.h3
-rw-r--r--src/declarative/util/qmlconnection.h3
-rw-r--r--src/declarative/util/qmlfollow.h4
-rw-r--r--src/declarative/util/qmlfont.h3
-rw-r--r--src/declarative/util/qmllistmodel.cpp77
-rw-r--r--src/declarative/util/qmllistmodel.h28
-rw-r--r--src/declarative/util/qmlpackage.h3
-rw-r--r--src/declarative/util/qmlscript.h3
-rw-r--r--src/declarative/util/qmlsetproperties.h3
-rw-r--r--src/declarative/util/qmlstate.cpp2
-rw-r--r--src/declarative/util/qmlstate.h5
-rw-r--r--src/declarative/util/qmlstategroup.h3
-rw-r--r--src/declarative/util/qmlstateoperations.h7
-rw-r--r--src/declarative/util/qmltransition.cpp1
-rw-r--r--src/declarative/util/qmltransition.h3
-rw-r--r--src/declarative/widgets/graphicslayouts.h12
-rw-r--r--src/declarative/widgets/graphicswidgets.h6
-rw-r--r--tests/auto/declarative/animations/data/badproperty1.qml22
-rw-r--r--tests/auto/declarative/animations/data/dotproperty.qml22
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp15
-rw-r--r--tools/linguist/lupdate/qml.cpp4
-rw-r--r--tools/qmldebugger/canvasframerate.cpp4
-rw-r--r--tools/qmldebugger/canvasframerate.h4
-rw-r--r--tools/qmldebugger/canvasscene.cpp3
-rw-r--r--tools/qmldebugger/canvasscene.h4
-rw-r--r--tools/qmlviewer/qmlviewer.cpp4
-rw-r--r--tools/qmlviewer/qmlviewer.h3
128 files changed, 825 insertions, 390 deletions
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 63566f6..eda9079 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -139,6 +139,7 @@ The following table lists the Qml elements provided by the Qt Declarative module
\o
\list
+\o \l Scale
\o \l Rotation
\o \l Squish
\o \l Rotation3D
diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml
new file mode 100644
index 0000000..af5538e
--- /dev/null
+++ b/examples/declarative/loader/Browser.qml
@@ -0,0 +1,41 @@
+Rect {
+ id: Root
+ width: parent.width
+ height: parent.height
+ FolderListModel {
+ id: folders
+ nameFilters: [ "*.qml" ]
+ }
+
+ Component {
+ id: FolderDelegate
+ Text {
+ id: Wrapper
+ width: Root.width
+ text: fileName
+ font.bold: true
+ font.size: 14
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: {
+ if (folders.isFolder(index)) {
+ folders.folder = filePath;
+ } else {
+ Shell.qml = filePath;
+ }
+ }
+ }
+ }
+ }
+
+ Text { id: DirText; text: folders.folder }
+
+ ListView {
+ anchors.top: DirText.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ model: folders
+ delegate: FolderDelegate
+ }
+}
diff --git a/examples/declarative/loader/loader.qml b/examples/declarative/loader/loader.qml
index 4dd7a03..6e4d6ec 100644
--- a/examples/declarative/loader/loader.qml
+++ b/examples/declarative/loader/loader.qml
@@ -1,41 +1,6 @@
Rect {
- id: Root
+ id: Shell
width: 300
height: 400
- FolderListModel {
- id: folders
- nameFilters: [ "*.qml" ]
- }
-
- Component {
- id: FolderDelegate
- Text {
- id: Wrapper
- width: Root.width
- text: fileName
- font.bold: true
- font.size: 14
- MouseRegion {
- anchors.fill: parent
- onClicked: {
- if (folders.isFolder(index)) {
- folders.folder = filePath;
- } else {
- Root.qml = filePath;
- }
- }
- }
- }
- }
-
- Text { id: DirText; text: folders.folder }
-
- ListView {
- anchors.top: DirText.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- model: folders
- delegate: FolderDelegate
- }
+ qml: "Browser.qml"
}
diff --git a/examples/declarative/loader/loader.qrc b/examples/declarative/loader/loader.qrc
index 8c80052..1f0925f 100644
--- a/examples/declarative/loader/loader.qrc
+++ b/examples/declarative/loader/loader.qrc
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>loader.qml</file>
+ <file>Browser.qml</file>
</qresource>
</RCC>
diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp
index de75bde..d4891ff 100644
--- a/src/corelib/kernel/qmetaobjectbuilder.cpp
+++ b/src/corelib/kernel/qmetaobjectbuilder.cpp
@@ -1,16 +1,49 @@
/****************************************************************************
**
-** This file is part of the $PACKAGE_NAME$.
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $QT_EXTENDED_DUAL_LICENSE$
+** $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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
**
****************************************************************************/
#include "qmetaobjectbuilder_p.h"
#include <QDebug>
+QT_BEGIN_NAMESPACE
+
/*!
\class QMetaObjectBuilder
\brief The QMetaObjectBuilder class supports building QMetaObject objects at runtime.
@@ -2444,3 +2477,5 @@ void QMetaEnumBuilder::removeKey(int index)
d->values.removeAt(index);
}
}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmetaobjectbuilder_p.h b/src/corelib/kernel/qmetaobjectbuilder_p.h
index dc95745..952364a 100644
--- a/src/corelib/kernel/qmetaobjectbuilder_p.h
+++ b/src/corelib/kernel/qmetaobjectbuilder_p.h
@@ -1,21 +1,65 @@
/****************************************************************************
**
-** This file is part of the $PACKAGE_NAME$.
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** Copyright (C) $THISYEAR$ $COMPANY_NAME$.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $QT_EXTENDED_DUAL_LICENSE$
+** $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 http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMETAOBJECTBUILDER_H
#define QMETAOBJECTBUILDER_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of moc. This header file may change from version to version without notice,
+// or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qobject.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qdatastream.h>
#include <QtCore/qmap.h>
+QT_BEGIN_NAMESPACE
+
class QMetaObjectBuilderPrivate;
class QMetaMethodBuilder;
class QMetaMethodBuilderPrivate;
@@ -266,4 +310,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaObjectBuilder::AddMembers)
Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaObjectBuilder::MetaObjectFlags)
+QT_END_NAMESPACE
+
#endif
diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h
index 3a0186e..c900ccf 100644
--- a/src/declarative/canvas/qsimplecanvas_p.h
+++ b/src/declarative/canvas/qsimplecanvas_p.h
@@ -81,11 +81,14 @@ private:
QSimpleCanvas::Matrix defaultTransform;
QSimpleCanvas::Matrix invDefaultTransform;
};
+QT_END_NAMESPACE
#endif
#include <QGraphicsView>
#include <QGraphicsScene>
+QT_BEGIN_NAMESPACE
+
struct QSimpleCanvasGraphicsView : public QGraphicsView
{
public:
@@ -198,6 +201,6 @@ public:
int paintVersion;
};
-#endif
-
QT_END_NAMESPACE
+
+#endif
diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h
index dce3007..6452aa4 100644
--- a/src/declarative/canvas/qsimplecanvasitem.h
+++ b/src/declarative/canvas/qsimplecanvasitem.h
@@ -328,11 +328,8 @@ private:
QSimpleCanvasLayer();
};
-
-
-#endif // _GFXCANVASITEM_H_
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QSIMPLECANVASITEM_H
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 382f3cb..9f555fe 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -3,7 +3,6 @@ QPRO_PWD = $$PWD
QT = core gui xml script network
contains(QT_CONFIG, svg): QT += svg
DEFINES += QT_BUILD_DECLARATIVE_LIB
-DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri
index fde4e3a..fca8ec8 100644
--- a/src/declarative/extra/extra.pri
+++ b/src/declarative/extra/extra.pri
@@ -8,6 +8,7 @@ SOURCES += \
extra/qfxanimatedimageitem.cpp \
extra/qfxblendedimage.cpp \
extra/qfxflowview.cpp \
+ extra/qfxparticles.cpp \
extra/qmlbehaviour.cpp \
extra/qbindablemap.cpp
@@ -22,6 +23,7 @@ HEADERS += \
extra/qfxanimatedimageitem_p.h \
extra/qfxblendedimage.h \
extra/qfxflowview.h \
+ extra/qfxparticles.h \
extra/qmlbehaviour.h \
extra/qbindablemap.h
diff --git a/src/declarative/extra/qbindablemap.h b/src/declarative/extra/qbindablemap.h
index c76928d..aa1908e 100644
--- a/src/declarative/extra/qbindablemap.h
+++ b/src/declarative/extra/qbindablemap.h
@@ -48,7 +48,6 @@
#include <QtCore/QStringList>
#include <QtCore/QVariant>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -80,8 +79,8 @@ private:
friend class QBindableMapMetaObject;
};
-
QT_END_NAMESPACE
QT_END_HEADER
+
#endif
diff --git a/src/declarative/extra/qfxanimatedimageitem.h b/src/declarative/extra/qfxanimatedimageitem.h
index 5d115d7..86ded86 100644
--- a/src/declarative/extra/qfxanimatedimageitem.h
+++ b/src/declarative/extra/qfxanimatedimageitem.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfximage.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QMovie;
class QFxAnimatedImageItemPrivate;
@@ -91,10 +91,10 @@ private:
Q_DECLARE_PRIVATE(QFxAnimatedImageItem)
};
-QML_DECLARE_TYPE(QFxAnimatedImageItem)
-
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxAnimatedImageItem)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/extra/qfxblendedimage.h b/src/declarative/extra/qfxblendedimage.h
index 248cc9d..44de94c 100644
--- a/src/declarative/extra/qfxblendedimage.h
+++ b/src/declarative/extra/qfxblendedimage.h
@@ -101,10 +101,11 @@ private:
QPixmap primPix;
QPixmap secPix;
};
-QML_DECLARE_TYPE(QFxBlendedImage)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxBlendedImage)
+
QT_END_HEADER
+
#endif // QFXBLENDEDIMAGE_H
diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp
index 77cd6df..254e423 100644
--- a/src/declarative/extra/qfxflowview.cpp
+++ b/src/declarative/extra/qfxflowview.cpp
@@ -42,6 +42,8 @@
#include "qfxvisualitemmodel.h"
#include "qfxflowview.h"
+#include <QGraphicsSceneMouseEvent>
+
QT_BEGIN_NAMESPACE
class QFxFlowViewAttached : public QObject
@@ -288,8 +290,6 @@ void QFxFlowView::moveItem(QFxItem *item, const QPointF &p)
m_timeline.move(*yv, p.y(), 100);
}
-#include <QGraphicsSceneMouseEvent>
-
void QFxFlowView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
for (int ii = 0; ii < m_items.count(); ++ii) {
@@ -376,6 +376,6 @@ void QFxFlowView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QML_DEFINE_TYPE(QFxFlowView,FlowView);
-#include "qfxflowview.moc"
-
QT_END_NAMESPACE
+
+#include "qfxflowview.moc"
diff --git a/src/declarative/extra/qfxflowview.h b/src/declarative/extra/qfxflowview.h
index 0e7c2d3..2bec6a1 100644
--- a/src/declarative/extra/qfxflowview.h
+++ b/src/declarative/extra/qfxflowview.h
@@ -50,6 +50,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxVisualItemModel;
class QFxFlowViewValue;
class QFxFlowViewAttached;
@@ -97,10 +98,11 @@ private:
QList<QFxFlowViewValue *> m_values;
int m_dragIdx;
};
-QML_DECLARE_TYPE(QFxFlowView);
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxFlowView);
+
QT_END_HEADER
#endif // QFXFLOWVIEW_H
diff --git a/src/declarative/extra/qfxintegermodel.cpp b/src/declarative/extra/qfxintegermodel.cpp
index 53814cd..437073e 100644
--- a/src/declarative/extra/qfxintegermodel.cpp
+++ b/src/declarative/extra/qfxintegermodel.cpp
@@ -41,8 +41,8 @@
#include "qfxintegermodel.h"
-
QT_BEGIN_NAMESPACE
+
QML_DEFINE_TYPE(QFxIntegerModel, IntegerModel)
class QFxIntegerModelPrivate
diff --git a/src/declarative/extra/qfxintegermodel.h b/src/declarative/extra/qfxintegermodel.h
index 43504d8..7fced2c 100644
--- a/src/declarative/extra/qfxintegermodel.h
+++ b/src/declarative/extra/qfxintegermodel.h
@@ -46,12 +46,12 @@
#include <QtDeclarative/qml.h>
#include <QtDeclarative/qlistmodelinterface.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxIntegerModelPrivate;
class Q_DECLARATIVE_EXPORT QFxIntegerModel : public QListModelInterface
{
@@ -77,10 +77,10 @@ private:
QFxIntegerModelPrivate *d;
};
-QML_DECLARE_TYPE(QFxIntegerModel)
-
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxIntegerModel)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp
index 4cd34c4..62fe4c1 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/extra/qfxparticles.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qfxitem_p.h"
+#include "private/qfxitem_p.h"
#if defined(QFX_RENDER_OPENGL)
#include "gltexture.h"
#endif
diff --git a/src/declarative/fx/qfxparticles.h b/src/declarative/extra/qfxparticles.h
index b3a569b..cfaffa7 100644
--- a/src/declarative/fx/qfxparticles.h
+++ b/src/declarative/extra/qfxparticles.h
@@ -66,7 +66,6 @@ public:
virtual void created(QFxParticle &);
virtual void destroy(QFxParticle &);
};
-QML_DECLARE_TYPE(QFxParticleMotion)
class Q_DECLARATIVE_EXPORT QFxParticleMotionLinear : public QFxParticleMotion
{
@@ -77,7 +76,6 @@ public:
virtual void advance(QFxParticle &, int interval);
};
-QML_DECLARE_TYPE(QFxParticleMotionLinear)
class Q_DECLARATIVE_EXPORT QFxParticleMotionGravity : public QFxParticleMotion
{
@@ -106,7 +104,6 @@ private:
int _yAttr;
qreal _accel;
};
-QML_DECLARE_TYPE(QFxParticleMotionGravity)
class Q_DECLARATIVE_EXPORT QFxParticleMotionWander : public QFxParticleMotion
{
@@ -146,7 +143,6 @@ private:
qreal _yvariance;
qreal _pace;
};
-QML_DECLARE_TYPE(QFxParticleMotionWander)
class QFxParticlesPrivate;
class Q_DECLARATIVE_EXPORT QFxParticles : public QFxItem
@@ -231,10 +227,15 @@ private:
Q_DISABLE_COPY(QFxParticles)
Q_DECLARE_PRIVATE(QFxParticles)
};
-QML_DECLARE_TYPE(QFxParticles)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxParticleMotion)
+QML_DECLARE_TYPE(QFxParticleMotionLinear)
+QML_DECLARE_TYPE(QFxParticleMotionGravity)
+QML_DECLARE_TYPE(QFxParticleMotionWander)
+QML_DECLARE_TYPE(QFxParticles)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/extra/qmlbehaviour.cpp b/src/declarative/extra/qmlbehaviour.cpp
index 4beca5e..4165d56 100644
--- a/src/declarative/extra/qmlbehaviour.cpp
+++ b/src/declarative/extra/qmlbehaviour.cpp
@@ -254,6 +254,6 @@ void QmlBehaviour::classComplete()
d->context->deactivate();
}
-#include "qmlbehaviour.moc"
-
QT_END_NAMESPACE
+
+#include "qmlbehaviour.moc"
diff --git a/src/declarative/extra/qmlbehaviour.h b/src/declarative/extra/qmlbehaviour.h
index 7cc83b2..1b5f524 100644
--- a/src/declarative/extra/qmlbehaviour.h
+++ b/src/declarative/extra/qmlbehaviour.h
@@ -51,6 +51,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlAbstractAnimation;
class QmlBehaviourPrivate;
class Q_DECLARATIVE_EXPORT QmlBehaviour : public QmlPropertyValueSource,
@@ -86,10 +87,11 @@ protected:
private Q_SLOTS:
void propertyValueChanged();
};
-QML_DECLARE_TYPE(QmlBehaviour)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlBehaviour)
+
QT_END_HEADER
#endif // QMLBEHAVIOUR_H
diff --git a/src/declarative/extra/qmldatetimeformatter.cpp b/src/declarative/extra/qmldatetimeformatter.cpp
index ad0e473..158431a 100644
--- a/src/declarative/extra/qmldatetimeformatter.cpp
+++ b/src/declarative/extra/qmldatetimeformatter.cpp
@@ -44,6 +44,7 @@
#include <QtCore/qlocale.h>
QT_BEGIN_NAMESPACE
+
//TODO: may need optimisation as the QDateTime member may not be needed?
// be able to set a locale?
@@ -365,4 +366,5 @@ void QmlDateTimeFormatter::classComplete()
}
QML_DEFINE_TYPE(QmlDateTimeFormatter, DateTimeFormatter)
+
QT_END_NAMESPACE
diff --git a/src/declarative/extra/qmldatetimeformatter.h b/src/declarative/extra/qmldatetimeformatter.h
index 84b27e3..71b366c 100644
--- a/src/declarative/extra/qmldatetimeformatter.h
+++ b/src/declarative/extra/qmldatetimeformatter.h
@@ -50,6 +50,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlDateTimeFormatterPrivate;
class Q_DECLARATIVE_EXPORT QmlDateTimeFormatter : public QObject, public QmlParserStatus
{
@@ -106,10 +107,10 @@ private:
Q_DECLARE_PRIVATE(QmlDateTimeFormatter)
};
-QML_DECLARE_TYPE(QmlDateTimeFormatter)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlDateTimeFormatter)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/extra/qmlfolderlistmodel.cpp b/src/declarative/extra/qmlfolderlistmodel.cpp
index abec01e..8b008a5 100644
--- a/src/declarative/extra/qmlfolderlistmodel.cpp
+++ b/src/declarative/extra/qmlfolderlistmodel.cpp
@@ -46,12 +46,10 @@
QT_BEGIN_NAMESPACE
-QT_MODULE(Declarative)
-
class QmlFolderListModelPrivate : public QObjectPrivate
{
public:
- QmlFolderListModelPrivate() {
+ QmlFolderListModelPrivate() : count(0) {
folder = QDir::currentPath();
nameFilters << "*";
}
@@ -60,6 +58,7 @@ public:
QString folder;
QStringList nameFilters;
QModelIndex folderIndex;
+ int count;
};
QmlFolderListModel::QmlFolderListModel(QObject *parent)
@@ -69,6 +68,11 @@ QmlFolderListModel::QmlFolderListModel(QObject *parent)
d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives);
connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int))
, this, SLOT(inserted(const QModelIndex&,int,int)));
+ connect(&d->model, SIGNAL(rowsRemoved(const QModelIndex&,int,int))
+ , this, SLOT(removed(const QModelIndex&,int,int)));
+ connect(&d->model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&))
+ , this, SLOT(dataChanged(const QModelIndex&,const QModelIndex&)));
+ connect(&d->model, SIGNAL(modelReset()), this, SLOT(refresh()));
}
QmlFolderListModel::~QmlFolderListModel()
@@ -91,9 +95,7 @@ QHash<int,QVariant> QmlFolderListModel::data(int index, const QList<int> &roles)
int QmlFolderListModel::count() const
{
Q_D(const QmlFolderListModel);
- if (!d->folderIndex.isValid())
- return 0;
- return d->model.rowCount(d->folderIndex);
+ return d->count;
}
QList<int> QmlFolderListModel::roles() const
@@ -164,22 +166,42 @@ bool QmlFolderListModel::isFolder(int index) const
void QmlFolderListModel::refresh()
{
Q_D(QmlFolderListModel);
- int prevCount = count();
d->folderIndex = QModelIndex();
- if (prevCount)
- emit itemsRemoved(0, prevCount);
+ if (d->count) {
+ int tmpCount = d->count;
+ d->count = 0;
+ emit itemsRemoved(0, tmpCount);
+ }
d->folderIndex = d->model.index(d->folder);
- qDebug() << "count" << count();
- if (count())
- emit itemsInserted(0, count());
+ d->count = d->model.rowCount(d->folderIndex);
+ if (d->count) {
+ emit itemsInserted(0, d->count);
+ }
}
void QmlFolderListModel::inserted(const QModelIndex &index, int start, int end)
{
Q_D(QmlFolderListModel);
- qDebug() << "inserted" << start << end;
- if (index == d->folderIndex)
+ if (index == d->folderIndex) {
+ d->count = d->model.rowCount(d->folderIndex);
emit itemsInserted(start, end - start + 1);
+ }
+}
+
+void QmlFolderListModel::removed(const QModelIndex &index, int start, int end)
+{
+ Q_D(QmlFolderListModel);
+ if (index == d->folderIndex) {
+ d->count = d->model.rowCount(d->folderIndex);
+ emit itemsRemoved(start, end - start + 1);
+ }
+}
+
+void QmlFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end)
+{
+ Q_D(QmlFolderListModel);
+ if (start.parent() == d->folderIndex)
+ emit itemsChanged(start.row(), end.row() - start.row() + 1, roles());
}
QML_DEFINE_TYPE(QmlFolderListModel,FolderListModel)
diff --git a/src/declarative/extra/qmlfolderlistmodel.h b/src/declarative/extra/qmlfolderlistmodel.h
index a6e8526..8c99b22 100644
--- a/src/declarative/extra/qmlfolderlistmodel.h
+++ b/src/declarative/extra/qmlfolderlistmodel.h
@@ -88,16 +88,18 @@ Q_SIGNALS:
private Q_SLOTS:
void refresh();
void inserted(const QModelIndex &index, int start, int end);
+ void removed(const QModelIndex &index, int start, int end);
+ void dataChanged(const QModelIndex &start, const QModelIndex &end);
private:
Q_DECLARE_PRIVATE(QmlFolderListModel)
Q_DISABLE_COPY(QmlFolderListModel)
};
-QML_DECLARE_TYPE(QmlFolderListModel)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlFolderListModel)
+
QT_END_HEADER
#endif // QMLFOLDERLISTMODEL_H
diff --git a/src/declarative/extra/qmlnumberformatter.cpp b/src/declarative/extra/qmlnumberformatter.cpp
index 1549525..b24f2d8 100644
--- a/src/declarative/extra/qmlnumberformatter.cpp
+++ b/src/declarative/extra/qmlnumberformatter.cpp
@@ -42,8 +42,8 @@
#include "qmlnumberformatter.h"
#include "private/qobject_p.h"
-
QT_BEGIN_NAMESPACE
+
//TODO: set locale
// docs
// this is a wrapper around qnumberformat (test integration)
@@ -210,6 +210,6 @@ void QmlNumberFormatter::classComplete()
d->classComplete = true;
d->updateText();
}
-
QML_DEFINE_TYPE(QmlNumberFormatter, NumberFormatter);
+
QT_END_NAMESPACE
diff --git a/src/declarative/extra/qmlnumberformatter.h b/src/declarative/extra/qmlnumberformatter.h
index e4efc03..6924fa5 100644
--- a/src/declarative/extra/qmlnumberformatter.h
+++ b/src/declarative/extra/qmlnumberformatter.h
@@ -45,12 +45,12 @@
#include <QtDeclarative/qml.h>
#include <QtDeclarative/qnumberformat.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QmlNumberFormatterPrivate;
class Q_DECLARATIVE_EXPORT QmlNumberFormatter : public QObject, public QmlParserStatus
{
@@ -83,10 +83,10 @@ private:
Q_DECLARE_PRIVATE(QmlNumberFormatter)
};
-QML_DECLARE_TYPE(QmlNumberFormatter)
-
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlNumberFormatter)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/extra/qmlsqlconnection.h b/src/declarative/extra/qmlsqlconnection.h
index ede8bcb..88a727a 100644
--- a/src/declarative/extra/qmlsqlconnection.h
+++ b/src/declarative/extra/qmlsqlconnection.h
@@ -50,6 +50,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QSqlDatabase;
class QmlSqlConnectionPrivate;
class Q_DECLARATIVE_EXPORT QmlSqlConnection : public QObject, public QmlParserStatus
@@ -107,10 +108,11 @@ private:
Q_DECLARE_PRIVATE(QmlSqlConnection)
};
-QML_DECLARE_TYPE(QmlSqlConnection)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlSqlConnection)
+
QT_END_HEADER
+
#endif // QMLXMLLISTMODEL_H
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
index 2b11774..d9d9760 100644
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ b/src/declarative/extra/qmlsqlquery.cpp
@@ -55,6 +55,7 @@
#include <QTimerEvent>
QT_BEGIN_NAMESPACE
+
QML_DEFINE_TYPE(QmlSqlBind, SqlBind)
QML_DEFINE_TYPE(QmlSqlQuery, SqlQuery)
@@ -790,4 +791,5 @@ void QmlSqlQueryPrivate::grabRoles() const
roles.append(i);
}
}
+
QT_END_NAMESPACE
diff --git a/src/declarative/extra/qmlsqlquery.h b/src/declarative/extra/qmlsqlquery.h
index 06ade08..8be758f 100644
--- a/src/declarative/extra/qmlsqlquery.h
+++ b/src/declarative/extra/qmlsqlquery.h
@@ -82,8 +82,6 @@ private:
Q_DECLARE_PRIVATE(QmlSqlBind)
};
-QML_DECLARE_TYPE(QmlSqlBind)
-
class QSqlQuery;
class QmlSqlQueryPrivate;
class Q_DECLARATIVE_EXPORT QmlSqlQuery : public QListModelInterface, public QmlParserStatus
@@ -135,10 +133,12 @@ private:
Q_DECLARE_PRIVATE(QmlSqlQuery)
};
-QML_DECLARE_TYPE(QmlSqlQuery)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlSqlBind)
+QML_DECLARE_TYPE(QmlSqlQuery)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/extra/qmltimer.h b/src/declarative/extra/qmltimer.h
index 8171385..0df4cb9 100644
--- a/src/declarative/extra/qmltimer.h
+++ b/src/declarative/extra/qmltimer.h
@@ -48,6 +48,7 @@
#include <QtDeclarative/qml.h>
QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -92,8 +93,11 @@ private Q_SLOTS:
void ticked();
void stateChanged(QAbstractAnimation::State,QAbstractAnimation::State);
};
-QML_DECLARE_TYPE(QmlTimer)
QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QmlTimer)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 082c9c2..48949b3 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -61,7 +61,6 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(XmlListModelRole, XmlRole)
QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel)
-
class QmlXmlListModelPrivate;
struct QmlXmlRoleList : public QmlConcreteList<XmlListModelRole *>
{
@@ -643,6 +642,6 @@ void QmlXmlListModel::queryCompleted(int id, int size)
}
}
-#include "qmlxmllistmodel.moc"
-
QT_END_NAMESPACE
+
+#include "qmlxmllistmodel.moc"
diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h
index 0d41456..804f13f 100644
--- a/src/declarative/extra/qmlxmllistmodel.h
+++ b/src/declarative/extra/qmlxmllistmodel.h
@@ -84,7 +84,6 @@ private:
QString m_name;
QString m_query;
};
-QML_DECLARE_TYPE(XmlListModelRole)
class QmlXmlListModelPrivate;
class Q_DECLARATIVE_EXPORT QmlXmlListModel : public QListModelInterface, public QmlParserStatus
@@ -144,10 +143,11 @@ private:
Q_DISABLE_COPY(QmlXmlListModel)
};
-QML_DECLARE_TYPE(QmlXmlListModel)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(XmlListModelRole)
+QML_DECLARE_TYPE(QmlXmlListModel)
+
QT_END_HEADER
#endif // QMLXMLLISTMODEL_H
diff --git a/src/declarative/extra/qnumberformat.cpp b/src/declarative/extra/qnumberformat.cpp
index 424c125..cde2fb0 100644
--- a/src/declarative/extra/qnumberformat.cpp
+++ b/src/declarative/extra/qnumberformat.cpp
@@ -41,9 +41,9 @@
#include "qnumberformat.h"
-
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(QNumberFormat,NumberFormat)
+
+QML_DEFINE_NOCREATE_TYPE(QNumberFormat)
QNumberFormat::QNumberFormat(QObject *parent) : QObject(parent), _number(0), _type(Decimal),
_groupingSize(0)
@@ -221,4 +221,5 @@ QString QNumberFormat::formatDecimal(const QString &formatDec, const QString &de
}
return outputDecimal;
}
+
QT_END_NAMESPACE
diff --git a/src/declarative/extra/qnumberformat.h b/src/declarative/extra/qnumberformat.h
index fba9872..830cf79 100644
--- a/src/declarative/extra/qnumberformat.h
+++ b/src/declarative/extra/qnumberformat.h
@@ -163,10 +163,11 @@ private:
QString _text;
};
-QML_DECLARE_TYPE(QNumberFormat)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QNumberFormat)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index 69fada0..fd6e480 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -26,7 +26,6 @@ HEADERS += \
fx/qfxlayouts_p.h \
fx/qfxmouseregion.h \
fx/qfxmouseregion_p.h \
- fx/qfxparticles.h \
fx/qfxpath.h \
fx/qfxpath_p.h \
fx/qfxpathview.h \
@@ -67,7 +66,6 @@ SOURCES += \
fx/qfxkeyproxy.cpp \
fx/qfxlayouts.cpp \
fx/qfxmouseregion.cpp \
- fx/qfxparticles.cpp \
fx/qfxpath.cpp \
fx/qfxpathview.cpp \
fx/qfxrect.cpp \
diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h
index 94c22a6..dcd5d79 100644
--- a/src/declarative/fx/qfxanchors.h
+++ b/src/declarative/fx/qfxanchors.h
@@ -77,8 +77,6 @@ public:
AnchorLine anchorLine;
};
-Q_DECLARE_METATYPE(QFxAnchorLine)
-
class QFxAnchorsPrivate;
class Q_DECLARATIVE_EXPORT QFxAnchors : public QObject
{
@@ -186,10 +184,12 @@ private:
Q_DISABLE_COPY(QFxAnchors)
Q_DECLARE_PRIVATE(QFxAnchors)
};
-QML_DECLARE_TYPE(QFxAnchors)
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QFxAnchorLine)
+QML_DECLARE_TYPE(QFxAnchors)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/fx/qfxblurfilter.h b/src/declarative/fx/qfxblurfilter.h
index 90285de..830663f 100644
--- a/src/declarative/fx/qfxblurfilter.h
+++ b/src/declarative/fx/qfxblurfilter.h
@@ -45,12 +45,12 @@
#include <QtDeclarative/qsimplecanvasfilter.h>
#include <QtDeclarative/qml.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxBlurFilterPrivate;
class Q_DECLARATIVE_EXPORT QFxBlurFilter : public QSimpleCanvasFilter
{
@@ -73,10 +73,11 @@ protected:
private:
QFxBlurFilterPrivate *d;
};
-QML_DECLARE_TYPE(QFxBlurFilter)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxBlurFilter)
+
QT_END_HEADER
+
#endif // QFXBLURFILTER_H
diff --git a/src/declarative/fx/qfxcomponentinstance.h b/src/declarative/fx/qfxcomponentinstance.h
index e749272..f3bf6b3 100644
--- a/src/declarative/fx/qfxcomponentinstance.h
+++ b/src/declarative/fx/qfxcomponentinstance.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxComponentInstancePrivate;
class Q_DECLARATIVE_EXPORT QFxComponentInstance : public QFxItem
{
@@ -80,10 +80,11 @@ protected:
private:
Q_DECLARE_PRIVATE(QFxComponentInstance)
};
-QML_DECLARE_TYPE(QFxComponentInstance)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxComponentInstance)
+
QT_END_HEADER
#endif // QFXCOMPONENTINSTANCE_H
diff --git a/src/declarative/fx/qfxcontentwrapper.h b/src/declarative/fx/qfxcontentwrapper.h
index d8fe0b8..9a9a89c 100644
--- a/src/declarative/fx/qfxcontentwrapper.h
+++ b/src/declarative/fx/qfxcontentwrapper.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxContentWrapperPrivate;
class Q_DECLARATIVE_EXPORT QFxContentWrapper : public QFxItem
{
@@ -73,7 +73,6 @@ protected:
private:
Q_DECLARE_PRIVATE(QFxContentWrapper)
};
-QML_DECLARE_TYPE(QFxContentWrapper)
class Q_DECLARATIVE_EXPORT QFxContent : public QFxItem
{
@@ -81,10 +80,12 @@ class Q_DECLARATIVE_EXPORT QFxContent : public QFxItem
public:
QFxContent(QFxItem *parent=0) : QFxItem(parent) {}
};
-QML_DECLARE_TYPE(QFxContent)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxContentWrapper)
+QML_DECLARE_TYPE(QFxContent)
+
QT_END_HEADER
#endif // QFXCONTENTWRAPPER_H
diff --git a/src/declarative/fx/qfxevents_p.h b/src/declarative/fx/qfxevents_p.h
index 60494e6..fbf0c5f 100644
--- a/src/declarative/fx/qfxevents_p.h
+++ b/src/declarative/fx/qfxevents_p.h
@@ -89,8 +89,6 @@ private:
QKeyEvent event;
};
-QML_DECLARE_TYPE(QFxKeyEvent)
-
class QFxMouseEvent : public QObject
{
Q_OBJECT
@@ -131,8 +129,9 @@ private:
bool _accepted;
};
-QML_DECLARE_TYPE(QFxMouseEvent)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxKeyEvent)
+QML_DECLARE_TYPE(QFxMouseEvent)
+
#endif // QFXEVENTS_P_H
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index 3580edb..a82385a 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -597,7 +597,13 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
int dx = int(event->pos().x() - pressPos.x());
if (qAbs(dx) > FlickThreshold || pressTime.elapsed() > 200) {
qreal newX = dx + pressX;
- if (q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) {
+ const qreal minX = q->minXExtent();
+ const qreal maxX = q->maxXExtent();
+ if (newX > minX)
+ newX = minX + (newX - minX) / 2;
+ if (newX < maxX && maxX - minX < 0)
+ newX = maxX + (newX - maxX) / 2;
+ if (q->overShoot() || (newX <= minX && newX >= maxX)) {
if (dragMode == QFxFlickable::Hard)
_moveX.setValue(newX);
else
diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h
index 2c858bc..da38df8 100644
--- a/src/declarative/fx/qfxflickable.h
+++ b/src/declarative/fx/qfxflickable.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxFlickablePrivate;
class Q_DECLARATIVE_EXPORT QFxFlickable : public QFxItem
{
@@ -186,10 +186,11 @@ private:
Q_DISABLE_COPY(QFxFlickable)
Q_DECLARE_PRIVATE(QFxFlickable)
};
-QML_DECLARE_TYPE(QFxFlickable)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxFlickable)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
index 9595724..7672858 100644
--- a/src/declarative/fx/qfxflipable.cpp
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -44,6 +44,8 @@
#include "qfxtransform.h"
#include <QtDeclarative/qmlinfo.h>
+QT_BEGIN_NAMESPACE
+
QML_DEFINE_TYPE(QFxFlipable,Flipable)
class QFxFlipablePrivate : public QFxItemPrivate
diff --git a/src/declarative/fx/qfxflipable.h b/src/declarative/fx/qfxflipable.h
index 6630633..06f8b93 100644
--- a/src/declarative/fx/qfxflipable.h
+++ b/src/declarative/fx/qfxflipable.h
@@ -97,10 +97,11 @@ private:
Q_DISABLE_COPY(QFxFlipable)
Q_DECLARE_PRIVATE(QFxFlipable)
};
-QML_DECLARE_TYPE(QFxFlipable)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxFlipable)
+
QT_END_HEADER
#endif // QFXFLIPABLE_H
diff --git a/src/declarative/fx/qfxfocuspanel.h b/src/declarative/fx/qfxfocuspanel.h
index 60f9118..623c9fb 100644
--- a/src/declarative/fx/qfxfocuspanel.h
+++ b/src/declarative/fx/qfxfocuspanel.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class Q_DECLARATIVE_EXPORT QFxFocusPanel : public QFxItem
{
Q_OBJECT
@@ -72,10 +72,10 @@ private:
Q_DISABLE_COPY(QFxFocusPanel)
};
-QML_DECLARE_TYPE(QFxFocusPanel)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxFocusPanel)
+
QT_END_HEADER
#endif // QFXFOCUSPANEL_H
diff --git a/src/declarative/fx/qfxfocusrealm.h b/src/declarative/fx/qfxfocusrealm.h
index d2aadce..20fc5ad 100644
--- a/src/declarative/fx/qfxfocusrealm.h
+++ b/src/declarative/fx/qfxfocusrealm.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class Q_DECLARATIVE_EXPORT QFxFocusRealm : public QFxItem
{
Q_OBJECT
@@ -58,10 +58,10 @@ public:
virtual ~QFxFocusRealm();
};
-QML_DECLARE_TYPE(QFxFocusRealm)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxFocusRealm)
+
QT_END_HEADER
#endif // QFXFOCUSREALM_H
diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h
index 19c21c4..b6d585e 100644
--- a/src/declarative/fx/qfxgridview.h
+++ b/src/declarative/fx/qfxgridview.h
@@ -139,10 +139,10 @@ private:
void refill();
};
-QML_DECLARE_TYPE(QFxGridView)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxGridView)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/fx/qfxhighlightfilter.h b/src/declarative/fx/qfxhighlightfilter.h
index 33f0963..56509a3 100644
--- a/src/declarative/fx/qfxhighlightfilter.h
+++ b/src/declarative/fx/qfxhighlightfilter.h
@@ -45,12 +45,12 @@
#include <QtDeclarative/qsimplecanvasfilter.h>
#include <QtDeclarative/qml.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxHighlightFilterPrivate;
class Q_DECLARATIVE_EXPORT QFxHighlightFilter : public QSimpleCanvasFilter
{
@@ -89,10 +89,11 @@ protected:
private:
QFxHighlightFilterPrivate *d;
};
-QML_DECLARE_TYPE(QFxHighlightFilter)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxHighlightFilter)
+
QT_END_HEADER
#endif // QFXHIGHLIGHTFILTER_H
diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h
index 35b921a..3071a9e 100644
--- a/src/declarative/fx/qfximage.h
+++ b/src/declarative/fx/qfximage.h
@@ -120,10 +120,11 @@ private:
Q_DECLARE_PRIVATE(QFxImage)
void setGridScaledImage(const QFxGridScaledImage& sci);
};
-QML_DECLARE_TYPE(QFxImage)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxImage)
+
QT_END_HEADER
#endif // QFXIMAGE_H
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 1c35290..7ccad5f 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -133,7 +133,9 @@ QFxContents::QFxContents() : m_height(0), m_width(0)
The contents properties allow an item access to the size of its
children. This property is useful if you have an item that needs to be
- sized to fit its children.
+ sized to fit its children.
+*/
+
/*!
\property QFxContents::height
\brief The height of the contents.
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 67a4553..2b45f73 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -86,7 +86,6 @@ private:
qreal m_height;
qreal m_width;
};
-QML_DECLARE_TYPE(QFxContents)
Q_DECLARE_OPERATORS_FOR_FLAGS(QFxAnchors::UsedAnchors)
class QmlState;
@@ -266,12 +265,13 @@ private:
Q_DISABLE_COPY(QFxItem)
Q_DECLARE_PRIVATE(QFxItem)
};
-QML_DECLARE_TYPE(QFxItem)
-
-QML_DECLARE_TYPE(QSimpleCanvasFilter)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxContents)
+QML_DECLARE_TYPE(QFxItem)
+QML_DECLARE_TYPE(QSimpleCanvasFilter)
+
QT_END_HEADER
#endif // QFXITEM_H
diff --git a/src/declarative/fx/qfxkeyactions.h b/src/declarative/fx/qfxkeyactions.h
index cea992a..91c2806 100644
--- a/src/declarative/fx/qfxkeyactions.h
+++ b/src/declarative/fx/qfxkeyactions.h
@@ -47,12 +47,12 @@
#include <QtDeclarative/qml.h>
#include <QtDeclarative/qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxKeyActionsPrivate;
class Q_DECLARATIVE_EXPORT QFxKeyActions : public QFxItem
{
@@ -310,10 +310,10 @@ private:
QFxKeyActionsPrivate *d;
};
-QML_DECLARE_TYPE(QFxKeyActions)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxKeyActions)
+
QT_END_HEADER
#endif // QFXKEYACTIONS_H
diff --git a/src/declarative/fx/qfxkeyproxy.h b/src/declarative/fx/qfxkeyproxy.h
index 38cff7a..d075295 100644
--- a/src/declarative/fx/qfxkeyproxy.h
+++ b/src/declarative/fx/qfxkeyproxy.h
@@ -49,6 +49,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxKeyProxyPrivate;
class Q_DECLARATIVE_EXPORT QFxKeyProxy : public QFxItem
{
@@ -69,10 +70,10 @@ private:
QFxKeyProxyPrivate *d;
};
-QML_DECLARE_TYPE(QFxKeyProxy)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxKeyProxy)
+
QT_END_HEADER
#endif // QFXKEYPROXY_H
diff --git a/src/declarative/fx/qfxlayouts.h b/src/declarative/fx/qfxlayouts.h
index b119d6f..112fe85 100644
--- a/src/declarative/fx/qfxlayouts.h
+++ b/src/declarative/fx/qfxlayouts.h
@@ -128,7 +128,6 @@ protected Q_SLOTS:
private:
Q_DISABLE_COPY(QFxVerticalLayout)
};
-QML_DECLARE_TYPE(QFxVerticalLayout)
class Q_DECLARATIVE_EXPORT QFxHorizontalLayout: public QFxBaseLayout
{
@@ -140,7 +139,6 @@ protected Q_SLOTS:
private:
Q_DISABLE_COPY(QFxHorizontalLayout)
};
-QML_DECLARE_TYPE(QFxHorizontalLayout)
class Q_DECLARATIVE_EXPORT QFxGridLayout : public QFxBaseLayout
{
@@ -163,9 +161,13 @@ private:
int _columns;
Q_DISABLE_COPY(QFxGridLayout)
};
-QML_DECLARE_TYPE(QFxGridLayout)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxVerticalLayout)
+QML_DECLARE_TYPE(QFxHorizontalLayout)
+QML_DECLARE_TYPE(QFxGridLayout)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h
index 5dfb0e4..6e9451e 100644
--- a/src/declarative/fx/qfxlistview.h
+++ b/src/declarative/fx/qfxlistview.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfxflickable.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxVisualItemModel;
class QFxListViewPrivate;
class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable
@@ -145,10 +145,10 @@ private Q_SLOTS:
void destroyingItem(QFxItem *item);
};
-QML_DECLARE_TYPE(QFxListView)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxListView)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h
index d7db1dc..429ad00 100644
--- a/src/declarative/fx/qfxmouseregion.h
+++ b/src/declarative/fx/qfxmouseregion.h
@@ -86,7 +86,6 @@ private:
int _ymax;
Q_DISABLE_COPY(QFxDrag)
};
-QML_DECLARE_TYPE(QFxDrag)
class QFxMouseEvent;
class QFxMouseRegionPrivate;
@@ -154,10 +153,12 @@ private:
Q_DISABLE_COPY(QFxMouseRegion)
Q_DECLARE_PRIVATE(QFxMouseRegion)
};
-QML_DECLARE_TYPE(QFxMouseRegion)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxDrag)
+QML_DECLARE_TYPE(QFxMouseRegion)
+
QT_END_HEADER
#endif // QFXMOUSEREGION_H
diff --git a/src/declarative/fx/qfxpainteditem.h b/src/declarative/fx/qfxpainteditem.h
index 6cb8fe7..7a0a9a9 100644
--- a/src/declarative/fx/qfxpainteditem.h
+++ b/src/declarative/fx/qfxpainteditem.h
@@ -101,10 +101,11 @@ private:
Q_DISABLE_COPY(QFxPaintedItem)
Q_DECLARE_PRIVATE(QFxPaintedItem)
};
-QML_DECLARE_TYPE(QFxPaintedItem)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxPaintedItem)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/qfxpath.h b/src/declarative/fx/qfxpath.h
index 39b9d01..04d24c6 100644
--- a/src/declarative/fx/qfxpath.h
+++ b/src/declarative/fx/qfxpath.h
@@ -61,7 +61,6 @@ public:
Q_SIGNALS:
void changed();
};
-QML_DECLARE_TYPE(QFxPathElement)
class Q_DECLARATIVE_EXPORT QFxPathAttribute : public QFxPathElement
{
@@ -83,7 +82,6 @@ private:
QString _name;
qreal _value;
};
-QML_DECLARE_TYPE(QFxPathAttribute)
class Q_DECLARATIVE_EXPORT QFxCurve : public QFxPathElement
{
@@ -106,7 +104,6 @@ private:
qreal _x;
qreal _y;
};
-QML_DECLARE_TYPE(QFxCurve)
class Q_DECLARATIVE_EXPORT QFxPathLine : public QFxCurve
{
@@ -116,7 +113,6 @@ public:
void addToPath(QPainterPath &path);
};
-QML_DECLARE_TYPE(QFxPathLine)
class Q_DECLARATIVE_EXPORT QFxPathQuad : public QFxCurve
{
@@ -139,7 +135,6 @@ private:
qreal _controlX;
qreal _controlY;
};
-QML_DECLARE_TYPE(QFxPathQuad)
class Q_DECLARATIVE_EXPORT QFxPathCubic : public QFxCurve
{
@@ -172,7 +167,6 @@ private:
int _control2X;
int _control2Y;
};
-QML_DECLARE_TYPE(QFxPathCubic)
class Q_DECLARATIVE_EXPORT QFxPathPercent : public QFxPathElement
{
@@ -187,7 +181,6 @@ public:
private:
qreal _value;
};
-QML_DECLARE_TYPE(QFxPathPercent)
class QFxPathPrivate;
class Q_DECLARATIVE_EXPORT QFxPath : public QObject, public QmlParserStatus
@@ -249,9 +242,18 @@ private:
Q_DISABLE_COPY(QFxPath)
Q_DECLARE_PRIVATE(QFxPath)
};
-QML_DECLARE_TYPE(QFxPath)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxPathElement)
+QML_DECLARE_TYPE(QFxPathAttribute)
+QML_DECLARE_TYPE(QFxCurve)
+QML_DECLARE_TYPE(QFxPathLine)
+QML_DECLARE_TYPE(QFxPathQuad)
+QML_DECLARE_TYPE(QFxPathCubic)
+QML_DECLARE_TYPE(QFxPathPercent)
+QML_DECLARE_TYPE(QFxPath)
+
QT_END_HEADER
+
#endif // QFXPATH_H
diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h
index cbdafa8..159c865 100644
--- a/src/declarative/fx/qfxpathview.h
+++ b/src/declarative/fx/qfxpathview.h
@@ -127,10 +127,11 @@ private:
Q_DISABLE_COPY(QFxPathView)
Q_DECLARE_PRIVATE(QFxPathView)
};
-QML_DECLARE_TYPE(QFxPathView)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxPathView)
+
QT_END_HEADER
#endif // QFXPATHVIEW_H
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index 0536f12..b521d00 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -617,7 +617,7 @@ void QFxRect::drawRect(QPainter &p)
if (d->gradient && d->gradient->gradient() /*|| p.usingQt() */) {
// XXX This path is still slower than the image path
// Image path won't work for gradients though
- QPainter::RenderHints oldHints = p.renderHints();
+ bool oldAA = p.testRenderHint(QPainter::Antialiasing);
p.setRenderHint(QPainter::Antialiasing);
if (d->pen && d->pen->isValid()) {
QPen pn(QColor(d->pen->color()), d->pen->width());
@@ -630,7 +630,7 @@ void QFxRect::drawRect(QPainter &p)
p.drawRoundedRect(0, 0, width(), height(), d->radius, d->radius);
else
p.drawRect(0, 0, width(), height());
- p.setRenderHints(oldHints);
+ p.setRenderHint(QPainter::Antialiasing, oldAA);
} else {
int offset = 0;
const int pw = d->pen && d->pen->isValid() ? (d->pen->width()+1)/2*2 : 0;
diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h
index df490b0..2b35d8d 100644
--- a/src/declarative/fx/qfxrect.h
+++ b/src/declarative/fx/qfxrect.h
@@ -77,7 +77,6 @@ private:
QColor _color;
bool _valid;
};
-QML_DECLARE_TYPE(QFxPen)
class Q_DECLARATIVE_EXPORT QFxGradientStop : public QObject
{
@@ -102,7 +101,6 @@ private:
qreal m_position;
QColor m_color;
};
-QML_DECLARE_TYPE(QFxGradientStop)
class Q_DECLARATIVE_EXPORT QFxGradient : public QObject
{
@@ -130,7 +128,6 @@ private:
mutable QGradient *m_gradient;
friend class QFxGradientStop;
};
-QML_DECLARE_TYPE(QFxGradient)
class QFxRectPrivate;
class Q_DECLARATIVE_EXPORT QFxRect : public QFxItem
@@ -184,10 +181,14 @@ private:
Q_DISABLE_COPY(QFxRect)
Q_DECLARE_PRIVATE(QFxRect)
};
-QML_DECLARE_TYPE(QFxRect)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxPen)
+QML_DECLARE_TYPE(QFxGradientStop)
+QML_DECLARE_TYPE(QFxGradient)
+QML_DECLARE_TYPE(QFxRect)
+
QT_END_HEADER
#endif // QFXRECT_H
diff --git a/src/declarative/fx/qfxreflectionfilter.h b/src/declarative/fx/qfxreflectionfilter.h
index 6e56b5e..d862040 100644
--- a/src/declarative/fx/qfxreflectionfilter.h
+++ b/src/declarative/fx/qfxreflectionfilter.h
@@ -87,10 +87,11 @@ private:
Q_DISABLE_COPY(QFxReflectionFilter)
QFxReflectionFilterPrivate *d;
};
-QML_DECLARE_TYPE(QFxReflectionFilter)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxReflectionFilter)
+
QT_END_HEADER
#endif // QFXREFLECTIONFILTER_H
diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h
index c1b194a..b82b9b0 100644
--- a/src/declarative/fx/qfxrepeater.h
+++ b/src/declarative/fx/qfxrepeater.h
@@ -44,12 +44,12 @@
#include <QtDeclarative/qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxRepeaterPrivate;
class Q_DECLARATIVE_EXPORT QFxRepeater : public QFxItem
{
@@ -80,10 +80,11 @@ private:
Q_DISABLE_COPY(QFxRepeater)
Q_DECLARE_PRIVATE(QFxRepeater)
};
-QML_DECLARE_TYPE(QFxRepeater)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxRepeater)
+
QT_END_HEADER
-#endif // _QFXREPEATER_H_
+#endif // QFXREPEATER_H
diff --git a/src/declarative/fx/qfxscalegrid.h b/src/declarative/fx/qfxscalegrid.h
index c59cb32..03b2dd3 100644
--- a/src/declarative/fx/qfxscalegrid.h
+++ b/src/declarative/fx/qfxscalegrid.h
@@ -110,10 +110,11 @@ private:
int _b;
QString _pix;
};
-QML_DECLARE_TYPE(QFxScaleGrid)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxScaleGrid)
+
QT_END_HEADER
+
#endif // QFXSCALEGRID_H
diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp
index 10c332c..d37d565 100644
--- a/src/declarative/fx/qfxshadowfilter.cpp
+++ b/src/declarative/fx/qfxshadowfilter.cpp
@@ -47,9 +47,9 @@
#include <glbasicshaders.h>
#endif
-class QFxShadowFilterPrivate
-
QT_BEGIN_NAMESPACE
+
+class QFxShadowFilterPrivate
{
public:
QFxShadowFilterPrivate()
diff --git a/src/declarative/fx/qfxshadowfilter.h b/src/declarative/fx/qfxshadowfilter.h
index 67d165a..1cbe54f 100644
--- a/src/declarative/fx/qfxshadowfilter.h
+++ b/src/declarative/fx/qfxshadowfilter.h
@@ -77,10 +77,11 @@ protected:
private:
QFxShadowFilterPrivate *d;
};
-QML_DECLARE_TYPE(QFxShadowFilter)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxShadowFilter)
+
QT_END_HEADER
-#endif // _QFXSHADOWFILTER_H_
+
+#endif // QFXSHADOWFILTER_H
diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h
index b929a6f..1f5a7b8 100644
--- a/src/declarative/fx/qfxtext.h
+++ b/src/declarative/fx/qfxtext.h
@@ -143,10 +143,11 @@ private:
Q_DISABLE_COPY(QFxText)
Q_DECLARE_PRIVATE(QFxText)
};
-QML_DECLARE_TYPE(QFxText)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxText)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h
index b761a1b..24ba3fe 100644
--- a/src/declarative/fx/qfxtextedit.h
+++ b/src/declarative/fx/qfxtextedit.h
@@ -202,10 +202,11 @@ private:
Q_DISABLE_COPY(QFxTextEdit)
Q_DECLARE_PRIVATE(QFxTextEdit)
};
-QML_DECLARE_TYPE(QFxTextEdit)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxTextEdit)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp
index a4c5d22..0f0ce80 100644
--- a/src/declarative/fx/qfxtransform.cpp
+++ b/src/declarative/fx/qfxtransform.cpp
@@ -46,11 +46,11 @@
#include <math.h>
#ifndef M_PI
-
-QT_BEGIN_NAMESPACE
#define M_PI 3.14159265358979323846
#endif
+QT_BEGIN_NAMESPACE
+
QML_DEFINE_NOCREATE_TYPE(QFxTransform);
/*!
@@ -84,6 +84,139 @@ void QFxTransform::update()
}
/*!
+ \qmlclass Scale
+ \brief A Scale object provides a way to scale an Item.
+
+ The scale object gives more control over scaling than using Item's scale property. Specifically,
+ it allows a different scale for the x and y axes, and allows the scale to be relative to an
+ arbitrary point.
+
+ The following example scales the X axis of the Rect, relative to its interior point 25, 25:
+ \qml
+ Rect {
+ width: 100; height: 100
+ color: "blue"
+ transform: Scale { originX: 25; originY: 25; xScale: 3}
+ }
+ \endqml
+*/
+
+QFxScale::QFxScale(QObject *parent)
+: QFxTransform(parent), _originX(0), _originY(0), _xScale(1), _yScale(1), _dirty(true)
+{
+}
+
+QFxScale::~QFxScale()
+{
+}
+
+/*!
+ \qmlproperty real Scale::originX
+ \qmlproperty real Scale::originY
+
+ The origin point for the scale. The scale will be relative to this point.
+*/
+qreal QFxScale::originX() const
+{
+ return _originX;
+}
+
+void QFxScale::setOriginX(qreal ox)
+{
+ _originX = ox;
+ update();
+}
+
+qreal QFxScale::originY() const
+{
+ return _originY;
+}
+
+void QFxScale::setOriginY(qreal oy)
+{
+ _originY = oy;
+ update();
+}
+
+/*!
+ \qmlproperty real Scale::xScale
+
+ The scaling factor for the X axis.
+*/
+qreal QFxScale::xScale() const
+{
+ return _xScale;
+}
+
+void QFxScale::setXScale(qreal scale)
+{
+ if (_xScale == scale)
+ return;
+ _xScale = scale;
+ update();
+ emit scaleChanged();
+}
+
+/*!
+ \qmlproperty real Scale::yScale
+
+ The scaling factor for the Y axis.
+*/
+qreal QFxScale::yScale() const
+{
+ return _yScale;
+}
+
+void QFxScale::setYScale(qreal scale)
+{
+ if (_yScale == scale)
+ return;
+ _yScale = scale;
+ update();
+ emit scaleChanged();
+}
+
+bool QFxScale::isIdentity() const
+{
+ return (_xScale == 1. && _yScale == 1.);
+}
+
+#if defined(QFX_RENDER_QPAINTER)
+QTransform QFxScale::transform() const
+{
+ if (_dirty) {
+ _transform = QTransform();
+ _dirty = false;
+ _transform.translate(_originX, _originY);
+ _transform.scale(_xScale, _yScale);
+ _transform.translate(-_originX, -_originY);
+ }
+ return _transform;
+}
+#elif defined(QFX_RENDER_OPENGL)
+QMatrix4x4 QFxScale::transform() const
+{
+ if (_dirty) {
+ _transform = QMatrix4x4();
+ _dirty = false;
+ _transform.translate(_originX, _originY);
+ _transform.scale(_xScale, _yScale);
+ _transform.translate(-_originX, -_originY);
+ }
+ return _transform;
+}
+#endif
+
+void QFxScale::update()
+{
+ _dirty = true;
+ QFxTransform::update();
+}
+
+QML_DEFINE_TYPE(QFxScale, Scale)
+
+
+/*!
\qmlclass Axis
\brief A Axis object defines an axis that can be used for rotation or translation.
diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h
index 7be8adc..e0bd276 100644
--- a/src/declarative/fx/qfxtransform.h
+++ b/src/declarative/fx/qfxtransform.h
@@ -67,7 +67,48 @@ public:
virtual bool isIdentity() const;
virtual QSimpleCanvas::Matrix transform() const;
};
-QML_DECLARE_TYPE(QFxTransform)
+
+class Q_DECLARATIVE_EXPORT QFxScale : public QFxTransform
+{
+ Q_OBJECT
+
+ Q_PROPERTY(qreal originX READ originX WRITE setOriginX)
+ Q_PROPERTY(qreal originY READ originY WRITE setOriginY)
+ Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY scaleChanged())
+ Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY scaleChanged())
+public:
+ QFxScale(QObject *parent=0);
+ ~QFxScale();
+
+ qreal originX() const;
+ void setOriginX(qreal);
+
+ qreal originY() const;
+ void setOriginY(qreal);
+
+ qreal xScale() const;
+ void setXScale(qreal);
+
+ qreal yScale() const;
+ void setYScale(qreal);
+
+ virtual bool isIdentity() const;
+ virtual QSimpleCanvas::Matrix transform() const;
+
+Q_SIGNALS:
+ void scaleChanged();
+
+private Q_SLOTS:
+ void update();
+private:
+ qreal _originX;
+ qreal _originY;
+ qreal _xScale;
+ qreal _yScale;
+
+ mutable bool _dirty;
+ mutable QSimpleCanvas::Matrix _transform;
+};
class Q_DECLARATIVE_EXPORT QFxAxis : public QObject
{
@@ -107,7 +148,6 @@ private:
qreal _endY;
qreal _endZ;
};
-QML_DECLARE_TYPE(QFxAxis)
class Q_DECLARATIVE_EXPORT QFxRotation : public QFxTransform
{
@@ -145,7 +185,6 @@ private:
mutable bool _dirty;
mutable QSimpleCanvas::Matrix _transform;
};
-QML_DECLARE_TYPE(QFxRotation)
class Q_DECLARATIVE_EXPORT QFxRotation3D : public QFxTransform
{
@@ -174,7 +213,6 @@ private:
mutable bool _dirty;
mutable QSimpleCanvas::Matrix _transform;
};
-QML_DECLARE_TYPE(QFxRotation3D)
class Q_DECLARATIVE_EXPORT QFxTranslation3D : public QFxTransform
{
@@ -203,7 +241,6 @@ private:
mutable bool _dirty;
mutable QSimpleCanvas::Matrix _transform;
};
-QML_DECLARE_TYPE(QFxTranslation3D)
class Q_DECLARATIVE_EXPORT QFxPerspective : public QFxTransform
{
@@ -244,7 +281,6 @@ private:
qreal _angle;
qreal _aspect;
};
-QML_DECLARE_TYPE(QFxPerspective)
class Q_DECLARATIVE_EXPORT QFxSquish : public QFxTransform
{
@@ -310,10 +346,18 @@ private:
QSizeF s;
QPointF p1, p2, p3, p4;
};
-QML_DECLARE_TYPE(QFxSquish)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxTransform)
+QML_DECLARE_TYPE(QFxScale)
+QML_DECLARE_TYPE(QFxAxis)
+QML_DECLARE_TYPE(QFxRotation)
+QML_DECLARE_TYPE(QFxRotation3D)
+QML_DECLARE_TYPE(QFxTranslation3D)
+QML_DECLARE_TYPE(QFxPerspective)
+QML_DECLARE_TYPE(QFxSquish)
+
QT_END_HEADER
#endif // QFXTRANSFORM_H
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index c60a379..d3ab4cc 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -52,9 +52,9 @@
#include "qmllistaccessor.h"
#include "qfxvisualitemmodel.h"
+QML_DECLARE_TYPE(QListModelInterface)
QT_BEGIN_NAMESPACE
-QML_DECLARE_TYPE(QListModelInterface)
class QFxVisualItemModelParts;
class QFxVisualItemModelData;
diff --git a/src/declarative/fx/qfxvisualitemmodel.h b/src/declarative/fx/qfxvisualitemmodel.h
index 968cc2e..9cacde4 100644
--- a/src/declarative/fx/qfxvisualitemmodel.h
+++ b/src/declarative/fx/qfxvisualitemmodel.h
@@ -123,10 +123,11 @@ private Q_SLOTS:
private:
Q_DISABLE_COPY(QFxVisualItemModel)
};
-QML_DECLARE_TYPE(QFxVisualItemModel)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxVisualItemModel)
+
QT_END_HEADER
#endif // QFXVISUALITEMMODEL_H
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index f4a06ce..3ab64bc 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -1010,6 +1010,6 @@ QObject *QFxWebPage::createPlugin(const QString &, const QUrl &url, const QStrin
return new QWidget_Dummy_Plugin(comp,view(),paramNames,paramValues);
}
-#include "qfxwebview.moc"
-
QT_END_NAMESPACE
+
+#include "qfxwebview.moc"
diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h
index 0ac1895..f5fd721 100644
--- a/src/declarative/fx/qfxwebview.h
+++ b/src/declarative/fx/qfxwebview.h
@@ -49,14 +49,14 @@
#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtWebKit/QWebPage>
-
QT_BEGIN_HEADER
+class QWebHistory;
+class QWebSettings;
+
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QWebHistory;
-class QWebSettings;
class QFxWebViewPrivate;
class QNetworkRequest;
class QFxWebView;
@@ -206,10 +206,11 @@ private:
Q_DISABLE_COPY(QFxWebView)
Q_DECLARE_PRIVATE(QFxWebView)
};
-QML_DECLARE_TYPE(QFxWebView)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxWebView)
+
QT_END_HEADER
+
#endif
diff --git a/src/declarative/fx/qfxwidgetcontainer.h b/src/declarative/fx/qfxwidgetcontainer.h
index cc36010..862a280 100644
--- a/src/declarative/fx/qfxwidgetcontainer.h
+++ b/src/declarative/fx/qfxwidgetcontainer.h
@@ -72,10 +72,11 @@ protected:
private:
QGraphicsWidget *_graphicsWidget;
};
-QML_DECLARE_TYPE(QFxWidgetContainer)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QFxWidgetContainer)
+
QT_END_HEADER
#endif // QFXGRAPHICSWIDGET_H
diff --git a/src/declarative/opengl/glbasicshaders.h b/src/declarative/opengl/glbasicshaders.h
index 7d358d8..877f0fc 100644
--- a/src/declarative/opengl/glbasicshaders.h
+++ b/src/declarative/opengl/glbasicshaders.h
@@ -236,9 +236,8 @@ private:
GLBasicShadersPrivate *d;
};
-#endif // _GLBASICSHADERS_H_
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // _GLBASICSHADERS_H_
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 51ca612..1990b7f 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -54,8 +54,6 @@
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE
-
QT_MODULE(Declarative)
#define QML_DECLARE_TYPE(TYPE) \
@@ -73,6 +71,8 @@ QT_MODULE(Declarative)
#define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE) \
QML_DECLARE_TYPE_HASMETATYPE(INTERFACE)
+QT_BEGIN_NAMESPACE
+
#define QML_DEFINE_INTERFACE(INTERFACE) \
template<> QmlPrivate::InstanceType QmlPrivate::Define<INTERFACE *>::instance(qmlRegisterInterface<INTERFACE>(#INTERFACE));
@@ -110,11 +110,11 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj)
return qmlAttachedPropertiesObjectById(idx, obj);
}
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(QObject)
Q_DECLARE_METATYPE(QVariant)
-QT_END_NAMESPACE
-
QT_END_HEADER
#endif // QML_H
diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp
index 222ea87..f447d4f 100644
--- a/src/declarative/qml/qmlbindablevalue.cpp
+++ b/src/declarative/qml/qmlbindablevalue.cpp
@@ -48,6 +48,8 @@
#include <qfxperf.h>
#include <QtCore/qdebug.h>
+Q_DECLARE_METATYPE(QList<QObject *>);
+
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(scriptWarnings, QML_SCRIPT_WARNINGS);
@@ -114,7 +116,6 @@ void QmlBindableValue::forceUpdate()
update();
}
-Q_DECLARE_METATYPE(QList<QObject *>);
void QmlBindableValue::update()
{
Q_D(QmlBindableValue);
diff --git a/src/declarative/qml/qmlbindablevalue.h b/src/declarative/qml/qmlbindablevalue.h
index 00da57e..12da9f6 100644
--- a/src/declarative/qml/qmlbindablevalue.h
+++ b/src/declarative/qml/qmlbindablevalue.h
@@ -88,10 +88,11 @@ protected:
private:
Q_DECLARE_PRIVATE(QmlBindableValue)
};
-QML_DECLARE_TYPE(QmlBindableValue)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlBindableValue)
+
QT_END_HEADER
#endif // QMLBINDABLEVALUE_H
diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp
index 5815dc6..9779e46 100644
--- a/src/declarative/qml/qmlboundsignal.cpp
+++ b/src/declarative/qml/qmlboundsignal.cpp
@@ -47,6 +47,7 @@
#include <qmlmetatype.h>
#include <qml.h>
#include <qmlcontext.h>
+#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -88,7 +89,6 @@ int QmlBoundSignalProxy::qt_metacall(QMetaObject::Call c, int id, void **a)
}
}
-#include <QDebug>
QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
QObject *parent)
: QObject(parent), types(0), values(0)
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index cb0c571..c2b2fb4 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -633,7 +633,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
if (isCustomParser) {
// Custom parser types don't support signal properties
if (testProperty(prop, obj)) {
- if (deferred.contains(prop->name))
+ if (deferred.contains(QString::fromLatin1(prop->name.constData())))
deferredProps << prop;
else
COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
@@ -644,7 +644,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
if (isSignalPropertyName(prop->name)) {
COMPILE_CHECK(compileSignal(prop,obj));
} else {
- if (deferred.contains(prop->name))
+ if (deferred.contains(QString::fromLatin1(prop->name.constData())))
deferredProps << prop;
else
COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
@@ -660,7 +660,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
if (isCustomParser) {
if (testProperty(prop, obj)) {
QMetaProperty p = deferred.isEmpty()?QMetaProperty():QmlMetaType::defaultProperty(obj->metaObject());
- if (deferred.contains(p.name()))
+ if (deferred.contains(QString::fromLatin1(p.name())))
deferredProps << prop;
else
COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
@@ -669,7 +669,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt)
}
} else {
QMetaProperty p = deferred.isEmpty()?QMetaProperty():QmlMetaType::defaultProperty(obj->metaObject());
- if (deferred.contains(p.name()))
+ if (deferred.contains(QString::fromLatin1(p.name())))
deferredProps << prop;
else
COMPILE_CHECK(compileProperty(prop, obj, objCtxt));
@@ -1683,7 +1683,7 @@ QStringList QmlCompiler::deferredProperties(QmlParser::Object *obj)
return QStringList();
QMetaClassInfo classInfo = mo->classInfo(idx);
- QStringList rv = QString(QLatin1String(classInfo.value())).split(',');
+ QStringList rv = QString(QLatin1String(classInfo.value())).split(QLatin1Char(','));
return rv;
}
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index 2c722b9..819c4ad 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -61,9 +61,8 @@
#include <private/qmlcompositetypemanager_p.h>
#include <private/qmlparser_p.h>
-class QStringList;
-
QT_BEGIN_NAMESPACE
+
class QmlEngine;
class QmlComponent;
class QmlCompiledComponent;
diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h
index 2e80b6b..db34e16 100644
--- a/src/declarative/qml/qmlcomponent.h
+++ b/src/declarative/qml/qmlcomponent.h
@@ -105,11 +105,12 @@ private:
friend class QmlVME;
friend struct QmlCompositeTypeData;
};
-Q_DECLARE_METATYPE(QmlComponent::Status)
-QML_DECLARE_TYPE(QmlComponent)
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QmlComponent::Status)
+QML_DECLARE_TYPE(QmlComponent)
+
QT_END_HEADER
#endif // QMLCOMPONENT_H
diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp
index c90ab47..b543978 100644
--- a/src/declarative/qml/qmlcustomparser.cpp
+++ b/src/declarative/qml/qmlcustomparser.cpp
@@ -43,6 +43,8 @@
#include "qmlcustomparser_p_p.h"
#include "qmlparser_p.h"
+#include <QtCore/qdebug.h>
+
QT_BEGIN_NAMESPACE
using namespace QmlParser;
@@ -120,7 +122,6 @@ QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root)
return rootNode;
}
-#include <QtCore/qdebug.h>
QmlCustomParserProperty
QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p)
{
diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h
index 67f39d9..914ddbd 100644
--- a/src/declarative/qml/qmlcustomparser_p.h
+++ b/src/declarative/qml/qmlcustomparser_p.h
@@ -85,7 +85,6 @@ private:
friend class QmlCustomParserPropertyPrivate;
QmlCustomParserPropertyPrivate *d;
};
-Q_DECLARE_METATYPE(QmlCustomParserProperty)
class QmlCustomParserNodePrivate;
class Q_DECLARATIVE_EXPORT QmlCustomParserNode
@@ -104,7 +103,6 @@ private:
friend class QmlCustomParserNodePrivate;
QmlCustomParserNodePrivate *d;
};
-Q_DECLARE_METATYPE(QmlCustomParserNode)
class Q_DECLARATIVE_EXPORT QmlCustomParser
{
@@ -119,6 +117,9 @@ public:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QmlCustomParserProperty)
+Q_DECLARE_METATYPE(QmlCustomParserNode)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/qml/qmldom_p.h b/src/declarative/qml/qmldom_p.h
index 49e117a..5345c44 100644
--- a/src/declarative/qml/qmldom_p.h
+++ b/src/declarative/qml/qmldom_p.h
@@ -54,15 +54,10 @@
//
#include <QtCore/QtGlobal>
-
-QT_BEGIN_HEADER
+#include "qmlparser_p.h"
QT_BEGIN_NAMESPACE
-QT_MODULE(Declarative)
-
-#include "qmlparser_p.h"
-
class QmlDomDocumentPrivate : public QSharedData
{
public:
@@ -136,7 +131,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMLDOM_P_H
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 8c926b7..294e333 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -73,12 +73,13 @@
#include <private/qmlbindablevalue_p.h>
#include <private/qmlvme_p.h>
+Q_DECLARE_METATYPE(QmlMetaProperty)
+Q_DECLARE_METATYPE(QList<QObject *>);
+
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlDebugger, QML_DEBUGGER)
-Q_DECLARE_METATYPE(QmlMetaProperty)
-
QML_DEFINE_TYPE(QObject,Object)
static QScriptValue qmlMetaProperty_emit(QScriptContext *ctx, QScriptEngine *engine)
@@ -1077,8 +1078,6 @@ void QmlExpression::valueChanged()
{
}
-Q_DECLARE_METATYPE(QList<QObject *>);
-
void BindExpressionProxy::changed()
{
e->valueChanged();
@@ -1552,7 +1551,7 @@ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine)
{
engine = bindEngine;
prototypeObject = engine->scriptEngine()->newObject();
- prototypeObject.setProperty("destroy",
+ prototypeObject.setProperty(QLatin1String("destroy"),
engine->scriptEngine()->newFunction(QmlObjectDestroy));
}
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 218fdf8..448671e 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -50,6 +50,8 @@
#include <math.h>
#include <QtCore/qdebug.h>
+Q_DECLARE_METATYPE(QList<QObject *>);
+
QT_BEGIN_NAMESPACE
class QMetaPropertyEx : public QMetaProperty
@@ -651,8 +653,6 @@ QVariant QmlMetaProperty::read() const
return QVariant();
}
-Q_DECLARE_METATYPE(QList<QObject *>);
-
void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
{
QString expr = value.toString();
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
index 3bd9089..69fd5c3 100644
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ b/src/declarative/qml/qmlmetaproperty_p.h
@@ -55,6 +55,8 @@
#include "qmlmetaproperty.h"
+QT_BEGIN_NAMESPACE
+
class QmlContext;
class QmlMetaPropertyPrivate
{
@@ -89,4 +91,6 @@ public:
void writeValueProperty(const QVariant &);
};
+QT_END_NAMESPACE
+
#endif // QMLMETAPROPERTY_P_H
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index f69e5e5..b15f711 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -59,8 +59,6 @@
#include <QtCore/qcryptographichash.h>
#include <private/qmlcustomparser_p.h>
-QT_BEGIN_NAMESPACE
-
#ifdef QT_BOOTSTRAPPED
# ifndef QT_NO_GEOM_VARIANT
# define QT_NO_GEOM_VARIANT
@@ -79,6 +77,8 @@ QT_BEGIN_NAMESPACE
#endif
#define NS(x) QT_PREPEND_NAMESPACE(x)
+QT_BEGIN_NAMESPACE
+
struct QmlMetaTypeData
{
QList<QmlType *> types;
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index d9b6503..3aab066 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -296,10 +296,11 @@ namespace QmlParser
void dump(int = 0) const;
};
}
-Q_DECLARE_METATYPE(QmlParser::Variant)
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QmlParser::Variant)
+
QT_END_HEADER
#endif // QMLPARSER_P_H
diff --git a/src/declarative/qml/qmlpropertyvaluesource.h b/src/declarative/qml/qmlpropertyvaluesource.h
index c142095..4e5f1c5 100644
--- a/src/declarative/qml/qmlpropertyvaluesource.h
+++ b/src/declarative/qml/qmlpropertyvaluesource.h
@@ -69,10 +69,11 @@ protected:
private:
Q_DISABLE_COPY(QmlPropertyValueSource)
};
-QML_DECLARE_TYPE(QmlPropertyValueSource)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlPropertyValueSource)
+
QT_END_HEADER
#endif // QMLPROPERTYVALUESOURCE_H
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp
index 5568bab..0baea31 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qmlproxymetaobject.cpp
@@ -41,6 +41,8 @@
#include "qmlproxymetaobject_p.h"
+#include <QDebug>
+
QT_BEGIN_NAMESPACE
QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
@@ -78,7 +80,6 @@ QmlProxyMetaObject::~QmlProxyMetaObject()
proxies = 0;
}
-#include <QDebug>
int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
if ((c == QMetaObject::ReadProperty ||
diff --git a/src/declarative/test/qfxtestengine.h b/src/declarative/test/qfxtestengine.h
index 44a140f..bce8eec 100644
--- a/src/declarative/test/qfxtestengine.h
+++ b/src/declarative/test/qfxtestengine.h
@@ -77,9 +77,9 @@ private:
QFxTestEnginePrivate *d;
};
-#endif // _QFXTESTENGINE_H_
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // _QFXTESTENGINE_H_
diff --git a/src/declarative/test/qfxtestobjects.cpp b/src/declarative/test/qfxtestobjects.cpp
index 12fc7fb..5035b28 100644
--- a/src/declarative/test/qfxtestobjects.cpp
+++ b/src/declarative/test/qfxtestobjects.cpp
@@ -45,19 +45,19 @@
#include <QDebug>
#include <QTextStream>
+QML_DECLARE_TYPE(TestObject)
+QML_DECLARE_TYPE(TestFrame)
+QML_DECLARE_TYPE(TestFullFrame)
+QML_DECLARE_TYPE(TestMouse)
+QML_DECLARE_TYPE(TestKey)
+QML_DECLARE_TYPE(TestLog)
QT_BEGIN_NAMESPACE
-QML_DECLARE_TYPE(TestObject)
QML_DEFINE_TYPE(TestObject,TestObject)
-QML_DECLARE_TYPE(TestFrame)
QML_DEFINE_TYPE(TestFrame,TestFrame)
-QML_DECLARE_TYPE(TestFullFrame)
QML_DEFINE_TYPE(TestFullFrame,TestFullFrame)
-QML_DECLARE_TYPE(TestMouse)
QML_DEFINE_TYPE(TestMouse,TestMouse)
-QML_DECLARE_TYPE(TestKey)
QML_DEFINE_TYPE(TestKey,TestKey)
-QML_DECLARE_TYPE(TestLog)
QML_DEFINE_TYPE(TestLog,TestLog)
static QString padding(int pad)
diff --git a/src/declarative/test/qfxtestobjects.h b/src/declarative/test/qfxtestobjects.h
index 80fcfe7..c8686ad 100644
--- a/src/declarative/test/qfxtestobjects.h
+++ b/src/declarative/test/qfxtestobjects.h
@@ -204,9 +204,8 @@ private:
QList<TestObject *> _actions;
};
-#endif // _QFXTESTOBJECTS_H_
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // _QFXTESTOBJECTS_H_
diff --git a/src/declarative/test/qfxtestview.h b/src/declarative/test/qfxtestview.h
index a8f78bf..353494d 100644
--- a/src/declarative/test/qfxtestview.h
+++ b/src/declarative/test/qfxtestview.h
@@ -66,9 +66,8 @@ private:
QFxTestEngine *testEngine;
};
-#endif // _QFXTESTVIEW_H_
-
-
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // _QFXTESTVIEW_H_
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index da26bdd..6ad47f5 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -97,13 +97,11 @@ QEasingCurve stringToCurve(const QString &curve)
if (normalizedCurve.startsWith(QLatin1String("ease")))
normalizedCurve = normalizedCurve.mid(4);
- //XXX optimize?
- int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type");
- QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index);
+ static int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type");
+ static QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index);
int value = me.keyToValue(normalizedCurve.toLatin1().constData());
if (value < 0) {
- //XXX print line number
qWarning("QEasingCurve: Unknown easing curve '%s'",
curve.toLatin1().constData());
value = 0;
@@ -130,7 +128,6 @@ QEasingCurve stringToCurve(const QString &curve)
return easingCurve;
}
- //XXX optimize
if (propName == QLatin1String("amplitude")) {
easingCurve.setAmplitude(propValue);
} else if (propName == QLatin1String("period")) {
@@ -698,15 +695,6 @@ void QmlPauseAnimation::setDuration(int duration)
emit durationChanged(duration);
}
-void QmlPauseAnimation::prepare(QmlMetaProperty &p)
-{
- Q_D(QmlPauseAnimation);
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
-}
-
QAbstractAnimation *QmlPauseAnimation::qtAnimation()
{
Q_D(QmlPauseAnimation);
@@ -721,6 +709,10 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
\code
ColorAnimation { from: "white"; to: "#c0c0c0"; duration: 100 }
\endcode
+
+ When used in a transition, ColorAnimation will by default animate
+ all properties of type color that are changing. If a property or properties
+ are explicity set for the animation, then those will be used instead.
*/
/*!
\internal
@@ -740,6 +732,7 @@ QmlColorAnimation::QmlColorAnimation(QObject *parent)
d->init();
d->interpolatorType = QMetaType::QColor;
d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
+ d->defaultToInterpolatorType = true;
}
QmlColorAnimation::~QmlColorAnimation()
@@ -1072,6 +1065,8 @@ void QmlSetPropertyAction::transition(QmlStateActions &actions,
for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = d->createProperty(obj, props.at(jj));
+ if (!myAction.property.isValid())
+ continue;
myAction.toValue = d->value;
data->actions << myAction;
}
@@ -1357,17 +1352,9 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
d->animations.at(i)->setTarget(d->userProperty);
}
- //XXX removing and readding isn't ideal; we do it to get around the problem mentioned below.
- for (int i = d->ag->animationCount()-1; i >= 0; --i)
- d->ag->takeAnimationAt(i);
-
for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
d->animations.at(ii)->transition(actions, modified, direction);
- d->ag->addAnimation(d->animations.at(ii)->qtAnimation());
}
-
- //XXX changing direction means all the animations play in reverse, while we only want the ordering reversed.
- //d->ag->setDirection(direction == Backward ? QAbstractAnimation::Backward : QAbstractAnimation::Forward);
}
QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation)
@@ -1807,8 +1794,11 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
int interpolatorType; //for Number/ColorAnimation
int prevInterpolatorType; //for generic
QVariantAnimation::Interpolator interpolator;
+ bool reverse;
void setValue(qreal v)
{
+ if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
+ v = 1 - v;
QmlTimeLineValue::setValue(v);
for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
@@ -1843,8 +1833,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
- /* ### we used to select properties of name 'color' by default for color animations
- props << QLatin1String("color");*/
+ bool useType = (props.isEmpty() && d->defaultToInterpolatorType) ? true : false;
if (d->userProperty.isValid() && props.isEmpty() && !target()) {
props.append(d->userProperty.value.name());
@@ -1854,6 +1843,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
PropertyUpdater *data = new PropertyUpdater;
data->interpolatorType = d->interpolatorType;
data->interpolator = d->interpolator;
+ data->reverse = direction == Backward ? true : false;
QSet<QObject *> objs;
for (int ii = 0; ii < actions.count(); ++ii) {
@@ -1867,7 +1857,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
if ((d->filter.isEmpty() || d->filter.contains(obj) || (!same && d->filter.contains(sObj))) &&
(!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
- (props.contains(propertyName) || (!same && props.contains(sPropertyName))) &&
+ (props.contains(propertyName) || (!same && props.contains(sPropertyName))
+ || (useType && action.property.propertyType() == d->interpolatorType)) &&
(!target() || target() == obj || (!same && target() == sObj))) {
objs.insert(obj);
Action myAction = action;
@@ -1895,6 +1886,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
for (int jj = 0; jj < props.count(); ++jj) {
Action myAction;
myAction.property = d->createProperty(obj, props.at(jj));
+ if (!myAction.property.isValid())
+ continue;
if (d->fromIsDefined) {
d->convertVariant(d->from, (QVariant::Type)(d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()));
diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h
index 110c43e..91c1898 100644
--- a/src/declarative/util/qmlanimation.h
+++ b/src/declarative/util/qmlanimation.h
@@ -134,8 +134,6 @@ private Q_SLOTS:
void timelineComplete();
};
-QML_DECLARE_TYPE(QmlAbstractAnimation)
-
class QmlPauseAnimationPrivate;
class QmlPauseAnimation : public QmlAbstractAnimation
{
@@ -156,9 +154,7 @@ Q_SIGNALS:
protected:
virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
};
-QML_DECLARE_TYPE(QmlPauseAnimation)
class QmlRunScriptActionPrivate;
class QmlRunScriptAction : public QmlAbstractAnimation
@@ -186,7 +182,6 @@ Q_SIGNALS:
protected:
virtual QAbstractAnimation *qtAnimation();
};
-QML_DECLARE_TYPE(QmlRunScriptAction)
class QmlSetPropertyActionPrivate;
class QmlSetPropertyAction : public QmlAbstractAnimation
@@ -223,7 +218,6 @@ protected:
virtual QAbstractAnimation *qtAnimation();
virtual void prepare(QmlMetaProperty &);
};
-QML_DECLARE_TYPE(QmlSetPropertyAction)
class QmlParentChangeActionPrivate;
class QmlParentChangeAction : public QmlAbstractAnimation
@@ -244,7 +238,6 @@ protected:
virtual QAbstractAnimation *qtAnimation();
virtual void prepare(QmlMetaProperty &);
};
-QML_DECLARE_TYPE(QmlParentChangeAction)
class QmlPropertyAnimationPrivate;
class QmlPropertyAnimation : public QmlAbstractAnimation
@@ -296,7 +289,6 @@ Q_SIGNALS:
void easingChanged(const QString &);
void propertiesChanged(const QString &);
};
-QML_DECLARE_TYPE(QmlPropertyAnimation)
class QmlColorAnimation : public QmlPropertyAnimation
{
@@ -315,7 +307,6 @@ public:
QColor to() const;
void setTo(const QColor &);
};
-QML_DECLARE_TYPE(QmlColorAnimation)
class QmlNumberAnimation : public QmlPropertyAnimation
{
@@ -335,7 +326,6 @@ public:
qreal to() const;
void setTo(qreal);
};
-QML_DECLARE_TYPE(QmlNumberAnimation)
class QmlAnimationGroupPrivate;
class QmlAnimationGroup : public QmlAbstractAnimation
@@ -369,7 +359,6 @@ protected:
virtual QAbstractAnimation *qtAnimation();
virtual void prepare(QmlMetaProperty &);
};
-QML_DECLARE_TYPE(QmlSequentialAnimation)
class QmlParallelAnimation : public QmlAnimationGroup
{
@@ -387,10 +376,20 @@ protected:
virtual QAbstractAnimation *qtAnimation();
virtual void prepare(QmlMetaProperty &);
};
-QML_DECLARE_TYPE(QmlParallelAnimation)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlAbstractAnimation)
+QML_DECLARE_TYPE(QmlPauseAnimation)
+QML_DECLARE_TYPE(QmlRunScriptAction)
+QML_DECLARE_TYPE(QmlSetPropertyAction)
+QML_DECLARE_TYPE(QmlParentChangeAction)
+QML_DECLARE_TYPE(QmlPropertyAnimation)
+QML_DECLARE_TYPE(QmlColorAnimation)
+QML_DECLARE_TYPE(QmlNumberAnimation)
+QML_DECLARE_TYPE(QmlSequentialAnimation)
+QML_DECLARE_TYPE(QmlParallelAnimation)
+
QT_END_HEADER
#endif // QMLANIMATION_H
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index 051516d..fce5eca 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -319,7 +319,8 @@ class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate
public:
QmlPropertyAnimationPrivate()
: QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false),
- interpolatorType(0), interpolator(0), va(0), value(this, &QmlPropertyAnimationPrivate::valueChanged) {}
+ defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0),
+ value(this, &QmlPropertyAnimationPrivate::valueChanged) {}
void init();
@@ -335,6 +336,7 @@ public:
bool fromSourced;
bool fromIsDefined;
bool toIsDefined;
+ bool defaultToInterpolatorType;
int interpolatorType;
QVariantAnimation::Interpolator interpolator;
diff --git a/src/declarative/util/qmlbind.h b/src/declarative/util/qmlbind.h
index b7b77f2..731cdf8 100644
--- a/src/declarative/util/qmlbind.h
+++ b/src/declarative/util/qmlbind.h
@@ -82,10 +82,11 @@ public:
private:
void eval();
};
-QML_DECLARE_TYPE(QmlBind)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlBind)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/util/qmlconnection.h b/src/declarative/util/qmlconnection.h
index d61659f..dcaac34 100644
--- a/src/declarative/util/qmlconnection.h
+++ b/src/declarative/util/qmlconnection.h
@@ -81,10 +81,11 @@ private:
void connectIfValid();
void componentComplete();
};
-QML_DECLARE_TYPE(QmlConnection)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlConnection)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/util/qmlfollow.h b/src/declarative/util/qmlfollow.h
index 72d6df5..0953f2c 100644
--- a/src/declarative/util/qmlfollow.h
+++ b/src/declarative/util/qmlfollow.h
@@ -92,10 +92,10 @@ Q_SIGNALS:
void valueChanged(qreal);
};
-QML_DECLARE_TYPE(QmlFollow)
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlFollow)
+
QT_END_HEADER
#endif // QFXFOLLOW_H
diff --git a/src/declarative/util/qmlfont.h b/src/declarative/util/qmlfont.h
index c4c86e2..e85b8d3 100644
--- a/src/declarative/util/qmlfont.h
+++ b/src/declarative/util/qmlfont.h
@@ -83,10 +83,11 @@ public:
Q_SIGNALS:
void updated();
};
-QML_DECLARE_TYPE(QmlFont)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlFont)
+
QT_END_HEADER
#endif // QMLFONT_H
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 1884e8b..f5f76b0 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -49,6 +49,8 @@
#include <qmlbindablevalue.h>
#include "qmllistmodel.h"
+Q_DECLARE_METATYPE(QListModelInterface *)
+
QT_BEGIN_NAMESPACE
#define DATA_ROLE_ID 1
@@ -67,8 +69,6 @@ struct ListModelData
ListInstruction *instructions() const { return (ListInstruction *)((char *)this + sizeof(ListModelData)); }
};
-Q_DECLARE_METATYPE(QListModelInterface *)
-
/*!
\qmlclass ListModel
\brief The ListModel element defines a free-form list data source.
@@ -169,31 +169,6 @@ Q_DECLARE_METATYPE(QListModelInterface *)
*/
-struct ModelNode;
-class ListModel : public QListModelInterface
-{
- Q_OBJECT
-public:
- ListModel(QObject *parent=0);
-
- virtual QList<int> roles() const;
- virtual QString toString(int role) const;
- Q_PROPERTY(int count READ count)
- virtual int count() const;
- virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
-
-private:
- QVariant valueForNode(ModelNode *) const;
- mutable QStringList roleStrings;
- friend class ListModelParser;
- friend struct ModelNode;
-
- void checkRoles() const;
- void addRole(const QString &) const;
- mutable bool _rolesOk;
- ModelNode *_root;
-};
-
class ModelObject : public QObject
{
Q_OBJECT
@@ -220,9 +195,9 @@ struct ModelNode
QList<QVariant> values;
QHash<QString, ModelNode *> properties;
- ListModel *model() {
+ QmlListModel *model() {
if (!modelCache) {
- modelCache = new ListModel;
+ modelCache = new QmlListModel;
modelCache->_root = this;
}
return modelCache;
@@ -240,22 +215,25 @@ struct ModelNode
return objectCache;
}
- ListModel *modelCache;
+ QmlListModel *modelCache;
ModelObject *objectCache;
};
-Q_DECLARE_METATYPE(ModelNode *)
ModelObject::ModelObject(ModelNode *node)
: _node(node), _haveProperties(false), _mo(new QmlOpenMetaObject(this))
{
}
-ListModel::ListModel(QObject *parent)
+QmlListModel::QmlListModel(QObject *parent)
: QListModelInterface(parent), _rolesOk(false), _root(0)
{
}
-void ListModel::checkRoles() const
+QmlListModel::~QmlListModel()
+{
+}
+
+void QmlListModel::checkRoles() const
{
if (_rolesOk)
return;
@@ -271,13 +249,13 @@ void ListModel::checkRoles() const
_rolesOk = true;
}
-void ListModel::addRole(const QString &role) const
+void QmlListModel::addRole(const QString &role) const
{
if (!roleStrings.contains(role))
roleStrings << role;
}
-QList<int> ListModel::roles() const
+QList<int> QmlListModel::roles() const
{
checkRoles();
QList<int> rv;
@@ -286,7 +264,7 @@ QList<int> ListModel::roles() const
return rv;
}
-QString ListModel::toString(int role) const
+QString QmlListModel::toString(int role) const
{
checkRoles();
if (role < roleStrings.count())
@@ -295,7 +273,7 @@ QString ListModel::toString(int role) const
return QString();
}
-QVariant ListModel::valueForNode(ModelNode *node) const
+QVariant QmlListModel::valueForNode(ModelNode *node) const
{
QObject *rv = 0;
@@ -328,7 +306,7 @@ QVariant ListModel::valueForNode(ModelNode *node) const
return QVariant();
}
-QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
+QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const
{
checkRoles();
QHash<int, QVariant> rv;
@@ -353,13 +331,13 @@ QHash<int,QVariant> ListModel::data(int index, const QList<int> &roles) const
return rv;
}
-int ListModel::count() const
+int QmlListModel::count() const
{
if (!_root) return 0;
return _root->values.count();
}
-class ListModelParser : public QmlCustomParser
+class QmlListModelParser : public QmlCustomParser
{
public:
QByteArray compile(const QList<QmlCustomParserProperty> &, bool *ok);
@@ -367,7 +345,7 @@ public:
void setCustomData(QObject *, const QByteArray &);
};
-bool ListModelParser::compileProperty(const QmlCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data)
+bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data)
{
QList<QVariant> values = prop.assignedValues();
for(int ii = 0; ii < values.count(); ++ii) {
@@ -434,7 +412,7 @@ bool ListModelParser::compileProperty(const QmlCustomParserProperty &prop, QList
return true;
}
-QByteArray ListModelParser::compile(const QList<QmlCustomParserProperty> &customProps, bool *ok)
+QByteArray QmlListModelParser::compile(const QList<QmlCustomParserProperty> &customProps, bool *ok)
{
*ok = true;
QList<ListInstruction> instr;
@@ -471,9 +449,9 @@ QByteArray ListModelParser::compile(const QList<QmlCustomParserProperty> &custom
return rv;
}
-void ListModelParser::setCustomData(QObject *obj, const QByteArray &d)
+void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
{
- ListModel *rv = static_cast<ListModel *>(obj);
+ QmlListModel *rv = static_cast<QmlListModel *>(obj);
ModelNode *root = new ModelNode;
rv->_root = root;
@@ -519,16 +497,14 @@ void ListModelParser::setCustomData(QObject *obj, const QByteArray &d)
}
}
-QML_DECLARE_TYPE(ListModel)
-QML_DEFINE_CUSTOM_TYPE(ListModel, ListModel, ListModelParser)
+QML_DEFINE_CUSTOM_TYPE(QmlListModel, ListModel, QmlListModelParser)
// ### FIXME
-class ListElement : public QObject
+class QmlListElement : public QObject
{
Q_OBJECT
};
-QML_DECLARE_TYPE(ListElement)
-QML_DEFINE_TYPE(ListElement,ListElement)
+QML_DEFINE_TYPE(QmlListElement,ListElement)
static void dump(ModelNode *node, int ind)
{
@@ -568,4 +544,7 @@ ModelNode::~ModelNode()
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(ModelNode *)
+QML_DECLARE_TYPE(QmlListElement)
+
#include "qmllistmodel.moc"
diff --git a/src/declarative/util/qmllistmodel.h b/src/declarative/util/qmllistmodel.h
index 56ed8fb..39edbe4 100644
--- a/src/declarative/util/qmllistmodel.h
+++ b/src/declarative/util/qmllistmodel.h
@@ -57,9 +57,37 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+struct ModelNode;
+class QmlListModel : public QListModelInterface
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count)
+
+public:
+ QmlListModel(QObject *parent=0);
+ ~QmlListModel();
+
+ virtual QList<int> roles() const;
+ virtual QString toString(int role) const;
+ virtual int count() const;
+ virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
+
+private:
+ QVariant valueForNode(ModelNode *) const;
+ mutable QStringList roleStrings;
+ friend class QmlListModelParser;
+ friend struct ModelNode;
+
+ void checkRoles() const;
+ void addRole(const QString &) const;
+ mutable bool _rolesOk;
+ ModelNode *_root;
+};
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlListModel)
+
QT_END_HEADER
#endif // QMLLISTMODEL_H
diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage.h
index 9f1d94f..9f7a623 100644
--- a/src/declarative/util/qmlpackage.h
+++ b/src/declarative/util/qmlpackage.h
@@ -77,10 +77,11 @@ public:
static QmlPackageAttached *qmlAttachedProperties(QObject *);
};
-QML_DECLARE_TYPE(QmlPackage)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlPackage)
+
QT_END_HEADER
#endif // QMLPACKAGE_H
diff --git a/src/declarative/util/qmlscript.h b/src/declarative/util/qmlscript.h
index 5b62da5..4ba4f6b 100644
--- a/src/declarative/util/qmlscript.h
+++ b/src/declarative/util/qmlscript.h
@@ -74,10 +74,11 @@ public:
private Q_SLOTS:
void replyFinished();
};
-QML_DECLARE_TYPE(QmlScript)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlScript)
+
QT_END_HEADER
#endif
diff --git a/src/declarative/util/qmlsetproperties.h b/src/declarative/util/qmlsetproperties.h
index 717d0ee..3632816 100644
--- a/src/declarative/util/qmlsetproperties.h
+++ b/src/declarative/util/qmlsetproperties.h
@@ -74,10 +74,11 @@ public:
virtual ActionList actions();
};
-QML_DECLARE_TYPE(QmlSetProperties)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlSetProperties)
+
QT_END_HEADER
#endif // QMLSETPROPERTIES_H
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 8ac1b33..8b096f0 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -525,7 +525,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
d->applyBindings(); //### merge into above foreach?
}
-QML_DEFINE_TYPE(QmlStateOperation,StateOperation)
+QML_DEFINE_NOCREATE_TYPE(QmlStateOperation)
QmlStateOperation::ActionList QmlStateOperation::actions()
{
return ActionList();
diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h
index b219b99..987c7ad 100644
--- a/src/declarative/util/qmlstate.h
+++ b/src/declarative/util/qmlstate.h
@@ -99,7 +99,6 @@ public:
protected:
QmlStateOperation(QObjectPrivate &dd, QObject *parent = 0);
};
-QML_DECLARE_TYPE(QmlStateOperation)
typedef QmlStateOperation::ActionList QmlStateActions;
@@ -149,10 +148,12 @@ private:
Q_DISABLE_COPY(QmlState)
friend class QmlTransitionPrivate;
};
-QML_DECLARE_TYPE(QmlState)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlStateOperation)
+QML_DECLARE_TYPE(QmlState)
+
QT_END_HEADER
#endif // QMLSTATE_H
diff --git a/src/declarative/util/qmlstategroup.h b/src/declarative/util/qmlstategroup.h
index 237b60e..a817bd0 100644
--- a/src/declarative/util/qmlstategroup.h
+++ b/src/declarative/util/qmlstategroup.h
@@ -85,10 +85,11 @@ private:
friend class QmlState;
void updateAutoState();
};
-QML_DECLARE_TYPE(QmlStateGroup)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlStateGroup)
+
QT_END_HEADER
#endif // QMLSTATEGROUP_H
diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h
index c7a6d42..6e5de48 100644
--- a/src/declarative/util/qmlstateoperations.h
+++ b/src/declarative/util/qmlstateoperations.h
@@ -70,7 +70,6 @@ public:
virtual ActionList actions();
};
-QML_DECLARE_TYPE(QmlParentChange)
class QmlRunScriptPrivate;
class Q_DECLARATIVE_EXPORT QmlRunScript : public QmlStateOperation, public ActionEvent
@@ -95,7 +94,6 @@ public:
virtual void execute();
};
-QML_DECLARE_TYPE(QmlRunScript)
class QmlSetPropertyPrivate;
class Q_DECLARATIVE_EXPORT QmlSetProperty : public QmlStateOperation
@@ -123,10 +121,13 @@ public:
virtual ActionList actions();
};
-QML_DECLARE_TYPE(QmlSetProperty)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlParentChange)
+QML_DECLARE_TYPE(QmlRunScript)
+QML_DECLARE_TYPE(QmlSetProperty)
+
QT_END_HEADER
#endif // QMLSTATEOPERATIONS_H
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 5931075..43a4605 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -176,6 +176,7 @@ void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
}
d->endState = endState;
+ d->group->setDirection(d->reversed ? QAbstractAnimation::Backward : QAbstractAnimation::Forward);
d->group->start();
}
diff --git a/src/declarative/util/qmltransition.h b/src/declarative/util/qmltransition.h
index 4462b4c..d6cd513 100644
--- a/src/declarative/util/qmltransition.h
+++ b/src/declarative/util/qmltransition.h
@@ -88,10 +88,11 @@ public:
void setReversed(bool r);
void stop();
};
-QML_DECLARE_TYPE(QmlTransition)
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QmlTransition)
+
QT_END_HEADER
#endif // QMLTRANSITION_H
diff --git a/src/declarative/widgets/graphicslayouts.h b/src/declarative/widgets/graphicslayouts.h
index 525a848..ab8ad90 100644
--- a/src/declarative/widgets/graphicslayouts.h
+++ b/src/declarative/widgets/graphicslayouts.h
@@ -52,9 +52,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-QML_DECLARE_INTERFACE(QGraphicsLayoutItem)
-QML_DECLARE_INTERFACE(QGraphicsLayout)
-
class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem
{
Q_OBJECT
@@ -64,7 +61,6 @@ public:
virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const;
};
-QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject)
//TODO:
// -content margins
@@ -120,7 +116,6 @@ private:
ChildList _children;
};
-QML_DECLARE_TYPE(QGraphicsLinearLayoutObject)
//TODO:
// -content margins
@@ -181,10 +176,15 @@ private:
ChildList _children;
};
-QML_DECLARE_TYPE(QGraphicsGridLayoutObject)
QT_END_NAMESPACE
+QML_DECLARE_INTERFACE(QGraphicsLayoutItem)
+QML_DECLARE_INTERFACE(QGraphicsLayout)
+QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject)
+QML_DECLARE_TYPE(QGraphicsLinearLayoutObject)
+QML_DECLARE_TYPE(QGraphicsGridLayoutObject)
+
QT_END_HEADER
#endif // GRAPHICSLAYOUTS_H
diff --git a/src/declarative/widgets/graphicswidgets.h b/src/declarative/widgets/graphicswidgets.h
index e29f1d6..8147400 100644
--- a/src/declarative/widgets/graphicswidgets.h
+++ b/src/declarative/widgets/graphicswidgets.h
@@ -48,13 +48,15 @@
#include <QtGui/QGraphicsWidget>
#include <QtGui/QGraphicsItem>
-QT_BEGIN_NAMESPACE
+QT_BEGIN_HEADER
+
+QT_MODULE(Declarative)
QML_DECLARE_TYPE(QGraphicsView)
QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene)
QML_DECLARE_TYPE(QGraphicsWidget)
QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem)
-QT_END_NAMESPACE
+QT_END_HEADER
#endif // GRAPHICSWIDGETS_H
diff --git a/tests/auto/declarative/animations/data/badproperty1.qml b/tests/auto/declarative/animations/data/badproperty1.qml
new file mode 100644
index 0000000..dc35775
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badproperty1.qml
@@ -0,0 +1,22 @@
+Rect {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rect {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ SetProperties { target: MyRect; pen.color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { target: MyRect; to: "red"; properties: "pen.colr"; duration: 1000 }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/dotproperty.qml b/tests/auto/declarative/animations/data/dotproperty.qml
new file mode 100644
index 0000000..2cfcefe
--- /dev/null
+++ b/tests/auto/declarative/animations/data/dotproperty.qml
@@ -0,0 +1,22 @@
+Rect {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rect {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ SetProperties { target: MyRect; pen.color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { properties: "pen.color"; duration: 1000 }
+ }
+}
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
index 1895cef2..a493454 100644
--- a/tests/auto/declarative/animations/tst_animations.cpp
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -12,6 +12,7 @@ public:
private slots:
void badTypes();
+ void badProperties();
//void mixedTypes();
};
@@ -51,6 +52,20 @@ void tst_animations::badTypes()
}
}
+void tst_animations::badProperties()
+{
+ //don't crash (should be runtime error)
+ {
+ QFxView *view = new QFxView;
+ view->setUrl(QUrl("file://" SRCDIR "/data/badproperty1.qml"));
+
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+}
+
/*//test animating mixed types with property animation
//for example, int + real; color + real; etc
void tst_animations::mixedTypes()
diff --git a/tools/linguist/lupdate/qml.cpp b/tools/linguist/lupdate/qml.cpp
index f33eae3..f66a6bd 100644
--- a/tools/linguist/lupdate/qml.cpp
+++ b/tools/linguist/lupdate/qml.cpp
@@ -47,8 +47,6 @@
#include <QtCore/QFile>
#include <QtCore/QString>
-QT_BEGIN_NAMESPACE
-
#include "parser/qmljsengine_p.h"
#include "parser/qmljsparser_p.h"
#include "parser/qmljslexer_p.h"
@@ -65,6 +63,8 @@ QT_BEGIN_NAMESPACE
#include <iostream>
#include <cstdlib>
+QT_BEGIN_NAMESPACE
+
using namespace QmlJS;
class FindTrCalls: protected AST::Visitor
diff --git a/tools/qmldebugger/canvasframerate.cpp b/tools/qmldebugger/canvasframerate.cpp
index 022aed5..f2a813d 100644
--- a/tools/qmldebugger/canvasframerate.cpp
+++ b/tools/qmldebugger/canvasframerate.cpp
@@ -14,6 +14,8 @@
#include <QLineEdit>
#include <QCheckBox>
+QT_BEGIN_NAMESPACE
+
class QLineGraph : public QWidget
{
Q_OBJECT
@@ -301,4 +303,6 @@ void CanvasFrameRate::stateChanged(int s)
static_cast<QmlDebugClientPlugin *>(m_plugin)->setEnabled(checked);
}
+QT_END_NAMESPACE
+
#include "canvasframerate.moc"
diff --git a/tools/qmldebugger/canvasframerate.h b/tools/qmldebugger/canvasframerate.h
index 543f233..cc40d4c 100644
--- a/tools/qmldebugger/canvasframerate.h
+++ b/tools/qmldebugger/canvasframerate.h
@@ -3,6 +3,8 @@
#include <QWidget>
+QT_BEGIN_NAMESPACE
+
class QmlDebugClient;
class QTabWidget;
class CanvasFrameRate : public QWidget
@@ -20,5 +22,7 @@ private:
QObject *m_plugin;
};
+QT_END_NAMESPACE
+
#endif // CANVASFRAMERATE_H
diff --git a/tools/qmldebugger/canvasscene.cpp b/tools/qmldebugger/canvasscene.cpp
index 2d5b764..95f3098 100644
--- a/tools/qmldebugger/canvasscene.cpp
+++ b/tools/qmldebugger/canvasscene.cpp
@@ -8,6 +8,8 @@
#include <QtDeclarative/qfxrect.h>
#include <QtDeclarative/qfximage.h>
+QT_BEGIN_NAMESPACE
+
class CanvasSceneClientPlugin : public QmlDebugClientPlugin
{
public:
@@ -243,3 +245,4 @@ void CanvasScene::setY(int y)
m_canvasRoot->setY(y);
}
+QT_END_NAMESPACE
diff --git a/tools/qmldebugger/canvasscene.h b/tools/qmldebugger/canvasscene.h
index d980241..8b583e8 100644
--- a/tools/qmldebugger/canvasscene.h
+++ b/tools/qmldebugger/canvasscene.h
@@ -6,6 +6,8 @@
#include <QtDeclarative/qsimplecanvas.h>
#include <QtDeclarative/qsimplecanvasitem.h>
+QT_BEGIN_NAMESPACE
+
class QmlDebugClient;
class CanvasSceneClient;
class QmlDebugClientPlugin;
@@ -35,5 +37,7 @@ private:
QTreeWidgetItem *m_selected;
};
+QT_END_NAMESPACE
+
#endif // CANVASSCENE_H
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 21cadda..cb7d00c 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -41,6 +41,8 @@
#include <QTimer>
#include <QNetworkProxyFactory>
+QT_BEGIN_NAMESPACE
+
class PreviewDeviceSkin : public DeviceSkin
{
Q_OBJECT
@@ -711,4 +713,6 @@ void QmlViewer::setCacheEnabled(bool on)
}
}
+QT_END_NAMESPACE
+
#include "qmlviewer.moc"
diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h
index 9de47a8..c533fe0 100644
--- a/tools/qmlviewer/qmlviewer.h
+++ b/tools/qmlviewer/qmlviewer.h
@@ -20,6 +20,7 @@
#include <qfxtestengine.h>
#include <QList>
+QT_BEGIN_NAMESPACE
class QFxView;
class PreviewDeviceSkin;
@@ -94,4 +95,6 @@ private:
QFxTestEngine *testEngine;
};
+QT_END_NAMESPACE
+
#endif