summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp31
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp36
-rw-r--r--src/declarative/fx/qfxitem.cpp258
-rw-r--r--src/declarative/fx/qfxparticles.cpp4
-rw-r--r--src/declarative/qml/qmlcomponent.cpp6
-rw-r--r--src/declarative/qml/qmlengine.cpp2
-rw-r--r--src/declarative/qml/qmlparserstatus.cpp7
-rw-r--r--src/declarative/qml/qmlparserstatus.h2
-rw-r--r--src/declarative/qml/qmlpropertyvaluesource.cpp3
9 files changed, 214 insertions, 135 deletions
diff --git a/src/declarative/extra/qmlsqlconnection.cpp b/src/declarative/extra/qmlsqlconnection.cpp
index a39aa6f..25ab033 100644
--- a/src/declarative/extra/qmlsqlconnection.cpp
+++ b/src/declarative/extra/qmlsqlconnection.cpp
@@ -79,13 +79,14 @@ public:
Qml the query should connect using its name.
\qml
- <SqlConnection id="myConnection">
- <name>qmlConnection</name>
- <driver>QSQLITE</driver>
- <databaseName>"mydb.sqlite"</databaseName>
- </SqlConnection>
- <SqlQuery id="listmodel" connection="{myConnection}">SELECT * FROM mytable</SqlQuery>
- <SqlQuery id="othermodel" connection="qmlConnection">SELECT * FROM myothertable</SqlQuery>
+ SqlConnection {
+ id: myConnection
+ name: "qmlConnection"
+ driver: "QSQLITE"
+ databaseName: "mydb.sqlite"
+ }
+ SqlQuery { id: listmodel; connection: myConnection; query: "SELECT * FROM mytable" }
+ SqlQuery { id: othermodel; connection: "qmlConnection"; query: "SELECT * FROM myothertable" }
\endqml
*/
@@ -99,34 +100,34 @@ public:
*/
/*!
- \qmlproperty QStringList SqlConnection::tables
+ \qmlproperty list<string> SqlConnection::tables
Defines the set of tables that exist in the database for the connection.
*/
/*!
- \qmlproperty QString SqlConnection::databaseName
+ \qmlproperty string SqlConnection::databaseName
Defines the connection's database name. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::driver
+ \qmlproperty string SqlConnection::driver
Defines the driver type of the connection. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::connectOptions
+ \qmlproperty string SqlConnection::connectOptions
Defines the options used when connecting to the database. These are used
when opening the connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::hostName
+ \qmlproperty string SqlConnection::hostName
Defines the connection's host name. This is used when opening the
connection to the database.
@@ -140,21 +141,21 @@ public:
*/
/*!
- \qmlproperty QString SqlConnection::userName
+ \qmlproperty string SqlConnection::userName
Defines the connection's user name. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::password
+ \qmlproperty string SqlConnection::password
Defines the connection's password. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::lastError
+ \qmlproperty string SqlConnection::lastError
Defines the last error, if one occurred, when working with the database.
If the error occurred in conjunction with an SQL query the error will be
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
index 70b3bdd..5bd1459 100644
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ b/src/declarative/extra/qmlsqlquery.cpp
@@ -77,18 +77,19 @@ public:
values will only apply when the SqlQuery exec() slot is called.
\qml
- <SqlQuery>
- SELECT * FROM mytable WHERE name LIKE :value
- <bindings>
- <SqlBind name=":value" value="{searchText + '%'}"/>
- </bindings>
- </SqlQuery>
- <SqlQuery>
- SELECT * FROM mytable WHERE type = ?
- <bindings>
- <SqlBind value="simple"/>
- </bindings>
- <SqlQuery>
+ SqlQuery {
+ query: "SELECT * FROM mytable WHERE name LIKE :value"
+ bindings: SqlBind {
+ name: ":value"
+ value: searchText + '%'
+ }
+ }
+ SqlQuery {
+ query: "SELECT * FROM mytable WHERE type = ?"
+ bindings: SqlBind {
+ value: "simple"
+ }
+ }
\endqml
*/
@@ -254,11 +255,12 @@ public:
appropriate table column name for the result column.
\qml
- <SqlQuery connection="{qmlConnectionId}" query="DELETE FROM mytable"/>
- <SqlQuery connection="connectionName">
- SELECT * FROM mytable
- </SqlQuery>
- <SqlQuery>SELECT id AS recordId, (firstName || ' ' || lastName) AS fullName FROM mytable</SqlQuery>
+ SqlQuery { connection: qmlConnectionId; query: "DELETE FROM mytable" }
+ SqlQuery {
+ connection: "connectionName"
+ query: "SELECT * FROM mytable"
+ }
+ SqlQuery { query: "SELECT id AS recordId, (firstName || ' ' || lastName) AS fullName FROM mytable" }
\endqml
*/
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index ecc2d65..c46c34c 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -551,17 +551,18 @@ QFxItem *QFxItem::itemParent() const
you, but it can come in handy in some cases.
\qml
- <Item>
- <children>
- <Text />
- <Rect />
- </children>
- <resources>
- <Component id="myComponent">
- <Text />
- </Component>
- </resources>
- </Item>
+ Item {
+ children: [
+ Text {},
+ Rect {}
+ ]
+ resources: [
+ Component {
+ id: myComponent
+ Text {}
+ }
+ ]
+ }
\endqml
*/
@@ -728,24 +729,24 @@ void QFxItemPrivate::children_clear()
So you can write:
\qml
- <Item>
- <Text />
- <Rect />
- <Script />
- </Item>
+ Item {
+ Text {}
+ Rect {}
+ Script {}
+ }
\endqml
instead of:
\qml
- <Item>
- <children>
- <Text />
- <Rect />
- </children>
- <resources>
- <Script/>
- </resources>
- </Item>
+ Item {
+ children: [
+ Text {},
+ Rect {}
+ ]
+ resources: [
+ Script {}
+ ]
+ }
\endqml
data is a behind-the-scenes property: you should never need to explicitly
@@ -916,7 +917,7 @@ void QFxItem::qmlLoaded()
Defines the item's position and size relative to its parent.
\qml
- <Item x="100" y="100" width="100" height="100" />
+ Item { x: 100; y: 100; width: 100; height: 100 }
\endqml
*/
@@ -970,39 +971,63 @@ void QFxItem::qmlLoaded()
\o \image declarative-item_stacking1.png
\o Same \c z - later children above earlier children:
\qml
- <Item>
- <Rect color="red" width="100" height="100" />
- <Rect color="blue" x="50" y="50" width="100" height="100" />
- </Item>
+ Item {
+ Rect {
+ color: "red"
+ width: 100; height: 100
+ }
+ Rect {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
\endqml
\row
\o \image declarative-item_stacking2.png
\o Higher \c z on top:
\qml
- <Item>
- <Rect z="1" color="red" width="100" height="100" />
- <Rect color="blue" x="50" y="50" width="100" height="100" />
- </Item>
+ Item {
+ Rect {
+ z: 1
+ color: "red"
+ width: 100; height: 100
+ }
+ Rect {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
\endqml
\row
\o \image declarative-item_stacking3.png
\o Same \c z - children above parents:
\qml
- <Item>
- <Rect color="red" width="100" height="100">
- <Rect color="blue" x="50" y="50" width="100" height="100" />
- </Rect>
- </Item>
+ Item {
+ Rect {
+ color: "red"
+ width: 100; height: 100
+ Rect {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
\endqml
\row
\o \image declarative-item_stacking4.png
\o Lower \c z below:
\qml
- <Item>
- <Rect color="red" width="100" height="100">
- <Rect z="-1" color="blue" x="50" y="50" width="100" height="100" />
- </Rect>
- </Item>
+ Item {
+ Rect {
+ color: "red"
+ width: 100; height: 100
+ Rect {
+ z: -1
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
\endqml
\endtable
*/
@@ -1179,8 +1204,8 @@ QRectF QFxItem::sceneBoundingRect() const
refer to the item. For example:
\qml
- <Text id="myText" .../>
- <Text text="{myText.text}"/>
+ Text { id: myText; ... }
+ Text { text: myText.text }
\endqml
The identifier is available throughout to the \l {components}{component}
@@ -1195,8 +1220,8 @@ QRectF QFxItem::sceneBoundingRect() const
refer to the item. For example:
\qml
- <Text id="myText" .../>
- <Text text="{myText.text}"/>
+ Text { id: myText; ... }
+ Text { text: myText.text }
\endqml
The identifier is available throughout the \l {components}{component}
@@ -1359,10 +1384,14 @@ QFxAnchorLine QFxItem::verticalCenter() const
\o \image declarative-anchors_example.png
\o Text anchored to Image, horizontally centered and vertically below, with a margin.
\qml
- <Image id="pic" .../>
- <Text id="label" anchors.horizontalCenter="{pic.horizontalCenter}"
- anchors.top="{pic.bottom}"
- anchors.topMargin="5" .../>
+ Image { id: pic; ... }
+ Text {
+ id: label
+ anchors.horizontalCenter: pic.horizontalCenter
+ anchors.top: pic.bottom
+ anchors.topMargin: 5
+ ...
+ }
\endqml
\row
\o \image declarative-anchors_example2.png
@@ -1371,9 +1400,13 @@ QFxAnchorLine QFxItem::verticalCenter() const
property of both defaults to 0.
\qml
- <Image id="pic" .../>
- <Text id="label" anchors.left="{pic.right}"
- anchors.leftMargin="5" .../>
+ Image { id: pic; ... }
+ Text {
+ id: label
+ anchors.left: pic.right
+ anchors.leftMargin: 5
+ ...
+ }
\endqml
\endtable
@@ -1432,10 +1465,19 @@ void QFxItem::setBaselineOffset(int offset)
\o \image declarative-rotation.png
\o
\qml
- <Rect color="blue" width="100" height="100">
- <Rect color="green" width="25" height="25"/>
- <Rect color="red" width="50" height="50" x="25" y="25" rotation="30"/>
- </Rect>
+ Rect {
+ color: "blue"
+ width: 100; height: 100
+ Rect {
+ color: "green"
+ width: 25; height: 25
+ }
+ Rect {
+ color: "red"
+ x: 25; y: 25; width: 50; height: 50
+ rotation: 30
+ }
+ }
\endqml
\endtable
*/
@@ -1495,10 +1537,19 @@ void QFxItem::setRotation(qreal rotation)
\o \image declarative-scale.png
\o
\qml
- <Rect color="blue" width="100" height="100">
- <Rect color="green" width="25" height="25"/>
- <Rect color="red" width="50" height="50" x="25" y="25" scale="1.4"/>
- </Rect>
+ Rect {
+ color: "blue"
+ width: 100; height: 100
+ Rect {
+ color: "green"
+ width: 25; height: 25
+ }
+ Rect {
+ color: "red"
+ x: 25; y: 25; width: 50; height: 50
+ scale: 1.4
+ }
+ }
\endqml
\endtable
*/
@@ -1546,21 +1597,32 @@ void QFxItem::setScale(qreal s)
\o \image declarative-item_opacity1.png
\o
\qml
- <Item>
- <Rect color="red" width="100" height="100">
- <Rect color="blue" x="50" y="50" width="100" height="100" />
- </Rect>
- </Item>
+ Item {
+ Rect {
+ color: "red"
+ width: 100; height: 100
+ Rect {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
\endqml
\row
\o \image declarative-item_opacity2.png
\o
\qml
- <Item>
- <Rect opacity="0.5" color="red" width="100" height="100">
- <Rect color="blue" x="50" y="50" width="100" height="100" />
- </Rect>
- </Item>
+ Item {
+ Rect {
+ opacity: 0.5
+ color: "red"
+ width: 100; height: 100
+ Rect {
+ color: "blue"
+ x: 50; y: 50; width: 100; height: 100
+ }
+ }
+ }
\endqml
\endtable
*/
@@ -1639,13 +1701,13 @@ QmlList<QObject *> *QFxItem::resources()
This property holds a list of states defined by the item.
\qml
- <Item>
- <states>
- <State .../>
- <State .../>
- ...
- </states>
- </Item>
+ Item {
+ states: [
+ State { ... },
+ State { ... }
+ ...
+ ]
+ }
\endqml
\sa {states-transitions}{States and Transitions}
@@ -1668,13 +1730,13 @@ QmlList<QmlState *>* QFxItem::states()
This property holds a list of transitions defined by the item.
\qml
- <Item>
- <transitions>
- <Transition .../>
- <Transition .../>
- ...
- </transitions>
- </Item>
+ Item {
+ transitions: [
+ Transition { ... },
+ Transition { ... }
+ ...
+ ]
+ }
\endqml
\sa {states-transitions}{States and Transitions}
@@ -1708,13 +1770,13 @@ QmlList<QmlTransition *>* QFxItem::transitions()
that canvas (but the QML will still be considered valid).
\qml
- <Item>
- <filter>
- <Blur .../>
- <Relection .../>
- ...
- </filter>
- </Item>
+ Item {
+ filter: [
+ Blur { ... },
+ Relection { ... }
+ ...
+ ]
+ }
\endqml
*/
@@ -1759,14 +1821,14 @@ QmlState *QFxItem::findState(const QString &name) const
example:
\qml
- <Script>
+ Script {
function toggle() {
if (button.state == 'On')
button.state = 'Off';
else
button.state = 'On';
}
- </Script>
+ }
\endqml
If the item is in its base state (i.e. no explicit state has been
@@ -1785,14 +1847,14 @@ QmlState *QFxItem::findState(const QString &name) const
example:
\qml
- <Script>
+ Script {
function toggle() {
if (button.state == 'On')
button.state = 'Off';
else
button.state = 'On';
}
- </Script>
+ }
\endqml
If the item is in its base state (i.e. no explicit state has been
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 0ac537a..b1f4f56 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -116,6 +116,10 @@ QML_DEFINE_TYPE(QFxParticleMotion,ParticleMotion);
\sa QFxParticles
*/
+
+/*!
+ Constructs a QFxParticleMotion with parent object \a parent.
+*/
QFxParticleMotion::QFxParticleMotion(QObject *parent) :
QObject(parent)
{
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index b1beb9c..72d4e08 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -256,7 +256,7 @@ QmlComponent::QmlComponent(QmlEngine *engine, const QUrl &url, QObject *parent)
}
/*!
- Create a QmlComponent from the given XML \a data. If provided, \a filename
+ Create a QmlComponent from the given QML \a data. If provided, \a url
is used to set the component name, and to provide a base path for items
resolved by this component.
*/
@@ -283,8 +283,8 @@ QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledComponent *cc, int star
}
/*!
- Sets the QmlComponent to use the given XML \a data. If provided,
- \a filename is used to set the component name, and to provide a base path
+ Sets the QmlComponent to use the given QML \a data. If provided,
+ \a url is used to set the component name, and to provide a base path
for items resolved by this component.
*/
void QmlComponent::setData(const QByteArray &data, const QUrl &url)
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 30848c1..f8b7ad6 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -373,7 +373,7 @@ bool QmlEnginePrivate::loadCache(QmlBasicScriptNodeCache &cache, const QString &
\code
QmlEngine engine;
- QmlComponent component("<Text text=\"Hello world!\"/>");
+ QmlComponent component("Text { text: \"Hello world!\" }");
QFxItem *item = qobject_cast<QFxItem *>(component.create(&engine));
//add item to view, etc
diff --git a/src/declarative/qml/qmlparserstatus.cpp b/src/declarative/qml/qmlparserstatus.cpp
index 1f49553..71b7adf 100644
--- a/src/declarative/qml/qmlparserstatus.cpp
+++ b/src/declarative/qml/qmlparserstatus.cpp
@@ -49,6 +49,13 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ Destroys the parser status instance.
+*/
+QmlParserStatus::~QmlParserStatus()
+{
+}
+
+/*!
Invoked after class creation, but before any properties have been set.
*/
void QmlParserStatus::classBegin()
diff --git a/src/declarative/qml/qmlparserstatus.h b/src/declarative/qml/qmlparserstatus.h
index 1ec50ba..bb3691c 100644
--- a/src/declarative/qml/qmlparserstatus.h
+++ b/src/declarative/qml/qmlparserstatus.h
@@ -53,7 +53,7 @@ QT_MODULE(Declarative)
class Q_DECLARATIVE_EXPORT QmlParserStatus
{
public:
- virtual ~QmlParserStatus() {}
+ virtual ~QmlParserStatus();
virtual void classBegin();
virtual void classComplete();
diff --git a/src/declarative/qml/qmlpropertyvaluesource.cpp b/src/declarative/qml/qmlpropertyvaluesource.cpp
index 78b0495..44e1952 100644
--- a/src/declarative/qml/qmlpropertyvaluesource.cpp
+++ b/src/declarative/qml/qmlpropertyvaluesource.cpp
@@ -50,6 +50,9 @@ QT_BEGIN_NAMESPACE
*/
QML_DEFINE_NOCREATE_TYPE(QmlPropertyValueSource);
+/*!
+ Constructs a QmlPropertyValueSource with parent \a parent.
+*/
QmlPropertyValueSource::QmlPropertyValueSource(QObject *parent)
: QObject(parent)