summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/easing/legal.qdoc2
-rw-r--r--src/corelib/animation/qabstractanimation.cpp2
-rw-r--r--src/corelib/animation/qanimationgroup.cpp2
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp2
-rw-r--r--src/corelib/animation/qpauseanimation.cpp2
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp2
-rw-r--r--src/corelib/animation/qvariantanimation.cpp2
-rw-r--r--src/corelib/kernel/qcoreevent.cpp2
-rw-r--r--src/corelib/tools/qeasingcurve.cpp2
-rw-r--r--src/declarative/extra/qmlnumberformatter.cpp4
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp45
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp34
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp15
-rw-r--r--src/declarative/fx/qfxanchors.cpp4
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.cpp16
-rw-r--r--src/declarative/fx/qfxblurfilter.cpp35
-rw-r--r--src/declarative/fx/qfxcomponentinstance.cpp19
-rw-r--r--src/declarative/fx/qfxcontentwrapper.cpp41
-rw-r--r--src/declarative/fx/qfxevents.cpp33
-rw-r--r--src/declarative/fx/qfxflickable.cpp31
-rw-r--r--src/declarative/fx/qfxflipable.cpp60
-rw-r--r--src/declarative/fx/qfxfocuspanel.cpp4
-rw-r--r--src/declarative/fx/qfxfocusrealm.cpp2
-rw-r--r--src/declarative/fx/qfxgridview.cpp8
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp32
-rw-r--r--src/declarative/fx/qfximage.cpp57
-rw-r--r--src/declarative/fx/qfximageitem.cpp4
-rw-r--r--src/declarative/fx/qfxitem.cpp71
-rw-r--r--src/declarative/fx/qfxkeyactions.cpp46
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp4
-rw-r--r--src/declarative/fx/qfxlayouts.cpp360
-rw-r--r--src/declarative/fx/qfxlistview.cpp151
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp36
-rw-r--r--src/declarative/fx/qfxpainted.cpp5
-rw-r--r--src/declarative/fx/qfxpainted.h5
-rw-r--r--src/declarative/fx/qfxparticles.cpp166
-rw-r--r--src/declarative/fx/qfxpath.cpp126
-rw-r--r--src/declarative/fx/qfxpathview.cpp197
-rw-r--r--src/declarative/fx/qfxpathview.h2
-rw-r--r--src/declarative/fx/qfxrect.cpp90
-rw-r--r--src/declarative/fx/qfxreflectionfilter.cpp69
-rw-r--r--src/declarative/fx/qfxrepeater.cpp39
-rw-r--r--src/declarative/fx/qfxshadowfilter.cpp28
-rw-r--r--src/declarative/fx/qfxtext.cpp78
-rw-r--r--src/declarative/fx/qfxtextedit.cpp74
-rw-r--r--src/declarative/fx/qfxtransform.cpp259
-rw-r--r--src/declarative/fx/qfxtransform.h22
-rw-r--r--src/declarative/fx/qfxwebview.cpp87
-rw-r--r--src/declarative/opengl/gltexture.cpp1
-rw-r--r--src/declarative/qml/parser/javascript.g180
-rw-r--r--src/declarative/qml/parser/javascriptast_p.h24
-rw-r--r--src/declarative/qml/parser/javascriptgrammar.cpp1218
-rw-r--r--src/declarative/qml/parser/javascriptgrammar_p.h67
-rw-r--r--src/declarative/qml/parser/javascriptlexer.cpp18
-rw-r--r--src/declarative/qml/parser/javascriptparser.cpp512
-rw-r--r--src/declarative/qml/parser/javascriptparser_p.h4
-rw-r--r--src/declarative/qml/qml.pri9
-rw-r--r--src/declarative/qml/qmlcompiler.cpp165
-rw-r--r--src/declarative/qml/qmlcompiler_p.h6
-rw-r--r--src/declarative/qml/qmlcomponent.cpp48
-rw-r--r--src/declarative/qml/qmlcomponent.h7
-rw-r--r--src/declarative/qml/qmlcomponent_p.h3
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp23
-rw-r--r--src/declarative/qml/qmlcompositetypemanager_p.h6
-rw-r--r--src/declarative/qml/qmlcontext.cpp18
-rw-r--r--src/declarative/qml/qmlcustomparser.cpp132
-rw-r--r--src/declarative/qml/qmlcustomparser_p.h (renamed from src/declarative/qml/qmlcustomparser.h)46
-rw-r--r--src/declarative/qml/qmlcustomparser_p_p.h79
-rw-r--r--src/declarative/qml/qmldom.cpp266
-rw-r--r--src/declarative/qml/qmldom.h2
-rw-r--r--src/declarative/qml/qmldom_p.h2
-rw-r--r--src/declarative/qml/qmlerror.cpp180
-rw-r--r--src/declarative/qml/qmlerror.h82
-rw-r--r--src/declarative/qml/qmlinstruction_p.h1
-rw-r--r--src/declarative/qml/qmlmetatype.cpp19
-rw-r--r--src/declarative/qml/qmlmetatype.h32
-rw-r--r--src/declarative/qml/qmlparser.cpp8
-rw-r--r--src/declarative/qml/qmlparser_p.h3
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp173
-rw-r--r--src/declarative/qml/qmlscriptparser_p.h11
-rw-r--r--src/declarative/qml/qmlvme.cpp31
-rw-r--r--src/declarative/qml/qmlvme_p.h5
-rw-r--r--src/declarative/qml/qmlxmlparser.cpp2
-rw-r--r--src/declarative/qml/script/qmlbasicscript.cpp1
-rw-r--r--src/declarative/test/qfxtestview.cpp4
-rw-r--r--src/declarative/timeline/qmltimeline.cpp9
-rw-r--r--src/declarative/util/qbindablemap.cpp4
-rw-r--r--src/declarative/util/qfxview.cpp200
-rw-r--r--src/declarative/util/qfxview.h20
-rw-r--r--src/declarative/util/qmlanimation.cpp139
-rw-r--r--src/declarative/util/qmlanimation_p.h14
-rw-r--r--src/declarative/util/qmlbehaviour.cpp20
-rw-r--r--src/declarative/util/qmlbind.cpp4
-rw-r--r--src/declarative/util/qmlconnection.cpp56
-rw-r--r--src/declarative/util/qmldatetimeformatter.cpp28
-rw-r--r--src/declarative/util/qmlfollow.cpp65
-rw-r--r--src/declarative/util/qmlfollow.h3
-rw-r--r--src/declarative/util/qmllistmodel.cpp389
-rw-r--r--src/declarative/util/qmllistmodel.h34
-rw-r--r--src/declarative/util/qmlscript.cpp8
-rw-r--r--src/declarative/util/qmlsetproperties.cpp14
-rw-r--r--src/declarative/util/qmlstateoperations.cpp42
-rw-r--r--src/declarative/util/qmltransition.cpp6
-rw-r--r--src/gui/painting/qpainterpath.cpp2
105 files changed, 4092 insertions, 2732 deletions
diff --git a/src/3rdparty/easing/legal.qdoc b/src/3rdparty/easing/legal.qdoc
index 25f67e1..1be5f66 100644
--- a/src/3rdparty/easing/legal.qdoc
+++ b/src/3rdparty/easing/legal.qdoc
@@ -1,7 +1,7 @@
/*!
\page legal-easing.html
\title Easing Equations by Robert Penner
-\ingroup animation
+\ingroup group_animation
\legalese
\code
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 6c55a77..f2d8668 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -41,7 +41,7 @@
/*!
\class QAbstractAnimation
- \ingroup animation
+ \ingroup group_animation
\brief The QAbstractAnimation class provides an abstract base class for animations.
\since 4.5
\preliminary
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index c4066ce..8c9f358 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -43,7 +43,7 @@
\class QAnimationGroup
\brief The QAnimationGroup class is an abstract base class for group of animations.
\since 4.5
- \ingroup animation
+ \ingroup group_animation
\preliminary
QAnimationGroup represents a group of animations, such as parallel or sequential,
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index 407ffde..a75f85c 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -43,7 +43,7 @@
\class QParallelAnimationGroup
\brief The QParallelAnimationGroup class provides a parallel group of animations.
\since 4.5
- \ingroup animation
+ \ingroup group_animation
\preliminary
The animations are all started at the same time, and run in parallel. The animation group
diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp
index 30ea92c..86c3049 100644
--- a/src/corelib/animation/qpauseanimation.cpp
+++ b/src/corelib/animation/qpauseanimation.cpp
@@ -43,7 +43,7 @@
\class QPauseAnimation
\brief The QPauseAnimation class provides a pause for QSequentialAnimationGroup.
\since 4.5
- \ingroup animation
+ \ingroup group_animation
\preliminary
*/
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 9a0c5bc..6b03c33 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -42,7 +42,7 @@
/*!
\class QPropertyAnimation
\brief The QPropertyAnimation class animates properties for QObject(and QWidget)
- \ingroup animation
+ \ingroup group_animation
\preliminary
This class is part of {The Animation Framework}. You can use QPropertyAnimation
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 61ff98d..45673c2 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -43,7 +43,7 @@
\class QSequentialAnimationGroup
\brief The QSequentialAnimationGroup class provides a sequential group of animations.
\since 4.5
- \ingroup animation
+ \ingroup group_animation
\preliminary
The first animation in the group is started first, and when it finishes, the next animation
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index 9f8cbf0..29819e5 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QVariantAnimation
- \ingroup animation
+ \ingroup group_animation
\brief The QVariantAnimation class provides an abstract base class for animations.
\since 4.5
\preliminary
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 4b4dfe5..efd0938 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -291,7 +291,7 @@ QEvent::~QEvent()
/*!
\property QEvent::accepted
- the accept flag of the event object
+ \brief The accept flag of the event object
Setting the accept parameter indicates that the event receiver
wants the event. Unwanted events might be propagated to the parent
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index a1a0d1f..da86442 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -53,7 +53,7 @@
/*!
\class QEasingCurve
- \ingroup animation
+ \ingroup group_animation
\brief The QEasingCurve class provides easing curves for controlling animation.
Easing curves describe a function that controls how the speed of the interpolation
diff --git a/src/declarative/extra/qmlnumberformatter.cpp b/src/declarative/extra/qmlnumberformatter.cpp
index 8772305..1549525 100644
--- a/src/declarative/extra/qmlnumberformatter.cpp
+++ b/src/declarative/extra/qmlnumberformatter.cpp
@@ -72,8 +72,8 @@ public:
In the following example, the text element will display the text "1,234.57".
\code
- <NumberFormatter id="Formatter" number="1234.5678" format="##,##0.##"/>
- <Text text="{Formatter.text}"/>
+ NumberFormatter { id: Formatter; number: 1234.5678; format: "##,##0.##" }
+ Text { text: Formatter.text }
\endcode
*/
diff --git a/src/declarative/extra/qmlsqlconnection.cpp b/src/declarative/extra/qmlsqlconnection.cpp
index 7f1fec2..a39aa6f 100644
--- a/src/declarative/extra/qmlsqlconnection.cpp
+++ b/src/declarative/extra/qmlsqlconnection.cpp
@@ -67,6 +67,26 @@ public:
/*!
\qmlclass SqlConnection QmlSqlConnection
\brief The SqlConnection element describes a connection to an SQL database.
+
+ The SqlConnection element works in a similar way to
+ QSqlDatabase::addDatabase(). It allows setting the database properties
+ such that the connection does not need to be set up in C++ code.
+ It differs from QSqlDatabase::addDatabase() in that it will automatically
+ open the database.
+
+ The database can then either be used from an SqlQuery element using its id
+ as a bind, or using its name. If the database is set up externally to
+ 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>
+ \endqml
*/
/*!
@@ -142,32 +162,9 @@ public:
*/
/*!
+ \internal
\class QmlSqlConnection
\brief The QmlSqlConnection class manages a connection to an SQL database.
-
- \qmltext
-
- The SqlConnection element works in a similar way to
- QSqlDatabase::addDatabase(). It allows setting the database properties
- such that the connection does not need to be set up in C++ code.
- It differs from QSqlDatabase::addDatabase() in that it will automatically
- open the database.
-
- The database can then either be used from an SqlQuery element using its id
- as a bind, or using its name. If the database is set up externally to
- 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>
- \endqml
-
- \endqmltext
*/
/*!
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
index 39f4c1e..70b3bdd 100644
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ b/src/declarative/extra/qmlsqlquery.cpp
@@ -67,16 +67,8 @@ public:
/*!
\qmlclass SqlBind QmlSqlBind
- \brief the SqlBind element specifies a value binding for an SqlQuery element.
-*/
+ \brief The SqlBind element specifies a value binding for an SqlQuery element.
-/*!
- \class QmlSqlBind
- \brief The QmlSqlBind class specifies a value binding for a QmlSqlQuery.
-
- \qmltext
-
- \qml
By using bindings its possible to cause a SqlQuery to update itself
when values bound through the SqlBind change. Hence in the example
below the results for the SqlQuery will change as searchText changes.
@@ -84,6 +76,7 @@ public:
If the query is not a SELECT statement, the effects of the bound
values will only apply when the SqlQuery exec() slot is called.
+ \qml
<SqlQuery>
SELECT * FROM mytable WHERE name LIKE :value
<bindings>
@@ -97,7 +90,12 @@ public:
</bindings>
<SqlQuery>
\endqml
- \endqmltext
+*/
+
+/*!
+ \internal
+ \class QmlSqlBind
+ \brief The QmlSqlBind class specifies a value binding for a QmlSqlQuery.
*/
/*!
@@ -235,13 +233,7 @@ public:
/*!
\qmlclass SqlQuery QmlSqlQuery
\brief The SqlQuery element describes a query into an SQL database.
-*/
-
-/*
- \class QmlSqlQuery
- \brief the QmlSqlQuery class manages a query into an SQL database.
- \qmltext
The SqlQuery element has three parts. The first is the query itself,
which can either be specified using the query property or by the
default text for the element. The second specifies the connection
@@ -256,11 +248,11 @@ public:
the query.
If the query is a select statement it can be used as a model for a ListView.
- The roles will be the columns of the result set. Use the SQL AS keyword
+ The roles will be the columns of the result set. Use the SQL AS keyword
in the query if you want to override the column names from that of the
table selected. You should also use the AS keyword if there is no
appropriate table column name for the result column.
-
+
\qml
<SqlQuery connection="{qmlConnectionId}" query="DELETE FROM mytable"/>
<SqlQuery connection="connectionName">
@@ -268,7 +260,11 @@ public:
</SqlQuery>
<SqlQuery>SELECT id AS recordId, (firstName || ' ' || lastName) AS fullName FROM mytable</SqlQuery>
\endqml
- \endqmltext
+*/
+
+/*
+ \class QmlSqlQuery
+ \brief the QmlSqlQuery class manages a query into an SQL database.
*/
/*!
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 91c8139..badc6fb 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -74,11 +74,14 @@ QML_DEFINE_TYPE(QmlXmlListModel, XmlListModel);
The following is an example of a model containing news from a Yahoo RSS feed:
\qml
- <XmlListModel id="FeedModel" src="http://rss.news.yahoo.com/rss/oceania" query="doc($src)/rss/channel/item">
- <Role name="title" query="title/string()"/>
- <Role name="link" query="link/string()"/>
- <Role name="description" query="description/string()" isCData="true"/>
- </XmlListModel>
+ XmlListModel {
+ id: FeedModel
+ source: "http://rss.news.yahoo.com/rss/oceania"
+ query: "doc($src)/rss/channel/item"
+ Role { name: "title"; query: "title/string()" }
+ Role { name: "link"; query: "link/string()" }
+ Role { name: "description"; query: "description/string()"; isCData: true }
+ }
\endqml
\note The model is currently static, so the above is really just a snapshot of an RSS feed.
*/
@@ -343,7 +346,7 @@ void QmlXmlListModel::doSubquery(int index) const
s.replace(QLatin1String("&gt;"), QLatin1String(">"));
s.replace(QLatin1String("&amp;"), QLatin1String("&"));
}
- resultList << s;
+ resultList << s.trimmed();
//qDebug() << s;
}
b.seek(0);
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index f537da9..540e1cb 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -151,7 +151,7 @@ void QFxAnchors::fillChanged()
/*!
\property QFxAnchors::fill
- \brief what item the item should fill.
+ \brief which item the item should fill.
This is a convenience property. It is the same as anchoring the left, right, top, and bottom
to another item's left, right, top, and bottom.
@@ -200,7 +200,7 @@ void QFxAnchors::setFill(QFxItem *f)
/*!
\property QFxAnchors::centeredIn
- \brief what item the item should stay centered in the middle of.
+ \brief which item the item should stay centered in.
This is a convenience property. It is the same as anchoring the horizontalCenter
and verticalCenter to another item's horizontalCenter and verticalCenter.
diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp
index 8f930d5..7a1cb7f 100644
--- a/src/declarative/fx/qfxanimatedimageitem.cpp
+++ b/src/declarative/fx/qfxanimatedimageitem.cpp
@@ -66,13 +66,15 @@ QT_BEGIN_NAMESPACE
\row
\o \image animatedimageitem.gif
\o
- \code
-<Item width="{anim.width}" height="{anim.height+8}">
- <AnimatedImage id="anim" file="pics/games-anim.gif"/>
- <Rect color="red" width="4" height="8" y="{anim.height}"
- x="{(anim.width-width)*anim.currentFrame/(anim.frameCount-1)}"/>
-</Item>
- \endcode
+ \qml
+Item {
+ width: anim.width; height: anim.height+8
+ AnimatedImage { id: anim; source: "pics/games-anim.gif" }
+ Rect { color: "red"; width: 4; height: 8; y: anim.height
+ x: (anim.width-width)*anim.currentFrame/(anim.frameCount-1)
+ }
+}
+ \endqml
\endtable
*/
QML_DEFINE_TYPE(QFxAnimatedImageItem, AnimatedImage);
diff --git a/src/declarative/fx/qfxblurfilter.cpp b/src/declarative/fx/qfxblurfilter.cpp
index ad3eebc..baa2253 100644
--- a/src/declarative/fx/qfxblurfilter.cpp
+++ b/src/declarative/fx/qfxblurfilter.cpp
@@ -64,25 +64,28 @@ public:
\brief The Blur filter blurs an item and its contents.
\inherits Filter
- Blurring reduces the clarity of a visual element. The following example
+ Blurring reduces the clarity of a visual item. The following example
shows an icon at a blur radius of 0, 5 and 10.
\table
\row
\o
- \code
- <HorizontalLayout>
- <Image src="icon.png">
- <filter><Blur radius="0" /></filter>
- </Image>
- <Image src="icon.png">
- <filter><Blur radius="5" /></filter>
- </Image>
- <Image src="icon.png">
- <filter><Blur radius="10" /></filter>
- </Image>
- </HorizontalLayout>
- \endcode
+ \qml
+HorizontalLayout {
+ Image {
+ source: "icon.png"
+ filter: Blur { radius: 0 }
+ }
+ Image {
+ source: "icon.png"
+ filter: Blur { radius: 5 }
+ }
+ Image {
+ source: "icon.png"
+ filter: Blur { radius: 10 }
+ }
+}
+ \endqml
\row
\o \image blur_example.png
\endtable
@@ -110,7 +113,9 @@ QFxBlurFilter::~QFxBlurFilter()
/*!
\qmlproperty real Blur::radius
- Sets the blur kernel radius. The larger the radius the more blurry the item will appear. A radius of 0 (or less) is equivalent to no blur.
+ Sets the blur kernel radius.
+ The larger the radius the more blurry the item will appear.
+ A radius of 0 (or less) is equivalent to no blur.
*/
/*!
diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp
index 5343f7d..9645e77 100644
--- a/src/declarative/fx/qfxcomponentinstance.cpp
+++ b/src/declarative/fx/qfxcomponentinstance.cpp
@@ -58,17 +58,18 @@ QML_DEFINE_TYPE(QFxComponentInstance,ComponentInstance);
/*!
\qmlclass ComponentInstance QFxComponentInstance
- \brief The ComponentInstance element allows you to instantiate a \l{qml-component.html} {Component}.
+ \brief The ComponentInstance item allows you to instantiate a \l{qml-component.html} {Component}.
- \code
- <Item>
- <Component id="RedSquare">
- <Rect color="red" width="10" height="10"/>
- </Component>
+ \qml
+ Item {
+ Component {
+ id: RedSquare
+ Rect { color: "red"; width: 10; height: 10 }
+ }
- <ComponentInstance component="{RedSquare}"/>
- </Item>
- \endcode
+ ComponentInstance { component: RedSquare }
+ }
+ \endqml
*/
QFxComponentInstance::QFxComponentInstance(QFxItem *parent)
: QFxItem(*(new QFxComponentInstancePrivate), parent)
diff --git a/src/declarative/fx/qfxcontentwrapper.cpp b/src/declarative/fx/qfxcontentwrapper.cpp
index a155d2b..2b95ff6 100644
--- a/src/declarative/fx/qfxcontentwrapper.cpp
+++ b/src/declarative/fx/qfxcontentwrapper.cpp
@@ -108,22 +108,31 @@ QML_DEFINE_TYPE(QFxContent,Content);
specified by Content.
Example:
- \code
- <!--GroupBox component definition-->
- <Rect width="{parent.width}" color="white" pen.width="2" pen.color="#adaeb0" radius="10" clip="false" height="{contents.height}">
- <VerticalLayout id="layout" width="{parent.width}">
- <Content/>
- </VerticalLayout>
- </Rect>
-
- <!--component use-->
- <GroupBox>
- <content>
- <Text text="First Item"/>
- ...
- </content>
- </GroupBox>
- \endcode
+ \qml
+// GroupBox component definition
+Rect {
+ width: parent.width
+ color: "white"
+ pen.width: 2
+ pen.color: "#adaeb0"
+ radius: 10
+ clip: false
+ height: contents.height
+ VerticalLayout {
+ id: layout
+ width: parent.width
+ Content { } // content property will go here
+ }
+}
+
+// component use
+GroupBox {
+ content: Text {
+ text: "First Item"
+ ...
+ }
+}
+ \endqml
*/
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxevents.cpp b/src/declarative/fx/qfxevents.cpp
index 7d04f5d..195d1e5 100644
--- a/src/declarative/fx/qfxevents.cpp
+++ b/src/declarative/fx/qfxevents.cpp
@@ -44,17 +44,18 @@
QT_BEGIN_NAMESPACE
/*!
\qmlclass KeyEvent QFxKeyEvent
- \brief The KeyEvent element provides information about a key event.
+ \brief The KeyEvent object provides information about a key event.
For example, the following changes the Item's state property when the Enter
key is pressed:
- \code
- <Item focus="true">
- <onKeyPress>if (event.key == Qt.Key_Enter) state = 'ShowDetails';</onKeyPress>
- </Item>
- \endcode
-
- The \l KeyActions element could also be used to achieve the above with
+ \qml
+Item {
+ focus: true
+ onKeyPress: { if (event.key == Qt.Key_Enter) state = 'ShowDetails'; }
+}
+ \endqml
+
+ The \l KeyActions object could also be used to achieve the above with
a clearer syntax.
\sa KeyActions
@@ -106,7 +107,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass MouseEvent QFxMouseEvent
- \brief The MouseEvent element provides information about a mouse event.
+ \brief The MouseEvent object provides information about a mouse event.
The position of the mouse can be found via the x and y properties.
The button that caused the event is available via the button property.
@@ -168,15 +169,11 @@ QT_BEGIN_NAMESPACE
\endlist
For example, to react to a Shift key + Left mouse button click:
- \code
- <MouseRegion>
- <onClick>
- <![CDATA[
- if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) doSomething();
- ]]>
- </onclick>
- </MouseRegion>
- \endcode
+ \qml
+MouseRegion {
+ onClick: { if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) doSomething(); }
+}
+ \endqml
*/
QML_DEFINE_NOCREATE_TYPE(QFxKeyEvent);
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index 671d65d..52b142b 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -226,15 +226,16 @@ QML_DEFINE_TYPE(QFxFlickable,Flickable);
/*!
\qmlclass Flickable
- \brief The Flickable element provides a surface that can be "flicked".
+ \brief The Flickable item provides a surface that can be "flicked".
\inherits Item
Flickable places its children on a surface that can be dragged and flicked.
\code
- <Flickable width="200" height="200" viewportWidth="{image.width}" viewportHeight="{image.height}">
- <Image id="image" file="bigimage.png"/>
- </Flickable>
+ Flickable {
+ width: 200; height: 200; viewportWidth: image.width; viewportHeight: image.height
+ Image { id: image; source: "bigimage.png" }
+ }
\endcode
\image flickable.gif
@@ -257,9 +258,10 @@ QML_DEFINE_TYPE(QFxFlickable,Flickable);
QFxFlickable allows its children to be dragged and flicked.
\code
-<Flickable width="320" height="480" viewportWidth="{image.width}" viewportHeight="{image.height}">
- <Image id="image" file="bigimage.png"/>
-</Flickable>
+Flickable {
+ width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height
+ Image { id: image; source: "bigimage.png" }
+}
\endcode
Note that QFxFlickable does not automatically clip its contents. If
@@ -475,9 +477,11 @@ bool QFxFlickable::isAtYBeginning() const
These properties are typically used to draw a scrollbar, for example:
\code
- <Rect opacity="0.5" anchors.right="{MyListView.right-2}" width="6"
- y="{MyListView.pageYPosition * MyListView.height}"
- height="{MyListView.pageHeight * MyListView.height}"/>
+ Rect {
+ opacity: 0.5; anchors.right: MyListView.right-2; width: 6
+ y: MyListView.pageYPosition * MyListView.height
+ height: MyListView.pageHeight * MyListView.height
+ }
\endcode
*/
qreal QFxFlickable::pageWidth() const
@@ -879,9 +883,10 @@ void QFxFlickable::setOverShoot(bool o)
should be set to the combined size of the items placed in the Flickable.
\code
- <Flickable width="320" height="480" viewportWidth="{image.width}" viewportHeight="{image.height}">
- <Image id="image" file="bigimage.png"/>
- </Flickable>
+ Flickable {
+ width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height
+ Image { id: image; source: "bigimage.png" }
+ }
\endcode
*/
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
index 1d15827..db390d2 100644
--- a/src/declarative/fx/qfxflipable.cpp
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -58,40 +58,50 @@ public:
QFxItem *front;
QFxItem *back;
QFxAxis *axis;
- QFxRotation axisRotation;
+ QFxRotation3D axisRotation;
qreal rotation;
};
/*!
\qmlclass Flipable QFxFlipable
- \brief The Flipable element provides a surface that can be flipped.
+ \brief The Flipable item provides a surface that can be flipped.
\inherits Item
Flipable allows you to specify a front and a back and then flip between those sides.
- \code
- <Flipable id="flipable" width="40" height="40">
- <axis>
- <Axis startX="20" startY="0" endX="20" endY="40" />
- </axis>
- <front>
- <Image src="front.png"/>
- </front>
- <back>
- <Image src="back.png"/>
- </back>
- <states>
- <State name="back">
- <SetProperty target="{flipable}" property="rotation" value="180" />
- </State>
- </states>
- <transitions>
- <Transition>
- <NumericAnimation easing="easeInOutQuad" properties="rotation"/>
- </Transition>
- </transitions>
- </Flipable>
- \endcode
+ \qml
+Flipable {
+ id: flipable
+ width: 40
+ height: 40
+ axis: Axis {
+ startX: 20
+ startY: 0
+ endX: 20
+ endY: 40
+ }
+ front: Image { src: "front.png" }
+ back: Image { src: "back.png" }
+ states: [
+ State {
+ name: "back"
+ SetProperty {
+ target: flipable
+ property: "rotation"
+ value: 180
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ NumericAnimation {
+ easing: "easeInOutQuad"
+ properties: "rotation"
+ }
+ }
+ ]
+}
+ \endqml
\image flipable.gif
*/
diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp
index 67c456e..5d62e66 100644
--- a/src/declarative/fx/qfxfocuspanel.cpp
+++ b/src/declarative/fx/qfxfocuspanel.cpp
@@ -47,7 +47,7 @@ QML_DEFINE_TYPE(QFxFocusPanel,FocusPanel);
/*!
\qmlclass FocusPanel
- \brief The FocusPanel element explicitly creates a focus panel.
+ \brief The FocusPanel object explicitly creates a focus panel.
\inherits Item
Focus panels assist in keyboard focus handling when building QML
@@ -73,7 +73,7 @@ QFxFocusPanel::~QFxFocusPanel()
/*!
\qmlproperty bool FocusPanel::active
- Sets whether the element is the active focus panel.
+ Sets whether the object is the active focus panel.
*/
bool QFxFocusPanel::isActive() const
diff --git a/src/declarative/fx/qfxfocusrealm.cpp b/src/declarative/fx/qfxfocusrealm.cpp
index da3f1b2..07849fa 100644
--- a/src/declarative/fx/qfxfocusrealm.cpp
+++ b/src/declarative/fx/qfxfocusrealm.cpp
@@ -47,7 +47,7 @@ QML_DEFINE_TYPE(QFxFocusRealm,FocusRealm);
/*!
\qmlclass FocusRealm
- \brief The FocusRealm element explicitly creates a focus realm.
+ \brief The FocusRealm object explicitly creates a focus realm.
\inherits Item
Focus realms assist in keyboard focus handling when building reusable QML
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index c8b8d27..8416234 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -647,15 +647,15 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex)
/*!
\qmlclass GridView
\inherits Flickable
- \brief The GridView element provides a grid view of items provided by a model.
+ \brief The GridView item provides a grid view of items provided by a model.
The model is typically provided by a QAbstractListModel "C++ model object",
- but can also be created directly in XML.
+ but can also be created directly in QML.
The items are laid out top to bottom (vertically) or left to right (horizontally)
and may be flicked to scroll.
- The below example creates a very simple grid, using an XML model.
+ The below example creates a very simple grid, using a QML model.
\code
<resources>
<ListModel id="contactModel">
@@ -706,7 +706,7 @@ QFxGridView::~QFxGridView()
The C++ model object must be a \l QListModelInterface subclass, a \l VisualModel,
or a simple list.
- Models can also be created directly in XML, using the \l ListModel element. For example:
+ Models can also be created directly in QML, using the \l ListModel object. For example:
\code
<ListModel id="contactModel">
<Contact>
diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp
index 70b50cd..862a698 100644
--- a/src/declarative/fx/qfxhighlightfilter.cpp
+++ b/src/declarative/fx/qfxhighlightfilter.cpp
@@ -73,18 +73,24 @@ public:
\brief The Highlight filter adds a highlight to an item.
\inherits Filter
- \code
-<Text id="highlighttext" color="red" font.size="32" text="Highlight">
- <filter>
- <Highlight src="pics/highlight.png">
- <xOffset>
- <NumericAnimation running="true" repeat="true"
- from="320" to="-320" duration="2000"/>
- </xOffset>
- </Highlight>
- </filter>
-</Text>
- \endcode
+ \qml
+Text {
+ id: highlighttext
+ color: "red"
+ font.size: 32
+ text: "Highlight"
+ filter: Highlight {
+ source: "pics/highlight.png"
+ xOffset: NumericAnimation {
+ running: true
+ repeat: true
+ from: 320
+ to: -320
+ duration: 2000
+ }
+ }
+}
+ \endqml
\image highlight.gif
Highlighting is only supported when Qt Declarative is compiled for OpenGL ES 2.0.
@@ -114,7 +120,7 @@ QFxHighlightFilter::~QFxHighlightFilter()
}
/*!
- \qmlproperty string Highlight::src
+ \qmlproperty string Highlight::source
This property holds the URL of the image to be used as the highlight.
*/
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index a34cd12..53c6137 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -60,37 +60,38 @@ QML_DEFINE_TYPE(QFxImage,Image);
\brief The Image element allows you to add bitmaps to a scene.
\inherits Item
- The Image element supports untransformed, stretched, grid-scaled and tiled images. For an explanation of grid-scaling see the scaleGrid property description or the QFxScaleGrid class description.
+ The Image element supports untransformed, stretched, grid-scaled and tiled images.
+ For an explanation of grid-scaling see the scaleGrid property description
+ or the QFxScaleGrid class description.
Examples:
\table
\row
\o \image declarative-qtlogo1.png
\o Untransformed
- \code
- <Image src="pics/qtlogo.png"/>
- \endcode
+ \qml
+ Image { source: "pics/qtlogo.png" }
+ \endqml
\row
\o \image declarative-qtlogo2.png
\o Stretched
- \code
- <Image width="160" height="160" src="pics/qtlogo.png"/>
- \endcode
+ \qml
+ Image { width: 160; height: 160; source: "pics/qtlogo.png" }
+ \endqml
\row
\o \image declarative-qtlogo4.png
\o Grid-scaled
- \code
- <Image scaleGrid.left="20" scaleGrid.right="10"
- scaleGrid.top="14" scaleGrid.bottom="14"
- width="160" height="160" src="pics/qtlogo.png"/>
- \endcode
+ \qml
+ Image { scaleGrid.left: 20; scaleGrid.right: 10
+ scaleGrid.top: 14; scaleGrid.bottom: 14
+ width: 160; height: 160; source: "pics/qtlogo.png" }
+ \endqml
\row
\o \image declarative-qtlogo3.png
\o Tiled
- \code
- <Image tile="true"
- width="160" height="160" src="pics/qtlogo.png"/>
- \endcode
+ \qml
+ Image { tile: true; width: 160; height: 160; source: "pics/qtlogo.png" }
+ \endqml
\endtable
*/
@@ -102,9 +103,9 @@ QML_DEFINE_TYPE(QFxImage,Image);
\ingroup group_coreitems
Example:
- \code
- <Image src="pics/star.png"/>
- \endcode
+ \qml
+ Image { source: "pics/star.png" }
+ \endqml
A QFxImage object can be instantiated in Qml using the tag \l Image.
*/
@@ -135,7 +136,7 @@ QFxImage::~QFxImage()
This property contains the image currently being displayed by this item,
which may be an empty pixmap if nothing is currently displayed. If this
property is set, the src property will be unset. This property is intended
- to be used only in C++, not in XML.
+ to be used only in C++, not in QML.
*/
QPixmap QFxImage::pixmap() const
{
@@ -199,13 +200,13 @@ QFxScaleGrid *QFxImage::scaleGrid()
bitmap file to its size. If tiling is enabled, the bitmap is repeated as a set
of unscaled tiles, clipped to the size of the Image.
- \code
- <Item>
- <Image src="tile.png" />
- <Image x="80" width="100" height="100" src="tile.png" />
- <Image x="190" width="100" height="100" tile="true" src="tile.png" />
- </Item>
- \endcode
+ \qml
+ Item {
+ Image { source: "tile.png" }
+ Image { x: 80; width: 100; height: 100; src: "tile.png" }
+ Image { x: 190; width: 100; height: 100; tile: true; src: "tile.png" }
+ }
+ \endqml
\image declarative-image_tile.png
If both tiling and the scaleGrid are set, tiling takes precedence.
@@ -812,7 +813,7 @@ QFxImage::Status QFxImage::status() const
*/
/*!
- \property QFxImage::src
+ \property QFxImage::source
\brief the url of the image to be displayed in this item.
The content specified can be of any image type loadable by QImage. Alternatively,
diff --git a/src/declarative/fx/qfximageitem.cpp b/src/declarative/fx/qfximageitem.cpp
index 52ab009..d751845 100644
--- a/src/declarative/fx/qfximageitem.cpp
+++ b/src/declarative/fx/qfximageitem.cpp
@@ -58,10 +58,10 @@ QT_BEGIN_NAMESPACE
/*!
\class QFxImageItem
- \brief The QFxImageItem class is an abstract base class for QFxView items that render using QPainter.
+ \brief The QFxImageItem class is an abstract base class for QFxView items that want cached painting.
\ingroup group_coreitems
- This is a convenience class allowing easy use of a QPainter within a custom
+ This is a convenience class allowing easy use of cached painting within a custom
item. The contents of the item are are cached behind the scenes.
The dirtyCache() function should be called if the contents change to
ensure the cache is refreshed the next time painting occurs.
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 11b7dd3..84dc484 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -206,7 +206,7 @@ void QFxContents::setItem(QFxItem *item)
/*!
\qmlclass Item QFxItem
- \brief The Item element is the most basic of all visual canvas members.
+ \brief The Item is the most basic of all visual items in QML.
*/
/*!
@@ -214,19 +214,32 @@ void QFxContents::setItem(QFxItem *item)
\brief The QFxItem class is a generic QFxView item. It is the base class for all other view items.
\qmltext
- All visual elements in Qt Declarative inherit from QFxItem. Although QFxItem
+ All visual items in Qt Declarative inherit from QFxItem. Although QFxItem
has no visual appearance, it defines all the properties that are
- common across visual elements - like the x and y position, and the
+ common across visual items - like the x and y position, and the
width and height.
- QFxItem is also useful for grouping elements together.
+ QFxItem is also useful for grouping items together.
\qml
- <Item>
- <Image file="tile.png" />
- <Image x="80" width="100" height="100" file="tile.png" />
- <Image x="190" width="100" height="100" tile="true" file="tile.png" />
- </Item>
+ Item {
+ Image {
+ file: "tile.png"
+ }
+ Image {
+ x: 80
+ width: 100
+ height: 100
+ file: "tile.png"
+ }
+ Image {
+ x: 190
+ width: 100
+ height: 100
+ tile: true
+ file: "tile.png"
+ }
+ }
\endqml
\endqmltext
@@ -260,7 +273,7 @@ void QFxContents::setItem(QFxItem *item)
via the baselineOffset property.
The baseline corresponds to the baseline of the text contained in
- the element. It is useful for aligning the text in items placed
+ the item. It is useful for aligning the text in items placed
beside each other. The default baseline is positioned at
2/3 of the height of the item.
*/
@@ -335,7 +348,9 @@ void QFxContents::setItem(QFxItem *item)
The key event is available via the KeyEvent \a event.
\qml
- <Item onKeyPress="if (event.key == Qt.Key_Enter) state='Enter'"/>
+ Item {
+ onKeyPress: { if (event.key == Qt.Key_Enter) state='Enter' }
+ }
\endqml
*/
@@ -347,7 +362,9 @@ void QFxContents::setItem(QFxItem *item)
The key event is available in via the KeyEvent \a event.
\qml
- <Item onKeyRelease="if (event.key == Qt.Key_Enter) state='Enter'"/>
+ Item {
+ onKeyRelease: { if (event.key == Qt.Key_Enter) state='Enter' }
+ }
\endqml
*/
@@ -429,9 +446,13 @@ QFxItem::~QFxItem()
\image declarative-transformorigin.png
This example scales an image about its center.
- \code
- <Image src="myimage.png" transformOrigin="Center" scale="4" />
- \endcode
+ \qml
+ Image {
+ src: "myimage.png"
+ transformOrigin: "Center"
+ scale: 4
+ }
+ \endqml
The default transform origin is \c TopLeft.
*/
@@ -522,7 +543,7 @@ QFxItem *QFxItem::itemParent() const
\qmlproperty list<Item> Item::children
\qmlproperty list<Object> Item::resources
- The children property contains the list of visual children of this element.
+ The children property contains the list of visual children of this item.
The resources property contains non-visual resources that you want to
reference by name.
@@ -702,7 +723,7 @@ void QFxItemPrivate::children_clear()
\default
The data property is allows you to freely mix visual children and resources
- of an element. If you assign a visual element to the data list it becomes
+ of an item. If you assign a visual item to the data list it becomes
a child and if you assign any other object type, it is added as a resource.
So you can write:
@@ -1583,12 +1604,20 @@ void QFxItem::setKeepMouseGrab(bool keep)
d->_keepMouse = keep;
}
-void QFxItem::activeFocusChanged(bool)
+/*!
+ This function emits the \e activeFocusChanged signal.
+ \a flag is not used.
+ */
+void QFxItem::activeFocusChanged(bool flag)
{
emit activeFocusChanged();
}
-void QFxItem::focusChanged(bool)
+/*!
+ This function emits the \e focusChanged signal.
+ \a flag is not used.
+ */
+void QFxItem::focusChanged(bool flag)
{
emit focusChanged();
}
@@ -1676,7 +1705,7 @@ QmlList<QmlTransition *>* QFxItem::transitions()
the item, or giving it a \l Reflection. Some
filters may not be available on all canvases; if a filter is not
available on a certain canvas, it will simply not be applied for
- that canvas (but the XML will still be considered valid).
+ that canvas (but the QML will still be considered valid).
\qml
<Item>
@@ -1926,7 +1955,7 @@ void QFxItem::classComplete()
}
/*!
- componentComplete() is called when all elements in the component
+ componentComplete() is called when all items in the component
have been constructed. It is often desireable to delay some
processing until the component is complete an all bindings in the
component have been resolved.
diff --git a/src/declarative/fx/qfxkeyactions.cpp b/src/declarative/fx/qfxkeyactions.cpp
index 69d4679..a07f047 100644
--- a/src/declarative/fx/qfxkeyactions.cpp
+++ b/src/declarative/fx/qfxkeyactions.cpp
@@ -169,22 +169,22 @@ void QFxKeyActionsPrivate::setBit(int b, bool v)
/*!
\qmlclass KeyActions
- \brief The KeyActions element enables simple key handling.
+ \brief The KeyActions item enables simple key handling.
\inherits Item
KeyActions is typically used in basic key handling scenarios where writing
JavaScript key handling routines would be unnecessarily complicated. The
- KeyActions element has a collection of properties that correspond to a
- selection of common keys. When a given key is pressed, the element executes
+ KeyActions item has a collection of properties that correspond to a
+ selection of common keys. When a given key is pressed, the item executes
the action script assigned to the matching property. If no action has
- been set the KeyActions element does nothing.
+ been set the KeyActions item does nothing.
To receive (and susequently respond to) key presses, the KeyActions class
- must be in the current focus chain, just like any other element.
+ must be in the current focus chain, just like any other item.
For basic mouse handling, see \l MouseRegion.
- KeyActions is an invisible element: it is never painted.
+ KeyActions is an invisible item: it is never painted.
*/
QFxKeyActions::QFxKeyActions(QFxItem *parent)
: QFxItem(parent), d(new QFxKeyActionsPrivate)
@@ -221,7 +221,7 @@ void QFxKeyActionsPrivate::setKeyExpr(Qt::Key k, const QString &expr)
\qmlproperty bool KeyActions::enabled
Enables or disables KeyActions' key handling. When not enabled, the
- KeyActions instance does not respond to any key presses. The element is
+ KeyActions instance does not respond to any key presses. The item is
enabled by default.
*/
bool QFxKeyActions::enabled() const
@@ -244,9 +244,9 @@ void QFxKeyActions::setEnabled(bool e)
The action to take for the given letter.
The following example sets actions for the 'c' and 'x' keys.
- \code
- <KeyActions keyC="print('c is for cookie')" keyX="print('I like cookies')" />
- \endcode
+ \qml
+ KeyActions { keyC: "print('c is for cookie')"; keyX: "print('I like cookies')" }
+ \endqml
*/
QString QFxKeyActions::key_A() const
{
@@ -518,9 +518,9 @@ void QFxKeyActions::setKey_Z(const QString &s)
The action to take for the given arrow key.
The following example sets actions for the left and right arrow keys.
- \code
- <KeyActions leftArrow="print('You pressed left')" rightArrow="print('You pressed right')" />
- \endcode
+ \qml
+ KeyActions { leftArrow: "print('You pressed left')"; rightArrow: "print('You pressed right')" }
+ \endqml
*/
QString QFxKeyActions::key_Left() const
@@ -569,9 +569,9 @@ void QFxKeyActions::setKey_Down(const QString &s)
The action to take for the given number key.
The following example sets actions for the '5' and '6' keys.
- \code
- <KeyActions digit5="print('5 is a prime number')" digit6="print('6 is a composite number')" />
- \endcode
+ \qml
+ KeyActions { digit5: "print('5 is a prime number')"; digit6: "print('6 is a composite number')"; focus: true }
+ \endqml
*/
QString QFxKeyActions::key_0() const
@@ -736,7 +736,7 @@ void QFxKeyActions::setKey_Space(const QString &s)
/*!
\qmlproperty string KeyActions::escape
- \qmlproperty string KeyActions::return
+ \qmlproperty string KeyActions::keyReturn
\qmlproperty string KeyActions::enter
\qmlproperty string KeyActions::delete
\qmlproperty string KeyActions::space
@@ -744,9 +744,9 @@ void QFxKeyActions::setKey_Space(const QString &s)
The action to take for the given utility key.
The following example sets an action for the space key.
- \code
- <KeyActions space="print('Space pressed')" />
- \endcode
+ \qml
+ KeyActions { space: "print('Space pressed')" }
+ \endqml
*/
/*!
@@ -765,9 +765,9 @@ void QFxKeyActions::setKey_Space(const QString &s)
The action to take for the given device key.
The following example sets an action for the hangup key.
- \code
- <KeyActions hangup="print('Go away now')" />
- \endcode
+ \qml
+ KeyActions { hangup: "print('Go away now')" }
+ \endqml
*/
QString QFxKeyActions::key_Back() const
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index 6d92441..6d9c6ab 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -47,7 +47,7 @@ QML_DEFINE_TYPE(QFxKeyProxy,KeyProxy);
/*!
\qmlclass KeyProxy
- \brief The KeyProxy element proxies key presses to a number of other elements.
+ \brief The KeyProxy item proxies key presses to a number of other items.
\inherits Item
*/
@@ -55,7 +55,7 @@ QML_DEFINE_TYPE(QFxKeyProxy,KeyProxy);
/*!
\internal
\class QFxKeyProxy
- \brief The QFxKeyProxy class proxies key presses to a number of other elements.
+ \brief The QFxKeyProxy class proxies key presses to a number of other items.
\ingroup group_utility
*/
diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp
index 76afeb0..85b198e 100644
--- a/src/declarative/fx/qfxlayouts.cpp
+++ b/src/declarative/fx/qfxlayouts.cpp
@@ -127,15 +127,18 @@ void QFxBaseLayout::setMargin(int s)
\property QFxBaseLayout::move
\brief the transition when moving an item.
- \code
- <BaseLayout id="layout" y="0">
- <move>
- <Transition>
- <NumericAnimation properties="y" ease="easeOutBounce" />
- </Transition>
- </move>
- </BaseLayout>
- \endcode
+ \qml
+BaseLayout {
+ id: layout
+ y: 0
+ move: Transition {
+ NumericAnimation {
+ properties: "y"
+ ease: "easeOutBounce"
+ }
+ }
+}
+ \endqml
*/
QmlTransition *QFxBaseLayout::move() const
{
@@ -153,15 +156,21 @@ void QFxBaseLayout::setMove(QmlTransition *mt)
\property QFxBaseLayout::add
\brief the transition when adding an item.
- \code
- <BaseLayout id="layout" y="0">
- <add>
- <Transition >
- <NumericAnimation target="{layout.item}" properties="opacity" from="0" to="1" duration="500" />
- </Transition>
- </add>
- </BaseLayout>
- \endcode
+ \qml
+BaseLayout {
+ id: layout
+ y: 0
+ add: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ }
+ }
+}
+ \endqml
*/
QmlTransition *QFxBaseLayout::add() const
{
@@ -182,15 +191,21 @@ void QFxBaseLayout::setAdd(QmlTransition *add)
Note that the item may be 'removed' because its opacity is zero. This can make certain
transitions difficult to see.
- \code
- <BaseLayout id="layout" y="0">
- <remove>
- <Transition >
- <NumericAnimation target="{layout.item}" properties="opacity" from="1" to="0" duration="500" />
- </Transition>
- </remove>
- </BaseLayout>
- \endcode
+ \qml
+BaseLayout {
+ id: layout
+ y: 0
+ remove: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 1
+ to: 0
+ duration: 500
+ }
+ }
+}
+ \endqml
*/
QmlTransition *QFxBaseLayout::remove() const
{
@@ -433,10 +448,10 @@ void QFxBaseLayout::applyRemove(const QList<QPair<QString, QVariant> >& changes,
QML_DEFINE_TYPE(QFxVerticalLayout, VerticalLayout);
/*!
\qmlclass VerticalLayout
- \brief The VerticalLayout element arranges its children in a vertical layout.
+ \brief The VerticalLayout item arranges its children in a vertical layout.
\inherits Item
- The VerticalLayout element arranges its child elements so that they are vertically
+ The VerticalLayout item arranges its child items so that they are vertically
aligned and not overlapping. Spacing between items can be added, as can a margin around all the items.
The below example lays out differently shaped rectangles using a VerticalLayout.
@@ -444,32 +459,34 @@ QML_DEFINE_TYPE(QFxVerticalLayout, VerticalLayout);
\row
\o \image verticalLayout_example.png
\o
- \code
- <VerticalLayout spacing="2">
- <Rect color="red" width="50" height="50"/>
- <Rect color="green" width="20" height="50"/>
- <Rect color="blue" width="50" height="20"/>
- </VerticalLayout>
- \endcode
+ \qml
+VerticalLayout {
+ spacing: 2
+ Rect { color: "red"; width: 50; height: 50 }
+ Rect { color: "green"; width: 20; height: 50 }
+ Rect { color: "blue"; width: 50; height: 20 }
+}
+ \endqml
\endtable
VerticalLayout also provides for transitions to be set when items are added, moved,
- or removed in the layout. Adding and removing apply both to elements which are deleted
+ or removed in the layout. Adding and removing apply both to items which are deleted
or have their position in the document changed so as to no longer be children of the layout,
- as well as to elements which have their opacity set to or from zero so as to appear or disappear.
+ as well as to items which have their opacity set to or from zero so as to appear or disappear.
\table
\row
\o \image verticalLayout_transition.gif
\o
- \code
- <VerticalLayout spacing="2">
- ...
- <remove>...</remove>
- <add>...</add>
- <move>...</move>
- </VerticalLayout>
- \endcode
+ \qml
+VerticalLayout {
+ spacing: 2
+ remove: ...
+ add: ...
+ move: ...
+ ...
+}
+ \endqml
\endtable
@@ -486,17 +503,20 @@ QML_DEFINE_TYPE(QFxVerticalLayout, VerticalLayout);
\row
\o \image layout-remove.gif
\o
- \code
- <VerticalLayout id="layout">
- <remove>
- <Transition >
- <NumericAnimation target="{layout.item}"
- properties="opacity" from="1" to="0"
- duration="500" />
- </Transition>
- </remove>
- </VerticalLayout>
- \endcode
+ \qml
+VerticalLayout {
+ id: layout
+ remove: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 1
+ to: 0
+ duration: 500
+ }
+ }
+}
+ \endqml
\endtable
*/
@@ -510,17 +530,20 @@ QML_DEFINE_TYPE(QFxVerticalLayout, VerticalLayout);
\row
\o \image layout-add.gif
\o
- \code
- <VerticalLayout id="layout">
- <add>
- <Transition >
- <NumericAnimation target="{layout.item}"
- properties="opacity" from="0" to="1"
- duration="500" />
- </Transition>
- </add>
- </VerticalLayout>
- \endcode
+ \qml
+VerticalLayout {
+ id: layout
+ add: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ }
+ }
+}
+ \endqml
\endtable
*/
@@ -534,15 +557,17 @@ QML_DEFINE_TYPE(QFxVerticalLayout, VerticalLayout);
\row
\o \image layout-move.gif
\o
- \code
- <VerticalLayout id="layout">
- <move>
- <Transition>
- <NumericAnimation properties="y" ease="easeOutBounce" />
- </Transition>
- </move>
- </VerticalLayout>
- \endcode
+ \qml
+VerticalLayout {
+ id: layout
+ move: Transition {
+ NumericAnimation {
+ properties: "y"
+ ease: "easeOutBounce"
+ }
+ }
+}
+ \endqml
\endtable
*/
/*!
@@ -624,19 +649,20 @@ void QFxVerticalLayout::doLayout()
QML_DEFINE_TYPE(QFxHorizontalLayout,HorizontalLayout);
/*!
\qmlclass HorizontalLayout
- \brief The HorizontalLayout element arranges its children in a horizontal layout.
+ \brief The HorizontalLayout item arranges its children in a horizontal layout.
\inherits Item
- The HorizontalLayout element arranges its child elements so that they are horizontally aligned and not overlapping. Spacing can be added between the items, and a margin around all items can also be added. It also provides for transitions to be set when items are added, moved, or removed in the layout. Adding and removing apply both to elements which are deleted or have their position in the document changed so as to no longer be children of the layout, as well as to elements which have their opacity set to or from zero so as to appear or disappear.
+ The HorizontalLayout item arranges its child items so that they are horizontally aligned and not overlapping. Spacing can be added between the items, and a margin around all items can also be added. It also provides for transitions to be set when items are added, moved, or removed in the layout. Adding and removing apply both to items which are deleted or have their position in the document changed so as to no longer be children of the layout, as well as to items which have their opacity set to or from zero so as to appear or disappear.
The below example lays out differently shaped rectangles using a HorizontalLayout.
- \code
- <HorizontalLayout spacing="2">
- <Rect color="red" width="50" height="50"/>
- <Rect color="green" width="20" height="50"/>
- <Rect color="blue" width="50" height="20"/>
- </HorizontalLayout>
- \endcode
+ \qml
+HorizontalLayout {
+ spacing: 2
+ Rect { color: "red"; width: 50; height: 50 }
+ Rect { color: "green"; width: 20; height: 50 }
+ Rect { color: "blue"; width: 50; height: 20 }
+}
+ \endqml
\image horizontalLayout_example.png
*/
@@ -648,15 +674,20 @@ QML_DEFINE_TYPE(QFxHorizontalLayout,HorizontalLayout);
Note that if the item counts as removed because its opacity is zero it will not be visible during the transition unless you set the opacity in the transition, like in the below example.
- \code
- <HorizontalLayout id="layout">
- <remove>
- <Transition >
- <NumericAnimation target="{layout.item}" properties="opacity" from="1" to="0" duration="500" />
- </Transition>
- </remove>
- </HorizontalLayout>
- \endcode
+ \qml
+HorizontalLayout {
+ id: layout
+ remove: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 1
+ to: 0
+ duration: 500
+ }
+ }
+}
+ \endqml
*/
/*!
@@ -665,15 +696,20 @@ QML_DEFINE_TYPE(QFxHorizontalLayout,HorizontalLayout);
Added can mean that either the object has been created or reparented, and thus is now a child or the layout, or that the object has had its opacity increased from zero, and thus is now visible.
- \code
- <HorizontalLayout id="layout">
- <add>
- <Transition >
- <NumericAnimation target="{layout.item}" properties="opacity" from="0" to="1" duration="500" />
- </Transition>
- </add>
- </HorizontalLayout>
- \endcode
+ \qml
+HorizontalLayout {
+ id: layout
+ add: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ }
+ }
+}
+ \endqml
*/
/*!
@@ -682,15 +718,17 @@ QML_DEFINE_TYPE(QFxHorizontalLayout,HorizontalLayout);
This can happen when other items are added or removed from the layout, or when items resize themselves.
- \code
- <HorizontalLayout id="layout">
- <move>
- <Transition>
- <NumericAnimation properties="x" ease="easeOutBounce" />
- </Transition>
- </move>
- </HorizontalLayout>
- \endcode
+ \qml
+HorizontalLayout {
+ id: layout
+ move: Transition {
+ NumericAnimation {
+ properties: "x"
+ ease: "easeOutBounce"
+ }
+ }
+}
+ \endqml
*/
/*!
@@ -776,21 +814,21 @@ QML_DEFINE_TYPE(QFxGridLayout,GridLayout);
/*!
\qmlclass GridLayout QFxGridLayout
- \brief The GridLayout element arranges its children in a grid layout.
+ \brief The GridLayout item arranges its children in a grid layout.
\inherits Item
- The GridLayout element arranges its child elements so that they are
+ The GridLayout item arranges its child items so that they are
aligned in a grid and are not overlapping. Spacing can be added
between the items, and a margin around all the items can also be
defined. It also provides for transitions to be set when items are
added, moved, or removed in the layout. Adding and removing apply
- both to elements which are deleted or have their position in the
+ both to items which are deleted or have their position in the
document changed so as to no longer be children of the layout, as
- well as to elements which have their opacity set to or from zero so
+ well as to items which have their opacity set to or from zero so
as to appear or disappear.
The GridLayout defaults to using four columns, and as many rows as
- are necessary to fit all the child elements. The number of rows
+ are necessary to fit all the child items. The number of rows
and/or the number of columns can be constrained by setting the rows
or columns properties. The grid layout calculates a grid with
rectangular cells of sufficient size to hold all items, and then
@@ -802,15 +840,17 @@ QML_DEFINE_TYPE(QFxGridLayout,GridLayout);
\row
\o \image gridLayout_example.png
\o
- \code
- <GridLayout columns="3" spacing="2">
- <Rect color="red" width="50" height="50"/>
- <Rect color="green" width="20" height="50"/>
- <Rect color="blue" width="50" height="20"/>
- <Rect color="cyan" width="50" height="50"/>
- <Rect color="magenta" width="10" height="10"/>
- </GridLayout>
- \endcode
+ \qml
+GridLayout {
+ columns: 3
+ spacing: 2
+ Rect { color: "red"; width: 50; height: 50 }
+ Rect { color: "green"; width: 20; height: 50 }
+ Rect { color: "blue"; width: 50; height: 20 }
+ Rect { color: "cyan"; width: 50; height: 50 }
+ Rect { color: "magenta"; width: 10; height: 10 }
+}
+ \endqml
\endtable
*/
/*!
@@ -826,15 +866,20 @@ QML_DEFINE_TYPE(QFxGridLayout,GridLayout);
zero it will not be visible during the transition unless you set
the opacity in the transition, like in the below example.
- \code
- <GridLayout id="layout">
- <remove>
- <Transition >
- <NumericAnimation target="{layout.item}" properties="opacity" from="1" to="0" duration="500" />
- </Transition>
- </remove>
- </GridLayout>
- \endcode
+ \qml
+GridLayout {
+ id: layout
+ remove: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 1
+ to: 0
+ duration: 500
+ }
+ }
+}
+ \endqml
*/
/*!
@@ -846,15 +891,20 @@ QML_DEFINE_TYPE(QFxGridLayout,GridLayout);
object has had its opacity increased from zero, and thus is now
visible.
- \code
- <GridLayout id="layout">
- <add>
- <Transition >
- <NumericAnimation target="{layout.item}" properties="opacity" from="0" to="1" duration="500" />
- </Transition>
- </add>
- </GridLayout>
- \endcode
+ \qml
+GridLayout {
+ id: layout
+ add: Transition {
+ NumericAnimation {
+ target: layout.item
+ properties: "opacity"
+ from: 0
+ to: 1
+ duration: 500
+ }
+ }
+}
+ \endqml
*/
/*!
@@ -864,15 +914,17 @@ QML_DEFINE_TYPE(QFxGridLayout,GridLayout);
This can happen when other items are added or removed from the layout, or
when items resize themselves.
- \code
- <GridLayout id="layout">
- <move>
- <Transition>
- <NumericAnimation properties="x,y" ease="easeOutBounce" />
- </Transition>
- </move>
- </GridLayout>
- \endcode
+ \qml
+GridLayout {
+ id: layout
+ move: Transition {
+ NumericAnimation {
+ properties: "x,y"
+ ease: "easeOutBounce"
+ }
+ }
+}
+ \endqml
*/
/*!
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index 0724e3a..9d076d0 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -795,40 +795,26 @@ void QFxListViewPrivate::fixupX()
/*!
\qmlclass ListView
\inherits Flickable
- \brief The ListView element provides a list view of items provided by a model.
-
- The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in XML.
+ \brief The ListView item provides a list view of items provided by a model.
+ The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in QML.
The items are laid out vertically or horizontally and may be flicked to scroll.
- The below example creates a very simple vertical list, using an XML model.
+ The below example creates a very simple vertical list, using a QML model.
\image trivialListView.png
- \code
- <resources>
- <ListModel id="contactModel">
- <Contact>
- <firstName>John</firstName>
- <lastName>Smith</lastName>
- </Contact>
- <Contact>
- <firstName>Bill</firstName>
- <lastName>Jones</lastName>
- </Contact>
- <Contact>
- <firstName>Jane</firstName>
- <lastName>Doe</lastName>
- </Contact>
- </ListModel>
- <Component id="contactDelegate">
- <Rect pen.color="blue" z="-1" height="20" width="80" color="white" radius="2">
- <Text id="name" text="{firstName + ' ' + lastName}" font.size="11"/>
- </Rect>
- </Component>
- </resources>
-
- <ListView id="list" width="320" height="240" clip="true"
- model="{contactModel}" delegate="{contactDelegate}"/>
- \endcode
+
+ The user interface defines a delegate to display an item, a highlight,
+ and the ListView which uses the above.
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml 3
+
+ The model is defined as a ListModel using QML:
+ \quotefromfile doc/src/snippets/declarative/listview/dummydata/ContactModel.qml
+ \skipto <ListModel
+ \printuntil </ListModel
+
+ In this case ListModel is a handy way for us to test our UI. In practice
+ the model would be implemented in C++, or perhaps via a SQL data source.
*/
QFxListView::QFxListView(QFxItem *parent)
@@ -851,28 +837,10 @@ QFxListView::~QFxListView()
The model provides a set of data that is used to create the items for the view.
For large or dynamic datasets the model is usually provided by a C++ model object.
- The C++ model object must be a \l QListModelInterface subclass, a \l VisualModel,
+ The C++ model object must be a \l QAbstractItemModel subclass, a \l VisualModel,
or a simple list.
- Models can also be created directly in XML, using the \l ListModel element. For example:
- \code
- <ListModel id="contactModel">
- <Contact>
- <firstName>John</firstName>
- <lastName>Smith</lastName>
- </Contact>
- <Contact>
- <firstName>Bill</firstName>
- <lastName>Jones</lastName>
- </Contact>
- <Contact>
- <firstName>Jane</firstName>
- <lastName>Doe</lastName>
- </Contact>
- </ListModel>
-
- <ListView model="{contactModel}" .../>
- \endcode
+ Models can also be created directly in QML, using a \l ListModel.
*/
QVariant QFxListView::model() const
{
@@ -922,17 +890,7 @@ void QFxListView::setModel(const QVariant &model)
The delegate provides a template describing what each item in the view should look and act like.
Here is an example delegate:
- \code
- <Component id="contactDelegate">
- <Item id="wrapper">
- <Image id="pic" width="100" height="100" file="{portrait}"/>
- <Text id="name" text="{firstName + ' ' + lastName}"
- anchors.left="{pic.right}" anchors.leftMargin="5"/>
- </Item>
- </Component>
- ...
- <ListView delegate="{contactDelegate}" .../>
- \endcode
+ \snippet doc/src/snippets/declarative/listview/listview.qml 0
*/
QmlComponent *QFxListView::delegate() const
{
@@ -1012,13 +970,9 @@ int QFxListView::count() const
The below example demonstrates how to make a simple highlight
for a vertical list.
- \code
- <Component id="ListHighlight">
- <Rect color="lightsteelblue" radius="4"/>
- </Component>
- <ListView highlight="{ListHighlight}">
- \endcode
- \image ListViewHighlight.png
+
+ \snippet doc/src/snippets/declarative/listview/listview.qml 1
+ \image trivialListView.png
\sa autoHighlight
*/
@@ -1043,17 +997,12 @@ void QFxListView::setHighlight(QmlComponent *highlight)
If autoHighlight is true, the highlight will be moved smoothly
to follow the current item. If autoHighlight is false, the
highlight will not be moved by the view, and must be implemented
- by the highlight, for example:
-
- \code
- <Component id="Highlight">
- <Rect id="Wrapper" color="#242424" radius="4" width="320" height="60" >
- <y>
- <Follow source="{Wrapper.ListView.view.current.y}" spring="3" damping="0.2"/>
- </y>
- </Rect>
- </Component>
- \endcode
+ by the highlight. The following example creates a highlight with
+ its motion defined by the spring \l {Follow}:
+
+ \snippet doc/src/snippets/declarative/listview/highlight.qml 1
+
+ \sa highlight
*/
bool QFxListView::autoHighlight() const
{
@@ -1079,11 +1028,18 @@ void QFxListView::setAutoHighlight(bool autoHighlight)
The modes supported are:
\list
\i Free - For Mouse, the current item may be positioned anywhere,
- whether within the visible area, or outside. during Keyboard interaction,
+ whether within the visible area, or outside. During Keyboard interaction,
the current item can move within the visible area, and the view will
scroll to keep the highlight visible.
- \i Snap -
- \i SnapAuto -
+ \i Snap - For mouse, the current item may be positioned anywhere,
+ whether within the visible area, or outside. During keyboard interaction,
+ the current item will be kept in the visible area and will prefer to be
+ positioned at the \l snapPosition, however the view will never scroll
+ beyond the beginning or end of the view.
+ \i SnapAuto - For both mouse and keyboard, the current item will be
+ kept at the \l {snapPosition}. Additionally, if the view is dragged or
+ flicked, the current item will be automatically updated to be the item
+ currently at the snapPosition.
\endlist
*/
QFxListView::CurrentItemPositioning QFxListView::currentItemPositioning() const
@@ -1121,10 +1077,10 @@ void QFxListView::setSnapPosition(int pos)
\qmlproperty enumeration ListView::orientation
This property holds the orientation of the list.
- Possible values are \c Qt::Vertical (default) and \c Qt::Horizontal.
+ Possible values are \c Vertical (default) and \c Horizontal.
Vertical Example:
- \image ListViewVertical.png
+ \image trivialListView.png
Horizontal Example:
\image ListViewHorizontal.png
*/
@@ -1205,24 +1161,15 @@ void QFxListView::setCacheBuffer(int b)
\qmlproperty string ListView::sectionExpression
This property holds the expression to be evaluated for the section attached property.
- Each item in the list has attached properties named \c section and
- \c prevSection. These may be used to place a section header for
- related items. The example below assumes that the model is alphabetically
- sorted. The section expression is the first character of the \c description
- property. If \c section and \c prevSection differ, the item will
- display a section header.
-
- \code
- <Component id="Delegate">
- <Item id="wrapper" x="0" width="240" height="{Separator.height + Desc.height}">
- <Item id="Separator" height="{wrapper.ListView.prevSection != wrapper.ListView.section ? 10 : 0}" width="240">
- <Text text="{wrapper.ListView.section}" anchors.fill="{parent}"/>
- </Item>
- <Text id="Desc" text="{description} width="{parent.width}" height="30"/>
- </Item>
- </Component>
- <ListView anchors.fill="{parent}" sectionExpression="{String(description).charAt(0)}" delegate="{Delegate}" model="{Model}"/>
- \endcode
+ Each item in the list has attached properties named \c ListView.section and
+ \c ListView.prevSection. These may be used to place a section header for
+ related items. The example below assumes that the model is sorted by size of
+ pet. The section expression is the size property. If \c ListView.section and
+ \c ListView.prevSection differ, the item will display a section header.
+
+ \snippet examples/declarative/listview/sections.qml 0
+
+ \image ListViewSections.png
*/
QString QFxListView::sectionExpression() const
{
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index d197c9a..a60ddc4 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -145,15 +145,14 @@ void QFxDrag::setYmax(int m)
/*!
\qmlclass MouseRegion
- \brief The MouseRegion element enables simple mouse handling.
+ \brief The MouseRegion item enables simple mouse handling.
\inherits Item
- A MouseRegion is typically used in conjunction with a visible element, where the MouseRegion effectively 'proxies' mouse handling for that element. For example, we can put a MouseRegion in a Rect that changes the Rect color to red when clicked:
- \code
- <Rect width="100" height="100">
- <MouseRegion anchors.fill="{parent}" onClick="parent.color = 'red';"/>
- </Rect>
- \endcode
+ A MouseRegion is typically used in conjunction with a visible item,
+ where the MouseRegion effectively 'proxies' mouse handling for that
+ item. For example, we can put a MouseRegion in a Rect that changes
+ the Rect color to red when clicked:
+ \snippet doc/src/snippets/declarative/mouseregion.qml 0
Many MouseRegion signals pass a \l {MouseEvent}{mouse} parameter that contains
additional information about the mouse event, such as the position, button,
@@ -161,15 +160,11 @@ void QFxDrag::setYmax(int m)
Below we have the previous
example extended so as to give a different color when you right click.
- \code
- <Rect width="100" height="100">
- <MouseRegion anchors.fill="{parent}" onClick="if (mouse.button==Qt.RightButton) { parent.color='blue';} else { parent.color = 'red';}"/>
- </Rect>
- \endcode
+ \snippet doc/src/snippets/declarative/mouseregion.qml 1
For basic key handling, see \l KeyActions.
- MouseRegion is an invisible element: it is never painted.
+ MouseRegion is an invisible item: it is never painted.
\sa MouseEvent
*/
@@ -578,19 +573,8 @@ QFxDrag *QFxMouseRegion::drag()
\i the min and max properties limit how far the target can be dragged along the corresponding axes.
\endlist
- The following example uses drag to blur an image as it moves to the right:
- \code
- <Item id="blurtest" width="600" height="200">
- <Image id="pic" file="pic.png" anchors.verticalCenter="{parent.verticalCenter}" >
- <filter><Blur radius="{pic.x/10}"/></filter>
- <MouseRegion anchors.fill="{parent}"
- drag.target="{pic}"
- drag.axis="x"
- drag.xmin="0"
- drag.xmax="{blurtest.width-pic.width}" />
- </Image>
- </Item>
- \endcode
+ The following example uses drag to reduce the opacity of an image as it moves to the right:
+ \snippet doc/src/snippets/declarative/drag.qml 0
*/
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxpainted.cpp b/src/declarative/fx/qfxpainted.cpp
index 7c88ce3..68918c3 100644
--- a/src/declarative/fx/qfxpainted.cpp
+++ b/src/declarative/fx/qfxpainted.cpp
@@ -45,12 +45,13 @@
QT_BEGIN_NAMESPACE
/*!
+ \internal
\class QFxPainted
- \brief The QFxPainted class is an abstract base class for QFxView items that paint using QPainter.
+ \brief The QFxPainted class is an abstract base class for QFxView items that want cached painting.
\ingroup group_coreitems
- This is a convenience class allowing easy use of QPainter within a custom item.
+ This is a convenience class allowing easy use of cached painting within a custom item.
The contents of the item are cached behind the scenes. Any time you change the contents
you should call markDirty to make sure the cache is refreshed the next time painting occurs.
diff --git a/src/declarative/fx/qfxpainted.h b/src/declarative/fx/qfxpainted.h
index 32f5dcb..1f22414 100644
--- a/src/declarative/fx/qfxpainted.h
+++ b/src/declarative/fx/qfxpainted.h
@@ -44,12 +44,15 @@
#include <qfxitem.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+/*
+WARNING: INTENDED TO MERGE WITH QFxImageItem
+*/
+
class QFxPaintedPrivate;
class Q_DECLARATIVE_EXPORT QFxPainted : public QFxItem
{
diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp
index 16b3570..45de1a3 100644
--- a/src/declarative/fx/qfxparticles.cpp
+++ b/src/declarative/fx/qfxparticles.cpp
@@ -151,7 +151,7 @@ void QFxParticleMotion::destroy(QFxParticle &particle)
/*!
\qmlclass ParticleMotionLinear
- \brief The ParticleMotionLinear element moves particles linearly.
+ \brief The ParticleMotionLinear object moves particles linearly.
\sa Particles
*/
@@ -175,7 +175,7 @@ void QFxParticleMotionLinear::advance(QFxParticle &p, int interval)
/*!
\qmlclass ParticleMotionGravity
- \brief The ParticleMotionGravity element moves particles towards a point.
+ \brief The ParticleMotionGravity object moves particles towards a point.
\sa Particles
*/
@@ -234,23 +234,37 @@ void QFxParticleMotionGravity::advance(QFxParticle &p, int interval)
/*!
\qmlclass ParticleMotionWander
- \brief The ParticleMotionWander element moves particles in a somewhat random fashion.
+ \brief The ParticleMotionWander object moves particles in a somewhat random fashion.
The particles will continue roughly in the original direction, however will randomly
drift to each side.
The code below produces an effect similar to falling snow.
- \code
- <Rect width="240" height="320" color="black">
- <Particles y="0" width="{parent.width}" height="30"
- src="star.png" lifeSpan="5000" count="50"
- angle="70" angleDeviation="36"
- velocity="30" velocityDeviation="10">
- <ParticleMotionWander xvariance="30" pace="100"/>
- </Particles>
- </Rect>
- \endcode
+ \qml
+Rect {
+ width: 240
+ height: 320
+ color: "black"
+
+ Particles {
+ y: 0
+ width: parent.width
+ height: 30
+ src: "star.png"
+ lifeSpan: 5000
+ count: 50
+ angle: 70
+ angleDeviation: 36
+ velocity: 30
+ velocityDeviation: 10
+ ParticleMotionWander {
+ xvariance: 30
+ pace: 100
+ }
+ }
+}
+ \endqml
\sa Particles
*/
@@ -508,35 +522,59 @@ QML_DEFINE_TYPE(QFxParticles,Particles);
/*!
\qmlclass Particles
- \brief The Particles element generates and moves particles.
+ \brief The Particles object generates and moves particles.
\inherits Item
- The particles created by this element cannot be dealt with directly, they can only be controlled through the parameters of the Particles element. The particles are all the same pixmap, specified by the user.
+ The particles created by this object cannot be dealt with directly, they can only be controlled through the parameters of the Particles object. The particles are all the same pixmap, specified by the user.
- The particles are painted relative to the parent of the Particles element. Moving the
- Particles element will not move the particles already emitted.
+ The particles are painted relative to the parent of the Particles object. Moving the
+ Particles object will not move the particles already emitted.
The below example creates two differently behaving particle sources.
The top one has particles falling from the top like snow,
the lower one has particles expelled up like a fountain.
- \code
- <Rect width="240" height="320" color="black">
- <Particles y="0" width="{parent.width}" height="30"
- src="star.png" lifeSpan="5000" count="50"
- angle="70" angleDeviation="36"
- velocity="30" velocityDeviation="10">
- <ParticleMotionWander xvariance="30" pace="100"/>
- </Particles>
- <Particles y="300" x="120" width="1" height="1"
- src="star.png" lifeSpan="5000" count="200"
- angle="270" angleDeviation="45"
- velocity="50" velocityDeviation="30">
- <ParticleMotionGravity yattractor="1000"
- xattractor="0" acceleration="25"/>
- </Particles>
- </Rect>
- \endcode
+ \qml
+Rect {
+ width: 240
+ height: 320
+ color: "black"
+ Particles {
+ y: 0
+ width: parent.width
+ height: 30
+ src: "star.png"
+ lifeSpan: 5000
+ count: 50
+ angle: 70
+ angleDeviation: 36
+ velocity: 30
+ velocityDeviation: 10
+ ParticleMotionWander {
+ xvariance: 30
+ pace: 100
+ }
+ }
+ Particles {
+ y: 300
+ x: 120
+ width: 1
+ height: 1
+ src: "star.png"
+ lifeSpan: 5000
+ count: 200
+ angle: 270
+ angleDeviation: 45
+ velocity: 50
+ velocityDeviation: 30
+ ParticleMotionGravity {
+ yattractor: 1000
+ xattractor: 0
+ acceleration: 25
+ }
+ }
+}
+ \endqml
\image particles.gif
*/
@@ -658,9 +696,13 @@ void QFxParticles::setCount(int cnt)
example, the following creates particles whose lifeSpan will vary
from 150ms to 250ms:
- \code
- <Particles src="star.png" lifeSpan="200" lifeSpanDeviation="100"/>
- \endcode
+ \qml
+Particles {
+ src: "star.png"
+ lifeSpan: 200
+ lifeSpanDeviation: 100
+}
+ \endqml
*/
/*!
@@ -691,9 +733,13 @@ void QFxParticles::setLifeSpan(int ls)
example, the following creates particles whose lifeSpan will vary
from 150ms to 250ms:
-\code
-<Particles src="star.png" lifeSpan="200" lifeSpanDeviation="100"/>
-\endcode
+\qml
+Particles {
+ src: "star.png"
+ lifeSpan: 200
+ lifeSpanDeviation: 100
+}
+\endqml
\sa QFxParticles::lifeSpan
*/
@@ -765,9 +811,13 @@ void QFxParticles::setFadeOutDuration(int dur)
example, the following creates particles whose initial direction will
vary from 15 degrees to 105 degrees:
- \code
- <Particles src="star.png" angle="60" angleDeviation="90"/>
- \endcode
+ \qml
+Particles {
+ src: "star.png"
+ angle: 60
+ angleDeviation: 90
+}
+ \endqml
*/
/*!
@@ -796,9 +846,13 @@ void QFxParticles::setAngle(qreal angle)
example, the following creates particles whose initial direction will
vary from 15 degrees to 105 degrees:
-\code
-<Particles src="star.png" angle="60" angleDeviation="90"/>
-\endcode
+\qml
+Particles {
+ src: "star.png"
+ angle: 60
+ angleDeviation: 90
+}
+\endqml
\sa QFxParticles::angle
*/
@@ -824,9 +878,13 @@ void QFxParticles::setAngleDeviation(qreal dev)
example, the following creates particles whose initial velocity will
vary from 40 to 60.
- \code
- <Particles src="star.png" velocity="50" velocityDeviation="20"/>
- \endcode
+ \qml
+Particles {
+ src: "star.png"
+ velocity: 50
+ velocityDeviation: 20
+}
+ \endqml
*/
/*!
@@ -855,9 +913,13 @@ void QFxParticles::setVelocity(qreal velocity)
example, the following creates particles whose initial velocity will
vary from 40 to 60.
-\code
-<Particles src="star.png" velocity="50" velocityDeviation="20"/>
-\endcode
+\qml
+Particles {
+ src: "star.png"
+ velocity: 50
+ velocityDeviation: 20
+}
+\endqml
\sa QFxParticles::velocity
*/
diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp
index f08671d..e11658c 100644
--- a/src/declarative/fx/qfxpath.cpp
+++ b/src/declarative/fx/qfxpath.cpp
@@ -57,9 +57,9 @@ QML_DEFINE_TYPE(QFxPathCubic,PathCubic);
/*!
\qmlclass PathElement
- \brief PathElement is the base path element.
+ \brief PathElement is the base path type.
- This element is the base for all path elements. It cannot
+ This type is the base for all path types. It cannot
be instantiated.
\sa Path, PathAttribute, PathPercent, PathLine, PathQuad, PathCubic
@@ -73,13 +73,13 @@ QML_DEFINE_TYPE(QFxPathCubic,PathCubic);
/*!
\qmlclass Path QFxPath
- \brief The Path element defines a path for use by \l PathView.
+ \brief A Path object defines a path for use by \l PathView.
A Path is composed of one or more path segments - PathLine, PathQuad,
PathCubic.
- The spacing of the items along the Path can be adjusted via the
- PathPercent element.
+ The spacing of the items along the Path can be adjusted via a
+ PathPercent object.
PathAttribute allows named attributes with values to be defined
along the path.
@@ -151,11 +151,11 @@ void QFxPath::setStartY(qreal y)
/*!
\qmlproperty list<PathElement> Path::pathElements
- This property holds the elements composing the path.
+ This property holds the objects composing the path.
\default
- A path can contain the following path elements:
+ A path can contain the following path objects:
\list
\i \l PathLine - a straight line to a given position.
\i \l PathQuad - a quadratic Bezier curve to a given position with a control point.
@@ -164,16 +164,7 @@ void QFxPath::setStartY(qreal y)
\i \l PathPercent - a way to spread out items along various segments of the path.
\endlist
- \code
- <Path startX="240" startY="350">
- <PathAttribute name="scale" value="1.0"/>
- <PathAttribute name="opacity" value="1"/>
- <PathQuad x="240" y="150" controlX="660" controlY="250"/>
- <PathAttribute name="scale" value="0.1"/>
- <PathAttribute name="opacity" value="-0.5"/>
- <PathCubic x="240" y="350" control1X="-180" control1Y="250" control2X="0" control2Y="25"/>
- </Path>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 2
*/
QList<QFxPathElement *>* QFxPath::pathElements()
@@ -487,37 +478,21 @@ void QFxCurve::setY(qreal y)
\qmlclass PathAttribute
\brief The PathAttribute allows setting an attribute at a given position in a Path.
- The PathAttribute element allows attibutes consisting of a name and a
+ The PathAttribute object allows attibutes consisting of a name and a
value to be specified for the endpoints of path segments. The attributes
are exposed to the delegate as \l {Attached Properties}. The value of
an attribute at any particular point is interpolated from the PathAttributes
bounding the point.
- The example below shows a path with the items scaled to 10% at the ends of
- the path and scaled 100% along the PathLine in the middle. Note the use
- of the PathView.scale attached property to set the scale of the delegate.
+ The example below shows a path with the items scaled to 30% with opacity 50%
+ at the top of the path and scaled 100% with opacity 100% at the bottom.
+ Note the use of the PathView.scale and PathView.opacity attached properties
+ to set the scale and opacity of the delegate.
\table
\row
\o \image declarative-pathattribute.png
\o
- \code
- <Component id="Delegate">
- <Rect id="Wrapper" width="20" height="20" scale="{PathView.scale}" color="steelblue"/>
- </Component>
- <PathView width="200" height="100" model="{Model}" delegate="{Delegate}">
- <path>
- <Path startX="20" startY="0">
- <PathAttribute name="scale" value="0.1"/>
- <PathQuad x="50" y="80" controlX="0" controlY="80"/>
- <PathAttribute name="scale" value="1"/>
- <PathLine x="150" y="80"/>
- <PathAttribute name="scale" value="1"/>
- <PathQuad x="180" y="0" controlX="200" controlY="80"/>
- <PathAttribute name="scale" value="0.1"/>
- </Path>
- </path>
- </PathView>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathattributes.qml 0
\endtable
\sa Path
@@ -582,11 +557,12 @@ void QFxPathAttribute::setValue(qreal value)
The example below creates a path consisting of a straight line from
0,100 to 200,100:
- \code
- <Path startX="0" startY="100">
- <PathLine x="200" y="100"/>
- </Path>
- \endcode
+ \qml
+ Path {
+ startX: 0; startY: 100
+ PathLine { x: 200; y: 100 }
+ }
+ \endqml
\sa Path, PathQuad, PathCubic
*/
@@ -623,11 +599,12 @@ void QFxPathLine::addToPath(QPainterPath &path)
\row
\o \image declarative-pathquad.png
\o
- \code
- <Path startX="0" startY="0">
- <PathQuad x="200" y="0" controlX="100" controlY="150"/>
- </Path>
- \endcode
+ \qml
+ Path {
+ startX: 0; startY: 0
+ PathQuad x: 200; y: 0; controlX: 100; controlY: 150 }
+ }
+ \endqml
\endtable
\sa Path, PathCubic, PathLine
@@ -706,12 +683,15 @@ void QFxPathQuad::addToPath(QPainterPath &path)
\row
\o \image declarative-pathcubic.png
\o
- \code
- <Path startX="20" startY="0">
- <PathCubic x="180" y="0" control1X="-10" control1Y="90"
- control2X="210" control2Y="90"/>
- </Path>
- \endcode
+ \qml
+ Path {
+ startX: 20; startY: 0
+ PathCubic {
+ x: 180; y: 0; control1X: -10; control1Y: 90
+ control2X: 210; control2Y: 90
+ }
+ }
+ \endqml
\endtable
\sa Path, PathQuad, PathLine
@@ -833,26 +813,28 @@ void QFxPathCubic::addToPath(QPainterPath &path)
\row
\o \image declarative-nopercent.png
\o
- \code
- <Path startX="20" startY="0">
- <PathQuad x="50" y="80" controlX="0" controlY="80"/>
- <PathLine x="150" y="80"/>
- <PathQuad x="180" y="0" controlX="200" controlY="80"/>
- </Path>
- \endcode
+ \qml
+ Path {
+ startX: 20; startY: 0
+ PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }
+ PathLine { x: 150; y: 80 }
+ PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }
+ }
+ \endqml
\row
\o \image declarative-percent.png
\o
- \code
- <Path startX="20" startY="0">
- <PathQuad x="50" y="80" controlX="0" controlY="80"/>
- <PathPercent value=".25"/>
- <PathLine x="150" y="80"/>
- <PathPercent value=".75"/>
- <PathQuad x="180" y="0" controlX="200" controlY="80"/>
- <PathPercent value="1"/>
- </Path>
- \endcode
+ \qml
+ Path {
+ startX: 20; startY: 0
+ PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }
+ PathPercent { value: 0.25 }
+ PathLine { x: 150; y: 80 }
+ PathPercent { value: 0.75 }
+ PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }
+ PathPercent { value: 1 }
+ }
+ \endqml
\endtable
\sa Path
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index c0d3ab2..810a359 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -41,7 +41,6 @@
#include <math.h>
#include <QDebug>
-#include <QPen>
#include <QEvent>
#include "qmlbindablevalue.h"
#include "qmlstate.h"
@@ -51,7 +50,6 @@
#include "qfxpathview.h"
#include "qfxpathview_p.h"
#include <QGraphicsSceneEvent>
-#include <QTimer>
static const int FlickThreshold = 5;
@@ -99,17 +97,11 @@ private:
\brief The PathView element lays out model-provided items on a path.
\inherits Item
- The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in XML.
+ The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in QML.
The items are laid out along a path defined by a \l Path and may be flicked to scroll.
- \code
- <PathView id="pathview" delegate="{contactDelegate}">
- <resources><Component id="contactDelegate">...</Component></resources>
- <model>...</model>
- <path>...</path>
- </PathView>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 0
\image pathview.gif
@@ -140,28 +132,7 @@ QFxPathView::~QFxPathView()
The model provides a set of data that is used to create the items for the view.
For large or dynamic datasets the model is usually provided by a C++ model object.
- However, models can also be created directly in XML, for example:
- \code
-<model>
- <ListModel>
- <Contact>
- <portrait>pics/john.png</portrait>
- <firstName>John</firstName>
- <lastName>Smith</lastName>
- </Contact>
- <Contact>
- <portrait>pics/bill.png</portrait>
- <firstName>Bill</firstName>
- <lastName>Jones</lastName>
- </Contact>
- <Contact>
- <portrait>pics/jane.png</portrait>
- <firstName>Jane</firstName>
- <lastName>Doe</lastName>
- </Contact>
- </ListModel>
-</model>
- \endcode
+ Models can also be created directly in XML, using the ListModel element.
*/
/*!
@@ -180,6 +151,10 @@ QVariant QFxPathView::model() const
void QFxPathView::setModel(const QVariant &model)
{
Q_D(QFxPathView);
+ if (d->model) {
+ disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
+ disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
+ }
if (QFxVisualItemModel *m = qvariant_cast<QFxVisualItemModel*>(model)) {
if (d->ownModel) {
delete d->model;
@@ -193,6 +168,12 @@ void QFxPathView::setModel(const QVariant &model)
}
d->model->setModel(model);
}
+ if (d->model) {
+ connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
+ connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
+ }
+ d->firstIndex = 0;
+ d->pathOffset = 0;
d->regenerate();
d->fixOffset();
}
@@ -331,23 +312,7 @@ void QFxPathView::setDragMargin(qreal dragMargin)
The delegate provides a template describing what each item in the view should look and act like.
Here is an example delegate:
- \code
- <PathView delegate="{contactDelegate}" ...>
- <resources>
- <Component id="contactDelegate">
- <Item id="wrapper" scale="{PathView.sc}" opacity="{PathView.op}" z="{PathView.z}">
- <Image id="pic" width="100" height="100" file="{portrait}"
- anchors.horizontalCenter="{parent.horizontalCenter}"/>
- <Text id="name" text="{firstName + ' ' + lastName}"
- font.size="20"
- anchors.top="{pic.bottom}" anchors.topMargin="5"
- anchors.horizontalCenter="{parent.horizontalCenter}"/>
- </Item>
- </Component>
- </resources>
- ...
- </PathView>
- \endcode
+ \snippet doc/src/snippets/declarative/pathview/pathview.qml 1
*/
/*!
@@ -425,6 +390,8 @@ QPointF QFxPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent)
void QFxPathView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxPathView);
+ if (!d->items.count())
+ return;
QPointF scenePoint = mapToScene(event->pos());
int idx = 0;
for (; idx < d->items.count(); ++idx) {
@@ -576,9 +543,6 @@ bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e)
void QFxPathViewPrivate::regenerate()
{
Q_Q(QFxPathView);
- if (!model || model->count() <= 0 || !model->delegate() || !path)
- return;
-
for (int i=0; i<items.count(); i++){
QFxItem *p = items[i];
q->attachedProperties.remove(p);
@@ -586,29 +550,23 @@ void QFxPathViewPrivate::regenerate()
}
items.clear();
- firstIndex = 0;
- pathOffset = 0;
+ if (!model || model->count() <= 0 || !model->delegate() || !path)
+ return;
+
+ if (firstIndex >= model->count())
+ firstIndex = model->count()-1;
+ if (pathOffset >= model->count())
+ pathOffset = model->count()-1;
- int numItems = (pathItems>=0 ? pathItems : model->count());
- qreal minDiff = 1e9;
- int minI = -1;
- for (int i=0; i<numItems; i++){
- QFxItem *item = model->item(i);
+ int numItems = pathItems >= 0 ? pathItems : model->count();
+ for (int i=0; i < numItems && i < model->count(); ++i){
+ QFxItem *item = model->item((i + firstIndex) % model->count());
if (!item)
return;
items.append(item);
item->setZ(i);
item->setParent(q);
- qreal percent = i * (100.0 / (numItems));
- percent /= 100.0;
- updateItem(items.last(), percent);
- qreal diff = qAbs(percent - snapPos);
- if (diff < minDiff){
- minDiff = diff;
- minI = i;
- }
}
- q->setCurrentIndex(minI);
q->refill();
}
@@ -639,10 +597,9 @@ void QFxPathView::refill()
positions << qAbs(percent/100.0);
}
- if (d->pathItems==-1){
- for (int i=0; i<positions.count(); i++){
+ if (d->pathItems==-1) {
+ for (int i=0; i<positions.count(); i++)
d->updateItem(d->items.at(i), positions[i]);
- }
return;
}
@@ -650,54 +607,110 @@ void QFxPathView::refill()
for (int i=0; i<d->items.count(); i++)
rotatedPositions << positions[(i + d->pathOffset + d->items.count()) % d->items.count()];
- int firstFind = -1;
- int i;
- for (i=0; i<d->items.count()-1; i++)
- {
+ int wrapIndex= -1;
+ for (int i=0; i<d->items.count()-1; i++) {
if (rotatedPositions[i] > rotatedPositions[i+1]){
- firstFind = i;
+ wrapIndex = i;
break;
}
}
- if (firstFind!=-1 ){
+ if (wrapIndex != -1 ){
//A wraparound has occured
- if (firstFind<(d->items.count()/2)){
- while(firstFind-- >= 0){
+ if (wrapIndex < d->items.count()/2){
+ while(wrapIndex-- >= 0){
QFxItem* p = d->items.takeFirst();
attachedProperties.remove(p);
d->model->release(p);
d->firstIndex++;
- d->firstIndex%=d->model->count();
+ d->firstIndex %= d->model->count();
int index = (d->firstIndex + d->items.count())%d->model->count();
d->items << d->model->item(index);
- d->items.last()->setZ(i);
+ d->items.last()->setZ(wrapIndex);
d->items.last()->setParent(this);
d->pathOffset++;
d->pathOffset=d->pathOffset % d->items.count();
}
- }else{
- while(firstFind++ < (d->items.count()-1)){
+ } else {
+ while(wrapIndex++ < d->items.count()-1){
QFxItem* p = d->items.takeLast();
attachedProperties.remove(p);
d->model->release(p);
d->firstIndex--;
- if (d->firstIndex<0)
+ if (d->firstIndex < 0)
d->firstIndex = d->model->count() - 1;
d->items.prepend(d->model->item(d->firstIndex));
d->items.first()->setZ(d->firstIndex);
d->items.first()->setParent(this);
d->pathOffset--;
- if (d->pathOffset<0)
+ if (d->pathOffset < 0)
d->pathOffset = d->items.count() - 1;
}
}
for (int i=0; i<d->items.count(); i++)
rotatedPositions[i] = positions[(i + d->pathOffset + d->items.count())
- % d->items.count()];
+ % d->items.count()];
}
- for (int i=0; i<d->items.count(); i++){
+ for (int i=0; i<d->items.count(); i++)
d->updateItem(d->items.at(i), rotatedPositions[i]);
+}
+
+void QFxPathView::itemsInserted(int modelIndex, int count)
+{
+ //XXX support animated insertion
+ Q_D(QFxPathView);
+ if (d->pathItems == -1) {
+ for (int i = 0; i < count; ++i) {
+ QFxItem *item = d->model->item(modelIndex + i);
+ item->setZ(modelIndex + i);
+ item->setParent(this);
+ d->items.insert(modelIndex + i, item);
+ }
+ refill();
+ } else {
+ //XXX This is pretty heavy handed until we reference count items.
+ d->regenerate();
+ }
+
+ // make sure the current item is still at the snap position
+ int itemIndex = (d->currentIndex - d->firstIndex + d->model->count())%d->model->count();
+ itemIndex += d->pathOffset;
+ itemIndex %= d->items.count();
+ qreal targetOffset = fmod(100 + (d->snapPos*100) - 100.0 * itemIndex / d->items.count(), 100);
+
+ if (targetOffset < 0)
+ targetOffset = 100.0 + targetOffset;
+ if (targetOffset != d->_offset)
+ d->moveOffset.setValue(targetOffset);
+}
+
+void QFxPathView::itemsRemoved(int modelIndex, int count)
+{
+ //XXX support animated removal
+ Q_D(QFxPathView);
+ if (d->pathItems == -1) {
+ for (int i = 0; i < count; ++i) {
+ QFxItem* p = d->items.takeAt(modelIndex);
+ attachedProperties.remove(p);
+ d->model->release(p);
+ }
+ d->snapToCurrent();
+ refill();
+ } else {
+ d->regenerate();
}
+
+ // make sure the current item is still at the snap position
+ if (d->currentIndex >= d->model->count())
+ d->currentIndex = d->model->count() - 1;
+ int itemIndex = (d->currentIndex - d->firstIndex + d->model->count())%d->model->count();
+ itemIndex += d->pathOffset;
+ itemIndex %= d->items.count();
+ qreal targetOffset = fmod(100 + (d->snapPos*100) - 100.0 * itemIndex / d->items.count(), 100);
+
+ if (targetOffset < 0)
+ targetOffset = 100.0 + targetOffset;
+ if (targetOffset != d->_offset)
+ d->moveOffset.setValue(targetOffset);
}
void QFxPathView::ticked()
@@ -715,7 +728,7 @@ int QFxPathViewPrivate::calcCurrentIndex()
if (_offset < 0)
_offset += 100.0;
- if (pathItems == -1){
+ if (pathItems == -1) {
qreal delta = fmod(_offset - snapPos, 100.0);
if (delta < 0)
delta = 100.0 + delta;
@@ -723,7 +736,7 @@ int QFxPathViewPrivate::calcCurrentIndex()
if (ii < 0)
ii = 0;
current = ii;
- }else{
+ } else {
qreal bestDiff=1e9;
int bestI=-1;
for (int i=0; i<items.count(); i++){
@@ -778,11 +791,11 @@ void QFxPathViewPrivate::snapToCurrent()
if (!model || model->count() <= 0)
return;
- int itemIndex = (currentIndex - firstIndex + model->count())%model->count();
+ int itemIndex = (currentIndex - firstIndex + model->count()) % model->count();
//Rounds is the number of times round to make the current item visible
int rounds = itemIndex / items.count();
- int otherWayRounds = (model->count() - (itemIndex))/items.count() + 1;
+ int otherWayRounds = (model->count() - (itemIndex)) / items.count() + 1;
if (otherWayRounds < rounds)
rounds = -otherWayRounds;
@@ -792,7 +805,7 @@ void QFxPathViewPrivate::snapToCurrent()
if (targetOffset < 0)
targetOffset = 100.0 + targetOffset;
- if (targetOffset == _offset && rounds==0)
+ if (targetOffset == _offset && rounds == 0)
return;
moveReason = Other;
diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h
index 2cc0769..23f2f07 100644
--- a/src/declarative/fx/qfxpathview.h
+++ b/src/declarative/fx/qfxpathview.h
@@ -113,6 +113,8 @@ protected:
private Q_SLOTS:
void refill();
void ticked();
+ void itemsInserted(int index, int count);
+ void itemsRemoved(int index, int count);
protected:
QFxPathView(QFxPathViewPrivate &dd, QFxItem *parent);
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index 2bfc149..371aa0c 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -53,9 +53,9 @@ QML_DEFINE_TYPE(QFxPen,Pen);
\brief The QFxPen class provides a pen used for drawing rect borders on a QFxView.
Example:
- \code
- <Rect pen.width="2" pen.color="red".../>
- \endcode
+ \qml
+ Rect { pen.width: 2; pen.color: "red" ... }
+ \endqml
*/
/*! \property QFxPen::width
@@ -72,13 +72,13 @@ QML_DEFINE_TYPE(QFxPen,Pen);
color is most commonly specified in hexidecimal notation (#RRGGBB)
or as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords}{SVG color keyword name}
(as defined by the World Wide Web Consortium). For example:
- \code
- <!-- rect with green border using hexidecimal notation -->
- <Rect pen.color="#00FF00" .../>
+ \qml
+ // rect with green border using hexidecimal notation
+ Rect { pen.color: "#00FF00" }
- <!-- rect with steelblue border using SVG color name-->
- <Rect pen.color="steelblue" .../>
- \endcode
+ // rect with steelblue border using SVG color name
+ Rect { pen.color: "steelblue" }
+ \endqml
For the full set of ways to specify color, see Qt's QColor::setNamedColor documentation.
*/
@@ -96,14 +96,22 @@ QML_DEFINE_TYPE(QFxRect,Rect);
/*!
\qmlclass Rect QFxRect
- \brief The Rect element allows you to add rectangles to a scene.
+ \brief The Rect item allows you to add rectangles to a scene.
\inherits Item
- A Rect is painted having a solid fill (color) and an optional border (pen). You can also create rounded rectangles using the radius property.
-
- \code
- <Rect width="100" height="100" color="red" pen.color="black" pen.width="5" radius="10"/>
- \endcode
+ A Rect is painted having a solid fill (color) and an optional border (pen).
+ You can also create rounded rectangles using the radius property.
+
+ \qml
+ Rect {
+ width: 100
+ height: 100
+ color: "red"
+ pen.color: "black"
+ pen.width: 5
+ radius: 10
+ }
+ \endqml
\image declarative-rect.png
*/
@@ -113,11 +121,19 @@ QML_DEFINE_TYPE(QFxRect,Rect);
\class QFxRect
\brief The QFxRect class provides a rect item that you can add to a QFxView.
- A Rect is painted having a solid fill (color) and an optional border (pen). You can also create rounded rectangles using the radius property.
-
- \code
- <Rect width="100" height="100" color="red" pen.color="black" pen.width="5" radius="10"/>
- \endcode
+ A Rect is painted having a solid fill (color) and an optional border (pen).
+ You can also create rounded rectangles using the radius property.
+
+ \qml
+ Rect {
+ width: 100
+ height: 100
+ color: "red"
+ pen.color: "black"
+ pen.width: 5
+ radius: 10
+ }
+ \endqml
\image declarative-rect.png
@@ -216,13 +232,13 @@ void QFxRect::dump(int depth)
\qmlproperty color Rect::color
This property holds the color used to fill the rect.
- \code
- <!-- green rect using hexidecimal notation -->
- <Rect color="#00FF00" .../>
+ \qml
+ // green rect using hexidecimal notation
+ Rect { color: "#00FF00" }
- <!-- steelblue rect using SVG color name-->
- <Rect color="steelblue" .../>
- \endcode
+ // steelblue rect using SVG color name
+ Rect { color: "steelblue" }
+ \endqml
*/
/*!
@@ -259,10 +275,10 @@ void QFxRect::setColor(const QColor &c)
This color will be drawn over the rect's color when the rect is painted. The tint color should usually be mostly transparent, or you will not be able to see the underlying color. The below example provides a slight red tint by having the tint color be pure red which is only 1/16th opaque.
- \code
- <Rect x="0" width="80" height="80" color="lightsteelblue"/>
- <Rect x="100" width="80" height="80" color="lightsteelblue" tintColor="#10FF0000"/>
- \endcode
+ \qml
+ Rect { x: 0; width: 80; height: 80; color: "lightsteelblue" }
+ Rect { x: 100; width: 80; height: 80; color: "lightsteelblue"; tintColor: "#10FF0000" }
+ \endqml
\image declarative-rect_tint.png
This attribute is not intended to be used with a single color over the lifetime of an user interface. It is most useful when a subtle change is intended to be conveyed due to some event; you can then use the tint color to more effectively tune the visible color.
@@ -320,13 +336,13 @@ QColor QFxRectPrivate::getColor()
This property allows for the easy construction of simple horizontal gradients. Other gradients may by formed by adding rotation to the rect. The gradient will blend linearly from the rect's main color to the color specified for gradient color.
- \code
- <Rect y="0" width="80" height="80" color="lightsteelblue"/>
- <Rect y="100" width="80" height="80" color="lightsteelblue" gradientColor="blue"/>
- <Rect rotation="90" x="80" y="200" width="80" height="80" color="lightsteelblue"
- gradientColor="blue"/>
- <!-- The x offset is needed because the rotation is from the top left corner -->
- \endcode
+ \qml
+ Rect { y: 0; width: 80; height: 80; color: "lightsteelblue" }
+ Rect { y: 100; width: 80; height: 80; color: "lightsteelblue"; gradientColor="blue" }
+ Rect { rotation: 90; x: 80; y: 200; width: 80; height: 80; color="lightsteelblue"
+ gradientColor: "blue" }
+ // The x offset is needed because the rotation is from the top left corner
+ \endqml
\image declarative-rect_gradient.png
*/
diff --git a/src/declarative/fx/qfxreflectionfilter.cpp b/src/declarative/fx/qfxreflectionfilter.cpp
index e02bc16..a55f374 100644
--- a/src/declarative/fx/qfxreflectionfilter.cpp
+++ b/src/declarative/fx/qfxreflectionfilter.cpp
@@ -69,35 +69,30 @@ public:
Here is an example of various Reflections applied to an image.
- \code
- <HorizontalLayout>
- <Image src="icon.png" >
- <filter>
- <Reflection />
- </filter>
- </Image>
- <Image src="icon.png" >
- <filter>
- <Reflection offset="1" />
- </filter>
- </Image>
- <Image src="icon.png" >
- <filter>
- <Reflection offset="1" alpha="0.5" />
- </filter>
- </Image>
- <Image src="icon.png" >
- <filter>
- <Reflection offset="1" alpha="0.5" height="50" />
- </filter>
- </Image>
- <Image src="icon.png" >
- <filter>
- <Reflection offset="1" alpha="0.5" height="50" scale="0.5" />
- </filter>
- </Image>
- </HorizontalLayout>
- \endcode
+ \qml
+HorizontalLayout {
+ Image {
+ src: "icon.png"
+ filter: Reflection { }
+ }
+ Image {
+ src: "icon.png"
+ filter: Reflection { offset: 1 }
+ }
+ Image {
+ src: "icon.png"
+ filter: Reflection { offset: 1; alpha: 0.5 }
+ }
+ Image {
+ src: "icon.png"
+ filter: Reflection { offset: 1; alpha: 0.5; height: 50 }
+ }
+ Image {
+ src: "icon.png"
+ filter: Reflection { offset: 1; alpha: 0.5; height: 50; scale: 0.5 }
+ }
+}
+ \endqml
\image reflection_example.png
@@ -149,13 +144,15 @@ void QFxReflectionFilter::setAlpha(qreal a)
it is set to 50, the bottom 50 pixels of the item are reflected. Data
binding could be used to reflect a percentage of the item.
- \code
- <Image id="myImage" src="album.png">
- <filter>
- <Reflection height="{myImage.height * 0.5}" />
- </filter>
- </Image>
- \endcode
+ \qml
+Image {
+ id: myImage
+ src: "album.png"
+ filter: Reflection {
+ height: myImage.height * 0.5
+ }
+}
+ \endqml
*/
/*!
\qmlproperty int Reflection::offset
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index 7ee949d..23b4e01 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -77,13 +77,13 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater);
\qmlclass Repeater
\inherits Item
- \brief The Repeater element allows you to repeat a component based on a data source.
+ \brief The Repeater item allows you to repeat a component based on a data source.
- The Repeater element is used when you want to create a large number of
+ The Repeater item is used when you want to create a large number of
similar items. For each entry in the data source, an item is instantiated
in a context seeded with data from the data source. If the repeater will
be instantiating a large number of instances, it may be more efficient to
- use one of Qt Declarative's \l {xmlViews}{view elements}.
+ use one of Qt Declarative's \l {xmlViews}{view items}.
The data source may be either an object list, a string list or a Qt model.
In each case, the data element and the index is exposed to each instantiated
@@ -92,21 +92,16 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater);
or object) is available as the \c modelData property. In the case of a Qt model,
all roles are available as named properties just like in the view classes.
- Items instantiated by the Repeater elemented are inserted, in order, as
+ Items instantiated by the Repeater are inserted, in order, as
children of the Repeater's parent. The insertion starts immediately after
the repeater's position in its parent stacking list. This is to allow
you to use a Repeater inside a layout. The following QML example shows how
the instantiated items would visually appear stacked between the red and
blue rectangles.
- \code
- <Item>
- <Rect width="100" height="100" color="red" />
- <Repeater ...repeater arguments... />
- <!-- Instantiated items would appear here -->
- <Rect width="100" height="100" color="blue" />
- </Item>
- \endcode
+ \snippet doc/src/snippets/declarative/repeater.qml 0
+
+ \image repeater.png
The repeater instance continues to own all items it instantiates, even
if they are otherwise manipulated. It is illegal to manually remove an item
@@ -144,14 +139,7 @@ QML_DEFINE_TYPE(QFxRepeater,Repeater);
the instantiated items would visually appear stacked between the red and
blue rectangles.
- \code
- <Item>
- <Rect width="100" height="100" color="red" />
- <Repeater ...repeater arguments... />
- <!-- Instantiated items would appear here -->
- <Rect width="100" height="100" color="blue" />
- </Item>
- \endcode
+ \snippet doc/src/snippets/declarative/repeater.qml 0
The QFxRepeater instance continues to own all items it instantiates, even
if they are otherwise manipulated. It is illegal to manually delete an item
@@ -191,6 +179,17 @@ QFxRepeater::~QFxRepeater()
\qmlproperty any Repeater::dataSource
The Repeater's data source.
+
+ The data source may be either an object list, a string list or a Qt model.
+ In each case, the data element and the index is exposed to each instantiated
+ component. The index is always exposed as an accessible \c index property.
+ In the case of an object or string list, the data element (of type string
+ or object) is available as the \c modelData property. In the case of a Qt model,
+ all roles are available as named properties just like in the view classes.
+
+ As a special case the data source can also be merely a number. In this case it will
+ create that many instances of the component. They will also be assigned an index
+ based on the order they are created.
*/
/*!
diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp
index 38d1c31..4d34f74 100644
--- a/src/declarative/fx/qfxshadowfilter.cpp
+++ b/src/declarative/fx/qfxshadowfilter.cpp
@@ -73,14 +73,26 @@ public:
\row
\o \image shadow_example.png
\o
- \code
- <Rect radius="5" color="lightsteelblue" width="100" height="100">
- <filter><Shadow yOffset="8" xOffset="8" /></filter>
- </Rect>
- <Image src="pics/qtlogo.png">
- <filter><Shadow yOffset="8" xOffset="8" /></filter>
- </Image>
- \endcode
+ \qml
+Rect {
+ radius: 5
+ color: "lightsteelblue"
+ width: 100
+ height: 100
+ filter: Shadow {
+ yOffset: 8
+ xOffset: 8
+ }
+}
+
+Image {
+ src: "pics/qtlogo.png"
+ filter: Shadow {
+ yOffset: 8
+ xOffset: 8
+ }
+}
+ \endqml
\endtable
Shadows are only supported when Qt Qt Declarative is compiled for OpenGL ES 2.0.
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index 5cb31e1..a43219d 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -61,22 +61,18 @@ QML_DEFINE_TYPE(QFxText,Text);
/*!
\qmlclass Text QFxText
- \brief The Text element allows you to add formatted text to a scene.
+ \brief The Text item allows you to add formatted text to a scene.
\inherits Item
It can display both plain and rich text. For example:
- \code
- <Text text="Hello World!" font.family="Helvetica" font.size="24" color="red"/>
- <Text>
- <![CDATA[<b>Hello</b> <i>World!</i>]]]]><![CDATA[>
- </Text>
- \endcode
+ \qml
+ Text { text: "Hello World!"; font.family: "Helvetica"; font.size: 24; color: "red" }
+ Text { text: "<b>Hello</b> <i>World!</i>" }
+ \endqml
\image declarative-text.png
- Additional examples can be found in examples/poc/text.xml
-
If height and width are not explicitly set, Text will attempt to determine how
much room is needed and set it accordingly. Unless \c wrap is set, it will always
prefer width to height (all text will be placed on a single line).
@@ -98,27 +94,20 @@ QML_DEFINE_TYPE(QFxText,Text);
Text was designed for read-only text; it does not allow for any text editing.
It can display both plain and rich text. For example:
- \code
- <Text text="Hello World!" font.family="Helvetica" font.size="24" color="red"/>
- <Text>
- <![CDATA[<b>Hello</b> <i>World!</i>]]>
- </Text>
- \endcode
+ \qml
+ Text { text: "Hello World!"; font.family: "Helvetica"; font.size: 24; color: "red" }
+ Text { text: "<b>Hello</b> <i>World!</i>" }
+ \endqml
\image text.png
- Note that the 'styling' properties such as color and outline are ignored for rich text, styling
- of rich text should be done within the text itself.
-
- Additional examples can be found in examples/poc/text.xml
-
If height and width are not explicitly set, Text will attempt to determine how
much room is needed and set it accordingly. Unless \c wrap is set, it will always
prefer width to height (all text will be placed on a single line).
- The \c elideMode can alternatively be used to fit a line of plain text to a set width.
+ The \c elide property can alternatively be used to fit a line of plain text to a set width.
- A QFxText object can be instantiated in Qml using the tag \c &lt;Text&gt;.
+ A QFxText object can be instantiated in Qml using the tag \c Text.
*/
QFxText::QFxText(QFxItem *parent)
: QFxItem(*(new QFxTextPrivate), parent)
@@ -143,9 +132,14 @@ QFxText::~QFxText()
}
/*!
- \qmlproperty font Text::font
+ \qmlproperty string Text::font.family
+ \qmlproperty bool Text::font.bold
+ \qmlproperty bool Text::font.italic
+ \qmlproperty real Text::font.size
- Set the Text's font attributes. \c font.size sets the font's point size.
+ Set the Text's font attributes.
+
+ \note \c font.size sets the font's point size (not pixel size).
*/
/*!
@@ -218,13 +212,13 @@ void QFxText::setColor(const QColor &color)
The text color.
- \code
- <!-- green text using hexadecimal notation -->
- <Text color="#00FF00" .../>
+ \qml
+ //green text using hexadecimal notation
+ Text { color: "#00FF00"; ... }
- <!-- steelblue text using SVG color name-->
- <Text color="steelblue" .../>
- \endcode
+ //steelblue text using SVG color name
+ Text { color: "steelblue"; ... }
+ \endqml
*/
QColor QFxText::color() const
@@ -240,14 +234,14 @@ QColor QFxText::color() const
Supported text styles are \c Normal, \c Outline, \c Raised and \c Sunken.
- \code
- <HorizontalLayout>
- <Text font.size="24" text="Normal" />
- <Text font.size="24" text="Raised" style="Raised" styleColor="#AAAAAA"/>
- <Text font.size="24" text="Outline" style="Outline" styleColor="red"/>
- <Text font.size="24" text="Sunken" style="Sunken" styleColor="#AAAAAA"/>
- </HorizontalLayout>
- \endcode
+ \qml
+ HorizontalLayout {
+ Text { font.size: 24; text: "Normal" }
+ Text { font.size: 24; text: "Raised"; style: "Raised"; styleColor: "#AAAAAA" }
+ Text { font.size: 24; text: "Outline"; style: "Outline"; styleColor: "red" }
+ Text { font.size: 24; text: "Sunken"; style: "Sunken"; styleColor: "#AAAAAA" }
+ }
+ \endqml
\image declarative-textstyle.png
*/
@@ -308,7 +302,7 @@ QColor QFxText::styleColor() const
\qmlproperty enumeration Text::hAlign
\qmlproperty enumeration Text::vAlign
- Sets the horizontal and vertical alignment of the text within the Text elements
+ Sets the horizontal and vertical alignment of the text within the Text items
width and height. By default, the text is top-left aligned.
The valid values for \c hAlign are \c AlignLeft, \c AlignRight and
@@ -355,7 +349,7 @@ void QFxText::setVAlign(VAlignment align)
/*!
\qmlproperty bool Text::wrap
- Set this property to wrap the text to the Text element's width. The text will only
+ Set this property to wrap the text to the Text item's width. The text will only
wrap if an explicit width has been set.
Wrapping is done on word boundaries (i.e. it is a "word-wrap"). If the text cannot be
@@ -384,9 +378,9 @@ void QFxText::setWrap(bool w)
}
/*!
- \qmlproperty Qt::TextElideMode Text::elideMode
+ \qmlproperty Qt::TextElideMode Text::elide
- Set this property to elide parts of the text fit to the Text element's width.
+ Set this property to elide parts of the text fit to the Text item's width.
The text will only elide if an explicit width has been set.
This property cannot be used with wrap enabled or with rich text.
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 68aea01..84e209b 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -62,17 +62,22 @@ QML_DEFINE_TYPE(QFxTextEdit, TextEdit);
/*!
\qmlclass TextEdit
- \brief The TextEdit element allows you to add editable formatted text to a scene.
- \inherits ImageItem
+ \brief The TextEdit item allows you to add editable formatted text to a scene.
It can display both plain and rich text. For example:
- \code
- <TextEdit id="edit" focus="true" focusable="true"
- font.family="Helvetica" font.size="20" color="blue" width="240">
- <![CDATA[<b>Hello</b> <i>World!</i>]]/>
- </TextEdit>
- \endcode
+ \qml
+TextEdit {
+ id: edit
+ text: "<b>Hello</b> <i>World!</i>"
+ focus: true
+ focusable: true
+ font.family: "Helvetica"
+ font.size: 20
+ color: "blue"
+ width: 240
+}
+ \endqml
\image declarative-textedit.gif
@@ -178,19 +183,24 @@ void QFxTextEdit::setText(const QString &text)
\table
\row
\o
- \code
- <VerticalLayout>
- <TextEdit font.size="24">
- <![CDATA[<b>Hello</b> <i>World!</i>]]]]><![CDATA[>
- </TextEdit>
- <TextEdit font.size="24" textFormat="RichText">
- <![CDATA[<b>Hello</b> <i>World!</i>]]]]><![CDATA[>
- </TextEdit>
- <TextEdit font.size="24" textFormat="PlainText">
- <![CDATA[<b>Hello</b> <i>World!</i>]]]]><![CDATA[>
- </TextEdit>
- </VerticalLayout>
- \endcode
+ \qml
+VerticalLayout {
+ TextEdit {
+ font.size: 24
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ TextEdit {
+ font.size: 24
+ textFormat: "RichText"
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+ TextEdit {
+ font.size: 24
+ textFormat: "PlainText"
+ text: "<b>Hello</b> <i>World!</i>"
+ }
+}
+ \endqml
\o \image declarative-textformat.png
\endtable
*/
@@ -248,13 +258,13 @@ QmlFont *QFxTextEdit::font()
The text color.
- \code
- <!-- green text using hexadecimal notation -->
- <TextEdit color="#00FF00" .../>
+ \qml
+// green text using hexadecimal notation
+TextEdit { color: "#00FF00"; ... }
- <!-- steelblue text using SVG color name-->
- <TextEdit color="steelblue" .../>
- \endcode
+// steelblue text using SVG color name
+TextEdit { color: "steelblue"; ... }
+ \endqml
*/
/*!
@@ -285,7 +295,7 @@ void QFxTextEdit::setColor(const QColor &color)
\qmlproperty enumeration TextEdit::hAlign
\qmlproperty enumeration TextEdit::vAlign
- Sets the horizontal and vertical alignment of the text within the TextEdit elements
+ Sets the horizontal and vertical alignment of the text within the TextEdit items
width and height. By default, the text is top-left aligned.
The valid values for \c hAlign are \c AlignLeft, \c AlignRight and
@@ -346,7 +356,8 @@ bool QFxTextEdit::wrap() const
/*!
\qmlproperty bool TextEdit::wrap
- Set this property to wrap the text to the TextEdit element's width. The text will only wrap if an explicit width has been set.
+ Set this property to wrap the text to the TextEdit item's width.
+ The text will only wrap if an explicit width has been set.
Wrapping is done on word boundaries (i.e. it is a "word-wrap"). Wrapping is off by default.
*/
@@ -411,7 +422,7 @@ void QFxTextEdit::componentComplete()
/*!
\qmlproperty bool TextEdit::readOnly
- Whether the user an interact with the TextEdit element. If this
+ Whether the user an interact with the TextEdit item. If this
property is set to true the text cannot be edited by user interaction.
By default this property is false.
@@ -419,8 +430,7 @@ void QFxTextEdit::componentComplete()
/*!
\property QFxTextEdit::readOnly
- \brief If this property is true the text can not be edited by
- user interaction.
+ \brief If this property is true the text can not be edited by user interaction.
Changing this property will modify the text interaction flags. If
you require more specific control about how user interaction
diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp
index c355158..1fe02d1 100644
--- a/src/declarative/fx/qfxtransform.cpp
+++ b/src/declarative/fx/qfxtransform.cpp
@@ -85,16 +85,16 @@ void QFxTransform::update()
/*!
\qmlclass Axis
- \brief The Axis element defines an axis that can be used for rotation or translation.
+ \brief A Axis object defines an axis that can be used for rotation or translation.
An axis is specified by 2 points in 3D space: a start point and
an end point. While technically the axis is the line running through these two points
(and thus many different sets of two points could define the same axis), the distance
between the points does matter for translation along an axis.
- \code
- <Axis startX="0" startY="0" endX="20" endY="30"/>
- \endcode
+ \qml
+ Axis { startX: 0; startY: 0; endX: 20; endY: 30 }
+ \endqml
*/
QML_DEFINE_TYPE(QFxAxis, Axis);
@@ -178,91 +178,69 @@ void QFxAxis::setEndZ(qreal z)
}
/*!
- \qmlclass AxisRotation
- \brief The AxisRotation element provides a way to rotate an Item around an axis.
+ \qmlclass Rotation3D
+ \brief A Rotation3D object provides a way to rotate an Item around an axis.
Here is an example of various rotations applied to an \l Image.
- \code
- <HorizontalLayout margin="10" spacing="10">
- <Image src="qt.png"/>
- <Image src="qt.png">
- <transform>
- <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="18"/>
- </transform>
- </Image>
- <Image src="qt.png">
- <transform>
- <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="36"/>
- </transform>
- </Image>
- <Image src="qt.png">
- <transform>
- <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="54"/>
- </transform>
- </Image>
- <Image src="qt.png">
- <transform>
- <AxisRotation axis.startX="30" axis.endX="30" axis.endY="60" angle="72"/>
- </transform>
- </Image>
- </HorizontalLayout>
- \endcode
+ \snippet doc/src/snippets/declarative/rotation.qml 0
\image axisrotation.png
*/
-QML_DEFINE_TYPE(QFxRotation,AxisRotation);
+QML_DEFINE_TYPE(QFxRotation3D,Rotation3D);
-QFxRotation::QFxRotation(QObject *parent)
-: QFxTransform(parent), _angle(0), _distanceToPlane(1024.), _dirty(true)
+QFxRotation3D::QFxRotation3D(QObject *parent)
+: QFxTransform(parent), _angle(0), _dirty(true)
{
connect(&_axis, SIGNAL(updated()), this, SLOT(update()));
}
-QFxRotation::~QFxRotation()
+QFxRotation3D::~QFxRotation3D()
{
}
/*!
- \qmlproperty real AxisRotation::axis.startX
- \qmlproperty real AxisRotation::axis.startY
- \qmlproperty real AxisRotation::axis.endX
- \qmlproperty real AxisRotation::axis.endY
- \qmlproperty real AxisRotation::axis.endZ
+ \qmlproperty real Rotation3D::axis.startX
+ \qmlproperty real Rotation3D::axis.startY
+ \qmlproperty real Rotation3D::axis.endX
+ \qmlproperty real Rotation3D::axis.endY
+ \qmlproperty real Rotation3D::axis.endZ
A rotation axis is specified by 2 points in 3D space: a start point and
an end point. The z-position of the start point is assumed to be 0, and cannot
be changed.
+
+ \sa Axis
*/
-QFxAxis *QFxRotation::axis()
+QFxAxis *QFxRotation3D::axis()
{
return &_axis;
}
/*!
- \qmlproperty real AxisRotation::angle
+ \qmlproperty real Rotation3D::angle
The angle, in degrees, to rotate around the specified axis.
*/
-qreal QFxRotation::angle() const
+qreal QFxRotation3D::angle() const
{
return _angle;
}
-void QFxRotation::setAngle(qreal angle)
+void QFxRotation3D::setAngle(qreal angle)
{
_angle = angle;
update();
}
-bool QFxRotation::isIdentity() const
+bool QFxRotation3D::isIdentity() const
{
return (_angle == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX());
}
#if defined(QFX_RENDER_QPAINTER)
const qreal inv_dist_to_plane = 1. / 1024.;
-QTransform QFxRotation::transform() const
+QTransform QFxRotation3D::transform() const
{
if (_dirty) {
_transform = QTransform();
@@ -282,10 +260,6 @@ QTransform QFxRotation::transform() const
qreal y = _axis.endY() - _axis.startY();
qreal z = _axis.endZ();
- qreal idtp = inv_dist_to_plane;
- if (distanceToPlane() != 1024.)
- idtp = 1. / distanceToPlane();
-
qreal len = x * x + y * y + z * z;
if (len != 1.) {
len = ::sqrt(len);
@@ -294,8 +268,8 @@ QTransform QFxRotation::transform() const
z /= len;
}
- QTransform rot(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*idtp,
- y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*idtp,
+ QTransform rot(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*inv_dist_to_plane,
+ y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*inv_dist_to_plane,
0, 0, 1);
_transform *= rotTrans;
@@ -310,7 +284,7 @@ QTransform QFxRotation::transform() const
return _transform;
}
#elif defined(QFX_RENDER_OPENGL)
-QMatrix4x4 QFxRotation::transform() const
+QMatrix4x4 QFxRotation3D::transform() const
{
if (_dirty) {
_dirty = false;
@@ -333,21 +307,7 @@ QMatrix4x4 QFxRotation::transform() const
}
#endif
-/*!
- \qmlproperty real AxisRotation::distanceToPlane
-*/
-qreal QFxRotation::distanceToPlane() const
-{
- return _distanceToPlane;
-}
-
-void QFxRotation::setDistanceToPlane(qreal d)
-{
- _distanceToPlane = d;
- update();
-}
-
-void QFxRotation::update()
+void QFxRotation3D::update()
{
_dirty = true;
QFxItem *item = qobject_cast<QFxItem *>(parent());
@@ -356,77 +316,86 @@ void QFxRotation::update()
}
/*!
- \qmlclass AxisTranslation
- \brief The AxisTranslation element provides a way to move an Item along an axis.
+ \qmlclass Translation3D
+ \brief A Translation3D object provides a way to move an Item along an axis.
The following example translates the image to 10, 3.
- \code
- <Image src="logo.png">
- <transform>
- <AxisTranslation axis.startX="0" axis.startY="0" axis.endX="1" axis.endY=".3" distance="10"/>
- </transform>
- </Image>
- \endcode
+ \qml
+Image {
+ src: "logo.png"
+ transform: [
+ Translation3D {
+ axis.startX: 0
+ axis.startY: 0
+ axis.endX: 1
+ axis.endY: .3
+ distance: 10
+ }
+ ]
+}
+ \endqml
*/
-QML_DEFINE_TYPE(QFxTranslation,AxisTranslation);
+QML_DEFINE_TYPE(QFxTranslation3D,Translation3D);
-QFxTranslation::QFxTranslation(QObject *parent)
+QFxTranslation3D::QFxTranslation3D(QObject *parent)
: QFxTransform(parent), _distance(0), _dirty(true)
{
connect(&_axis, SIGNAL(updated()), this, SLOT(update()));
}
-QFxTranslation::~QFxTranslation()
+QFxTranslation3D::~QFxTranslation3D()
{
}
/*!
- \qmlproperty real AxisTranslation::axis.startX
- \qmlproperty real AxisTranslation::axis.startY
- \qmlproperty real AxisTranslation::axis.endX
- \qmlproperty real AxisTranslation::axis.endY
- \qmlproperty real AxisTranslation::axis.endZ
+ \qmlproperty real Translation3D::axis.startX
+ \qmlproperty real Translation3D::axis.startY
+ \qmlproperty real Translation3D::axis.endX
+ \qmlproperty real Translation3D::axis.endY
+ \qmlproperty real Translation3D::axis.endZ
A translation axis is specified by 2 points in 3D space: a start point and
an end point. The z-position of the start point is assumed to be 0, and cannot
be changed. Changing the z-position of the end point is only valid when running
under OpenGL.
+
+ \sa Axis
*/
-QFxAxis *QFxTranslation::axis()
+QFxAxis *QFxTranslation3D::axis()
{
return &_axis;
}
/*!
- \qmlproperty real AxisTranslation::distance
+ \qmlproperty real Translation3D::distance
The distance to translate along the specified axis. distance is a multiplier;
in the example below, a distance of 1 would translate to 100, 50, while a distance
of 0.5 would translate to 50, 25.
- \code
- <AxisTranslation axis.startX="0" axis.startY="0" axis.endX="100" axis.endY="50"/>
- \endcode
+ \qml
+ Translation3D { axis.startX: 0; axis.startY: 0; axis.endX: 100; axis.endY: 50 }
+ \endqml
*/
-qreal QFxTranslation::distance() const
+qreal QFxTranslation3D::distance() const
{
return _distance;
}
-void QFxTranslation::setDistance(qreal distance)
+void QFxTranslation3D::setDistance(qreal distance)
{
_distance = distance;
update();
}
-bool QFxTranslation::isIdentity() const
+bool QFxTranslation3D::isIdentity() const
{
return (_distance == 0.) || (_axis.endZ() == 0. && _axis.endY() == _axis.startY() && _axis.endX() == _axis.startX());
}
#if defined(QFX_RENDER_QPAINTER)
-QTransform QFxTranslation::transform() const
+QTransform QFxTranslation3D::transform() const
{
if (_dirty) {
_transform = QTransform();
@@ -446,7 +415,7 @@ QTransform QFxTranslation::transform() const
return _transform;
}
#elif defined(QFX_RENDER_OPENGL)
-QMatrix4x4 QFxRotation::transform() const
+QMatrix4x4 QFxTranslation3D::transform() const
{
if (_dirty) {
_dirty = false;
@@ -465,7 +434,7 @@ QMatrix4x4 QFxRotation::transform() const
}
#endif
-void QFxTranslation::update()
+void QFxTranslation3D::update()
{
_dirty = true;
@@ -482,7 +451,7 @@ void QFxTranslation::update()
/*!
\qmlclass Perspective
- \brief The Perspective element specifies a perspective transformation.
+ \brief A Perspective object specifies a perspective transformation.
A Perspective transform only affects an item when running under OpenGL; when running under software
rasterization it has no effect.
@@ -539,10 +508,64 @@ QMatrix4x4 QFxPerspective::transform() const
/*!
\qmlclass Squish
- \brief The Squish element allows you to distort an items appearance by 'squishing' it.
+ \brief A Squish object allows you to distort an items appearance by 'squishing' it.
+
+ Here is an example of various \l Image squishes.
+ \qml
+ Rect {
+ id: Screen
+ width: 360; height: 80
+ color: "white"
+
+ HorizontalLayout {
+ margin: 10
+ spacing: 10
+ Image { src: "qt.png" }
+ Image {
+ src: "qt.png"
+ transform: Squish {
+ x:0; y:0; width:60; height:60
+ topLeftX:0; topLeftY:0
+ topRightX:50; topRightY:10
+ bottomLeftX:0; bottomLeftY:60
+ bottomRightX: 60; bottomRightY:60
+ }
+ }
+ Image {
+ src: "qt.png"
+ transform: Squish {
+ x:0; y:0; width:60; height:60
+ topLeftX:0; topLeftY:0
+ topRightX:50; topRightY:0
+ bottomLeftX:10; bottomLeftY:50
+ bottomRightX: 60; bottomRightY:60
+ }
+ }
+ Image {
+ src: "qt.png"
+ transform: Squish {
+ x:0; y:0; width:60; height:60
+ topLeftX:0; topLeftY:10
+ topRightX:60; topRightY:10
+ bottomLeftX:0; bottomLeftY:50
+ bottomRightX: 60; bottomRightY:50
+ }
+ }
+ Image {
+ src: "qt.png"
+ transform: Squish {
+ x:0; y:0; width:60; height:60
+ topLeftX:10; topLeftY:0
+ topRightX:50; topRightY:0
+ bottomLeftX:10; bottomLeftY:60
+ bottomRightX: 50; bottomRightY:60
+ }
+ }
+ }
+ }
+ \endqml
- A Squish transform only affects an item when running under OpenGL; when running under software
- rasterization it has no effect.
+ \image squish.png
*/
QML_DEFINE_TYPE(QFxSquish,Squish);
@@ -557,6 +580,11 @@ QFxSquish::~QFxSquish()
/*!
\qmlproperty real Squish::x
+ \qmlproperty real Squish::y
+ \qmlproperty real Squish::width
+ \qmlproperty real Squish::height
+
+ This is usually set to the original geometry of the item being squished.
*/
qreal QFxSquish::x() const
{
@@ -569,9 +597,6 @@ void QFxSquish::setX(qreal v)
update();
}
-/*!
- \qmlproperty real Squish::y
-*/
qreal QFxSquish::y() const
{
return p.y();
@@ -583,9 +608,6 @@ void QFxSquish::setY(qreal v)
update();
}
-/*!
- \qmlproperty real Squish::width
-*/
qreal QFxSquish::width() const
{
return s.width();
@@ -597,9 +619,6 @@ void QFxSquish::setWidth(qreal v)
update();
}
-/*!
- \qmlproperty real Squish::height
-*/
qreal QFxSquish::height() const
{
return s.height();
@@ -614,6 +633,8 @@ void QFxSquish::setHeight(qreal v)
/*!
\qmlproperty real Squish::topLeftX
\qmlproperty real Squish::topLeftY
+
+ The top left point for the squish.
*/
qreal QFxSquish::topLeft_x() const
{
@@ -640,6 +661,8 @@ void QFxSquish::settopLeft_y(qreal v)
/*!
\qmlproperty real Squish::topRightX
\qmlproperty real Squish::topRightY
+
+ The top right point for the squish.
*/
qreal QFxSquish::topRight_x() const
{
@@ -666,6 +689,8 @@ void QFxSquish::settopRight_y(qreal v)
/*!
\qmlproperty real Squish::bottomLeftX
\qmlproperty real Squish::bottomLeftY
+
+ The bottom left point for the squish.
*/
qreal QFxSquish::bottomLeft_x() const
{
@@ -692,6 +717,8 @@ void QFxSquish::setbottomLeft_y(qreal v)
/*!
\qmlproperty real Squish::bottomRightX
\qmlproperty real Squish::bottomRightY
+
+ The bottom right point for the squish.
*/
qreal QFxSquish::bottomRight_x() const
{
@@ -722,12 +749,24 @@ void QFxSquish::update()
item->updateTransform();
}
-#if defined(QFX_RENDER_OPENGL)
bool QFxSquish::isIdentity() const
{
return false;
}
+#if defined(QFX_RENDER_QPAINTER)
+QTransform QFxSquish::transform() const
+{
+ QPolygonF poly;
+ poly << p << QPointF(p.x() + s.width(), p.y()) << QPointF(p.x() + s.width(), p.y() + s.height()) << QPointF(p.x(), p.y() + s.height());
+ QPolygonF poly2;
+ poly2 << p1 << p2 << p4 << p3;
+
+ QTransform t;
+ QTransform::quadToQuad(poly, poly2, t);
+ return t;
+}
+#elif defined(QFX_RENDER_OPENGL)
QMatrix4x4 QFxSquish::transform() const
{
QPolygonF poly;
diff --git a/src/declarative/fx/qfxtransform.h b/src/declarative/fx/qfxtransform.h
index 8a4eab1..14bce9b 100644
--- a/src/declarative/fx/qfxtransform.h
+++ b/src/declarative/fx/qfxtransform.h
@@ -109,16 +109,15 @@ private:
};
QML_DECLARE_TYPE(QFxAxis);
-class Q_DECLARATIVE_EXPORT QFxRotation : public QFxTransform
+class Q_DECLARATIVE_EXPORT QFxRotation3D : public QFxTransform
{
Q_OBJECT
Q_PROPERTY(QFxAxis *axis READ axis)
Q_PROPERTY(qreal angle READ angle WRITE setAngle)
- Q_PROPERTY(qreal distanceToPlane READ distanceToPlane WRITE setDistanceToPlane)
public:
- QFxRotation(QObject *parent=0);
- ~QFxRotation();
+ QFxRotation3D(QObject *parent=0);
+ ~QFxRotation3D();
QFxAxis *axis();
@@ -136,22 +135,21 @@ private Q_SLOTS:
private:
QFxAxis _axis;
qreal _angle;
- qreal _distanceToPlane;
mutable bool _dirty;
mutable QSimpleCanvas::Matrix _transform;
};
-QML_DECLARE_TYPE(QFxRotation);
+QML_DECLARE_TYPE(QFxRotation3D);
-class Q_DECLARATIVE_EXPORT QFxTranslation : public QFxTransform
+class Q_DECLARATIVE_EXPORT QFxTranslation3D : public QFxTransform
{
Q_OBJECT
Q_PROPERTY(QFxAxis *axis READ axis)
Q_PROPERTY(qreal distance READ distance WRITE setDistance)
public:
- QFxTranslation(QObject *parent=0);
- ~QFxTranslation();
+ QFxTranslation3D(QObject *parent=0);
+ ~QFxTranslation3D();
QFxAxis *axis();
@@ -170,7 +168,7 @@ private:
mutable bool _dirty;
mutable QSimpleCanvas::Matrix _transform;
};
-QML_DECLARE_TYPE(QFxTranslation);
+QML_DECLARE_TYPE(QFxTranslation3D);
class Q_DECLARATIVE_EXPORT QFxPerspective : public QFxTransform
{
@@ -269,10 +267,8 @@ public:
qreal bottomRight_x() const;
void setbottomRight_x(qreal);
-#if defined(QFX_RENDER_OPENGL)
virtual bool isIdentity() const;
- virtual QMatrix4x4 transform() const;
-#endif
+ virtual QSimpleCanvas::Matrix transform() const;
private:
void update();
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index b2ad06c..dac8ced 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -204,12 +204,12 @@ public:
/*!
\qmlclass WebView
- \brief The WebView element allows you to add web content to a canvas.
+ \brief The WebView item allows you to add web content to a canvas.
\inherits Item
A WebView renders web content based on a URL.
- If the width and height of the element is not set, they will
+ If the width and height of the item is not set, they will
dynamically adjust to a size appropriate for the content.
This width may be large (eg. 980) for typical online web pages.
@@ -220,13 +220,19 @@ public:
Due to WebKit limitations, the height may be more than necessary
if the idealHeight is changed after the content is loaded.
- \code
- <WebView url="http://www.nokia.com" smooth="true" scale="0.5" width="490" height="400"/>
- \endcode
+ \qml
+ WebView {
+ url: "http://www.nokia.com"
+ width: 490
+ height: 400
+ scale: 0.5
+ smooth: true
+ }
+ \endqml
\image webview.png
- The element includes no scrolling, scaling,
+ The item includes no scrolling, scaling,
toolbars, etc., those must be implemented around WebView. See the WebBrowser example
for a demonstration of this.
*/
@@ -240,7 +246,7 @@ public:
\image webview.png
- The element includes no scrolling, scaling,
+ The item includes no scrolling, scaling,
toolbars, etc., those must be implemented around WebView. See the WebBrowser example
for a demonstration of this.
@@ -589,7 +595,8 @@ void QFxWebView::paintGLContents(GLPainter &p)
#if defined(QFX_RENDER_QPAINTER)
bool wasAA = p.testRenderHint(QPainter::Antialiasing);
- p.setRenderHints(QPainter::Antialiasing, d->smooth);
+ bool wasSM = p.testRenderHint(QPainter::SmoothPixmapTransform);
+ p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth);
QRectF clipf = p.clipRegion().boundingRect();
const QRect clip = p.clipRegion().isEmpty() ? content : clipf.toRect();
#elif defined(QFX_RENDER_OPENGL)
@@ -656,6 +663,7 @@ void QFxWebView::paintGLContents(GLPainter &p)
}
#if defined(QFX_RENDER_QPAINTER)
p.setRenderHints(QPainter::Antialiasing, wasAA);
+ p.setRenderHints(QPainter::SmoothPixmapTransform, wasSM);
#endif
}
@@ -926,7 +934,7 @@ QWebPage *QFxWebView::page() const
QFxWebView *self = const_cast<QFxWebView*>(this);
QWebPage *wp = new QFxWebPage(self);
- // QML elements don't default to having a background,
+ // QML items don't default to having a background,
// even though most we pages will set one anyway.
QPalette pal = QApplication::palette();
pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0));
@@ -942,7 +950,35 @@ QWebPage *QFxWebView::page() const
return d->page;
}
+
// The QObject interface to settings().
+/*!
+ \qmlproperty bool WebView::settings::autoLoadImages
+ \qmlproperty bool WebView::settings::javascriptEnabled
+ \qmlproperty bool WebView::settings::javaEnabled
+ \qmlproperty bool WebView::settings::pluginsEnabled
+ \qmlproperty bool WebView::settings::privateBrowsingEnabled
+ \qmlproperty bool WebView::settings::javascriptCanOpenWindows
+ \qmlproperty bool WebView::settings::javascriptCanAccessClipboard
+ \qmlproperty bool WebView::settings::developerExtrasEnabled
+ \qmlproperty bool WebView::settings::linksIncludedInFocusChain
+ \qmlproperty bool WebView::settings::zoomTextOnly
+ \qmlproperty bool WebView::settings::printElementBackgrounds
+ \qmlproperty bool WebView::settings::offlineStorageDatabaseEnabled
+ \qmlproperty bool WebView::settings::offlineWebApplicationCacheEnabled
+ \qmlproperty bool WebView::settings::localStorageDatabaseEnabled
+
+ These properties give access to the settings controlling the web view.
+
+ See QWebSettings for the list of sub-properties.
+
+ \qml
+ WebView {
+ settings.pluginsEnabled: true
+ ...
+ }
+ \endqml
+*/
QObject *QFxWebView::settingsObject() const
{
Q_D(const QFxWebView);
@@ -996,33 +1032,22 @@ QString QFxWebView::html() const
\qmlproperty string WebView::html
This property holds HTML text set directly
- The html property can be set as a string (using CDATA for large blocks),
- or as xhtml inline using the XML namespace http://www.w3.org/1999/xhtml:
-
- \code
- <WebView>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <p>This is valid xHTML.</p>
- </html>
- </WebView>
- \endcode
-
- \code
- <WebView>
- <html>&lt;CDATA[
- <p>This is just HTML.
- ]]&gt;html>
- </WebView>
- \endcode
+ The html property can be set as a string.
+
+ \qml
+ WebView {
+ html: "<p>This is <b>HTML</b>."
+ }
+ \endqml
*/
void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl)
{
Q_D(QFxWebView);
- d->page->setViewportSize(QSize(
+ page()->setViewportSize(QSize(
d->idealwidth>0 ? d->idealwidth : width(),
d->idealheight>0 ? d->idealheight : height()));
if (isComponentComplete())
- d->page->mainFrame()->setHtml(html, baseUrl);
+ page()->mainFrame()->setHtml(html, qmlContext(this)->resolvedUrl(baseUrl));
else {
d->pending = d->PendingHtml;
d->pending_url = baseUrl;
@@ -1033,12 +1058,12 @@ void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl)
void QFxWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
{
Q_D(QFxWebView);
- d->page->setViewportSize(QSize(
+ page()->setViewportSize(QSize(
d->idealwidth>0 ? d->idealwidth : width(),
d->idealheight>0 ? d->idealheight : height()));
if (isComponentComplete())
- d->page->mainFrame()->setContent(data,mimeType,baseUrl);
+ page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl));
else {
d->pending = d->PendingContent;
d->pending_url = baseUrl;
diff --git a/src/declarative/opengl/gltexture.cpp b/src/declarative/opengl/gltexture.cpp
index 6d737ad..199b362 100644
--- a/src/declarative/opengl/gltexture.cpp
+++ b/src/declarative/opengl/gltexture.cpp
@@ -45,6 +45,7 @@
QT_BEGIN_NAMESPACE
/*!
+ \internal
\class GLTexture
\brief The GLTexture class simplifies the use of OpenGL textures.
*/
diff --git a/src/declarative/qml/parser/javascript.g b/src/declarative/qml/parser/javascript.g
index 52d076f..5482392 100644
--- a/src/declarative/qml/parser/javascript.g
+++ b/src/declarative/qml/parser/javascript.g
@@ -70,6 +70,7 @@
%token T_REMAINDER_EQ "%=" T_RETURN "return" T_RPAREN ")"
%token T_SEMICOLON ";" T_AUTOMATIC_SEMICOLON T_STAR "*"
%token T_STAR_EQ "*=" T_STRING_LITERAL "string literal"
+%token T_PROPERTY "property" T_SIGNAL "signal"
%token T_SWITCH "switch" T_THIS "this" T_THROW "throw"
%token T_TILDE "~" T_TRY "try" T_TYPEOF "typeof"
%token T_VAR "var" T_VOID "void" T_WHILE "while"
@@ -78,13 +79,14 @@
%token T_CONST "const"
%token T_DEBUGGER "debugger"
%token T_RESERVED_WORD "reserved word"
+%token T_MULTILINE_STRING_LITERAL "multiline string literal"
--- context keywords.
%token T_PUBLIC "public"
%token T_IMPORT "import"
%nonassoc SHIFT_THERE
-%nonassoc T_IDENTIFIER T_COLON
+%nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY
%nonassoc REDUCE_HERE
%start UiProgram
@@ -611,6 +613,27 @@ case $rule_number: {
} break;
./
+UiMultilineStringLiteral: T_MULTILINE_STRING_LITERAL ;
+/.
+case $rule_number: {
+ AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+UiMultilineStringStatement: UiMultilineStringLiteral T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+UiMultilineStringStatement: UiMultilineStringLiteral T_SEMICOLON ;
+/.
+case $rule_number: {
+ AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectMember: UiQualifiedId T_COLON UiMultilineStringStatement ;
+/. case $rule_number: ./
UiArrayObjectMember: UiQualifiedId T_COLON Statement ;
/. case $rule_number: ./
UiObjectMember: UiQualifiedId T_COLON Statement ;
@@ -623,30 +646,84 @@ case $rule_number: {
} break;
./
-UiObjectMember: T_PUBLIC T_IDENTIFIER T_IDENTIFIER ;
+UiPropertyType: T_VAR ;
+/.
+case $rule_number:
+./
+UiPropertyType: T_RESERVED_WORD ;
+/.
+case $rule_number: {
+ sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
+ break;
+}
+./
+
+UiPropertyType: T_IDENTIFIER ;
+
+UiObjectMember: T_SIGNAL T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (JavaScriptNameIdImpl *)0, sym(2).sval);
+ node->type = AST::UiPublicMember::Signal;
+ node->propertyToken = loc(1);
+ node->typeToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
- node->publicToken = loc(1);
- node->attributeTypeToken = loc(2);
+ node->propertyToken = loc(1);
+ node->typeToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
./
-UiObjectMember: T_PUBLIC T_IDENTIFIER T_IDENTIFIER T_COLON Expression ;
+UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER ;
+/.
+case $rule_number: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
+ node->isDefaultMember = true;
+ node->defaultToken = loc(1);
+ node->propertyToken = loc(2);
+ node->typeToken = loc(3);
+ node->identifierToken = loc(4);
+ sym(1).Node = node;
+} break;
+./
+
+UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
sym(5).Expression);
- node->publicToken = loc(1);
- node->attributeTypeToken = loc(2);
+ node->propertyToken = loc(1);
+ node->typeToken = loc(2);
node->identifierToken = loc(3);
node->colonToken = loc(4);
sym(1).Node = node;
} break;
./
+UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression ;
+/.
+case $rule_number: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
+ sym(6).Expression);
+ node->isDefaultMember = true;
+ node->defaultToken = loc(1);
+ node->propertyToken = loc(2);
+ node->typeToken = loc(3);
+ node->identifierToken = loc(4);
+ node->colonToken = loc(5);
+ sym(1).Node = node;
+} break;
+./
+
UiObjectMember: FunctionDeclaration ;
/.
case $rule_number: {
@@ -661,7 +738,40 @@ case $rule_number: {
} break;
./
-UiQualifiedId: T_IDENTIFIER ;
+UiQualifiedId: T_RESERVED_WORD ;
+/.case $rule_number: ./
+
+UiQualifiedId: T_RETURN ;
+/.
+case $rule_number:
+{
+ AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
+JsIdentifier: T_IDENTIFIER;
+
+JsIdentifier: T_PROPERTY ;
+/.
+case $rule_number: {
+ QString s = QLatin1String(JavaScriptGrammar::spell[T_PROPERTY]);
+ sym(1).sval = driver->intern(s.constData(), s.length());
+ break;
+}
+./
+
+JsIdentifier: T_SIGNAL ;
+/.
+case $rule_number: {
+ QString s = QLatin1String(JavaScriptGrammar::spell[T_SIGNAL]);
+ sym(1).sval = driver->intern(s.constData(), s.length());
+ break;
+}
+./
+
+UiQualifiedId: JsIdentifier ;
/.
case $rule_number: {
AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).sval);
@@ -670,7 +780,7 @@ case $rule_number: {
} break;
./
-UiQualifiedId: UiQualifiedId T_DOT T_IDENTIFIER ;
+UiQualifiedId: UiQualifiedId T_DOT JsIdentifier ;
/.
case $rule_number: {
AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval);
@@ -683,6 +793,7 @@ case $rule_number: {
--------------------------------------------------------------------------------------------------------
-- Expressions
--------------------------------------------------------------------------------------------------------
+
PrimaryExpression: T_THIS ;
/.
case $rule_number: {
@@ -692,7 +803,7 @@ case $rule_number: {
} break;
./
-PrimaryExpression: T_IDENTIFIER ;
+PrimaryExpression: JsIdentifier ;
/.
case $rule_number: {
AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
@@ -934,6 +1045,18 @@ case $rule_number: {
} break;
./
+PropertyName: T_SIGNAL ;
+/.case $rule_number:./
+
+PropertyName: T_PROPERTY ;
+/.
+case $rule_number: {
+ AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
+./
+
PropertyName: T_STRING_LITERAL ;
/.
case $rule_number: {
@@ -1089,7 +1212,7 @@ case $rule_number:
} break;
./
-PropertyIdentifier: T_IDENTIFIER ;
+PropertyIdentifier: JsIdentifier ;
PropertyIdentifier: ReservedIdentifier ;
MemberExpression: PrimaryExpression ;
@@ -2002,7 +2125,7 @@ case $rule_number: {
} break;
./
-VariableDeclaration: T_IDENTIFIER InitialiserOpt ;
+VariableDeclaration: JsIdentifier InitialiserOpt ;
/.
case $rule_number: {
AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
@@ -2011,7 +2134,7 @@ case $rule_number: {
} break;
./
-VariableDeclarationNotIn: T_IDENTIFIER InitialiserNotInOpt ;
+VariableDeclarationNotIn: JsIdentifier InitialiserNotInOpt ;
/.
case $rule_number: {
AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
@@ -2190,8 +2313,8 @@ case $rule_number: {
} break;
./
-ContinueStatement: T_CONTINUE T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
-ContinueStatement: T_CONTINUE T_IDENTIFIER T_SEMICOLON ;
+ContinueStatement: T_CONTINUE JsIdentifier T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+ContinueStatement: T_CONTINUE JsIdentifier T_SEMICOLON ;
/.
case $rule_number: {
AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
@@ -2213,8 +2336,8 @@ case $rule_number: {
} break;
./
-BreakStatement: T_BREAK T_IDENTIFIER T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
-BreakStatement: T_BREAK T_IDENTIFIER T_SEMICOLON ;
+BreakStatement: T_BREAK JsIdentifier T_AUTOMATIC_SEMICOLON ; -- automatic semicolon
+BreakStatement: T_BREAK JsIdentifier T_SEMICOLON ;
/.
case $rule_number: {
AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
@@ -2326,6 +2449,19 @@ case $rule_number: {
} break;
./
+LabelledStatement: T_SIGNAL T_COLON Statement ;
+/.case $rule_number:./
+
+LabelledStatement: T_PROPERTY T_COLON Statement ;
+/.
+case $rule_number: {
+ AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement);
+ node->identifierToken = loc(1);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
+./
+
LabelledStatement: T_IDENTIFIER T_COLON Statement ;
/.
case $rule_number: {
@@ -2374,7 +2510,7 @@ case $rule_number: {
} break;
./
-Catch: T_CATCH T_LPAREN T_IDENTIFIER T_RPAREN Block ;
+Catch: T_CATCH T_LPAREN JsIdentifier T_RPAREN Block ;
/.
case $rule_number: {
AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
@@ -2406,7 +2542,7 @@ case $rule_number: {
} break;
./
-FunctionDeclaration: T_FUNCTION T_IDENTIFIER T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ;
+FunctionDeclaration: T_FUNCTION JsIdentifier T_LPAREN FormalParameterListOpt T_RPAREN T_LBRACE FunctionBodyOpt T_RBRACE ;
/.
case $rule_number: {
AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
@@ -2435,7 +2571,7 @@ case $rule_number: {
} break;
./
-FormalParameterList: T_IDENTIFIER ;
+FormalParameterList: JsIdentifier ;
/.
case $rule_number: {
AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
@@ -2444,7 +2580,7 @@ case $rule_number: {
} break;
./
-FormalParameterList: FormalParameterList T_COMMA T_IDENTIFIER ;
+FormalParameterList: FormalParameterList T_COMMA JsIdentifier ;
/.
case $rule_number: {
AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
@@ -2527,7 +2663,7 @@ case $rule_number: {
} break;
./
-IdentifierOpt: T_IDENTIFIER ;
+IdentifierOpt: JsIdentifier ;
PropertyNameAndValueListOpt: ;
/.
diff --git a/src/declarative/qml/parser/javascriptast_p.h b/src/declarative/qml/parser/javascriptast_p.h
index 8515998..ad317e8 100644
--- a/src/declarative/qml/parser/javascriptast_p.h
+++ b/src/declarative/qml/parser/javascriptast_p.h
@@ -2326,17 +2326,22 @@ public:
UiPublicMember(JavaScriptNameIdImpl *memberType,
JavaScriptNameIdImpl *name)
- : memberType(memberType), name(name), expression(0)
+ : type(Property), memberType(memberType), name(name), expression(0), isDefaultMember(false)
{ kind = K; }
UiPublicMember(JavaScriptNameIdImpl *memberType,
JavaScriptNameIdImpl *name,
ExpressionNode *expression)
- : memberType(memberType), name(name), expression(expression)
+ : type(Property), memberType(memberType), name(name), expression(expression), isDefaultMember(false)
{ kind = K; }
virtual SourceLocation firstSourceLocation() const
- { return publicToken; }
+ {
+ if (defaultToken.isValid())
+ return defaultToken;
+
+ return propertyToken;
+ }
virtual SourceLocation lastSourceLocation() const
{
@@ -2346,19 +2351,22 @@ public:
return colonToken;
else if (identifierToken.isValid())
return identifierToken;
- else if (attributeTypeToken.isValid())
- return attributeTypeToken;
- return publicToken;
+ else if (typeToken.isValid())
+ return typeToken;
+ return propertyToken;
}
virtual void accept0(Visitor *visitor);
// attributes
+ enum { Signal, Property } type;
JavaScriptNameIdImpl *memberType;
JavaScriptNameIdImpl *name;
ExpressionNode *expression;
- SourceLocation publicToken;
- SourceLocation attributeTypeToken;
+ bool isDefaultMember;
+ SourceLocation defaultToken;
+ SourceLocation propertyToken;
+ SourceLocation typeToken;
SourceLocation identifierToken;
SourceLocation colonToken;
};
diff --git a/src/declarative/qml/parser/javascriptgrammar.cpp b/src/declarative/qml/parser/javascriptgrammar.cpp
index b344366..a33f343 100644
--- a/src/declarative/qml/parser/javascriptgrammar.cpp
+++ b/src/declarative/qml/parser/javascriptgrammar.cpp
@@ -49,571 +49,637 @@ const char *const JavaScriptGrammar::spell [] = {
"if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=",
"-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=",
"||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return",
- ")", ";", 0, "*", "*=", "string literal", "switch", "this", "throw", "~",
- "try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true",
- "false", "const", "debugger", "reserved word", "public", "import", 0, 0};
+ ")", ";", 0, "*", "*=", "string literal", "property", "signal", "switch", "this",
+ "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=",
+ "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "public", "import", 0,
+ 0};
const int JavaScriptGrammar::lhs [] = {
- 88, 89, 89, 92, 92, 93, 93, 91, 90, 90,
- 95, 95, 97, 97, 96, 94, 96, 94, 96, 94,
- 96, 94, 94, 94, 94, 94, 98, 98, 103, 103,
- 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
- 103, 103, 103, 105, 105, 109, 109, 104, 104, 107,
- 107, 110, 110, 110, 110, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 111, 111, 112, 112, 113, 113,
- 113, 113, 113, 116, 116, 117, 117, 117, 117, 115,
- 115, 118, 118, 119, 119, 120, 120, 120, 121, 121,
- 121, 121, 121, 121, 121, 121, 121, 121, 122, 122,
- 122, 122, 123, 123, 123, 124, 124, 124, 124, 125,
- 125, 125, 125, 125, 125, 125, 126, 126, 126, 126,
- 126, 126, 127, 127, 127, 127, 127, 128, 128, 128,
- 128, 128, 129, 129, 130, 130, 131, 131, 132, 132,
- 133, 133, 134, 134, 135, 135, 136, 136, 137, 137,
- 138, 138, 139, 139, 140, 140, 108, 108, 141, 141,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 100, 100, 143, 143, 144, 144, 145, 145,
- 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 146, 161, 161, 160, 160,
- 102, 102, 162, 162, 163, 163, 165, 165, 164, 166,
- 169, 167, 167, 170, 168, 168, 147, 148, 148, 149,
- 149, 150, 150, 150, 150, 150, 150, 150, 151, 151,
- 151, 151, 152, 152, 152, 152, 153, 153, 154, 156,
- 171, 171, 174, 174, 172, 172, 175, 173, 155, 157,
- 157, 158, 158, 158, 176, 177, 159, 159, 101, 114,
- 181, 181, 178, 178, 179, 179, 182, 183, 183, 184,
- 184, 180, 180, 106, 106, 185};
+ 91, 92, 92, 95, 95, 96, 96, 94, 93, 93,
+ 98, 98, 100, 100, 99, 97, 99, 97, 99, 97,
+ 102, 103, 103, 97, 99, 97, 105, 105, 105, 97,
+ 97, 97, 97, 97, 97, 97, 101, 101, 109, 109,
+ 109, 101, 101, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 112, 112,
+ 116, 116, 111, 111, 114, 114, 117, 117, 117, 117,
+ 117, 117, 118, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 119, 119, 120, 120, 120, 120, 120,
+ 123, 123, 124, 124, 124, 124, 122, 122, 125, 125,
+ 126, 126, 127, 127, 127, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 129, 129, 129, 129, 130,
+ 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
+ 132, 132, 132, 133, 133, 133, 133, 133, 133, 134,
+ 134, 134, 134, 134, 135, 135, 135, 135, 135, 136,
+ 136, 137, 137, 138, 138, 139, 139, 140, 140, 141,
+ 141, 142, 142, 143, 143, 144, 144, 145, 145, 146,
+ 146, 147, 147, 115, 115, 148, 148, 149, 149, 149,
+ 149, 149, 149, 149, 149, 149, 149, 149, 149, 106,
+ 106, 150, 150, 151, 151, 152, 152, 104, 104, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
+ 104, 104, 153, 168, 168, 167, 167, 108, 108, 169,
+ 169, 170, 170, 172, 172, 171, 173, 176, 174, 174,
+ 177, 175, 175, 154, 155, 155, 156, 156, 157, 157,
+ 157, 157, 157, 157, 157, 158, 158, 158, 158, 159,
+ 159, 159, 159, 160, 160, 161, 163, 178, 178, 181,
+ 181, 179, 179, 182, 180, 162, 162, 162, 164, 164,
+ 165, 165, 165, 183, 184, 166, 166, 107, 121, 188,
+ 188, 185, 185, 186, 186, 189, 190, 190, 191, 191,
+ 187, 187, 113, 113, 192};
const int JavaScriptGrammar:: rhs[] = {
2, 1, 1, 1, 2, 3, 3, 0, 1, 2,
1, 3, 2, 3, 4, 4, 2, 2, 5, 5,
- 3, 3, 3, 5, 1, 1, 1, 3, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 3, 5,
- 3, 4, 3, 2, 4, 1, 2, 0, 1, 3,
- 5, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 2, 3, 3, 3, 1, 1, 1, 2,
+ 3, 4, 5, 6, 1, 1, 1, 1, 1, 1,
+ 1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 3, 3, 5, 3, 4, 3, 2, 4,
+ 1, 2, 0, 1, 3, 5, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 4, 3, 5, 1, 2, 4, 4, 4, 3, 0,
- 1, 1, 3, 1, 1, 1, 2, 2, 1, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 1, 3,
- 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
- 3, 3, 3, 3, 3, 3, 1, 3, 3, 3,
- 3, 3, 1, 3, 3, 3, 3, 1, 3, 3,
- 3, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 3, 1, 5, 1, 5, 1, 3, 1, 3,
+ 1, 1, 1, 1, 1, 1, 1, 4, 3, 5,
+ 1, 2, 4, 4, 4, 3, 0, 1, 1, 3,
+ 1, 1, 1, 2, 2, 1, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 3, 3, 3, 1,
+ 3, 3, 1, 3, 3, 3, 1, 3, 3, 3,
+ 3, 3, 3, 1, 3, 3, 3, 3, 3, 1,
+ 3, 3, 3, 3, 1, 3, 3, 3, 3, 1,
+ 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
+ 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
+ 5, 1, 5, 1, 3, 1, 3, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 3, 0, 1, 1, 3, 0, 1,
+ 3, 0, 1, 1, 3, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 3, 1, 2, 0, 1,
- 3, 3, 1, 1, 1, 3, 1, 3, 2, 2,
- 2, 0, 1, 2, 0, 1, 1, 2, 2, 7,
- 5, 7, 7, 5, 9, 10, 7, 8, 2, 2,
- 3, 3, 2, 2, 3, 3, 3, 3, 5, 5,
- 3, 5, 1, 2, 0, 1, 4, 3, 3, 3,
- 3, 3, 3, 4, 5, 2, 2, 2, 8, 8,
- 1, 3, 0, 1, 0, 1, 1, 1, 2, 1,
- 1, 0, 1, 0, 1, 2};
+ 1, 1, 3, 1, 2, 0, 1, 3, 3, 1,
+ 1, 1, 3, 1, 3, 2, 2, 2, 0, 1,
+ 2, 0, 1, 1, 2, 2, 7, 5, 7, 7,
+ 5, 9, 10, 7, 8, 2, 2, 3, 3, 2,
+ 2, 3, 3, 3, 3, 5, 5, 3, 5, 1,
+ 2, 0, 1, 4, 3, 3, 3, 3, 3, 3,
+ 3, 3, 4, 5, 2, 2, 2, 8, 8, 1,
+ 3, 0, 1, 0, 1, 1, 1, 2, 1, 1,
+ 0, 1, 0, 1, 2};
const int JavaScriptGrammar::action_default [] = {
8, 2, 0, 4, 3, 0, 0, 0, 6, 7,
- 5, 25, 223, 0, 27, 0, 224, 9, 1, 0,
- 0, 26, 0, 283, 284, 0, 281, 0, 282, 0,
- 285, 126, 193, 157, 165, 161, 201, 208, 105, 177,
- 207, 215, 203, 153, 0, 204, 286, 0, 291, 90,
- 205, 206, 211, 106, 169, 173, 94, 123, 104, 109,
- 89, 143, 209, 130, 288, 287, 290, 212, 0, 0,
- 0, 0, 36, 37, 0, 33, 0, 292, 30, 0,
- 294, 48, 0, 0, 0, 0, 0, 31, 34, 0,
- 0, 195, 237, 35, 0, 29, 0, 0, 32, 0,
- 0, 0, 0, 0, 213, 214, 119, 202, 210, 0,
- 0, 106, 125, 292, 30, 294, 108, 107, 0, 0,
- 0, 121, 122, 120, 0, 293, 283, 0, 0, 285,
- 0, 280, 0, 295, 0, 55, 56, 57, 58, 83,
- 59, 84, 60, 61, 62, 63, 64, 65, 66, 67,
- 52, 68, 69, 70, 71, 72, 54, 85, 73, 53,
- 74, 75, 76, 77, 78, 79, 80, 81, 82, 86,
- 0, 50, 0, 0, 42, 0, 51, 41, 124, 0,
- 154, 0, 0, 0, 0, 144, 0, 0, 0, 0,
- 0, 0, 134, 0, 0, 0, 128, 129, 127, 132,
- 136, 135, 133, 131, 146, 145, 147, 0, 162, 0,
- 158, 0, 0, 100, 99, 88, 87, 0, 0, 98,
- 194, 101, 0, 102, 0, 103, 97, 238, 239, 279,
- 0, 190, 183, 181, 188, 189, 187, 186, 192, 185,
- 184, 182, 191, 178, 0, 166, 0, 0, 170, 0,
- 0, 174, 0, 0, 100, 92, 0, 91, 0, 96,
- 289, 253, 0, 254, 255, 256, 249, 0, 250, 251,
- 252, 277, 278, 110, 0, 0, 0, 0, 0, 242,
- 243, 199, 197, 159, 167, 163, 179, 155, 200, 0,
- 106, 171, 175, 148, 137, 0, 0, 156, 0, 0,
- 0, 0, 149, 0, 0, 0, 0, 0, 141, 139,
- 142, 140, 138, 151, 150, 152, 0, 164, 0, 160,
- 0, 198, 106, 0, 180, 195, 196, 0, 195, 0,
- 0, 245, 0, 0, 0, 247, 0, 168, 0, 0,
- 172, 0, 0, 176, 235, 0, 227, 236, 230, 0,
- 234, 0, 195, 228, 0, 195, 0, 0, 246, 0,
- 0, 0, 248, 293, 0, 269, 0, 0, 0, 241,
- 0, 240, 217, 220, 0, 56, 83, 59, 84, 61,
- 62, 33, 66, 67, 30, 68, 71, 31, 34, 195,
- 35, 74, 29, 76, 32, 78, 79, 80, 81, 82,
- 86, 218, 216, 94, 95, 100, 0, 93, 0, 257,
- 258, 0, 0, 0, 260, 265, 263, 266, 0, 0,
- 264, 265, 0, 261, 0, 262, 219, 268, 0, 219,
- 267, 0, 270, 271, 0, 219, 272, 273, 0, 0,
- 274, 0, 0, 0, 275, 276, 112, 111, 0, 0,
- 0, 244, 0, 0, 0, 259, 0, 49, 0, 46,
- 48, 39, 0, 45, 40, 47, 44, 38, 0, 43,
- 116, 114, 118, 115, 113, 117, 0, 18, 13, 0,
- 14, 10, 0, 23, 0, 24, 0, 0, 22, 30,
- 48, 16, 27, 0, 11, 0, 17, 0, 20, 12,
- 0, 21, 30, 48, 15, 0, 19, 28, 232, 225,
- 0, 233, 229, 0, 231, 221, 0, 222, 226, 296};
+ 5, 35, 42, 240, 0, 0, 39, 40, 37, 38,
+ 41, 241, 9, 1, 0, 0, 36, 0, 29, 28,
+ 27, 0, 32, 0, 143, 210, 174, 182, 178, 122,
+ 194, 170, 34, 107, 45, 123, 186, 190, 111, 140,
+ 121, 126, 106, 160, 147, 0, 51, 52, 48, 311,
+ 39, 313, 63, 0, 0, 0, 0, 0, 46, 49,
+ 0, 0, 40, 41, 50, 44, 0, 47, 0, 0,
+ 136, 0, 0, 123, 142, 125, 124, 0, 0, 0,
+ 138, 139, 137, 141, 0, 171, 0, 0, 0, 0,
+ 161, 0, 0, 0, 0, 0, 0, 151, 0, 0,
+ 0, 145, 146, 144, 149, 153, 152, 150, 148, 163,
+ 162, 164, 0, 179, 0, 175, 0, 0, 117, 104,
+ 116, 105, 73, 74, 75, 100, 76, 101, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
+ 89, 102, 90, 91, 92, 93, 94, 95, 96, 97,
+ 98, 99, 103, 0, 0, 115, 211, 118, 0, 119,
+ 0, 120, 114, 0, 207, 200, 198, 205, 206, 204,
+ 203, 209, 202, 201, 199, 208, 195, 0, 183, 0,
+ 0, 187, 0, 0, 191, 0, 0, 117, 109, 0,
+ 108, 0, 113, 127, 0, 312, 302, 303, 0, 300,
+ 0, 301, 0, 304, 218, 225, 224, 232, 220, 0,
+ 221, 305, 0, 310, 222, 223, 228, 226, 307, 306,
+ 309, 229, 0, 0, 0, 0, 0, 311, 39, 0,
+ 313, 40, 212, 254, 41, 0, 0, 0, 0, 0,
+ 230, 231, 219, 227, 255, 256, 299, 308, 0, 270,
+ 271, 272, 273, 0, 266, 267, 268, 269, 296, 297,
+ 0, 0, 0, 0, 0, 259, 260, 216, 214, 176,
+ 184, 180, 196, 172, 217, 0, 123, 188, 192, 165,
+ 154, 0, 0, 173, 0, 0, 0, 0, 166, 0,
+ 0, 0, 0, 0, 158, 156, 159, 157, 155, 168,
+ 167, 169, 0, 181, 0, 177, 0, 215, 123, 0,
+ 197, 212, 213, 0, 212, 0, 0, 262, 0, 0,
+ 0, 264, 0, 185, 0, 0, 189, 0, 0, 193,
+ 252, 0, 244, 253, 247, 0, 251, 0, 212, 245,
+ 0, 212, 0, 0, 263, 0, 0, 0, 265, 312,
+ 302, 0, 0, 304, 0, 298, 0, 288, 0, 0,
+ 0, 258, 0, 257, 0, 314, 0, 72, 234, 237,
+ 0, 73, 240, 76, 101, 78, 79, 48, 83, 84,
+ 39, 85, 88, 46, 49, 40, 212, 41, 50, 91,
+ 44, 93, 47, 95, 96, 241, 98, 99, 103, 0,
+ 65, 0, 0, 67, 71, 69, 57, 68, 70, 0,
+ 66, 56, 235, 233, 111, 112, 117, 0, 110, 0,
+ 287, 0, 274, 275, 0, 286, 0, 0, 0, 277,
+ 282, 280, 283, 0, 0, 281, 282, 0, 278, 0,
+ 279, 236, 285, 0, 236, 284, 0, 289, 290, 0,
+ 236, 291, 292, 0, 0, 293, 0, 0, 0, 294,
+ 295, 129, 128, 0, 0, 0, 261, 0, 0, 0,
+ 276, 0, 64, 0, 61, 63, 54, 0, 60, 55,
+ 62, 59, 53, 0, 58, 133, 131, 135, 132, 130,
+ 134, 0, 0, 18, 13, 0, 14, 10, 0, 31,
+ 0, 33, 30, 0, 0, 26, 39, 63, 21, 0,
+ 24, 16, 39, 0, 11, 0, 17, 0, 20, 12,
+ 0, 25, 39, 63, 15, 0, 19, 22, 23, 43,
+ 249, 242, 0, 250, 246, 0, 248, 238, 0, 239,
+ 243, 315};
const int JavaScriptGrammar::goto_default [] = {
- 6, 5, 18, 1, 4, 3, 17, 493, 494, 477,
- 19, 372, 44, 11, 107, 60, 458, 456, 134, 133,
- 32, 457, 132, 135, 214, 56, 49, 222, 58, 38,
- 221, 53, 59, 106, 57, 31, 63, 61, 293, 43,
- 287, 33, 283, 35, 285, 34, 284, 54, 291, 55,
- 292, 39, 286, 282, 323, 408, 288, 289, 36, 42,
- 45, 50, 51, 40, 37, 62, 108, 52, 67, 104,
- 105, 41, 374, 373, 20, 510, 509, 345, 346, 512,
- 348, 511, 347, 414, 418, 421, 417, 416, 436, 437,
- 25, 47, 124, 24, 46, 65, 64, 0};
+ 6, 5, 23, 1, 4, 3, 22, 523, 524, 503,
+ 24, 519, 520, 378, 508, 219, 11, 252, 44, 52,
+ 483, 481, 376, 375, 35, 482, 374, 377, 130, 48,
+ 43, 168, 50, 39, 167, 45, 51, 80, 49, 34,
+ 54, 53, 289, 41, 283, 36, 279, 38, 281, 37,
+ 280, 46, 287, 47, 288, 40, 282, 278, 319, 431,
+ 284, 285, 214, 218, 220, 224, 225, 216, 215, 227,
+ 253, 226, 231, 250, 251, 217, 380, 379, 25, 542,
+ 541, 341, 342, 544, 344, 543, 343, 439, 443, 446,
+ 442, 441, 461, 462, 208, 222, 204, 207, 221, 229,
+ 228, 0};
const int JavaScriptGrammar::action_index [] = {
- -21, -88, 43, -88, -11, 246, 80, 75, -88, -88,
- -88, -88, -88, 56, 66, 50, -88, -88, 238, 173,
- 71, -88, 51, 27, 9, -30, -88, -2, -88, -7,
- 1298, 132, -88, 23, -34, -73, -88, -88, 205, -88,
- -88, -88, -88, 239, 203, -88, -88, -18, -88, -88,
- -88, -88, -88, 489, 133, 111, 197, 177, -88, -88,
- -88, 404, -88, 274, -88, 1298, -88, -88, 186, 181,
- 89, 566, -88, -88, 1214, -88, 74, 68, 83, 69,
- 1550, 87, 566, 566, 566, 379, 566, -88, -88, 566,
- 566, 566, -88, -88, 52, -88, 566, 566, -88, 65,
- 566, 566, 53, 58, -88, -88, -88, -88, -88, 566,
- 566, 90, 172, 63, -88, 1046, -88, -88, 566, 566,
- 566, -88, -88, -88, 40, -88, -17, -52, -28, 1298,
- -26, -88, 24, 88, -12, -88, -88, -88, -88, -88,
- -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
- -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
- -88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
- 566, -88, 1130, 32, -88, 566, -88, -88, 187, 566,
- 233, 566, 566, 566, 566, 312, 566, 566, 566, 566,
- 566, 566, 274, 566, 566, 566, 118, 131, 128, 160,
- 180, 168, 200, 165, 322, 302, 404, 566, -8, 566,
- 72, 962, 566, 566, -88, -88, -88, 106, 566, -88,
- -88, 73, 59, -88, 566, -88, -88, -88, -88, -88,
- 566, -88, -88, -88, -88, -88, -88, -88, -88, -88,
- -88, -88, -88, -88, 566, 13, 566, 566, 133, 60,
- 566, -88, 962, 566, 566, -88, 117, -88, 17, -88,
- -88, -88, 92, -88, -88, -88, -88, 85, -88, -88,
- -88, -88, -88, -88, 67, 70, 566, 104, 115, -88,
- -88, 643, -88, 19, -29, -55, -88, 237, 8, -46,
- 421, 20, 79, 339, 274, -4, 566, 227, 566, 566,
- 566, 566, 257, 566, 566, 566, 566, 566, 274, 274,
- 274, 274, 274, 263, 339, 339, 566, -75, 566, 3,
- 566, -88, 489, 566, -88, 566, 47, -33, 566, -60,
- 1214, -88, 566, 136, 1214, -88, 566, -35, 566, 566,
- 7, 0, 566, -88, 1, 99, 2, -88, -88, 566,
- -88, 28, 566, -88, 4, 566, 12, 1214, -88, 566,
- 114, 1214, -88, 34, 1214, -88, 566, 110, 1214, 22,
- 1214, -88, -88, 1214, -20, 152, 5, 162, 77, 566,
- 1214, 41, 14, 84, 42, 11, 353, 38, 35, 801,
- 25, 10, 33, 566, 44, 21, 566, 31, 566, 26,
- 39, -88, -88, 194, -88, 566, -1, -88, 105, -88,
- -88, 566, 95, 45, -88, 6, -88, 48, 211, 566,
- -88, 36, 37, -88, -19, -88, 1214, -88, 109, 1214,
- -88, 192, -88, -88, 120, 1214, 46, -88, 16, 30,
- -88, 29, -54, -23, -88, -88, -88, -88, 566, 137,
- 1214, -88, 566, 126, 1214, -88, 119, -6, 720, -88,
- 15, -88, 878, -88, -88, -88, -88, -88, 96, -88,
- -88, -88, -88, -88, -88, -88, 286, -88, -88, 248,
- -88, -88, 54, 64, 566, 61, 1382, 55, -88, 171,
- 123, -88, 49, 103, -88, 94, -88, 57, -88, -88,
- 1466, -88, 116, 113, -88, 107, -88, -88, 76, -88,
- 140, -88, -88, 566, -88, -88, 62, -88, -88, -88,
+ 62, -91, -18, -91, -40, 362, 44, 117, -91, -91,
+ -91, -91, -91, -91, -12, 144, 20, 130, -91, -91,
+ 14, -91, -91, 356, 127, 195, -91, 158, -91, -91,
+ -91, 11, 34, 678, 125, -91, 41, -9, -27, 204,
+ -91, 263, 58, -91, -91, 519, 61, 63, 220, 131,
+ -91, -91, -91, 330, 159, 678, -91, -91, -91, 154,
+ -91, 1176, 53, 678, 678, 678, 598, 678, -91, -91,
+ 678, 678, -91, -91, -91, -91, 678, -91, 678, 678,
+ -91, 678, 678, 118, 221, -91, -91, 678, 678, 678,
+ -91, -91, -91, 217, 678, 269, 678, 678, 678, 678,
+ 311, 678, 678, 678, 678, 678, 678, 228, 678, 678,
+ 678, 104, 65, 64, 187, 164, 214, 295, 295, 431,
+ 431, 345, 678, -7, 678, 90, 1089, 678, 678, -91,
+ -91, -91, -91, -91, -91, -91, -91, -91, -91, -91,
+ -91, -91, -91, -91, -91, -91, -91, -91, -91, -91,
+ -91, -91, -91, -91, -91, -91, -91, -91, -91, -91,
+ -91, -91, -91, 113, 678, -91, -91, 42, -8, -91,
+ 678, -91, -91, 678, -91, -91, -91, -91, -91, -91,
+ -91, -91, -91, -91, -91, -91, -91, 678, 22, 678,
+ 678, 29, 5, 678, -91, 1089, 678, 678, -91, 110,
+ -91, 51, -91, -91, 36, -91, 184, 85, 60, -91,
+ 151, -91, 56, 1437, -91, -91, -91, -91, -91, 166,
+ -91, -91, 28, -91, -91, -91, -91, -91, -91, 1437,
+ -91, -91, 290, 244, 102, 1350, 49, 178, 73, 39,
+ 1698, 70, 678, -91, 72, 46, 678, 43, 37, 38,
+ -91, -91, -91, -91, -91, -91, -91, -91, 68, -91,
+ -91, -91, -91, 71, -91, -91, -91, -91, -91, -91,
+ 50, 54, 678, 88, 66, -91, -91, 842, -91, 87,
+ 47, 45, -91, 257, 59, 26, 486, 84, 146, 363,
+ 295, 205, 678, 249, 678, 678, 678, 678, 363, 678,
+ 678, 678, 678, 678, 295, 295, 295, 295, 295, 293,
+ 363, 363, 678, -21, 678, 18, 678, -91, 519, 678,
+ -91, 678, 13, -37, 678, -38, 1350, -91, 678, 98,
+ 1350, -91, 678, -28, 678, 678, 16, 8, 678, -91,
+ 0, 229, -15, -91, -91, 678, -91, 219, 678, -91,
+ -34, 678, -32, 1350, -91, 678, 89, 1350, -91, -6,
+ 197, -24, 1, 1437, -23, -91, 1350, -91, 678, 94,
+ 1350, 17, 1350, -91, 6, 15, -26, -91, -91, 1350,
+ -30, 231, 7, 278, 76, 678, 1350, -5, -36, 260,
+ -3, -29, 598, -4, -1, -91, 762, -91, 3, 19,
+ 4, 678, -2, -25, 678, 2, 678, -35, -10, 678,
+ -91, 1263, 52, -91, -91, -91, -91, -91, -91, 678,
+ -91, -91, -91, -91, 167, -91, 678, 21, -91, 1350,
+ -91, 74, -91, -91, 1350, -91, 678, 91, 25, -91,
+ 105, -91, 105, 97, 678, -91, 105, 55, -91, 23,
+ -91, 1350, -91, 101, 1350, -91, 208, -91, -91, 92,
+ 1350, 40, -91, 33, 35, -91, 180, 24, 31, -91,
+ -91, -91, -91, 678, 86, 1350, -91, 678, 93, 1350,
+ -91, 106, 57, 922, -91, 48, -91, 1002, -91, -91,
+ -91, -91, -91, 132, -91, -91, -91, -91, -91, -91,
+ -91, 10, 424, -91, -91, 421, -91, -91, 9, 30,
+ 678, 27, -91, 1611, 156, -91, 134, 342, -91, 95,
+ -91, -91, 12, 116, -91, 124, -91, 270, -91, -91,
+ 1524, -91, 112, 352, -91, 114, -91, -91, -91, -91,
+ 32, -91, 169, -91, -91, 678, -91, -91, 139, -91,
+ -91, -91,
- -98, -98, -98, -98, 13, 6, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, -98, -98, 60, -98,
- -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- 62, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -32, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, 174, -98, -98, -98, -98,
- -98, 63, -98, -98, -2, -98, -98, -98, -98, -98,
- -98, -98, 51, 80, 83, 56, 99, -98, -98, 87,
- 59, 48, -98, -98, -98, -98, 40, 113, -98, -17,
- 139, 123, -98, -98, -98, -98, -98, -98, -98, 130,
- 131, -98, -98, -98, -98, -98, -98, -98, 120, 117,
- 112, -98, -98, -98, -98, -98, -60, -98, -98, 175,
- -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- 33, -98, 35, -98, -98, 39, -98, -98, -98, 54,
- -98, 64, 66, 67, 68, -98, 55, 52, 41, 71,
- 93, 95, -98, 92, 86, 75, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, -98, 69, -98, 78,
- -98, 20, 32, 26, -98, -98, -98, -98, 8, -98,
- -98, -98, -98, -98, 15, -98, -98, -98, -98, -98,
- 31, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, 97, -98, 102, 34, -98, -98,
- 38, -98, 47, 36, 42, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, 30, -98, -98, -98,
- -98, 144, -98, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, 187, -98, 173, 170,
- 176, 162, -98, 140, 137, 127, 103, 121, -98, -98,
- -98, -98, -98, -98, -98, -98, 158, -98, 161, -98,
- 185, -98, -98, 188, -98, 129, -98, -98, 135, -98,
- 29, -98, 19, -98, 21, -98, 189, -98, 186, 179,
- -98, -98, 160, -98, -98, -98, -98, -98, -98, 146,
- -98, -52, 128, -98, -98, 124, -98, 22, -98, 24,
- -98, 27, -98, -98, 28, -98, 25, -98, 23, -98,
- 18, -98, -98, 53, -98, -98, -98, -98, -98, 136,
- 50, -98, -98, -98, -98, -98, 110, -98, -98, 44,
- -98, -98, -98, 43, -98, -11, 49, -98, 45, -98,
- -98, -98, -98, -98, -98, 88, -98, -98, -98, -98,
- -98, 37, -98, -98, -98, -98, -98, -84, -98, -6,
- -98, -83, -98, -98, -98, -98, -62, -98, -98, -47,
- -98, -98, -98, -98, -98, -98, -77, -98, -98, -42,
- -98, -98, -98, -37, -98, -98, -98, -98, -10, -98,
- -7, -98, 77, -98, 0, -98, -98, -98, 7, -98,
- 1, -98, -1, -98, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -98, -98, -98, 240, -98, -98, 73,
- -98, -98, -98, -98, 12, -98, -3, -98, -98, -9,
- 3, -98, 14, -98, -98, -98, -98, 57, -98, -98,
- 4, -98, 5, 115, -98, -98, -98, -98, -98, -98,
- -98, -98, -98, -13, -98, -98, -71, -98, -98, -98};
+ -102, -102, -102, -102, 34, 63, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, 53, -102, -102, -102, -102,
+ -102, -102, -102, 235, -102, 9, -102, 4, -102, -102,
+ -102, -102, -102, -5, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -51, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, 156, -102, -102, -102, 18,
+ -102, -102, -102, -11, 95, 88, 90, 79, -102, -102,
+ 80, 100, -102, -102, -102, -102, 114, -102, 101, 107,
+ -102, 73, 131, -102, -102, -102, -102, 108, 111, 115,
+ -102, -102, -102, -102, 165, -102, 83, 85, 118, 71,
+ -102, 120, 144, 145, 143, 147, 159, -102, 122, 129,
+ 66, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, 41, -102, 65, -102, 77, 26, 19, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, 27, -102, -102, -102, -102, -102,
+ 28, -102, -102, 42, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, 139, -102, 138,
+ -1, -102, -102, 1, -102, 230, -10, 55, -102, -102,
+ -102, -102, -102, -102, -102, -102, -3, -102, -102, -102,
+ -4, -102, -102, 86, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, 254,
+ -102, -102, 56, 50, -102, 46, -102, -6, -102, -102,
+ -102, -102, -2, -102, -102, -102, 17, -28, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, 5, -102, -102, -102, -102, 146, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, 43, 225, -102, 237, 226, 197, 196, -102, 127,
+ 136, 137, 135, 93, -102, -102, -102, -102, -102, -102,
+ -102, -102, 174, -102, 180, -102, 170, -102, -102, 183,
+ -102, 68, -102, -102, 70, -102, 49, -102, 48, -102,
+ 47, -102, 193, -102, 161, 219, -102, -102, 189, -102,
+ -102, -102, -102, -102, -102, 190, -102, 59, 72, -102,
+ -102, 75, -102, 57, -102, 58, -102, 51, -102, -102,
+ 64, -102, -102, 203, -102, -102, 44, -102, 32, -102,
+ 31, -102, 29, -102, -102, -102, -102, -102, -102, 40,
+ -102, 37, -102, 38, -102, 61, 36, -102, -102, 30,
+ -102, -102, 62, -102, -102, -102, 35, -102, -102, -102,
+ -102, 39, -102, 3, 128, -102, 155, -102, -102, 22,
+ -102, 14, -102, -102, -102, -102, -102, -102, -102, 13,
+ -102, -102, -102, -102, -102, -102, 123, -102, -102, 45,
+ -102, -102, -102, -102, 25, -102, 52, -102, -102, -102,
+ -102, -102, -80, -102, 54, -102, -72, -102, -102, -102,
+ -102, -73, -102, -102, -76, -102, -102, -102, -102, -102,
+ -102, -87, -102, -102, -45, -102, 12, -102, -31, -102,
+ -102, -102, -102, 20, -102, 15, -102, 98, -102, 6,
+ -102, -102, -102, 0, -102, 2, -102, -16, -102, -102,
+ -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+ -102, -102, 232, -102, -102, 238, -102, -102, -102, -102,
+ 11, -102, -102, 16, -9, -102, -7, 74, -102, -102,
+ -102, -102, 24, -102, -102, -102, -102, 194, -102, -102,
+ 8, -102, -8, 188, -102, -102, -102, -102, -102, -102,
+ -102, -102, -102, -102, -102, 21, -102, -102, 60, -102,
+ -102, -102};
const int JavaScriptGrammar::action_info [] = {
- 330, 318, 465, 209, 296, 129, 443, 342, 128, 336,
- 435, 419, 26, 316, 207, 325, 320, 27, 349, 316,
- 296, 318, 336, 459, 179, 344, 30, 28, 328, 131,
- 29, 170, -53, 359, -223, 402, 425, 229, 370, 175,
- -75, 419, -54, 177, 426, -72, 411, 366, -64, -52,
- 281, -77, 441, 419, 435, 218, 26, 344, 442, 407,
- -224, 207, 448, 435, 2, 355, 439, 250, 209, 218,
- 23, 484, 357, 179, 2, 452, 126, 259, 415, 482,
- 519, 224, 476, 483, 507, 22, 492, 23, 411, 448,
- 364, 508, 125, 513, 452, 459, 172, 363, 435, 476,
- 508, 500, 0, 218, 218, 366, 276, 351, 7, 487,
- 281, 497, 218, 125, 218, 497, 429, 218, 218, 226,
- -292, 459, 218, 364, 0, 218, 438, 460, 0, 338,
- 0, 459, 116, 339, 218, 244, 9, 8, 272, 271,
- 439, 275, 492, 117, 218, 218, 270, 269, 516, 476,
- 272, 271, 492, 265, 264, 413, 469, 0, 109, 498,
- 352, 246, 219, 506, 278, 247, 410, 409, 109, 110,
- 368, 109, 109, 257, 361, 461, 280, 279, 364, 110,
- 486, 262, 110, 110, 118, 193, 454, 194, 487, 118,
- 193, 267, 194, 193, 0, 194, 334, 450, 195, 118,
- 218, 517, 515, 195, 476, 193, 195, 194, 0, 252,
- 267, 218, 252, 263, 261, 262, 0, 0, 195, 0,
- 211, 422, 0, 268, 266, 193, 0, 194, 253, 119,
- 405, 253, 0, 254, 119, 120, 0, 0, 195, 212,
- 120, 213, 268, 266, 119, 298, 299, 263, 261, 0,
- 120, 181, 182, 433, 432, 298, 299, 181, 182, 0,
- 13, 0, 0, 0, 228, 227, 423, 14, 13, 0,
- 13, 0, 300, 301, 0, 14, 0, 14, 183, 184,
- 303, 304, 300, 301, 183, 184, 303, 304, 0, 305,
- 0, 0, 306, 0, 307, 305, 0, 0, 306, 193,
- 307, 194, 0, 480, 0, 0, 0, 0, 13, 0,
- 16, 0, 195, 0, 0, 14, 0, 0, 16, 12,
- 16, 0, 15, 0, 0, 186, 187, 12, 0, 12,
- 15, 0, 15, 188, 189, 186, 187, 190, 0, 191,
- 0, 478, 0, 188, 189, 186, 187, 190, 0, 191,
- 0, 0, 0, 188, 189, 0, 0, 190, 16, 191,
- 0, 0, 303, 304, 0, 72, 73, 12, 0, 0,
- 15, 305, 0, 0, 306, 113, 307, 0, 0, 0,
- 0, 0, 114, 0, 0, 0, 115, 81, 0, 82,
- 0, 72, 73, 0, 0, 0, 85, 0, 0, 0,
- 88, 113, 0, 0, 0, 0, 0, 0, 114, 0,
- 0, 0, 115, 81, 0, 82, 0, 0, 93, 0,
- 95, 0, 85, 0, 231, 0, 88, 186, 187, 0,
- 0, 87, 98, 75, 232, 188, 189, 0, 233, 190,
- 0, 191, 0, 0, 93, 0, 95, 234, 0, 235,
- 0, 0, 332, 0, 0, 0, 0, 87, 98, 75,
- 236, 0, 237, 116, 0, 0, 0, 0, 0, 0,
- 238, 0, 0, 239, 117, 0, 0, 0, 0, 240,
- 0, 0, 0, 0, 0, 241, 0, 0, 0, 0,
- 0, 0, 231, 0, 0, 0, 0, 0, 242, 0,
- 0, 0, 232, 0, 0, 0, 233, 0, 0, 0,
- 0, 0, 0, 0, 0, 234, 0, 235, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 236, 0,
- 237, 116, 0, 0, 0, 0, 0, 0, 238, 0,
- 0, 239, 117, 0, 0, 0, 0, 240, 0, 0,
- 0, 0, 0, 241, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 242, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 71, 72, 73,
- 0, 0, 0, 0, 0, 0, 0, 0, 113, 0,
- 0, 0, 0, 0, 0, 114, 0, 0, 0, 115,
- 81, 0, 82, 0, 0, 0, 83, 0, 84, 85,
- 86, 0, 0, 88, 0, 0, 0, 89, 0, 90,
+ 277, 473, -81, -89, -67, -94, -71, 368, 460, -97,
+ -70, -92, 193, 409, -100, 338, 355, 345, 332, 292,
+ 312, 164, 326, 411, 324, 423, 477, 351, 353, 421,
+ 360, 187, 365, 372, 363, 164, 362, 510, 509, 122,
+ 32, 33, 94, 512, 551, 502, 360, 7, 2, 545,
+ 170, 124, 172, 502, 27, 436, 484, 314, 440, 419,
+ 464, 484, 451, 187, 460, 490, 164, 316, 460, 466,
+ 122, 124, 206, 473, 477, 368, 460, 429, 450, 434,
+ 366, 428, 436, 256, 468, 277, 332, 321, 292, 213,
+ 272, 94, 0, 210, 164, 312, 164, 164, 463, 164,
+ 0, 164, 164, 0, 81, 81, 164, 447, 454, 164,
+ 444, 202, 464, 189, 485, 82, 82, 190, 164, 366,
+ 212, 164, 527, 314, 527, 0, 271, 276, 275, 262,
+ 261, 530, 267, 266, 513, 433, 432, 269, 268, 514,
+ 164, 366, 514, 87, 81, 502, 475, 0, 274, 357,
+ 2, 438, 448, 479, 370, 82, 538, 537, 330, 28,
+ 85, 0, 486, 269, 268, 81, 200, 502, 60, 165,
+ 536, 86, 528, 60, 164, 0, 82, 548, 9, 8,
+ 60, 0, 195, 60, 108, 60, 109, 28, 88, 108,
+ 0, 109, 494, 0, 89, 0, 334, 110, 0, 0,
+ 335, 196, 110, 426, 30, 72, 73, 60, 0, 60,
+ 72, 73, 108, 60, 109, 29, 164, 72, 73, 126,
+ 72, 73, 72, 73, 60, 110, 60, 255, 254, 87,
+ 549, 547, 30, 87, 60, 195, 0, 347, 127, 108,
+ 128, 109, 0, 29, 72, 73, 72, 73, 60, 0,
+ 72, 73, 110, 108, 196, 109, 197, 0, 0, 0,
+ 60, 72, 73, 72, 73, 0, 110, 294, 295, 458,
+ 457, 72, 73, 60, 88, 294, 295, 0, 88, 0,
+ 89, 96, 97, 0, 89, 72, 73, 96, 97, 60,
+ 348, 0, 260, 259, 296, 297, -311, 72, 73, 522,
+ 0, 0, 296, 297, 0, 265, 264, 60, 98, 99,
+ 72, 73, 0, 0, 98, 99, 299, 300, 0, 60,
+ 108, 0, 109, 0, 0, 301, 72, 73, 302, 19,
+ 303, 0, 0, 110, 101, 102, 72, 73, 0, 265,
+ 264, 0, 103, 104, 72, 73, 105, 0, 106, 0,
+ 484, 260, 259, 101, 102, 18, 72, 73, 0, 0,
+ 484, 103, 104, 0, 0, 105, 14, 106, 101, 102,
+ 0, 522, 14, 0, 0, 0, 103, 104, 15, 0,
+ 105, 522, 106, 0, 15, 16, 299, 300, 0, 0,
+ 0, 16, 0, 0, 0, 301, 0, 0, 302, 0,
+ 303, 19, 0, 0, 0, 0, 0, 0, 72, 73,
+ 0, 19, 0, 0, 0, 19, 0, 0, 72, 73,
+ 0, 19, 17, 20, 0, 0, 0, 18, 17, 20,
+ 21, 14, 0, 0, 14, 0, 21, 18, 0, 13,
+ 0, 18, 0, 15, 0, 13, 15, 18, 0, 0,
+ 16, 0, 0, 16, 101, 102, 0, 0, 0, 0,
+ 0, 0, 103, 104, 0, 0, 105, 0, 106, 0,
+ 0, 0, 0, 0, 0, 0, 506, 0, 0, 504,
+ 19, 0, 0, 19, 0, 0, 0, 17, 20, 174,
+ 17, 20, 0, 0, 0, 21, 0, 0, 21, 175,
+ 0, 0, 0, 176, 13, 0, 18, 13, 0, 18,
+ 0, 0, 177, 0, 178, 0, 0, 328, 0, 0,
+ 0, 0, 174, 0, 0, 179, 0, 180, 85, 0,
+ 0, 0, 175, 0, 0, 181, 176, 0, 182, 86,
+ 0, 0, 0, 0, 183, 177, 0, 178, 0, 0,
+ 184, 0, 0, 0, 0, 0, 0, 0, 179, 0,
+ 180, 85, 0, 0, 0, 185, 0, 0, 181, 0,
+ 0, 182, 86, 0, 0, 0, 0, 183, 0, 0,
+ 0, 0, 0, 184, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 185, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 93, 0, 95, 0, 97, 0, 100, 0, 101,
- 0, 0, 0, 0, 87, 98, 75, 0, 0, 0,
- 0, 0, 0, 0, 71, 72, 73, 0, 0, 0,
- 0, 0, 0, 0, 0, 113, 0, 0, 0, 0,
- 0, 0, 114, 0, 0, 0, 115, 81, 0, 82,
- 0, 0, 0, 83, 0, 84, 85, 86, 0, 0,
- 88, 0, 0, 0, 89, 0, 90, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 93, 0,
- 95, 0, 97, 0, 100, 295, 101, 0, 0, 0,
- 0, 87, 98, 75, 0, 0, 0, 0, 0, 0,
- 0, 71, 72, 73, 0, 0, 0, 0, 0, 0,
- 0, 0, 113, 0, 0, 0, 0, 0, 0, 114,
- 0, 0, 0, 115, 81, 0, 82, 0, 0, 0,
- 83, 0, 84, 85, 86, 0, 0, 88, 0, 0,
- 0, 89, 0, 90, 0, 0, 467, 0, 0, 0,
- 0, 0, 0, 0, 0, 93, 0, 95, 0, 97,
- 0, 100, 0, 101, 0, 0, 0, 0, 87, 98,
- 75, 0, 0, 0, 0, 0, 0, 0, -73, 0,
- 0, 0, 71, 72, 73, 0, 0, 0, 0, 0,
- 0, 0, 0, 113, 0, 0, 0, 0, 0, 0,
- 114, 0, 0, 0, 115, 81, 0, 82, 0, 0,
- 0, 83, 0, 84, 85, 86, 0, 0, 88, 0,
- 0, 0, 89, 0, 90, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 93, 0, 95, 0,
- 97, 0, 100, 0, 101, 0, 0, 0, 0, 87,
- 98, 75, 0, 0, 0, 0, 0, 0, 0, 71,
- 72, 73, 0, 0, 0, 0, 0, 0, 0, 0,
- 113, 0, 0, 0, 0, 0, 0, 114, 0, 0,
- 0, 115, 81, 0, 82, 0, 0, 0, 83, 0,
- 84, 85, 86, 0, 0, 88, 0, 0, 0, 89,
- 0, 90, 0, 0, 464, 0, 0, 0, 0, 0,
- 0, 0, 0, 93, 0, 95, 0, 97, 0, 100,
- 0, 101, 0, 0, 0, 0, 87, 98, 75, 0,
- 0, 0, 0, 0, 0, 0, 136, 137, 138, 0,
- 0, 140, 142, 143, 0, 0, 144, 0, 145, 0,
- 0, 0, 147, 148, 149, 0, 0, 0, 0, 0,
- 0, 216, 151, 152, 153, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 154, 0, 0, 0, 0,
+ 56, 57, 0, 0, 0, 0, 0, 0, 0, 0,
+ 59, 0, 0, 0, 0, 0, 0, 60, 0, 0,
+ 0, 61, 62, 0, 63, 0, 0, 0, 0, 0,
+ 0, 66, 0, 0, 0, 69, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 158, 0, 0, 0, 0, 0, 0, 160, 161,
- 162, 0, 164, 165, 166, 167, 168, 169, 0, 0,
- 155, 163, 146, 139, 141, 157, 0, 0, 0, 0,
- 136, 137, 138, 0, 0, 140, 142, 143, 0, 0,
- 144, 0, 145, 0, 0, 0, 147, 148, 149, 0,
- 0, 0, 0, 0, 0, 150, 151, 152, 153, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 154,
- 0, 0, 0, 156, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 158, 0, 0, 0, 0,
- 0, 159, 160, 161, 162, 0, 164, 165, 166, 167,
- 168, 169, 0, 0, 155, 163, 146, 139, 141, 157,
- 0, 0, 0, 0, 136, 137, 138, 0, 0, 140,
- 142, 143, 0, 0, 144, 0, 145, 0, 0, 0,
- 147, 148, 149, 0, 0, 0, 0, 0, 0, 150,
- 151, 152, 153, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 154, 0, 0, 0, 156, 0, 0,
- 0, 0, 0, 0, 0, 174, 0, 0, 0, 158,
- 0, 0, 0, 0, 0, 159, 160, 161, 162, 0,
- 164, 165, 166, 167, 168, 169, 0, 0, 155, 163,
- 146, 139, 141, 157, 0, 0, 0, 0, 68, 0,
- 0, 0, 0, 69, 0, 71, 72, 73, 74, 0,
- 0, 0, 0, 0, 0, 76, 113, 0, 0, 0,
- 0, 0, 0, 78, 79, 0, 0, 80, 81, 0,
- 82, 0, 0, 0, 83, 0, 84, 85, 86, 0,
- 0, 88, 0, 0, 0, 89, 0, 90, 0, 0,
- 0, 0, 0, 91, 0, 92, 0, 0, 0, 93,
- 94, 95, 96, 97, 99, 100, 16, 101, 102, 103,
- 0, 0, 87, 98, 75, 12, 70, 0, 0, 0,
- 0, 0, 68, 0, 0, 0, 0, 69, 0, 71,
- 72, 73, 74, 0, 0, 0, 0, 0, 0, 76,
- 77, 0, 0, 0, 0, 0, 0, 78, 79, 0,
- 0, 80, 81, 0, 82, 0, 0, 0, 83, 0,
- 84, 85, 86, 0, 0, 88, 0, 0, 0, 89,
- 0, 90, 0, 0, 0, 0, 0, 91, 0, 92,
- 0, 0, 0, 93, 94, 95, 96, 97, 99, 100,
- 16, 101, 102, 103, 0, 0, 87, 98, 75, 12,
- 70, 0, 0, 0, 0, 0, 68, 0, 0, 0,
- 0, 69, 0, 71, 72, 73, 74, 0, 0, 0,
- 0, 0, 0, 76, 113, 0, 0, 0, 0, 0,
- 0, 489, 79, 0, 0, 80, 490, 0, 82, 0,
- 0, 0, 83, 0, 84, 85, 86, 0, 0, 88,
- 0, 0, 0, 89, 0, 90, 0, 0, 0, 0,
- 0, 91, 0, 92, 0, 0, 0, 93, 94, 95,
- 96, 97, 99, 100, 16, 101, 102, 103, 0, 0,
- 87, 98, 75, 12, 70, 0, 0, 0, 0, 0,
- 68, 0, 0, 0, 0, 69, 0, 71, 72, 73,
- 74, 0, 0, 0, 0, 0, 0, 76, 113, 0,
- 0, 0, 0, 0, 0, 502, 79, 0, 0, 80,
- 503, 0, 82, 0, 0, 0, 83, 0, 84, 85,
- 86, 0, 0, 88, 0, 0, 0, 89, 0, 90,
- 0, 0, 0, 0, 0, 91, 0, 92, 0, 0,
- 0, 93, 94, 95, 96, 97, 99, 100, 16, 101,
- 102, 103, 0, 0, 87, 98, 75, 12, 70, 0,
- 0, 0, 0, 0, 375, 137, 138, 0, 0, 377,
- 142, 379, 72, 73, 380, 0, 145, 0, 0, 0,
- 147, 382, 383, 0, 0, 0, 0, 0, 0, 384,
- 385, 152, 153, 80, 81, 0, 82, 0, 0, 0,
- 83, 0, 84, 386, 86, 0, 0, 388, 0, 0,
- 0, 89, 0, 90, 0, -219, 0, 0, 0, 389,
- 0, 92, 0, 0, 0, 390, 391, 392, 393, 97,
- 395, 396, 397, 398, 399, 400, 0, 0, 387, 394,
- 381, 376, 378, 157, 0, 0, 0, 0,
+ 0, 0, 0, 74, 72, 73, 0, 75, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 68, 77,
+ 58, 0, 0, 0, 0, 0, 0, 0, 0, 55,
+ 56, 57, 0, 0, 0, 0, 0, 0, 0, 0,
+ 59, 0, 0, 0, 0, 0, 0, 60, 0, 0,
+ 0, 61, 62, 0, 63, 0, 0, 0, 64, 0,
+ 65, 66, 67, 0, 0, 69, 0, 0, 0, 70,
+ 0, 71, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 74, 72, 73, 0, 75, 0, 76,
+ 0, 78, 0, 79, 0, 0, 0, 0, 68, 77,
+ 58, 0, 0, 0, 0, 0, 0, 0, 0, -90,
+ 0, 0, 0, 55, 56, 57, 0, 0, 0, 0,
+ 0, 0, 0, 0, 59, 0, 0, 0, 0, 0,
+ 0, 60, 0, 0, 0, 61, 62, 0, 63, 0,
+ 0, 0, 64, 0, 65, 66, 67, 0, 0, 69,
+ 0, 0, 0, 70, 0, 71, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 74, 72, 73,
+ 0, 75, 0, 76, 0, 78, 0, 79, 0, 0,
+ 0, 0, 68, 77, 58, 0, 0, 0, 0, 0,
+ 0, 0, 0, 55, 56, 57, 0, 0, 0, 0,
+ 0, 0, 0, 0, 59, 0, 0, 0, 0, 0,
+ 0, 60, 0, 0, 0, 61, 62, 0, 63, 0,
+ 0, 0, 64, 0, 65, 66, 67, 0, 0, 69,
+ 0, 0, 0, 70, 0, 71, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 74, 72, 73,
+ 0, 75, 0, 76, 0, 78, 291, 79, 0, 0,
+ 0, 0, 68, 77, 58, 0, 0, 0, 0, 0,
+ 0, 0, 0, 55, 56, 57, 0, 0, 0, 0,
+ 0, 0, 0, 0, 59, 0, 0, 0, 0, 0,
+ 0, 60, 0, 0, 0, 61, 62, 0, 63, 0,
+ 0, 0, 64, 0, 65, 66, 67, 0, 0, 69,
+ 0, 0, 0, 70, 0, 71, 0, 0, 492, 0,
+ 0, 0, 0, 0, 0, 0, 0, 74, 72, 73,
+ 0, 75, 0, 76, 0, 78, 0, 79, 0, 0,
+ 0, 0, 68, 77, 58, 0, 0, 0, 0, 0,
+ 0, 0, 0, 55, 56, 57, 0, 0, 0, 0,
+ 0, 0, 0, 0, 59, 0, 0, 0, 0, 0,
+ 0, 60, 0, 0, 0, 61, 62, 0, 63, 0,
+ 0, 0, 64, 0, 65, 66, 67, 0, 0, 69,
+ 0, 0, 0, 70, 0, 71, 0, 0, 489, 0,
+ 0, 0, 0, 0, 0, 0, 0, 74, 72, 73,
+ 0, 75, 0, 76, 0, 78, 0, 79, 0, 0,
+ 0, 0, 68, 77, 58, 0, 0, 0, 0, 0,
+ 0, 0, 0, 132, 133, 134, 0, 0, 136, 138,
+ 139, 0, 0, 140, 0, 141, 0, 0, 0, 143,
+ 144, 145, 0, 0, 0, 0, 0, 0, 60, 146,
+ 147, 148, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 149, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 152, 0,
+ 0, 0, 0, 0, 0, 72, 73, 153, 154, 155,
+ 0, 157, 158, 159, 160, 161, 162, 0, 0, 150,
+ 156, 142, 135, 137, 151, 0, 0, 0, 0, 0,
+ 132, 133, 134, 0, 0, 136, 138, 139, 0, 0,
+ 140, 0, 141, 0, 0, 0, 143, 144, 145, 0,
+ 0, 0, 0, 0, 0, 413, 146, 147, 148, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 149,
+ 0, 0, 0, 414, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 152, 0, 0, 0, 0,
+ 0, 418, 415, 417, 153, 154, 155, 0, 157, 158,
+ 159, 160, 161, 162, 0, 0, 150, 156, 142, 135,
+ 137, 151, 0, 0, 0, 0, 0, 132, 133, 134,
+ 0, 0, 136, 138, 139, 0, 0, 140, 0, 141,
+ 0, 0, 0, 143, 144, 145, 0, 0, 0, 0,
+ 0, 0, 413, 146, 147, 148, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 149, 0, 0, 0,
+ 414, 0, 0, 0, 0, 0, 0, 0, 416, 0,
+ 0, 0, 152, 0, 0, 0, 0, 0, 418, 415,
+ 417, 153, 154, 155, 0, 157, 158, 159, 160, 161,
+ 162, 0, 0, 150, 156, 142, 135, 137, 151, 0,
+ 0, 0, 0, 0, 232, 0, 0, 0, 0, 233,
+ 0, 55, 56, 57, 235, 0, 0, 0, 0, 0,
+ 0, 236, 59, 0, 0, 0, 0, 0, 0, 238,
+ 239, 0, 0, 240, 62, 0, 63, 0, 0, 0,
+ 64, 0, 65, 66, 67, 0, 0, 69, 0, 0,
+ 0, 70, 0, 71, 0, 0, 0, 0, 0, 242,
+ 0, 243, 0, 0, 0, 74, 241, 244, 245, 75,
+ 246, 76, 247, 78, 21, 79, 248, 249, 0, 0,
+ 68, 77, 58, 13, 234, 0, 0, 0, 0, 0,
+ 0, 232, 0, 0, 0, 0, 233, 0, 55, 56,
+ 57, 235, 0, 0, 0, 0, 0, 0, 236, 237,
+ 0, 0, 0, 0, 0, 0, 238, 239, 0, 0,
+ 240, 62, 0, 63, 0, 0, 0, 64, 0, 65,
+ 66, 67, 0, 0, 69, 0, 0, 0, 70, 0,
+ 71, 0, 0, 0, 0, 0, 242, 0, 243, 0,
+ 0, 0, 74, 241, 244, 245, 75, 246, 76, 247,
+ 78, 21, 79, 248, 249, 0, 0, 68, 77, 58,
+ 13, 234, 0, 0, 0, 0, 0, 0, 232, 0,
+ 0, 0, 0, 233, 0, 55, 56, 57, 235, 0,
+ 0, 0, 0, 0, 0, 236, 59, 0, 0, 0,
+ 0, 0, 0, 532, 239, 0, 0, 240, 533, 0,
+ 63, 0, 0, 0, 64, 0, 65, 66, 67, 0,
+ 0, 69, 0, 0, 0, 70, 0, 71, 0, 0,
+ 0, 0, 0, 242, 0, 243, 0, 0, 0, 74,
+ 241, 244, 245, 75, 246, 76, 247, 78, 21, 79,
+ 248, 249, 0, 0, 68, 77, 58, 13, 234, 0,
+ 0, 0, 0, 0, 0, 232, 0, 0, 0, 0,
+ 233, 0, 55, 56, 57, 235, 0, 0, 0, 0,
+ 0, 0, 236, 59, 0, 0, 0, 0, 0, 0,
+ 516, 239, 0, 0, 240, 517, 0, 63, 0, 0,
+ 0, 64, 0, 65, 66, 67, 0, 0, 69, 0,
+ 0, 0, 70, 0, 71, 0, 0, 0, 0, 0,
+ 242, 0, 243, 0, 0, 0, 74, 241, 244, 245,
+ 75, 246, 76, 247, 78, 21, 79, 248, 249, 0,
+ 0, 68, 77, 58, 13, 234, 0, 518, 0, 0,
+ 0, 0, 381, 133, 134, 0, 0, 383, 138, 385,
+ 56, 57, 386, 0, 141, 0, 0, 0, 143, 388,
+ 389, 0, 0, 0, 0, 0, 0, 390, 391, 147,
+ 148, 240, 62, 0, 63, 0, 0, 0, 64, 0,
+ 65, 392, 67, 0, 0, 394, 0, 0, 0, 70,
+ 0, 71, 0, -236, 0, 0, 0, 396, 0, 243,
+ 0, 0, 0, 398, 395, 397, 399, 400, 401, 76,
+ 403, 404, 405, 406, 407, 408, 0, 0, 393, 402,
+ 387, 382, 384, 151, 0, 0, 0, 0, 0,
- 491, 424, 449, 420, 451, 518, 428, 514, 488, 274,
- 427, 455, 440, 495, 504, 501, 445, 462, 10, 463,
- 21, 444, 230, 496, 485, 430, 353, 466, 220, 371,
- 127, 333, 335, 358, 369, 225, 360, 367, 362, 365,
- 331, 434, 277, 215, 217, 0, 223, 434, 256, 412,
- 0, 243, 431, 171, 249, 431, 326, 173, 251, 176,
- 326, 274, 223, 468, 401, 499, 481, 495, 0, 258,
- 215, 255, 111, 66, 21, 48, 111, 200, 447, 481,
- 111, 403, 446, 111, 404, 111, 111, 21, 199, 453,
- 111, 192, 474, 180, 111, 111, 273, 111, 111, 111,
- 111, 185, 111, 204, 205, 206, 111, 201, 223, 111,
- 198, 111, 208, 470, 111, 406, 471, 111, 111, 210,
- 473, 197, 505, 111, 111, 495, 111, 196, 111, 202,
- 111, 203, 472, 111, 111, 403, 326, 0, 404, 311,
- 326, 326, 245, 111, 111, 123, 475, 326, 111, 248,
- 122, 111, 111, 121, 111, 0, 447, 312, 111, 0,
- 0, 111, 111, 310, 112, 178, 0, 111, 111, 273,
- 111, 111, 446, 309, 0, 290, 308, 322, 0, 356,
- 294, 0, 294, 354, 327, 66, 66, 48, 48, 111,
- 329, 322, 111, 111, 294, 0, 294, 294, 294, 350,
- 315, 111, 317, 319, 111, 0, 294, 111, 313, 294,
- 322, 302, 294, 343, 314, 294, 322, 111, 111, 322,
- 111, 294, 294, 294, 294, 294, 0, 297, 0, 0,
- 0, 0, 341, 0, 340, 337, 0, 0, 321, 0,
- 0, 324, 479, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 21, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 130, 0, 0, 0,
- 260, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 455, 534, 521, 452, 493, 199, 465, 173, 488, 539,
+ 42, 445, 359, 322, 211, 209, 449, 470, 31, 480,
+ 273, 531, 487, 192, 491, 194, 511, 540, 476, 515,
+ 467, 469, 456, 526, 459, 474, 205, 420, 435, 10,
+ 412, 163, 373, 169, 371, 546, 410, 369, 205, 270,
+ 322, 166, 171, 422, 456, 258, 263, 367, 430, 270,
+ 331, 340, 327, 329, 358, 459, 186, 437, 263, 453,
+ 354, 501, 0, 356, 258, 0, 83, 340, 540, 169,
+ 26, 12, 209, 322, 525, 322, 201, 322, 123, 0,
+ 322, 424, 12, 0, 425, 129, 83, 0, 203, 230,
+ 83, 83, 223, 0, 131, 113, 83, 0, 83, 0,
+ 125, 84, 121, 478, 83, 83, 497, 498, 83, 424,
+ 83, 0, 425, 83, 100, 496, 119, 323, 83, 325,
+ 83, 350, 495, 308, 352, 83, 83, 499, 471, 0,
+ 550, 349, 83, 83, 472, 90, 83, 169, 91, 83,
+ 83, 500, 92, 83, 427, 83, 0, 83, 361, 120,
+ 107, 111, 83, 83, 83, 471, 83, 304, 112, 93,
+ 83, 83, 83, 83, 83, 307, 305, 306, 83, 83,
+ 83, 286, 83, 116, 114, 115, 290, 117, 188, 191,
+ 83, 83, 472, 203, 83, 535, 83, 0, 525, 118,
+ 83, 290, 529, 0, 525, 318, 12, 0, 95, 83,
+ 290, 0, 12, 336, 290, 83, 230, 0, 318, 223,
+ 290, 0, 313, 290, 318, 318, 315, 317, 83, 290,
+ 290, 83, 83, 290, 505, 0, 290, 290, 311, 310,
+ 320, 507, 0, 333, 507, 0, 339, 346, 129, 26,
+ 12, 0, 26, 12, 318, 26, 12, 131, 198, 290,
+ 83, 83, 0, 0, 0, 290, 290, 230, 309, 293,
+ 223, 0, 83, 0, 0, 0, 337, 290, 0, 298,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 364, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0};
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 257, 0};
const int JavaScriptGrammar::action_check [] = {
- 60, 76, 8, 76, 1, 33, 60, 7, 60, 2,
- 33, 5, 29, 48, 48, 61, 8, 8, 17, 48,
- 1, 76, 2, 8, 1, 29, 33, 29, 61, 55,
- 60, 7, 7, 31, 29, 55, 55, 55, 16, 7,
- 7, 5, 7, 55, 7, 7, 36, 36, 7, 7,
- 36, 7, 36, 5, 33, 8, 29, 29, 29, 60,
- 29, 48, 36, 33, 85, 61, 20, 7, 76, 8,
- 36, 7, 60, 1, 85, 36, 36, 60, 33, 29,
- 0, 8, 33, 29, 29, 29, 29, 36, 36, 36,
- 7, 29, 29, 17, 36, 8, 8, 29, 33, 33,
- 29, 7, -1, 8, 8, 36, 36, 8, 65, 15,
- 36, 8, 8, 29, 8, 8, 7, 8, 8, 60,
- 36, 8, 8, 7, -1, 8, 6, 8, -1, 50,
- -1, 8, 42, 54, 8, 2, 61, 62, 61, 62,
- 20, 74, 29, 53, 8, 8, 61, 62, 8, 33,
- 61, 62, 29, 61, 62, 60, 60, -1, 40, 56,
- 61, 50, 56, 56, 60, 54, 61, 62, 40, 51,
- 60, 40, 40, 56, 60, 56, 61, 62, 7, 51,
- 7, 29, 51, 51, 12, 25, 60, 27, 15, 12,
- 25, 29, 27, 25, -1, 27, 60, 60, 38, 12,
- 8, 61, 62, 38, 33, 25, 38, 27, -1, 15,
- 29, 8, 15, 61, 62, 29, -1, -1, 38, -1,
- 15, 10, -1, 61, 62, 25, -1, 27, 34, 57,
- 36, 34, -1, 36, 57, 63, -1, -1, 38, 34,
- 63, 36, 61, 62, 57, 18, 19, 61, 62, -1,
- 63, 18, 19, 61, 62, 18, 19, 18, 19, -1,
- 22, -1, -1, -1, 61, 62, 55, 29, 22, -1,
- 22, -1, 45, 46, -1, 29, -1, 29, 45, 46,
- 23, 24, 45, 46, 45, 46, 23, 24, -1, 32,
- -1, -1, 35, -1, 37, 32, -1, -1, 35, 25,
- 37, 27, -1, 55, -1, -1, -1, -1, 22, -1,
- 72, -1, 38, -1, -1, 29, -1, -1, 72, 81,
- 72, -1, 84, -1, -1, 23, 24, 81, -1, 81,
- 84, -1, 84, 31, 32, 23, 24, 35, -1, 37,
- -1, 55, -1, 31, 32, 23, 24, 35, -1, 37,
- -1, -1, -1, 31, 32, -1, -1, 35, 72, 37,
- -1, -1, 23, 24, -1, 12, 13, 81, -1, -1,
- 84, 32, -1, -1, 35, 22, 37, -1, -1, -1,
- -1, -1, 29, -1, -1, -1, 33, 34, -1, 36,
- -1, 12, 13, -1, -1, -1, 43, -1, -1, -1,
- 47, 22, -1, -1, -1, -1, -1, -1, 29, -1,
- -1, -1, 33, 34, -1, 36, -1, -1, 65, -1,
- 67, -1, 43, -1, 3, -1, 47, 23, 24, -1,
- -1, 78, 79, 80, 13, 31, 32, -1, 17, 35,
- -1, 37, -1, -1, 65, -1, 67, 26, -1, 28,
- -1, -1, 31, -1, -1, -1, -1, 78, 79, 80,
- 39, -1, 41, 42, -1, -1, -1, -1, -1, -1,
- 49, -1, -1, 52, 53, -1, -1, -1, -1, 58,
- -1, -1, -1, -1, -1, 64, -1, -1, -1, -1,
- -1, -1, 3, -1, -1, -1, -1, -1, 77, -1,
- -1, -1, 13, -1, -1, -1, 17, -1, -1, -1,
- -1, -1, -1, -1, -1, 26, -1, 28, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 39, -1,
- 41, 42, -1, -1, -1, -1, -1, -1, 49, -1,
+ 36, 36, 7, 7, 7, 7, 7, 36, 33, 7,
+ 7, 7, 7, 7, 7, 7, 31, 17, 2, 1,
+ 48, 8, 60, 8, 61, 55, 36, 61, 60, 55,
+ 36, 2, 55, 16, 33, 8, 60, 7, 29, 48,
+ 29, 7, 1, 29, 0, 33, 36, 65, 88, 17,
+ 8, 78, 60, 33, 66, 36, 8, 78, 33, 7,
+ 20, 8, 7, 2, 33, 8, 8, 8, 33, 36,
+ 48, 78, 36, 36, 36, 36, 33, 7, 55, 7,
+ 7, 60, 36, 55, 60, 36, 2, 61, 1, 33,
+ 36, 1, -1, 8, 8, 48, 8, 8, 6, 8,
+ -1, 8, 8, -1, 40, 40, 8, 10, 7, 8,
+ 5, 60, 20, 50, 8, 51, 51, 54, 8, 7,
+ 60, 8, 8, 78, 8, -1, 76, 61, 62, 61,
+ 62, 7, 61, 62, 7, 61, 62, 61, 62, 15,
+ 8, 7, 15, 12, 40, 33, 60, -1, 60, 60,
+ 88, 60, 55, 60, 60, 51, 61, 62, 60, 29,
+ 42, -1, 56, 61, 62, 40, 56, 33, 29, 56,
+ 56, 53, 56, 29, 8, -1, 51, 8, 61, 62,
+ 29, -1, 15, 29, 25, 29, 27, 29, 57, 25,
+ -1, 27, 60, -1, 63, -1, 50, 38, -1, -1,
+ 54, 34, 38, 36, 74, 66, 67, 29, -1, 29,
+ 66, 67, 25, 29, 27, 85, 8, 66, 67, 15,
+ 66, 67, 66, 67, 29, 38, 29, 61, 62, 12,
+ 61, 62, 74, 12, 29, 15, -1, 8, 34, 25,
+ 36, 27, -1, 85, 66, 67, 66, 67, 29, -1,
+ 66, 67, 38, 25, 34, 27, 36, -1, -1, -1,
+ 29, 66, 67, 66, 67, -1, 38, 18, 19, 61,
+ 62, 66, 67, 29, 57, 18, 19, -1, 57, -1,
+ 63, 18, 19, -1, 63, 66, 67, 18, 19, 29,
+ 61, -1, 61, 62, 45, 46, 36, 66, 67, 29,
+ -1, -1, 45, 46, -1, 61, 62, 29, 45, 46,
+ 66, 67, -1, -1, 45, 46, 23, 24, -1, 29,
+ 25, -1, 27, -1, -1, 32, 66, 67, 35, 59,
+ 37, -1, -1, 38, 23, 24, 66, 67, -1, 61,
+ 62, -1, 31, 32, 66, 67, 35, -1, 37, -1,
+ 8, 61, 62, 23, 24, 85, 66, 67, -1, -1,
+ 8, 31, 32, -1, -1, 35, 10, 37, 23, 24,
+ -1, 29, 10, -1, -1, -1, 31, 32, 22, -1,
+ 35, 29, 37, -1, 22, 29, 23, 24, -1, -1,
+ -1, 29, -1, -1, -1, 32, -1, -1, 35, -1,
+ 37, 59, -1, -1, -1, -1, -1, -1, 66, 67,
+ -1, 59, -1, -1, -1, 59, -1, -1, 66, 67,
+ -1, 59, 66, 67, -1, -1, -1, 85, 66, 67,
+ 74, 10, -1, -1, 10, -1, 74, 85, -1, 83,
+ -1, 85, -1, 22, -1, 83, 22, 85, -1, -1,
+ 29, -1, -1, 29, 23, 24, -1, -1, -1, -1,
+ -1, -1, 31, 32, -1, -1, 35, -1, 37, -1,
+ -1, -1, -1, -1, -1, -1, 55, -1, -1, 55,
+ 59, -1, -1, 59, -1, -1, -1, 66, 67, 3,
+ 66, 67, -1, -1, -1, 74, -1, -1, 74, 13,
+ -1, -1, -1, 17, 83, -1, 85, 83, -1, 85,
+ -1, -1, 26, -1, 28, -1, -1, 31, -1, -1,
+ -1, -1, 3, -1, -1, 39, -1, 41, 42, -1,
+ -1, -1, 13, -1, -1, 49, 17, -1, 52, 53,
+ -1, -1, -1, -1, 58, 26, -1, 28, -1, -1,
+ 64, -1, -1, -1, -1, -1, -1, -1, 39, -1,
+ 41, 42, -1, -1, -1, 79, -1, -1, 49, -1,
-1, 52, 53, -1, -1, -1, -1, 58, -1, -1,
-1, -1, -1, 64, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 77, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 11, 12, 13,
- -1, -1, -1, -1, -1, -1, -1, -1, 22, -1,
- -1, -1, -1, -1, -1, 29, -1, -1, -1, 33,
- 34, -1, 36, -1, -1, -1, 40, -1, 42, 43,
- 44, -1, -1, 47, -1, -1, -1, 51, -1, 53,
+ -1, -1, -1, -1, -1, -1, -1, -1, 79, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 65, -1, 67, -1, 69, -1, 71, -1, 73,
- -1, -1, -1, -1, 78, 79, 80, -1, -1, -1,
- -1, -1, -1, -1, 11, 12, 13, -1, -1, -1,
- -1, -1, -1, -1, -1, 22, -1, -1, -1, -1,
- -1, -1, 29, -1, -1, -1, 33, 34, -1, 36,
- -1, -1, -1, 40, -1, 42, 43, 44, -1, -1,
- 47, -1, -1, -1, 51, -1, 53, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 65, -1,
- 67, -1, 69, -1, 71, 72, 73, -1, -1, -1,
- -1, 78, 79, 80, -1, -1, -1, -1, -1, -1,
- -1, 11, 12, 13, -1, -1, -1, -1, -1, -1,
- -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
- -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
- 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
- -1, 51, -1, 53, -1, -1, 56, -1, -1, -1,
- -1, -1, -1, -1, -1, 65, -1, 67, -1, 69,
- -1, 71, -1, 73, -1, -1, -1, -1, 78, 79,
- 80, -1, -1, -1, -1, -1, -1, -1, 7, -1,
- -1, -1, 11, 12, 13, -1, -1, -1, -1, -1,
- -1, -1, -1, 22, -1, -1, -1, -1, -1, -1,
- 29, -1, -1, -1, 33, 34, -1, 36, -1, -1,
- -1, 40, -1, 42, 43, 44, -1, -1, 47, -1,
- -1, -1, 51, -1, 53, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 65, -1, 67, -1,
- 69, -1, 71, -1, 73, -1, -1, -1, -1, 78,
- 79, 80, -1, -1, -1, -1, -1, -1, -1, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ 22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
+ -1, 33, 34, -1, 36, -1, -1, -1, -1, -1,
+ -1, 43, -1, -1, -1, 47, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 65, 66, 67, -1, 69, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 80, 81,
+ 82, -1, -1, -1, -1, -1, -1, -1, -1, 11,
12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
-1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
- -1, 53, -1, -1, 56, -1, -1, -1, -1, -1,
- -1, -1, -1, 65, -1, 67, -1, 69, -1, 71,
- -1, 73, -1, -1, -1, -1, 78, 79, 80, -1,
- -1, -1, -1, -1, -1, -1, 4, 5, 6, -1,
- -1, 9, 10, 11, -1, -1, 14, -1, 16, -1,
- -1, -1, 20, 21, 22, -1, -1, -1, -1, -1,
- -1, 29, 30, 31, 32, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 43, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 59, -1, -1, -1, -1, -1, -1, 66, 67,
- 68, -1, 70, 71, 72, 73, 74, 75, -1, -1,
- 78, 79, 80, 81, 82, 83, -1, -1, -1, -1,
+ -1, 53, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 65, 66, 67, -1, 69, -1, 71,
+ -1, 73, -1, 75, -1, -1, -1, -1, 80, 81,
+ 82, -1, -1, -1, -1, -1, -1, -1, -1, 7,
+ -1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
+ -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
+ -1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
+ -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
+ -1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
+ -1, 69, -1, 71, -1, 73, -1, 75, -1, -1,
+ -1, -1, 80, 81, 82, -1, -1, -1, -1, -1,
+ -1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
+ -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
+ -1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
+ -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
+ -1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
+ -1, 69, -1, 71, -1, 73, 74, 75, -1, -1,
+ -1, -1, 80, 81, 82, -1, -1, -1, -1, -1,
+ -1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
+ -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
+ -1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
+ -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
+ -1, -1, -1, 51, -1, 53, -1, -1, 56, -1,
+ -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
+ -1, 69, -1, 71, -1, 73, -1, 75, -1, -1,
+ -1, -1, 80, 81, 82, -1, -1, -1, -1, -1,
+ -1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
+ -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
+ -1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
+ -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
+ -1, -1, -1, 51, -1, 53, -1, -1, 56, -1,
+ -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
+ -1, 69, -1, 71, -1, 73, -1, 75, -1, -1,
+ -1, -1, 80, 81, 82, -1, -1, -1, -1, -1,
+ -1, -1, -1, 4, 5, 6, -1, -1, 9, 10,
+ 11, -1, -1, 14, -1, 16, -1, -1, -1, 20,
+ 21, 22, -1, -1, -1, -1, -1, -1, 29, 30,
+ 31, 32, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 43, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 59, -1,
+ -1, -1, -1, -1, -1, 66, 67, 68, 69, 70,
+ -1, 72, 73, 74, 75, 76, 77, -1, -1, 80,
+ 81, 82, 83, 84, 85, -1, -1, -1, -1, -1,
4, 5, 6, -1, -1, 9, 10, 11, -1, -1,
14, -1, 16, -1, -1, -1, 20, 21, 22, -1,
-1, -1, -1, -1, -1, 29, 30, 31, 32, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 43,
-1, -1, -1, 47, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
- -1, 65, 66, 67, 68, -1, 70, 71, 72, 73,
- 74, 75, -1, -1, 78, 79, 80, 81, 82, 83,
- -1, -1, -1, -1, 4, 5, 6, -1, -1, 9,
- 10, 11, -1, -1, 14, -1, 16, -1, -1, -1,
- 20, 21, 22, -1, -1, -1, -1, -1, -1, 29,
- 30, 31, 32, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, 55, -1, -1, -1, 59,
- -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, 71, 72, 73, 74, 75, -1, -1, 78, 79,
- 80, 81, 82, 83, -1, -1, -1, -1, 4, -1,
+ -1, 65, 66, 67, 68, 69, 70, -1, 72, 73,
+ 74, 75, 76, 77, -1, -1, 80, 81, 82, 83,
+ 84, 85, -1, -1, -1, -1, -1, 4, 5, 6,
+ -1, -1, 9, 10, 11, -1, -1, 14, -1, 16,
+ -1, -1, -1, 20, 21, 22, -1, -1, -1, -1,
+ -1, -1, 29, 30, 31, 32, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 43, -1, -1, -1,
+ 47, -1, -1, -1, -1, -1, -1, -1, 55, -1,
+ -1, -1, 59, -1, -1, -1, -1, -1, 65, 66,
+ 67, 68, 69, 70, -1, 72, 73, 74, 75, 76,
+ 77, -1, -1, 80, 81, 82, 83, 84, 85, -1,
+ -1, -1, -1, -1, 4, -1, -1, -1, -1, 9,
+ -1, 11, 12, 13, 14, -1, -1, -1, -1, -1,
+ -1, 21, 22, -1, -1, -1, -1, -1, -1, 29,
+ 30, -1, -1, 33, 34, -1, 36, -1, -1, -1,
+ 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
+ -1, 51, -1, 53, -1, -1, -1, -1, -1, 59,
+ -1, 61, -1, -1, -1, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76, 77, -1, -1,
+ 80, 81, 82, 83, 84, -1, -1, -1, -1, -1,
+ -1, 4, -1, -1, -1, -1, 9, -1, 11, 12,
+ 13, 14, -1, -1, -1, -1, -1, -1, 21, 22,
+ -1, -1, -1, -1, -1, -1, 29, 30, -1, -1,
+ 33, 34, -1, 36, -1, -1, -1, 40, -1, 42,
+ 43, 44, -1, -1, 47, -1, -1, -1, 51, -1,
+ 53, -1, -1, -1, -1, -1, 59, -1, 61, -1,
+ -1, -1, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, -1, -1, 80, 81, 82,
+ 83, 84, -1, -1, -1, -1, -1, -1, 4, -1,
-1, -1, -1, 9, -1, 11, 12, 13, 14, -1,
-1, -1, -1, -1, -1, 21, 22, -1, -1, -1,
-1, -1, -1, 29, 30, -1, -1, 33, 34, -1,
@@ -621,74 +687,60 @@ const int JavaScriptGrammar::action_check [] = {
-1, 47, -1, -1, -1, 51, -1, 53, -1, -1,
-1, -1, -1, 59, -1, 61, -1, -1, -1, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- -1, -1, 78, 79, 80, 81, 82, -1, -1, -1,
- -1, -1, 4, -1, -1, -1, -1, 9, -1, 11,
- 12, 13, 14, -1, -1, -1, -1, -1, -1, 21,
- 22, -1, -1, -1, -1, -1, -1, 29, 30, -1,
- -1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
+ 76, 77, -1, -1, 80, 81, 82, 83, 84, -1,
+ -1, -1, -1, -1, -1, 4, -1, -1, -1, -1,
+ 9, -1, 11, 12, 13, 14, -1, -1, -1, -1,
+ -1, -1, 21, 22, -1, -1, -1, -1, -1, -1,
+ 29, 30, -1, -1, 33, 34, -1, 36, -1, -1,
+ -1, 40, -1, 42, 43, 44, -1, -1, 47, -1,
+ -1, -1, 51, -1, 53, -1, -1, -1, -1, -1,
+ 59, -1, 61, -1, -1, -1, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, -1,
+ -1, 80, 81, 82, 83, 84, -1, 86, -1, -1,
+ -1, -1, 4, 5, 6, -1, -1, 9, 10, 11,
+ 12, 13, 14, -1, 16, -1, -1, -1, 20, 21,
+ 22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
+ 32, 33, 34, -1, 36, -1, -1, -1, 40, -1,
42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
- -1, 53, -1, -1, -1, -1, -1, 59, -1, 61,
+ -1, 53, -1, 55, -1, -1, -1, 59, -1, 61,
-1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, -1, -1, 78, 79, 80, 81,
- 82, -1, -1, -1, -1, -1, 4, -1, -1, -1,
- -1, 9, -1, 11, 12, 13, 14, -1, -1, -1,
- -1, -1, -1, 21, 22, -1, -1, -1, -1, -1,
- -1, 29, 30, -1, -1, 33, 34, -1, 36, -1,
- -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
- -1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
- -1, 59, -1, 61, -1, -1, -1, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, -1, -1,
- 78, 79, 80, 81, 82, -1, -1, -1, -1, -1,
- 4, -1, -1, -1, -1, 9, -1, 11, 12, 13,
- 14, -1, -1, -1, -1, -1, -1, 21, 22, -1,
- -1, -1, -1, -1, -1, 29, 30, -1, -1, 33,
- 34, -1, 36, -1, -1, -1, 40, -1, 42, 43,
- 44, -1, -1, 47, -1, -1, -1, 51, -1, 53,
- -1, -1, -1, -1, -1, 59, -1, 61, -1, -1,
- -1, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, 75, -1, -1, 78, 79, 80, 81, 82, -1,
- -1, -1, -1, -1, 4, 5, 6, -1, -1, 9,
- 10, 11, 12, 13, 14, -1, 16, -1, -1, -1,
- 20, 21, 22, -1, -1, -1, -1, -1, -1, 29,
- 30, 31, 32, 33, 34, -1, 36, -1, -1, -1,
- 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
- -1, 51, -1, 53, -1, 55, -1, -1, -1, 59,
- -1, 61, -1, -1, -1, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, -1, -1, 78, 79,
- 80, 81, 82, 83, -1, -1, -1, -1,
+ 72, 73, 74, 75, 76, 77, -1, -1, 80, 81,
+ 82, 83, 84, 85, -1, -1, -1, -1, -1,
- 9, 84, 12, 87, 11, 76, 12, 20, 11, 11,
- 72, 11, 89, 10, 9, 11, 58, 16, 5, 20,
- 14, 58, 54, 9, 12, 72, 78, 20, 20, 11,
- 90, 12, 11, 11, 11, 20, 12, 12, 11, 11,
- 11, 58, 12, 23, 12, -1, 20, 58, 12, 12,
- -1, 20, 12, 20, 20, 12, 12, 22, 20, 20,
- 12, 11, 20, 12, 11, 8, 6, 10, -1, 27,
- 23, 24, 31, 11, 14, 13, 31, 36, 33, 6,
- 31, 25, 33, 31, 28, 31, 31, 14, 36, 12,
- 31, 36, 33, 39, 31, 31, 33, 31, 31, 31,
- 31, 37, 31, 37, 37, 37, 31, 36, 20, 31,
- 35, 31, 43, 33, 31, 27, 33, 31, 31, 41,
- 33, 35, 7, 31, 31, 10, 31, 35, 31, 36,
- 31, 36, 33, 31, 31, 25, 12, -1, 28, 36,
- 12, 12, 45, 31, 31, 33, 33, 12, 31, 47,
- 33, 31, 31, 33, 31, -1, 33, 36, 31, -1,
- -1, 31, 31, 36, 34, 34, -1, 31, 31, 33,
- 31, 31, 33, 36, -1, 31, 36, 31, -1, 55,
- 36, -1, 36, 55, 55, 11, 11, 13, 13, 31,
- 55, 31, 31, 31, 36, -1, 36, 36, 36, 53,
- 38, 31, 44, 42, 31, -1, 36, 31, 38, 36,
- 31, 38, 36, 53, 38, 36, 31, 31, 31, 31,
- 31, 36, 36, 36, 36, 36, -1, 40, -1, -1,
- -1, -1, 53, -1, 48, 46, -1, -1, 53, -1,
- -1, 53, 2, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 14, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 91, -1, -1, -1,
- 96, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 76, 9, 9, 76, 15, 15, 93, 58, 24, 18,
+ 15, 91, 18, 15, 18, 18, 88, 62, 14, 13,
+ 15, 13, 20, 24, 24, 24, 15, 18, 13, 13,
+ 18, 62, 15, 9, 62, 15, 18, 24, 13, 5,
+ 26, 15, 13, 24, 13, 24, 24, 15, 18, 13,
+ 15, 24, 24, 13, 15, 18, 18, 13, 13, 13,
+ 13, 18, 13, 15, 13, 62, 24, 15, 18, 15,
+ 13, 18, -1, 15, 18, -1, 35, 18, 18, 24,
+ 17, 18, 18, 15, 10, 15, 31, 15, 47, -1,
+ 15, 29, 18, -1, 32, 18, 35, -1, 37, 13,
+ 35, 35, 16, -1, 27, 39, 35, -1, 35, -1,
+ 45, 38, 41, 15, 35, 35, 37, 37, 35, 29,
+ 35, -1, 32, 35, 41, 37, 41, 59, 35, 59,
+ 35, 59, 37, 40, 59, 35, 35, 37, 37, -1,
+ 80, 82, 35, 35, 37, 37, 35, 24, 37, 35,
+ 35, 37, 37, 35, 31, 35, -1, 35, 94, 41,
+ 40, 39, 35, 35, 35, 37, 35, 40, 39, 38,
+ 35, 35, 35, 35, 35, 40, 40, 40, 35, 35,
+ 35, 35, 35, 40, 40, 40, 40, 40, 49, 51,
+ 35, 35, 37, 37, 35, 7, 35, -1, 10, 40,
+ 35, 40, 8, -1, 10, 35, 18, -1, 43, 35,
+ 40, -1, 18, 52, 40, 35, 13, -1, 35, 16,
+ 40, -1, 48, 40, 35, 35, 46, 57, 35, 40,
+ 40, 35, 35, 40, 2, -1, 40, 40, 42, 42,
+ 57, 6, -1, 50, 6, -1, 57, 57, 18, 17,
+ 18, -1, 17, 18, 35, 17, 18, 27, 28, 40,
+ 35, 35, -1, -1, -1, 40, 40, 13, 42, 44,
+ 16, -1, 35, -1, -1, -1, 57, 40, -1, 42,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 95, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1};
+ -1, -1, -1, -1, 100, -1};
diff --git a/src/declarative/qml/parser/javascriptgrammar_p.h b/src/declarative/qml/parser/javascriptgrammar_p.h
index c35c56e..c01d1cc 100644
--- a/src/declarative/qml/parser/javascriptgrammar_p.h
+++ b/src/declarative/qml/parser/javascriptgrammar_p.h
@@ -59,8 +59,8 @@ class JavaScriptGrammar
public:
enum {
EOF_SYMBOL = 0,
- REDUCE_HERE = 87,
- SHIFT_THERE = 86,
+ REDUCE_HERE = 90,
+ SHIFT_THERE = 89,
T_AND = 1,
T_AND_AND = 2,
T_AND_EQ = 3,
@@ -70,9 +70,9 @@ public:
T_CATCH = 6,
T_COLON = 7,
T_COMMA = 8,
- T_CONST = 81,
+ T_CONST = 83,
T_CONTINUE = 9,
- T_DEBUGGER = 82,
+ T_DEBUGGER = 84,
T_DEFAULT = 10,
T_DELETE = 11,
T_DIVIDE_ = 12,
@@ -83,7 +83,7 @@ public:
T_EQ = 17,
T_EQ_EQ = 18,
T_EQ_EQ_EQ = 19,
- T_FALSE = 80,
+ T_FALSE = 82,
T_FINALLY = 20,
T_FOR = 21,
T_FUNCTION = 22,
@@ -95,7 +95,7 @@ public:
T_GT_GT_GT_EQ = 28,
T_IDENTIFIER = 29,
T_IF = 30,
- T_IMPORT = 85,
+ T_IMPORT = 88,
T_IN = 31,
T_INSTANCEOF = 32,
T_LBRACE = 33,
@@ -108,11 +108,12 @@ public:
T_MINUS = 40,
T_MINUS_EQ = 41,
T_MINUS_MINUS = 42,
+ T_MULTILINE_STRING_LITERAL = 86,
T_NEW = 43,
T_NOT = 44,
T_NOT_EQ = 45,
T_NOT_EQ_EQ = 46,
- T_NULL = 78,
+ T_NULL = 80,
T_NUMERIC_LITERAL = 47,
T_OR = 48,
T_OR_EQ = 49,
@@ -120,42 +121,44 @@ public:
T_PLUS = 51,
T_PLUS_EQ = 52,
T_PLUS_PLUS = 53,
- T_PUBLIC = 84,
+ T_PROPERTY = 66,
+ T_PUBLIC = 87,
T_QUESTION = 54,
T_RBRACE = 55,
T_RBRACKET = 56,
T_REMAINDER = 57,
T_REMAINDER_EQ = 58,
- T_RESERVED_WORD = 83,
+ T_RESERVED_WORD = 85,
T_RETURN = 59,
T_RPAREN = 60,
T_SEMICOLON = 61,
+ T_SIGNAL = 67,
T_STAR = 63,
T_STAR_EQ = 64,
T_STRING_LITERAL = 65,
- T_SWITCH = 66,
- T_THIS = 67,
- T_THROW = 68,
- T_TILDE = 69,
- T_TRUE = 79,
- T_TRY = 70,
- T_TYPEOF = 71,
- T_VAR = 72,
- T_VOID = 73,
- T_WHILE = 74,
- T_WITH = 75,
- T_XOR = 76,
- T_XOR_EQ = 77,
-
- ACCEPT_STATE = 519,
- RULE_COUNT = 296,
- STATE_COUNT = 520,
- TERMINAL_COUNT = 88,
- NON_TERMINAL_COUNT = 98,
-
- GOTO_INDEX_OFFSET = 520,
- GOTO_INFO_OFFSET = 1638,
- GOTO_CHECK_OFFSET = 1638
+ T_SWITCH = 68,
+ T_THIS = 69,
+ T_THROW = 70,
+ T_TILDE = 71,
+ T_TRUE = 81,
+ T_TRY = 72,
+ T_TYPEOF = 73,
+ T_VAR = 74,
+ T_VOID = 75,
+ T_WHILE = 76,
+ T_WITH = 77,
+ T_XOR = 78,
+ T_XOR_EQ = 79,
+
+ ACCEPT_STATE = 551,
+ RULE_COUNT = 315,
+ STATE_COUNT = 552,
+ TERMINAL_COUNT = 91,
+ NON_TERMINAL_COUNT = 102,
+
+ GOTO_INDEX_OFFSET = 552,
+ GOTO_INFO_OFFSET = 1789,
+ GOTO_CHECK_OFFSET = 1789
};
static const char *const spell [];
diff --git a/src/declarative/qml/parser/javascriptlexer.cpp b/src/declarative/qml/parser/javascriptlexer.cpp
index 80a558d..c0a4b63 100644
--- a/src/declarative/qml/parser/javascriptlexer.cpp
+++ b/src/declarative/qml/parser/javascriptlexer.cpp
@@ -291,6 +291,10 @@ int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
return JavaScriptGrammar::T_IMPORT;
+ else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('i')
+ && c[2] == QLatin1Char('g') && c[3] == QLatin1Char('n')
+ && c[4] == QLatin1Char('a') && c[5] == QLatin1Char('l'))
+ return JavaScriptGrammar::T_SIGNAL;
else if (check_reserved) {
if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
@@ -311,7 +315,7 @@ int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('b') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
- return JavaScriptGrammar::T_RESERVED_WORD;
+ return JavaScriptGrammar::T_PUBLIC;
else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('i')
&& c[4] == QLatin1Char('v') && c[5] == QLatin1Char('e'))
@@ -374,6 +378,11 @@ int JavaScript::Lexer::findReservedWord(const QChar *c, int size) const
&& c[4] == QLatin1Char('g') && c[5] == QLatin1Char('g')
&& c[6] == QLatin1Char('e') && c[7] == QLatin1Char('r'))
return JavaScriptGrammar::T_DEBUGGER;
+ else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
+ && c[2] == QLatin1Char('o') && c[3] == QLatin1Char('p')
+ && c[4] == QLatin1Char('e') && c[5] == QLatin1Char('r')
+ && c[6] == QLatin1Char('t') && c[7] == QLatin1Char('y'))
+ return JavaScriptGrammar::T_PROPERTY;
else if (check_reserved) {
if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('b')
&& c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t')
@@ -450,6 +459,7 @@ int JavaScript::Lexer::lex()
int token = 0;
state = Start;
ushort stringType = 0; // either single or double quotes
+ bool multiLineString = false;
pos8 = pos16 = 0;
done = false;
terminator = false;
@@ -499,6 +509,7 @@ int JavaScript::Lexer::lex()
} else if (current == '"' || current == '\'') {
recordStartPos();
state = InString;
+ multiLineString = false;
stringType = current;
} else if (isIdentLetter(current)) {
recordStartPos();
@@ -540,6 +551,9 @@ int JavaScript::Lexer::lex()
if (current == stringType) {
shift(1);
setDone(String);
+ } else if (isLineTerminator()) {
+ multiLineString = true;
+ record16(current);
} else if (current == 0 || isLineTerminator()) {
setDone(Bad);
err = UnclosedStringLiteral;
@@ -817,7 +831,7 @@ int JavaScript::Lexer::lex()
qsyylval.ustr = driver->intern(buffer16, pos16);
else
qsyylval.ustr = 0;
- return JavaScriptGrammar::T_STRING_LITERAL;
+ return multiLineString?JavaScriptGrammar::T_MULTILINE_STRING_LITERAL:JavaScriptGrammar::T_STRING_LITERAL;
case Number:
qsyylval.dval = dval;
return JavaScriptGrammar::T_NUMERIC_LITERAL;
diff --git a/src/declarative/qml/parser/javascriptparser.cpp b/src/declarative/qml/parser/javascriptparser.cpp
index 03bbc13..185a824 100644
--- a/src/declarative/qml/parser/javascriptparser.cpp
+++ b/src/declarative/qml/parser/javascriptparser.cpp
@@ -251,95 +251,164 @@ case 19: {
node->rbracketToken = loc(5);
sym(1).Node = node;
} break;
- case 20:
-case 21: {
+
+case 20: {
+ AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
+ node->literalToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 22: {
+ AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression);
+ node->semicolonToken = loc(2);
+ sym(1).Node = node;
+} break;
+ case 23: case 24:
+case 25: {
AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(),
sym(3).Statement);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 22: {
+case 26:
+
+case 27: {
+ sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
+ break;
+}
+
+case 29: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (JavaScriptNameIdImpl *)0, sym(2).sval);
+ node->type = AST::UiPublicMember::Signal;
+ node->propertyToken = loc(1);
+ node->typeToken = loc(2);
+ node->identifierToken = loc(3);
+ sym(1).Node = node;
+} break;
+
+case 30: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
- node->publicToken = loc(1);
- node->attributeTypeToken = loc(2);
+ node->propertyToken = loc(1);
+ node->typeToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 23: {
+case 31: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
+ node->isDefaultMember = true;
+ node->defaultToken = loc(1);
+ node->propertyToken = loc(2);
+ node->typeToken = loc(3);
+ node->identifierToken = loc(4);
+ sym(1).Node = node;
+} break;
+
+case 32: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
sym(5).Expression);
- node->publicToken = loc(1);
- node->attributeTypeToken = loc(2);
+ node->propertyToken = loc(1);
+ node->typeToken = loc(2);
node->identifierToken = loc(3);
node->colonToken = loc(4);
sym(1).Node = node;
} break;
-case 24: {
+case 33: {
+ AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
+ sym(6).Expression);
+ node->isDefaultMember = true;
+ node->defaultToken = loc(1);
+ node->propertyToken = loc(2);
+ node->typeToken = loc(3);
+ node->identifierToken = loc(4);
+ node->colonToken = loc(5);
+ sym(1).Node = node;
+} break;
+
+case 34: {
sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
} break;
-case 25: {
+case 35: {
sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
} break;
+case 36:
+case 37:
+{
+ AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
+ node->identifierToken = loc(1);
+ sym(1).Node = node;
+} break;
+
+case 39: {
+ QString s = QLatin1String(JavaScriptGrammar::spell[T_PROPERTY]);
+ sym(1).sval = driver->intern(s.constData(), s.length());
+ break;
+}
+
+case 40: {
+ QString s = QLatin1String(JavaScriptGrammar::spell[T_SIGNAL]);
+ sym(1).sval = driver->intern(s.constData(), s.length());
+ break;
+}
-case 26: {
+case 41: {
AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).sval);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 27: {
+case 42: {
AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 28: {
+case 43: {
AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool());
node->thisToken = loc(1);
sym(1).Node = node;
} break;
-case 29: {
+case 44: {
AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 30: {
+case 45: {
AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool());
node->nullToken = loc(1);
sym(1).Node = node;
} break;
-case 31: {
+case 46: {
AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool());
node->trueToken = loc(1);
sym(1).Node = node;
} break;
-case 32: {
+case 47: {
AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool());
node->falseToken = loc(1);
sym(1).Node = node;
} break;
-case 33: {
+case 48: {
AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
node->literalToken = loc(1);
sym(1).Node = node;
} break;
-case 34: {
+case 49: {
AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
node->literalToken = loc(1);
sym(1).Node = node;
} break;
-case 35: {
+case 50: {
bool rx = lexer->scanRegExp(Lexer::NoPrefix);
if (!rx) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
@@ -351,7 +420,7 @@ case 35: {
sym(1).Node = node;
} break;
-case 36: {
+case 51: {
bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
if (!rx) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, lexer->startLineNo(),
@@ -363,21 +432,21 @@ case 36: {
sym(1).Node = node;
} break;
-case 37: {
+case 52: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision);
node->lbracketToken = loc(1);
node->rbracketToken = loc(3);
sym(1).Node = node;
} break;
-case 38: {
+case 53: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
node->lbracketToken = loc(1);
node->rbracketToken = loc(3);
sym(1).Node = node;
} break;
-case 39: {
+case 54: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision);
node->lbracketToken = loc(1);
node->commaToken = loc(3);
@@ -385,7 +454,7 @@ case 39: {
sym(1).Node = node;
} break;
-case 40: {
+case 55: {
AST::ObjectLiteral *node = 0;
if (sym(2).Node)
node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
@@ -397,7 +466,7 @@ case 40: {
sym(1).Node = node;
} break;
-case 41: {
+case 56: {
AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
sym(2).PropertyNameAndValueList->finish ());
node->lbraceToken = loc(1);
@@ -405,51 +474,51 @@ case 41: {
sym(1).Node = node;
} break;
-case 42: {
+case 57: {
AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression);
node->lparenToken = loc(1);
node->rparenToken = loc(3);
sym(1).Node = node;
} break;
-case 43: {
+case 58: {
sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision, sym(2).Expression);
} break;
-case 44: {
+case 59: {
AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision, sym(4).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 45: {
+case 60: {
AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool());
node->commaToken = loc(1);
sym(1).Node = node;
} break;
-case 46: {
+case 61: {
AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 47: {
+case 62: {
sym(1).Node = 0;
} break;
-case 48: {
+case 63: {
sym(1).Elision = sym(1).Elision->finish ();
} break;
-case 49: {
+case 64: {
AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
sym(1).PropertyName, sym(3).Expression);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 50: {
+case 65: {
AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression);
node->commaToken = loc(2);
@@ -457,110 +526,116 @@ case 50: {
sym(1).Node = node;
} break;
-case 51: {
+case 66: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
+case 67:
+case 68: {
+ AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
+ node->propertyNameToken = loc(1);
+ sym(1).Node = node;
+} break;
-case 52: {
+case 69: {
AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 53: {
+case 70: {
AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 54: {
+case 71: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 55:
+case 72:
-case 56:
+case 73:
-case 57:
+case 74:
-case 58:
+case 75:
-case 59:
+case 76:
-case 60:
+case 77:
-case 61:
+case 78:
-case 62:
+case 79:
-case 63:
+case 80:
-case 64:
+case 81:
-case 65:
+case 82:
-case 66:
+case 83:
-case 67:
+case 84:
-case 68:
+case 85:
-case 69:
+case 86:
-case 70:
+case 87:
-case 71:
+case 88:
-case 72:
+case 89:
-case 73:
+case 90:
-case 74:
+case 91:
-case 75:
+case 92:
-case 76:
+case 93:
-case 77:
+case 94:
-case 78:
+case 95:
-case 79:
+case 96:
-case 80:
+case 97:
-case 81:
+case 98:
-case 82:
+case 99:
-case 83:
+case 100:
-case 84:
+case 101:
-case 85:
+case 102:
{
sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
} break;
-case 90: {
+case 107: {
AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->lbracketToken = loc(2);
node->rbracketToken = loc(4);
sym(1).Node = node;
} break;
-case 91: {
+case 108: {
AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
node->dotToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 92: {
+case 109: {
AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList);
node->newToken = loc(1);
node->lparenToken = loc(3);
@@ -568,384 +643,384 @@ case 92: {
sym(1).Node = node;
} break;
-case 94: {
+case 111: {
AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression);
node->newToken = loc(1);
sym(1).Node = node;
} break;
-case 95: {
+case 112: {
AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
} break;
-case 96: {
+case 113: {
AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
} break;
-case 97: {
+case 114: {
AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->lbracketToken = loc(2);
node->rbracketToken = loc(4);
sym(1).Node = node;
} break;
-case 98: {
+case 115: {
AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
node->dotToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 99: {
+case 116: {
sym(1).Node = 0;
} break;
-case 100: {
+case 117: {
sym(1).Node = sym(1).ArgumentList->finish();
} break;
-case 101: {
+case 118: {
sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression);
} break;
-case 102: {
+case 119: {
AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 106: {
+case 123: {
AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression);
node->incrementToken = loc(2);
sym(1).Node = node;
} break;
-case 107: {
+case 124: {
AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression);
node->decrementToken = loc(2);
sym(1).Node = node;
} break;
-case 109: {
+case 126: {
AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression);
node->deleteToken = loc(1);
sym(1).Node = node;
} break;
-case 110: {
+case 127: {
AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression);
node->voidToken = loc(1);
sym(1).Node = node;
} break;
-case 111: {
+case 128: {
AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression);
node->typeofToken = loc(1);
sym(1).Node = node;
} break;
-case 112: {
+case 129: {
AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression);
node->incrementToken = loc(1);
sym(1).Node = node;
} break;
-case 113: {
+case 130: {
AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression);
node->decrementToken = loc(1);
sym(1).Node = node;
} break;
-case 114: {
+case 131: {
AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression);
node->plusToken = loc(1);
sym(1).Node = node;
} break;
-case 115: {
+case 132: {
AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression);
node->minusToken = loc(1);
sym(1).Node = node;
} break;
-case 116: {
+case 133: {
AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression);
node->tildeToken = loc(1);
sym(1).Node = node;
} break;
-case 117: {
+case 134: {
AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression);
node->notToken = loc(1);
sym(1).Node = node;
} break;
-case 119: {
+case 136: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Mul, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 120: {
+case 137: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Div, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 121: {
+case 138: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Mod, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 123: {
+case 140: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Add, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 124: {
+case 141: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Sub, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 126: {
+case 143: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::LShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 127: {
+case 144: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::RShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 128: {
+case 145: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::URShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 130: {
+case 147: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Lt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 131: {
+case 148: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Gt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 132: {
+case 149: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Le, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 133: {
+case 150: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Ge, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 134: {
+case 151: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::InstanceOf, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 135: {
+case 152: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::In, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 137: {
+case 154: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Lt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 138: {
+case 155: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Gt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 139: {
+case 156: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Le, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 140: {
+case 157: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Ge, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 141: {
+case 158: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::InstanceOf, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 143: {
+case 160: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Equal, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 144: {
+case 161: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::NotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 145: {
+case 162: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::StrictEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 146: {
+case 163: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::StrictNotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 148: {
+case 165: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Equal, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 149: {
+case 166: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::NotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 150: {
+case 167: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::StrictEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 151: {
+case 168: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::StrictNotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 153: {
+case 170: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::BitAnd, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 155: {
+case 172: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::BitAnd, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 157: {
+case 174: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::BitXor, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 159: {
+case 176: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::BitXor, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 161: {
+case 178: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::BitOr, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 163: {
+case 180: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::BitOr, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 165: {
+case 182: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::And, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 167: {
+case 184: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::And, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 169: {
+case 186: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Or, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 171: {
+case 188: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Or, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 173: {
+case 190: {
AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
sym(3).Expression, sym(5).Expression);
node->questionToken = loc(2);
@@ -953,7 +1028,7 @@ case 173: {
sym(1).Node = node;
} break;
-case 175: {
+case 192: {
AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
sym(3).Expression, sym(5).Expression);
node->questionToken = loc(2);
@@ -961,112 +1036,112 @@ case 175: {
sym(1).Node = node;
} break;
-case 177: {
+case 194: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
sym(2).ival, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 179: {
+case 196: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
sym(2).ival, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 180: {
+case 197: {
sym(1).ival = QSOperator::Assign;
} break;
-case 181: {
+case 198: {
sym(1).ival = QSOperator::InplaceMul;
} break;
-case 182: {
+case 199: {
sym(1).ival = QSOperator::InplaceDiv;
} break;
-case 183: {
+case 200: {
sym(1).ival = QSOperator::InplaceMod;
} break;
-case 184: {
+case 201: {
sym(1).ival = QSOperator::InplaceAdd;
} break;
-case 185: {
+case 202: {
sym(1).ival = QSOperator::InplaceSub;
} break;
-case 186: {
+case 203: {
sym(1).ival = QSOperator::InplaceLeftShift;
} break;
-case 187: {
+case 204: {
sym(1).ival = QSOperator::InplaceRightShift;
} break;
-case 188: {
+case 205: {
sym(1).ival = QSOperator::InplaceURightShift;
} break;
-case 189: {
+case 206: {
sym(1).ival = QSOperator::InplaceAnd;
} break;
-case 190: {
+case 207: {
sym(1).ival = QSOperator::InplaceXor;
} break;
-case 191: {
+case 208: {
sym(1).ival = QSOperator::InplaceOr;
} break;
-case 193: {
+case 210: {
AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 194: {
+case 211: {
sym(1).Node = 0;
} break;
-case 197: {
+case 214: {
AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 198: {
+case 215: {
sym(1).Node = 0;
} break;
-case 215: {
+case 232: {
AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList);
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
-case 216: {
+case 233: {
sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement);
} break;
-case 217: {
+case 234: {
sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement);
} break;
-case 218: {
+case 235: {
sym(1).Node = 0;
} break;
-case 219: {
+case 236: {
sym(1).Node = sym(1).StatementList->finish ();
} break;
-case 221: {
+case 238: {
AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(),
sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST));
node->declarationKindToken = loc(1);
@@ -1074,76 +1149,76 @@ case 221: {
sym(1).Node = node;
} break;
-case 222: {
+case 239: {
sym(1).ival = T_CONST;
} break;
-case 223: {
+case 240: {
sym(1).ival = T_VAR;
} break;
-case 224: {
+case 241: {
sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
} break;
-case 225: {
+case 242: {
AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(),
sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 226: {
+case 243: {
sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
} break;
-case 227: {
+case 244: {
sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
} break;
-case 228: {
+case 245: {
AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 229: {
+case 246: {
AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 230: {
+case 247: {
// ### TODO: AST for initializer
sym(1) = sym(2);
} break;
-case 231: {
+case 248: {
sym(1).Node = 0;
} break;
-case 233: {
+case 250: {
// ### TODO: AST for initializer
sym(1) = sym(2);
} break;
-case 234: {
+case 251: {
sym(1).Node = 0;
} break;
-case 236: {
+case 253: {
AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool());
node->semicolonToken = loc(1);
sym(1).Node = node;
} break;
-case 238: {
+case 255: {
AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 239: {
+case 256: {
AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement);
node->ifToken = loc(1);
node->lparenToken = loc(2);
@@ -1152,7 +1227,7 @@ case 239: {
sym(1).Node = node;
} break;
-case 240: {
+case 257: {
AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
node->ifToken = loc(1);
node->lparenToken = loc(2);
@@ -1160,7 +1235,7 @@ case 240: {
sym(1).Node = node;
} break;
-case 242: {
+case 259: {
AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression);
node->doToken = loc(1);
node->whileToken = loc(3);
@@ -1170,7 +1245,7 @@ case 242: {
sym(1).Node = node;
} break;
-case 243: {
+case 260: {
AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
node->whileToken = loc(1);
node->lparenToken = loc(2);
@@ -1178,7 +1253,7 @@ case 243: {
sym(1).Node = node;
} break;
-case 244: {
+case 261: {
AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression,
sym(5).Expression, sym(7).Expression, sym(9).Statement);
node->forToken = loc(1);
@@ -1189,7 +1264,7 @@ case 244: {
sym(1).Node = node;
} break;
-case 245: {
+case 262: {
AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(),
sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression,
sym(8).Expression, sym(10).Statement);
@@ -1202,7 +1277,7 @@ case 245: {
sym(1).Node = node;
} break;
-case 246: {
+case 263: {
AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression,
sym(5).Expression, sym(7).Statement);
node->forToken = loc(1);
@@ -1212,7 +1287,7 @@ case 246: {
sym(1).Node = node;
} break;
-case 247: {
+case 264: {
AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(),
sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement);
node->forToken = loc(1);
@@ -1223,14 +1298,14 @@ case 247: {
sym(1).Node = node;
} break;
-case 249: {
+case 266: {
AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool());
node->continueToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 251: {
+case 268: {
AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
node->continueToken = loc(1);
node->identifierToken = loc(2);
@@ -1238,14 +1313,14 @@ case 251: {
sym(1).Node = node;
} break;
-case 253: {
+case 270: {
AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool());
node->breakToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 255: {
+case 272: {
AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
node->breakToken = loc(1);
node->identifierToken = loc(2);
@@ -1253,14 +1328,14 @@ case 255: {
sym(1).Node = node;
} break;
-case 257: {
+case 274: {
AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression);
node->returnToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
-case 258: {
+case 275: {
AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
node->withToken = loc(1);
node->lparenToken = loc(2);
@@ -1268,7 +1343,7 @@ case 258: {
sym(1).Node = node;
} break;
-case 259: {
+case 276: {
AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock);
node->switchToken = loc(1);
node->lparenToken = loc(2);
@@ -1276,83 +1351,90 @@ case 259: {
sym(1).Node = node;
} break;
-case 260: {
+case 277: {
AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
-case 261: {
+case 278: {
AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(5);
sym(1).Node = node;
} break;
-case 262: {
+case 279: {
sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause);
} break;
-case 263: {
+case 280: {
sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause);
} break;
-case 264: {
+case 281: {
sym(1).Node = 0;
} break;
-case 265: {
+case 282: {
sym(1).Node = sym(1).CaseClauses->finish ();
} break;
-case 266: {
+case 283: {
AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList);
node->caseToken = loc(1);
node->colonToken = loc(3);
sym(1).Node = node;
} break;
-case 267: {
+case 284: {
AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList);
node->defaultToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
+case 285:
+case 286: {
+ AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement);
+ node->identifierToken = loc(1);
+ node->colonToken = loc(2);
+ sym(1).Node = node;
+} break;
-case 268: {
+case 287: {
AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement);
node->identifierToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 270: {
+case 289: {
AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression);
node->throwToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
-case 271: {
+case 290: {
AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 272: {
+case 291: {
AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 273: {
+case 292: {
AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 274: {
+case 293: {
AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
node->catchToken = loc(1);
node->lparenToken = loc(2);
@@ -1361,20 +1443,20 @@ case 274: {
sym(1).Node = node;
} break;
-case 275: {
+case 294: {
AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block);
node->finallyToken = loc(1);
sym(1).Node = node;
} break;
-case 277: {
+case 296: {
AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool());
node->debuggerToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 278: {
+case 297: {
AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
node->identifierToken = loc(2);
@@ -1385,7 +1467,7 @@ case 278: {
sym(1).Node = node;
} break;
-case 279: {
+case 298: {
AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
if (sym(2).sval)
@@ -1397,56 +1479,56 @@ case 279: {
sym(1).Node = node;
} break;
-case 280: {
+case 299: {
AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 281: {
+case 300: {
AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
node->commaToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 282: {
+case 301: {
sym(1).Node = 0;
} break;
-case 283: {
+case 302: {
sym(1).Node = sym(1).FormalParameterList->finish ();
} break;
-case 284: {
+case 303: {
sym(1).Node = 0;
} break;
-case 286: {
+case 305: {
sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ());
} break;
-case 287: {
+case 306: {
sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement);
} break;
-case 288: {
+case 307: {
sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement);
} break;
-case 289: {
+case 308: {
sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement);
} break;
-case 290: {
+case 309: {
sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration);
} break;
-case 291: {
+case 310: {
sym(1).sval = 0;
} break;
-case 293: {
+case 312: {
sym(1).Node = 0;
} break;
diff --git a/src/declarative/qml/parser/javascriptparser_p.h b/src/declarative/qml/parser/javascriptparser_p.h
index e97abeb..497fae8 100644
--- a/src/declarative/qml/parser/javascriptparser_p.h
+++ b/src/declarative/qml/parser/javascriptparser_p.h
@@ -206,9 +206,9 @@ protected:
};
-#define J_SCRIPT_REGEXPLITERAL_RULE1 35
+#define J_SCRIPT_REGEXPLITERAL_RULE1 50
-#define J_SCRIPT_REGEXPLITERAL_RULE2 36
+#define J_SCRIPT_REGEXPLITERAL_RULE2 51
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index 00e3ccb..69a1461 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -22,7 +22,8 @@ SOURCES += qml/qmlparser.cpp \
qml/qmlclassfactory.cpp \
qml/qmlparserstatus.cpp \
qml/qmlcompositetypemanager.cpp \
- qml/qmlinfo.cpp
+ qml/qmlinfo.cpp \
+ qml/qmlerror.cpp
HEADERS += qml/qmlparser_p.h \
qml/qmlinstruction_p.h \
@@ -32,7 +33,8 @@ HEADERS += qml/qmlparser_p.h \
qml/qmlmetaproperty.h \
qml/qmlcomponent.h \
qml/qmlcomponent_p.h \
- qml/qmlcustomparser.h \
+ qml/qmlcustomparser_p.h \
+ qml/qmlcustomparser_p_p.h \
qml/qmlpropertyvaluesource.h \
qml/qmlboundsignal_p.h \
qml/qmlxmlparser_p.h \
@@ -57,7 +59,8 @@ HEADERS += qml/qmlparser_p.h \
qml/qmlcontext_p.h \
qml/qmlcompositetypemanager_p.h \
qml/qmllist.h \
- qml/qmldeclarativedata_p.h
+ qml/qmldeclarativedata_p.h \
+ qml/qmlerror.h
# for qtscript debugger
QT += scripttools
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index fae0f43..37d7fa1 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -59,6 +59,7 @@
#include <qmlcontext.h>
#include <qmlmetatype.h>
#include <QtCore/qdebug.h>
+#include "private/qmlcustomparser_p_p.h"
#include "qmlscriptparser_p.h"
@@ -146,7 +147,7 @@ int QmlCompiledData::indexForInt(int *data, int count)
}
QmlCompiler::QmlCompiler()
-: exceptionLine(-1), output(0)
+: exceptionLine(-1), exceptionColumn(-1), output(0)
{
}
@@ -155,14 +156,19 @@ bool QmlCompiler::isError() const
return exceptionLine != -1;
}
-qint64 QmlCompiler::errorLine() const
+QList<QmlError> QmlCompiler::errors() const
{
- return exceptionLine;
-}
+ QList<QmlError> rv;
+
+ if(isError()) {
+ QmlError error;
+ error.setDescription(exceptionDescription);
+ error.setLine(exceptionLine);
+ error.setColumn(exceptionColumn);
+ rv << error;
+ }
-QString QmlCompiler::errorDescription() const
-{
- return exceptionDescription;
+ return rv;
}
bool QmlCompiler::isValidId(const QString &val)
@@ -436,9 +442,19 @@ void QmlCompiler::reset(QmlCompiledComponent *cc, bool deleteMemory)
cc->bytecode.clear();
}
+#define COMPILE_EXCEPTION2(token, desc) \
+ { \
+ exceptionLine = token->line; \
+ exceptionColumn = token->column; \
+ QDebug d(&exceptionDescription); \
+ d << desc; \
+ return false; \
+ }
+
#define COMPILE_EXCEPTION(desc) \
{ \
exceptionLine = obj->line; \
+ exceptionColumn = obj->column; \
QDebug d(&exceptionDescription); \
d << desc; \
return false; \
@@ -552,6 +568,7 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
obj->properties.remove(SIGNALS_NAME);
}
+ int createInstrIdx = output->bytecode.count();
if (obj->type != -1 && output->types.at(obj->type).parser) {
QByteArray data = obj->custom;
int ref = output->indexForByteArray(data);
@@ -567,6 +584,7 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
QmlInstruction create;
create.type = QmlInstruction::CreateObject;
create.line = obj->line;
+ create.create.data = -1;
create.create.type = obj->type;
output->bytecode << create;
}
@@ -591,19 +609,48 @@ bool QmlCompiler::compileObject(Object *obj, int ctxt)
}
}
+ bool isCustomParser = output->types.at(obj->type).type &&
+ output->types.at(obj->type).type->customParser() != 0;
+ QList<QmlCustomParserProperty> customProps;
+
foreach(Property *prop, obj->properties) {
if (!ignoreProperties && prop->name == PROPERTIES_NAME) {
} else if (!ignoreSignals && prop->name == SIGNALS_NAME) {
} else if (prop->name.length() >= 3 && prop->name.startsWith("on") &&
('A' <= prop->name.at(2) && 'Z' >= prop->name.at(2))) {
- COMPILE_CHECK(compileSignal(prop, obj));
+ if (!isCustomParser) {
+ COMPILE_CHECK(compileSignal(prop, obj));
+ } else {
+ customProps << QmlCustomParserNodePrivate::fromProperty(prop);
+ }
} else {
- COMPILE_CHECK(compileProperty(prop, obj, ctxt));
+ if (!isCustomParser || (isCustomParser && testProperty(prop, obj))) {
+ COMPILE_CHECK(compileProperty(prop, obj, ctxt));
+ } else {
+ customProps << QmlCustomParserNodePrivate::fromProperty(prop);
+ }
}
}
- if (obj->defaultProperty)
- COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
+ if (obj->defaultProperty) {
+ if(!isCustomParser || (isCustomParser && testProperty(obj->defaultProperty, obj))) {
+ COMPILE_CHECK(compileProperty(obj->defaultProperty, obj, ctxt));
+ } else {
+ customProps << QmlCustomParserNodePrivate::fromProperty(obj->defaultProperty);
+ }
+ }
+
+ if (isCustomParser && !customProps.isEmpty()) {
+ // ### Check for failure
+ bool ok = false;
+ QmlCustomParser *cp = output->types.at(obj->type).type->customParser();
+ QByteArray customData = cp->compile(customProps, &ok);
+ if(!ok)
+ COMPILE_EXCEPTION("Failure compiling custom type");
+ if(!customData.isEmpty())
+ output->bytecode[createInstrIdx].create.data =
+ output->indexForByteArray(customData);
+ }
if (obj->type != -1) {
if (output->types.at(obj->type).component) {
@@ -764,65 +811,61 @@ bool QmlCompiler::compileSignal(Property *prop, Object *obj)
return true;
}
+// Returns true if prop exists on obj, false otherwise
+bool QmlCompiler::testProperty(QmlParser::Property *prop,
+ QmlParser::Object *obj)
+{
+ if(isAttachedProperty(prop->name) || prop->name == "id")
+ return true;
+
+ const QMetaObject *mo = obj->metaObject();
+ if (mo) {
+ if (prop->isDefault) {
+ QMetaProperty p = QmlMetaType::defaultProperty(mo);
+ return p.name() != 0;
+ } else {
+ int idx = mo->indexOfProperty(prop->name.constData());
+ return idx != -1;
+ }
+ }
+
+ return false;
+}
+
bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
{
if (prop->values.isEmpty() && !prop->value)
return true;
// First we're going to need a reference to this property
- if (obj->type != -1) {
+ const QMetaObject *mo = obj->metaObject();
+ if (mo && !isAttachedProperty(prop->name)) {
+ if (prop->isDefault) {
+ QMetaProperty p = QmlMetaType::defaultProperty(mo);
+ // XXX
+ // Currently we don't handle enums in the static analysis
+ // so we let them drop through to generateStoreInstruction()
+ if (p.name() && !p.isEnumType()) {
+ prop->index = mo->indexOfProperty(p.name());
+ prop->name = p.name();
- const QMetaObject *mo = obj->metaObject();
- if (mo) {
- if (prop->isDefault) {
- QMetaProperty p = QmlMetaType::defaultProperty(mo);
- // XXX
- // Currently we don't handle enums in the static analysis
- // so we let them drop through to generateStoreInstruction()
- if (p.name() && !p.isEnumType()) {
- prop->index = mo->indexOfProperty(p.name());
- prop->name = p.name();
-
- int t = p.type();
- if (t == QVariant::UserType)
- t = p.userType();
-
- prop->type = t;
- }
- } else {
- prop->index = mo->indexOfProperty(prop->name.constData());
- QMetaProperty p = mo->property(prop->index);
- // XXX
- // Currently we don't handle enums in the static analysis
- // so we let them drop through to generateStoreInstruction()
- if (p.name() && !p.isEnumType()) {
- int t = p.type();
- if (t == QVariant::UserType)
- t = p.userType();
-
- prop->type = t;
- }
- }
- }
- } else {
- const QMetaObject *mo = obj->metaObject();
- if (mo) {
- if (prop->isDefault) {
- QMetaProperty p = QmlMetaType::defaultProperty(mo);
- if (p.name()) {
- prop->index = mo->indexOfProperty(p.name());
- prop->name = p.name();
- }
int t = p.type();
if (t == QVariant::UserType)
t = p.userType();
+
prop->type = t;
- } else {
- prop->index = mo->indexOfProperty(prop->name.constData());
- QMetaProperty p = mo->property(prop->index);
+ }
+ } else {
+ prop->index = mo->indexOfProperty(prop->name.constData());
+ QMetaProperty p = mo->property(prop->index);
+ // XXX
+ // Currently we don't handle enums in the static analysis
+ // so we let them drop through to generateStoreInstruction()
+ if (p.name() && !p.isEnumType()) {
int t = p.type();
if (t == QVariant::UserType)
t = p.userType();
+
prop->type = t;
}
}
@@ -841,7 +884,7 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt)
COMPILE_CHECK(compileNestedProperty(prop, ctxt));
} else if (QmlMetaType::isQmlList(prop->type) ||
- QmlMetaType::isList(prop->type)) {
+ QmlMetaType::isList(prop->type)) {
COMPILE_CHECK(compileListProperty(prop, obj, ctxt));
@@ -1187,10 +1230,10 @@ bool QmlCompiler::compilePropertyLiteralAssignment(QmlParser::Property *prop,
//### we are restricted to a rather generic message here. If we can find a way to move
// the exception into generateStoreInstruction we could potentially have better messages.
// (the problem is that both compile and run exceptions can be generated, though)
- COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to property" << obj->metaObject()->property(prop->index).name());
+ COMPILE_EXCEPTION2(v, "Cannot assign value" << v->primitive << "to property" << obj->metaObject()->property(prop->index).name());
doassign = false;
} else if (r == ReadOnly) {
- COMPILE_EXCEPTION("Cannot assign value" << v->primitive << "to the read-only property" << obj->metaObject()->property(prop->index).name());
+ COMPILE_EXCEPTION2(v, "Cannot assign value" << v->primitive << "to the read-only property" << obj->metaObject()->property(prop->index).name());
} else {
doassign = true;
}
@@ -1351,7 +1394,7 @@ bool QmlCompiler::findDynamicProperties(QmlParser::Property *prop,
definedProperties << propDef;
}
- obj->dynamicProperties = definedProperties;
+ obj->dynamicProperties << definedProperties;
return true;
}
@@ -1407,7 +1450,7 @@ bool QmlCompiler::findDynamicSignals(QmlParser::Property *sigs,
definedSignals << sigDef;
}
- obj->dynamicSignals = definedSignals;
+ obj->dynamicSignals << definedSignals;
return true;
}
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index 2a06f73..cc1a9e9 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -45,6 +45,7 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qset.h>
#include <qml.h>
+#include <qmlerror.h>
#include <private/qmlinstruction_p.h>
#include <private/qmlcompositetypemanager_p.h>
class QStringList;
@@ -115,8 +116,7 @@ public:
bool compile(QmlEngine *, QmlCompositeTypeData *, QmlCompiledComponent *);
bool isError() const;
- qint64 errorLine() const;
- QString errorDescription() const;
+ QList<QmlError> errors() const;
static bool isValidId(const QString &);
static bool isBinding(const QString &);
@@ -139,6 +139,7 @@ private:
bool compileComponentFromRoot(QmlParser::Object *obj, int);
bool compileFetchedObject(QmlParser::Object *obj, int);
bool compileSignal(QmlParser::Property *prop, QmlParser::Object *obj);
+ bool testProperty(QmlParser::Property *prop, QmlParser::Object *obj);
bool compileProperty(QmlParser::Property *prop, QmlParser::Object *obj, int);
bool compileIdProperty(QmlParser::Property *prop,
QmlParser::Object *obj);
@@ -175,6 +176,7 @@ private:
QSet<QString> ids;
qint64 exceptionLine;
+ qint64 exceptionColumn;
QString exceptionDescription;
QmlCompiledData *output;
};
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 2c3ebd6..3b4d7b3 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -89,16 +89,20 @@ bool QmlComponentPrivate::isXml(const QByteArray &ba)
file, or for defining a component that logically belongs with the
file containing it.
- \code
- <Item>
- <Component id="RedSquare">
- <Rect color="red" width="10" height="10"/>
- </Component>
-
- <ComponentInstance component="{RedSquare}"/>
- <ComponentInstance component="{RedSquare}" x="20"/>
- </Item>
- \endcode
+ \qml
+Item {
+ Component {
+ id: RedSquare
+ Rect {
+ color: "red"
+ width: 10
+ height: 10
+ }
+ }
+ ComponentInstance { component: RedSquare }
+ ComponentInstance { component: RedSquare; x: 20 }
+}
+ \endqml
*/
QML_DEFINE_TYPE(QmlComponent,Component);
@@ -133,9 +137,7 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
if (!c) {
Q_ASSERT(data->status == QmlCompositeTypeData::Error);
- errorDescription = data->errorDescription;
- qWarning().nospace() << "QmlComponent: "
- << data->errorDescription.toLatin1().constData();
+ errors = data->errors;
} else {
@@ -190,7 +192,7 @@ QmlComponent::Status QmlComponent::status() const
return Loading;
else if (d->engine && d->cc)
return Ready;
- else if (!d->errorDescription.isEmpty())
+ else if (!d->errors.isEmpty())
return Error;
else
return Null;
@@ -349,13 +351,13 @@ void QmlComponent::loadUrl(const QUrl &url)
emit statusChanged(status());
}
-QString QmlComponent::errorDescription() const
+QList<QmlError> QmlComponent::errors() const
{
Q_D(const QmlComponent);
if (isError())
- return d->errorDescription;
+ return d->errors;
else
- return QString();
+ return QList<QmlError>();
}
/*!
@@ -444,7 +446,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
}
if (!isReady()) {
- qWarning("QmlComponent: Cannot create un-ready component");
+ qWarning("QmlComponent: Component is not ready");
return 0;
}
@@ -462,15 +464,9 @@ QObject *QmlComponent::beginCreate(QmlContext *context)
QmlVME vme;
QObject *rv = vme.run(ctxt, d->cc, d->start, d->count);
- if (vme.isError()) {
- qWarning().nospace()
-#ifdef QML_VERBOSEERRORS_ENABLED
- << "QmlComponent: "
-#endif
- << vme.errorDescription().toLatin1().constData() << " @"
- << d->url.toString().toLatin1().constData() << ":" << vme.errorLine();
- }
+ if (vme.isError())
+ d->errors = vme.errors();
ctxt->deactivate();
diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h
index 83d08ea..90f7467 100644
--- a/src/declarative/qml/qmlcomponent.h
+++ b/src/declarative/qml/qmlcomponent.h
@@ -46,7 +46,7 @@
#include <QtCore/qstring.h>
#include <QtDeclarative/qfxglobal.h>
#include <QtDeclarative/qml.h>
-
+#include <QtDeclarative/qmlerror.h>
QT_BEGIN_HEADER
@@ -77,7 +77,8 @@ public:
bool isReady() const;
bool isError() const;
bool isLoading() const;
- QString errorDescription() const;
+
+ QList<QmlError> errors() const;
QUrl url() const;
@@ -98,7 +99,7 @@ private:
QmlComponent(QmlEngine *, QmlCompiledComponent *, int, int, QObject *parent);
friend class QmlVME;
- friend class QmlCompositeTypeData;
+ friend struct QmlCompositeTypeData;
};
QML_DECLARE_TYPE(QmlComponent);
diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h
index bb5f7bb..0507958 100644
--- a/src/declarative/qml/qmlcomponent_p.h
+++ b/src/declarative/qml/qmlcomponent_p.h
@@ -47,6 +47,7 @@
#include <QList>
#include "private/qobject_p.h"
#include "private/qmlcompositetypemanager_p.h"
+#include <qmlerror.h>
#include "qmlcomponent.h"
class QmlComponent;
class QmlEngine;
@@ -68,7 +69,7 @@ public:
void fromTypeData(QmlCompositeTypeData *data);
- QString errorDescription;
+ QList<QmlError> errors;
QUrl url;
int start;
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index 7f2cc58..fbe40bf 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -105,10 +105,9 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
QmlCompiler compiler;
if (!compiler.compile(engine, this, compiledComponent)) {
status = Error;
- errorDescription = compiler.errorDescription() +
- QLatin1String("@") +
- url + QLatin1String(":") +
- QString::number(compiler.errorLine());
+ errors = compiler.errors();
+ for(int ii = 0; ii < errors.count(); ++ii)
+ errors[ii].setUrl(url);
compiledComponent->release();
compiledComponent = 0;
}
@@ -188,7 +187,10 @@ void QmlCompositeTypeManager::replyFinished()
reply->url().toString();
unit->status = QmlCompositeTypeData::Error;
- unit->errorDescription = errorDescription;
+ // ### FIXME
+ QmlError error;
+ error.setDescription(errorDescription);
+ unit->errors << error;
doComplete(unit);
} else {
@@ -215,7 +217,10 @@ void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit)
// ### - Fill in error
errorDescription = QLatin1String("File error for URL ") + url.toString();
unit->status = QmlCompositeTypeData::Error;
- unit->errorDescription = errorDescription;
+ // ### FIXME
+ QmlError error;
+ error.setDescription(errorDescription);
+ unit->errors << error;
doComplete(unit);
}
@@ -234,7 +239,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
if (!unit->data.parse(data, url)) {
unit->status = QmlCompositeTypeData::Error;
- unit->errorDescription = unit->data.errorDescription();
+ unit->errors << unit->data.errors();
doComplete(unit);
} else {
@@ -273,7 +278,7 @@ void QmlCompositeTypeManager::checkComplete(QmlCompositeTypeData *unit)
if (u->status == QmlCompositeTypeData::Error) {
unit->status = QmlCompositeTypeData::Error;
- unit->errorDescription = u->errorDescription;
+ unit->errors = u->errors;
doComplete(unit);
return;
} else if (u->status == QmlCompositeTypeData::Waiting) {
@@ -334,7 +339,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
case QmlCompositeTypeData::Invalid:
case QmlCompositeTypeData::Error:
unit->status = QmlCompositeTypeData::Error;
- unit->errorDescription = urlUnit->errorDescription;
+ unit->errors = urlUnit->errors;
doComplete(unit);
return;
diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h
index ffa4fda..e4028d5 100644
--- a/src/declarative/qml/qmlcompositetypemanager_p.h
+++ b/src/declarative/qml/qmlcompositetypemanager_p.h
@@ -45,6 +45,7 @@
#include <qglobal.h>
#include <private/qmlscriptparser_p.h>
#include <private/qmlrefcount_p.h>
+#include <qmlerror.h>
QT_BEGIN_NAMESPACE
@@ -52,6 +53,7 @@ class QmlEngine;
class QmlCompiledComponent;
class QmlComponentPrivate;
class QmlComponent;
+class QmlDomDocument;
struct QmlCompositeTypeData : public QmlRefCount
{
QmlCompositeTypeData();
@@ -64,7 +66,8 @@ struct QmlCompositeTypeData : public QmlRefCount
Waiting
};
Status status;
- QString errorDescription;
+
+ QList<QmlError> errors;
QString url;
QList<QmlCompositeTypeData *> dependants;
@@ -98,6 +101,7 @@ struct QmlCompositeTypeData : public QmlRefCount
private:
friend class QmlCompositeTypeManager;
friend class QmlCompiler;
+ friend class QmlDomDocument;
QmlScriptParser data;
QList<QmlComponentPrivate *> waiters;
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index c1acdc7..30857ad 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -261,10 +261,10 @@ QmlContext *QmlContext::parentContext() const
Add a default \a object to this context. The object will be added after
any existing default objects.
*/
-void QmlContext::addDefaultObject(QObject *defaultObject)
+void QmlContext::addDefaultObject(QObject *object)
{
Q_D(QmlContext);
- d->addDefaultObject(defaultObject, QmlContextPrivate::NormalPriority);
+ d->addDefaultObject(object, QmlContextPrivate::NormalPriority);
}
/*!
@@ -340,13 +340,11 @@ QmlContext *QmlContext::activeContext()
/*!
Resolves the URL \a src relative to the URL of the
- containing component.
+ containing component. If \a src is absolute, it is
+ simply returned. If there is no containing component,
+ an empty URL is returned.
- If \a src is absolute, it is simply returned.
-
- If there is no containing component, an empty URL is returned.
-
- \sa componentUrl
+ \sa QmlEngine::componentUrl()
*/
QUrl QmlContext::resolvedUrl(const QUrl &src)
{
@@ -372,10 +370,10 @@ QUrl QmlContext::resolvedUrl(const QUrl &src)
/*!
Resolves the component URI \a src relative to the URL of the
containing component, and according to the
- \link QmlEngine::nameSpacePaths() namespace paths\endlink of the
+ \l {QmlEngine::nameSpacePaths()} {namespace paths} of the
context's engine, returning the resolved URL.
- \sa componentUrl
+ \sa QmlEngine::componentUrl()
*/
QUrl QmlContext::resolvedUri(const QUrl &src)
{
diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp
index a342ca8..544c469 100644
--- a/src/declarative/qml/qmlcustomparser.cpp
+++ b/src/declarative/qml/qmlcustomparser.cpp
@@ -39,14 +39,18 @@
**
****************************************************************************/
-#include "qmlcustomparser.h"
-
+#include "qmlcustomparser_p.h"
+#include "qmlcustomparser_p_p.h"
+#include "qmlparser_p.h"
QT_BEGIN_NAMESPACE
+using namespace QmlParser;
+
/*!
\class QmlCustomParser
\brief The QmlCustomParser class allows you to add new arbitrary types to QML.
+ \internal
By subclassing QmlCustomParser, you can add an XML parser for building a
particular type.
@@ -92,5 +96,129 @@ QT_BEGIN_NAMESPACE
the same-named type as this custom parser is defined for).
*/
+QmlCustomParserNode
+QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root)
+{
+ QmlCustomParserNode rootNode;
+ rootNode.d->name = root->typeName;
+
+ for(QHash<QByteArray, Property *>::Iterator iter = root->properties.begin();
+ iter != root->properties.end();
+ ++iter) {
+
+ Property *p = *iter;
+
+ rootNode.d->properties << fromProperty(p);
+ }
+
+ return rootNode;
+}
+
+QmlCustomParserProperty
+QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p)
+{
+ QmlCustomParserProperty prop;
+ prop.d->name = p->name;
+ prop.d->isList = (p->values.count() > 1);
+
+ for(int ii = 0; ii < p->values.count(); ++ii) {
+ Value *v = p->values.at(ii);
+
+ // We skip fetched properties for now
+ if(v->object && v->object->type == -1)
+ continue;
+
+ if(v->object) {
+ QmlCustomParserNode node = fromObject(v->object);
+ prop.d->values << QVariant::fromValue(node);
+ } else {
+ prop.d->values << QVariant::fromValue(v->primitive);
+ }
+
+ }
+
+ return prop;
+}
+
+QmlCustomParserNode::QmlCustomParserNode()
+: d(new QmlCustomParserNodePrivate)
+{
+}
+
+QmlCustomParserNode::QmlCustomParserNode(const QmlCustomParserNode &other)
+: d(new QmlCustomParserNodePrivate)
+{
+ *this = other;
+}
+
+QmlCustomParserNode &QmlCustomParserNode::operator=(const QmlCustomParserNode &other)
+{
+ d->name = other.d->name;
+ d->properties = other.d->properties;
+ return *this;
+}
+
+QmlCustomParserNode::~QmlCustomParserNode()
+{
+ delete d; d = 0;
+}
+
+QByteArray QmlCustomParserNode::name() const
+{
+ return d->name;
+}
+
+QList<QmlCustomParserProperty> QmlCustomParserNode::properties() const
+{
+ return d->properties;
+}
+
+QmlCustomParserProperty::QmlCustomParserProperty()
+: d(new QmlCustomParserPropertyPrivate)
+{
+}
+
+QmlCustomParserProperty::QmlCustomParserProperty(const QmlCustomParserProperty &other)
+: d(new QmlCustomParserPropertyPrivate)
+{
+ *this = other;
+}
+
+QmlCustomParserProperty &QmlCustomParserProperty::operator=(const QmlCustomParserProperty &other)
+{
+ d->name = other.d->name;
+ d->isList = other.d->isList;
+ d->values = other.d->values;
+ return *this;
+}
+
+QmlCustomParserProperty::~QmlCustomParserProperty()
+{
+ delete d; d = 0;
+}
+
+QByteArray QmlCustomParserProperty::name() const
+{
+ return d->name;
+}
+
+bool QmlCustomParserProperty::isList() const
+{
+ return d->isList;
+}
+
+QList<QVariant> QmlCustomParserProperty::assignedValues() const
+{
+ return d->values;
+}
+
+QByteArray QmlCustomParser::compile(const QList<QmlCustomParserProperty> &, bool *ok)
+{
+ return QByteArray();
+}
+
+void QmlCustomParser::setCustomData(QObject *, const QByteArray &)
+{
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlcustomparser.h b/src/declarative/qml/qmlcustomparser_p.h
index 9de1be4..0e6a619 100644
--- a/src/declarative/qml/qmlcustomparser.h
+++ b/src/declarative/qml/qmlcustomparser_p.h
@@ -53,13 +53,55 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+class QmlCustomParserPropertyPrivate;
+class Q_DECLARATIVE_EXPORT QmlCustomParserProperty
+{
+public:
+ QmlCustomParserProperty();
+ QmlCustomParserProperty(const QmlCustomParserProperty &);
+ QmlCustomParserProperty &operator=(const QmlCustomParserProperty &);
+ ~QmlCustomParserProperty();
+
+ QByteArray name() const;
+
+ bool isList() const;
+ QList<QVariant> assignedValues() const;
+
+private:
+ friend class QmlCustomParserNodePrivate;
+ friend class QmlCustomParserPropertyPrivate;
+ QmlCustomParserPropertyPrivate *d;
+};
+Q_DECLARE_METATYPE(QmlCustomParserProperty);
+
+class QmlCustomParserNodePrivate;
+class Q_DECLARATIVE_EXPORT QmlCustomParserNode
+{
+public:
+ QmlCustomParserNode();
+ QmlCustomParserNode(const QmlCustomParserNode &);
+ QmlCustomParserNode &operator=(const QmlCustomParserNode &);
+ ~QmlCustomParserNode();
+
+ QByteArray name() const;
+
+ QList<QmlCustomParserProperty> properties() const;
+
+private:
+ friend class QmlCustomParserNodePrivate;
+ QmlCustomParserNodePrivate *d;
+};
+Q_DECLARE_METATYPE(QmlCustomParserNode);
+
class Q_DECLARATIVE_EXPORT QmlCustomParser
{
public:
virtual ~QmlCustomParser() {}
virtual QByteArray compile(QXmlStreamReader&, bool *ok)=0;
+ virtual QByteArray compile(const QList<QmlCustomParserProperty> &, bool *ok);
virtual QVariant create(const QByteArray &)=0;
+ virtual void setCustomData(QObject *, const QByteArray &);
struct Register {
Register(const char *name, QmlCustomParser *parser) {
@@ -76,7 +118,11 @@ public:
#define QML_DEFINE_CUSTOM_PARSER_NS(namespacestring, name, parserClass) \
template<> QmlCustomParser::Register QmlCustomParser::Define<parserClass>::instance(namespacestring "/" # name, new parserClass);
+#define QML_DEFINE_CUSTOM_TYPE(TYPE, NAME, CUSTOMTYPE) \
+ template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *>::instance(qmlRegisterCustomType<TYPE>(#NAME, #TYPE, new CUSTOMTYPE));
+
QT_END_NAMESPACE
QT_END_HEADER
+
#endif
diff --git a/src/declarative/qml/qmlcustomparser_p_p.h b/src/declarative/qml/qmlcustomparser_p_p.h
new file mode 100644
index 0000000..96e9b32
--- /dev/null
+++ b/src/declarative/qml/qmlcustomparser_p_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLCUSTOMPARSER_P_H
+#define QMLCUSTOMPARSER_P_H
+
+#include <QtCore/qglobal.h>
+#include "qmlcustomparser_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QmlParser
+{
+ class Object;
+ class Property;
+};
+
+class QmlCustomParserNodePrivate
+{
+public:
+ QByteArray name;
+ QList<QmlCustomParserProperty> properties;
+
+ static QmlCustomParserNode fromObject(QmlParser::Object *);
+ static QmlCustomParserProperty fromProperty(QmlParser::Property *);
+};
+
+class QmlCustomParserPropertyPrivate
+{
+public:
+ QmlCustomParserPropertyPrivate()
+ : isList(false) {}
+
+ QByteArray name;
+ bool isList;
+ QList<QVariant> values;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMLCUSTOMPARSER_P_H
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index 72c1c76..3942375 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -42,6 +42,7 @@
#include "qmldom.h"
#include "qmldom_p.h"
#include "private/qmlcompiler_p.h"
+#include "private/qmlengine_p.h"
#include "qmlcompiledcomponent_p.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qstring.h>
@@ -149,27 +150,38 @@ int QmlDomDocument::version() const
*/
bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
{
- d->error = QString();
+ Q_UNUSED(engine);
- QmlScriptParser parser;
- if (!parser.parse(data)) {
- d->error = parser.errorDescription();
- return false;
- }
+ d->errors.clear();
QmlCompiledComponent component;
QmlCompiler compiler;
- // ###
-// compiler.compile(engine, parser, &component);
+
+ QmlCompositeTypeData *td = ((QmlEnginePrivate *)QmlEnginePrivate::get(engine))->typeManager.getImmediate(data, QUrl());;
+
+ if(td->status == QmlCompositeTypeData::Error) {
+ d->errors = td->errors;
+ td->release();
+ return false;
+ } else if(td->status == QmlCompositeTypeData::Waiting) {
+ QmlError error;
+ error.setDescription(QLatin1String("QmlDomDocument supports local types only"));
+ d->errors << error;
+ td->release();
+ return false;
+ }
+
+ compiler.compile(engine, td, &component);
if (compiler.isError()) {
- d->error = compiler.errorDescription();
+ d->errors = compiler.errors();
+ td->release();
return false;
}
- if (parser.tree()) {
- component.dump(0, parser.tree());
- d->root = parser.tree();
+ if (td->data.tree()) {
+ component.dump(0, td->data.tree());
+ d->root = td->data.tree();
d->root->addref();
}
@@ -178,14 +190,14 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data)
/*!
- Returns the last load error. The load error will be reset after a
+ Returns the last load errors. The load errors will be reset after a
successful call to load().
\sa load()
*/
-QString QmlDomDocument::loadError() const
+QList<QmlError> QmlDomDocument::errors() const
{
- return d->error;
+ return d->errors;
}
/*!
@@ -204,11 +216,13 @@ QByteArray QmlDomDocument::save() const
document has no root.
In the sample QML below, the root object will be the QFxItem type.
- \code
- <Item>
- <Text text="Hello World" />
- </Item>
- \endcode
+ \qml
+Item {
+ Text {
+ text: "Hello World"
+ }
+}
+ \endqml
*/
QmlDomObject QmlDomDocument::rootObject() const
{
@@ -280,9 +294,13 @@ QmlDomProperty &QmlDomProperty::operator=(const QmlDomProperty &other)
/*!
Return the name of this property.
- \code
- <Text x="10" y="10" font.bold="true" />
- \endcode
+ \qml
+Text {
+ x: 10
+ y: 10
+ font.bold: true
+}
+ \endqml
As illustrated above, a property name can be a simple string, such as "x" or
"y", or a more complex "dot property", such as "font.bold". In both cases
@@ -302,9 +320,13 @@ QByteArray QmlDomProperty::propertyName() const
Return the name of this property, split into multiple parts in the case
of dot properties.
- \code
- <Text x="10" y="10" font.bold="true" />
- \endcode
+ \qml
+Text {
+ x: 10
+ y: 10
+ font.bold: true
+}
+ \endqml
For each of the properties shown above, this method would return ("x"),
("y") and ("font", "bold").
@@ -321,10 +343,10 @@ QList<QByteArray> QmlDomProperty::propertyNameParts() const
Return true if this property is used as a default property in the QML
document.
- \code
- <Text text="hello" />
- <Text>hello</Text>
- \endcode
+ \qml
+<Text text="hello"/>
+<Text>hello</Text>
+ \endqml
The above two examples return the same DOM tree, except that the second has
the default property flag set on the text property. Observe that whether
@@ -440,9 +462,12 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
Each QmlDomProperty represents a QML property assignment on the instantiated
object. For example,
- \code
- <QGraphicsWidget opacity="0.5" size="100x100" />
- \endcode
+ \qml
+QGraphicsWidget {
+ opacity: 0.5
+ size: "100x100"
+}
+ \endqml
describes a single QmlDomObject - "QGraphicsWidget" - with two properties,
"opacity" and "size". Obviously QGraphicsWidget has many more properties than just
@@ -509,9 +534,9 @@ bool QmlDomObject::isValid() const
Returns the type name of this object.
For example, the type of this object would be "QGraphicsWidget".
- \code
- <QGraphicsWidget />
- \endcode
+ \qml
+QGraphicsWidget { }
+ \endqml
*/
QByteArray QmlDomObject::objectType() const
{
@@ -524,9 +549,9 @@ QByteArray QmlDomObject::objectType() const
has been assigned.
For example, the object id of this object would be "MyText".
- \code
- <Text id="MyText" />
- \endcode
+ \qml
+Text { id: MyText }
+ \endqml
*/
QByteArray QmlDomObject::objectId() const
{
@@ -549,9 +574,12 @@ void QmlDomObject::setObjectId(const QByteArray &id)
Returns the list of assigned properties on this object.
In the following example, "text" and "x" properties would be returned.
- \code
- <Text text="Hello world!" x="100" />
- \endcode
+ \qml
+Text {
+ text: "Hello world!"
+ x: 100
+}
+ \endqml
*/
QList<QmlDomProperty> QmlDomObject::properties() const
{
@@ -586,12 +614,12 @@ QList<QmlDomProperty> QmlDomObject::properties() const
Returns the object's \a name property if a value has been assigned to
it, or an invalid QmlDomProperty otherwise.
- In the example below, \c {object.property("src")} would return a valid
+ In the example below, \c {object.property("source")} would return a valid
QmlDomProperty, and \c {object.property("tile")} an invalid QmlDomProperty.
- \code
- <Image src="sample.jpg" />
- \endcode
+ \qml
+Image { source: "sample.jpg" }
+ \endqml
*/
QmlDomProperty QmlDomObject::property(const QByteArray &name) const
{
@@ -714,9 +742,13 @@ QmlDomBasicValuePrivate::~QmlDomBasicValuePrivate()
example below, the "x", "y" and "color" properties are being assigned
literal values.
- \code
- <Rect x="10" y="10" color="red" />
- \endcode
+ \qml
+Rect {
+ x: 10
+ y: 10
+ color: "red"
+}
+ \endqml
*/
/*!
@@ -755,9 +787,9 @@ QmlDomValueLiteral &QmlDomValueLiteral::operator=(const QmlDomValueLiteral &othe
Return the literal value.
In the example below, the literal value will be the string "10".
- \code
- <Rect x="10" />
- \endcode
+ \qml
+Rect { x: 10 }
+ \endqml
*/
QString QmlDomValueLiteral::literal() const
{
@@ -781,15 +813,16 @@ void QmlDomValueLiteral::setLiteral(const QString &value)
A property binding is an ECMAScript expression assigned to a property. In
the example below, the "x" property is being assigned a property binding.
- \code
- <Rect x="{Other.x}" />
- \endcode
+ \qml
+Rect { x: Other.x }
+ \endqml
*/
/*!
Construct an empty QmlDomValueBinding.
*/
-QmlDomValueBinding::QmlDomValueBinding()
+QmlDomValueBinding::QmlDomValueBinding():
+ d(new QmlDomBasicValuePrivate)
{
}
@@ -821,9 +854,9 @@ QmlDomValueBinding &QmlDomValueBinding::operator=(const QmlDomValueBinding &othe
Return the binding expression.
In the example below, the string "Other.x" will be returned.
- \code
- <Rect x="{Other.x}" />
- \endcode
+ \qml
+Rect { x: Other.x }
+ \endqml
*/
QString QmlDomValueBinding::binding() const
{
@@ -851,19 +884,23 @@ void QmlDomValueBinding::setBinding(const QString &expression)
class. In the example below, the "x" property is being assigned the
NumericAnimation value source.
- \code
- <Rect>
- <x>
- <NumericAnimation from="0" to="100" repeat="true" running="true" />
- </x>
- </Rect>
- \endcode
+ \qml
+Rect {
+ x: NumericAnimation {
+ from: 0
+ to: 100
+ repeat: true
+ running: true
+ }
+}
+ \endqml
*/
/*!
Construct an empty QmlDomValueValueSource.
*/
-QmlDomValueValueSource::QmlDomValueValueSource()
+QmlDomValueValueSource::QmlDomValueValueSource():
+ d(new QmlDomBasicValuePrivate)
{
}
@@ -896,13 +933,16 @@ QmlDomValueValueSource &QmlDomValueValueSource::operator=(const QmlDomValueValue
In the example below, an object representing the NumericAnimation will be
returned.
- \code
- <Rect>
- <x>
- <NumericAnimation from="0" to="100" repeat="true" running="true" />
- </x>
- </Rect>
- \endcode
+ \qml
+Rect {
+ x: NumericAnimation {
+ from: 0
+ to: 100
+ repeat: true
+ running: true
+ }
+}
+ \endqml
*/
QmlDomObject QmlDomValueValueSource::object() const
{
@@ -911,7 +951,7 @@ QmlDomObject QmlDomValueValueSource::object() const
rv.d->object = d->value->object;
rv.d->object->addref();
}
- return QmlDomObject();
+ return rv;
}
/*!
@@ -956,9 +996,12 @@ QmlDomValuePrivate::~QmlDomValuePrivate()
For example, in the following example,
- \code
- <Text text="Hello World!" y="{Other.y}" />
- \endcode
+ \qml
+Text {
+ text: "Hello World!"
+ y: Other.y
+}
+ \endqml
The text property is being assigned a literal, and the y property a property
binding. To output the values assigned to the text and y properties in the
@@ -1197,24 +1240,27 @@ QmlDomList QmlDomValue::toList() const
Lists of values can be assigned to properties. For example, the following
example assigns multiple objects to Item's "children" property
- \code
- <Item>
- <children>
- <Text />
- <Rect />
- </children>
- </Item>
- \endcode
+ \qml
+Item {
+ children: [
+ Text { },
+ Rect { }
+ ]
+}
+ \endqml
Lists can also be implicitly created by assigning multiple
\l {QmlDomValueValueSource}{value sources} or constants to a property.
- \code
- <Item x="10">
- <x>
- <NumericAnimation running="false" from="0" to="100" />
- </x>
- </Item>
- \endcode
+ \qml
+Item {
+ x: 10
+ x: NumericAnimation {
+ running: false
+ from: 0
+ to: 100
+ }
+}
+ \endqml
*/
/*!
@@ -1285,13 +1331,16 @@ void QmlDomList::setValues(const QList<QmlDomValue> &values)
following example shows the definition of a sub-component with the id
"ListDelegate".
- \code
- <Item>
- <Component id="ListDelegate">
- <Text text="{modelData.text}" />
- </Component>
- </Item>
- \endcode
+ \qml
+Item {
+ Component {
+ id: ListDelegate
+ Text {
+ text: modelData.text
+ }
+ }
+}
+ \endqml
Like QmlDomDocument's, components contain a single root object.
*/
@@ -1331,13 +1380,16 @@ QmlDomComponent &QmlDomComponent::operator=(const QmlDomComponent &other)
Returns the component's root object.
In the example below, the root object is the "Text" object.
- \code
- <Item>
- <Component id="ListDelegate">
- <Text text="{modelData.text}" />
- </Component>
- </Item>
- \endcode
+ \qml
+Item {
+ Component {
+ id: ListDelegate
+ Text {
+ text: modelData.text
+ }
+ }
+}
+ \endqml
*/
QmlDomObject QmlDomComponent::componentRoot() const
{
diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h
index 47a89d9..74ed27c 100644
--- a/src/declarative/qml/qmldom.h
+++ b/src/declarative/qml/qmldom.h
@@ -44,6 +44,7 @@
#include <QtCore/qlist.h>
#include <QtCore/qshareddata.h>
+#include <QtDeclarative/qmlerror.h>
QT_BEGIN_HEADER
@@ -71,6 +72,7 @@ public:
int version() const;
+ QList<QmlError> errors() const;
QString loadError() const;
bool load(QmlEngine *, const QByteArray &);
QByteArray save() const;
diff --git a/src/declarative/qml/qmldom_p.h b/src/declarative/qml/qmldom_p.h
index 8ea56bf..4c3ca44 100644
--- a/src/declarative/qml/qmldom_p.h
+++ b/src/declarative/qml/qmldom_p.h
@@ -57,7 +57,7 @@ public:
QmlDomDocumentPrivate(const QmlDomDocumentPrivate &);
~QmlDomDocumentPrivate();
- QString error;
+ QList<QmlError> errors;
QmlParser::Object *root;
};
diff --git a/src/declarative/qml/qmlerror.cpp b/src/declarative/qml/qmlerror.cpp
new file mode 100644
index 0000000..66c834f
--- /dev/null
+++ b/src/declarative/qml/qmlerror.cpp
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmlerror.h"
+#include <QtCore/qdebug.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qstringlist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QmlErrorPrivate
+{
+public:
+ QmlErrorPrivate();
+
+ QUrl url;
+ QString description;
+ int line;
+ int column;
+};
+
+QmlErrorPrivate::QmlErrorPrivate()
+: line(-1), column(-1)
+{
+}
+
+QmlError::QmlError()
+: d(new QmlErrorPrivate)
+{
+}
+
+QmlError::QmlError(const QmlError &other)
+: d(new QmlErrorPrivate)
+{
+ *this = other;
+}
+
+QmlError &QmlError::operator=(const QmlError &other)
+{
+ d->url = other.d->url;
+ d->description = other.d->description;
+ d->line = other.d->line;
+ d->column = other.d->column;
+ return *this;
+}
+
+QmlError::~QmlError()
+{
+ delete d; d = 0;
+}
+
+QUrl QmlError::url() const
+{
+ return d->url;
+}
+
+void QmlError::setUrl(const QUrl &url)
+{
+ d->url = url;
+}
+
+QString QmlError::description() const
+{
+ return d->description;
+}
+
+void QmlError::setDescription(const QString &description)
+{
+ d->description = description;
+}
+
+int QmlError::line() const
+{
+ return d->line;
+}
+
+void QmlError::setLine(int line)
+{
+ d->line = line;
+}
+
+int QmlError::column() const
+{
+ return d->column;
+}
+
+void QmlError::setColumn(int column)
+{
+ d->column = column;
+}
+
+QDebug operator<<(QDebug debug, const QmlError &error)
+{
+ QUrl url = error.url();
+
+ QString output;
+
+ output = url.toString() + QLatin1String(":") +
+ QString::number(error.line());
+
+ if(error.column() != -1)
+ output += QLatin1String(":") + QString::number(error.column());
+
+ output += QLatin1String(": ") + error.description();
+
+ debug << qPrintable(output) << "\n";
+
+ if (error.line() > 0 && error.column() > 0 &&
+ url.scheme() == QLatin1String("file")) {
+ QString file = url.toLocalFile();
+ QFile f(file);
+ if (f.open(QIODevice::ReadOnly)) {
+ QByteArray data = f.readAll();
+ QTextStream stream(data, QIODevice::ReadOnly);
+ const QString code = stream.readAll();
+ const QStringList lines = code.split(QLatin1Char('\n'));
+
+ if (lines.count() >= error.line()) {
+ const QString &line = lines.at(error.line() - 1);
+ debug << qPrintable(line) << "\n";
+
+ int column = qMax(0, error.column() - 1);
+ column = qMin(column, line.length());
+
+ QByteArray ind;
+ ind.reserve(column);
+ for (int i = 0; i < column; ++i) {
+ const QChar ch = line.at(i);
+ if (ch.isSpace())
+ ind.append(ch.unicode());
+ else
+ ind.append(' ');
+ }
+ ind.append('^');
+ debug << ind.constData();
+ }
+ }
+ }
+ return debug;
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlerror.h b/src/declarative/qml/qmlerror.h
new file mode 100644
index 0000000..57d2f8f
--- /dev/null
+++ b/src/declarative/qml/qmlerror.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLERROR_H
+#define QMLERROR_H
+
+#include <QtCore/qurl.h>
+#include <QtCore/qstring.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDebug;
+class QmlErrorPrivate;
+class Q_DECLARATIVE_EXPORT QmlError
+{
+public:
+ QmlError();
+ QmlError(const QmlError &);
+ QmlError &operator=(const QmlError &);
+ ~QmlError();
+
+ QUrl url() const;
+ void setUrl(const QUrl &);
+ QString description() const;
+ void setDescription(const QString &);
+ int line() const;
+ void setLine(int);
+ int column() const;
+ void setColumn(int);
+private:
+ QmlErrorPrivate *d;
+};
+
+QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, const QmlError &error);
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QMLERROR_H
diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h
index 440b54a..922fc61 100644
--- a/src/declarative/qml/qmlinstruction_p.h
+++ b/src/declarative/qml/qmlinstruction_p.h
@@ -174,6 +174,7 @@ public:
} init;
struct {
int type;
+ int data;
} create;
struct {
int data;
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index 9b99917..63e5c58 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -57,7 +57,7 @@
#include <qvector.h>
#include <qlocale.h>
#include <QtCore/qcryptographichash.h>
-#include <qmlcustomparser.h>
+#include <private/qmlcustomparser_p.h>
QT_BEGIN_NAMESPACE
#ifdef QT_BOOTSTRAPPED
@@ -118,6 +118,7 @@ public:
QmlPrivate::CreateFunc m_extFunc;
const QMetaObject *m_extMetaObject;
int m_index;
+ QmlCustomParser *m_customParser;
mutable volatile bool m_isSetup:1;
mutable QList<QmlProxyMetaObject::ProxyData> m_metaObjects;
mutable QByteArray m_hash;
@@ -126,7 +127,8 @@ public:
QmlTypePrivate::QmlTypePrivate()
: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_qmlListId(0),
m_opFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0),
- m_parserStatusCast(-1), m_extFunc(0), m_extMetaObject(0), m_index(-1), m_isSetup(false)
+ m_parserStatusCast(-1), m_extFunc(0), m_extMetaObject(0), m_index(-1),
+ m_customParser(0), m_isSetup(false)
{
}
@@ -150,7 +152,8 @@ QmlType::QmlType(int type, int listType, int qmlListType,
const QMetaObject *metaObject,
QmlAttachedPropertiesFunc attachedPropertiesFunc,
int parserStatusCast, QmlPrivate::CreateFunc extFunc,
- const QMetaObject *extMetaObject, int index)
+ const QMetaObject *extMetaObject, int index,
+ QmlCustomParser *customParser)
: d(new QmlTypePrivate)
{
d->m_name = qmlName;
@@ -163,6 +166,7 @@ QmlType::QmlType(int type, int listType, int qmlListType,
d->m_parserStatusCast = parserStatusCast;
d->m_extFunc = extFunc;
d->m_index = index;
+ d->m_customParser = customParser;
if (extMetaObject)
d->m_extMetaObject = extMetaObject;
@@ -272,6 +276,11 @@ QObject *QmlType::create() const
return rv;
}
+QmlCustomParser *QmlType::customParser() const
+{
+ return d->m_customParser;
+}
+
bool QmlType::isInterface() const
{
return d->m_isInterface;
@@ -396,7 +405,7 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
return index;
}
-int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func, const char *cname, const QMetaObject *mo, QmlAttachedPropertiesFunc attach, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo)
+int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func, const char *cname, const QMetaObject *mo, QmlAttachedPropertiesFunc attach, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser)
{
Q_UNUSED(object);
QWriteLocker lock(metaTypeDataLock());
@@ -414,7 +423,7 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
QmlType *type = new QmlType(id.typeId, id.listId, id.qmlListId,
func, cname, mo, attach, pStatus, extFunc,
- extmo, index);
+ extmo, index, parser);
data->types.append(type);
data->idToType.insert(type->typeId(), type);
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index 83fb60b..99f8e93 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -59,7 +59,7 @@ class QmlCustomParser;
class Q_DECLARATIVE_EXPORT QmlMetaType
{
public:
- static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo);
+ static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int pStatus, int object, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *);
static int registerInterface(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *);
static void registerCustomParser(const char *, QmlCustomParser *);
@@ -121,6 +121,8 @@ public:
QObject *create() const;
+ QmlCustomParser *customParser() const;
+
bool isInterface() const;
int typeId() const;
int qListTypeId() const;
@@ -145,7 +147,7 @@ private:
friend class QmlMetaType;
friend class QmlTypePrivate;
QmlType(int, int, int, QmlPrivate::Func, const char *, int);
- QmlType(int, int, int, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int, QmlPrivate::CreateFunc, const QMetaObject *, int);
+ QmlType(int, int, int, QmlPrivate::Func, const char *, const QMetaObject *, QmlAttachedPropertiesFunc, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
~QmlType();
QmlTypePrivate *d;
@@ -166,7 +168,7 @@ int qmlRegisterType(const char *typeName)
QmlPrivate::attachedPropertiesFunc<T>(),
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- 0, 0);
+ 0, 0, 0);
}
template<typename T>
@@ -184,7 +186,7 @@ int qmlRegisterType(const char *qmlName, const char *typeName)
QmlPrivate::attachedPropertiesFunc<T>(),
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- 0, 0);
+ 0, 0, 0);
}
template<typename T, typename E>
@@ -206,7 +208,7 @@ int qmlRegisterExtendedType(const char *typeName)
&T::staticMetaObject, attached,
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- &QmlPrivate::CreateParent<E>::create, &E::staticMetaObject);
+ &QmlPrivate::CreateParent<E>::create, &E::staticMetaObject, 0);
}
template<typename T, typename E>
@@ -231,7 +233,7 @@ int qmlRegisterExtendedType(const char *qmlName, const char *typeName)
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
&QmlPrivate::CreateParent<E>::create,
- &E::staticMetaObject);
+ &E::staticMetaObject, 0);
}
template<typename T>
@@ -249,6 +251,24 @@ int qmlRegisterInterface(const char *typeName)
qobject_interface_iid<T *>());
}
+template<typename T>
+int qmlRegisterCustomType(const char *qmlName, const char *typeName, QmlCustomParser *parser)
+{
+ QByteArray name(typeName);
+ QmlPrivate::MetaTypeIds ids = {
+ qRegisterMetaType<T *>(QByteArray(name + "*").constData()),
+ qRegisterMetaType<T *>(QByteArray("QList<" + name + "*>*").constData()),
+ qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
+ };
+
+ return QmlMetaType::registerType(ids, QmlPrivate::list_op<T>, qmlName,
+ &T::staticMetaObject,
+ QmlPrivate::attachedPropertiesFunc<T>(),
+ QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
+ QmlPrivate::StaticCastSelector<T,QObject>::cast(),
+ 0, 0, parser);
+}
+
void qmlRegisterCustomParser(const char *qmlName, QmlCustomParser *);
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index ecb6f0b..87c8434 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
using namespace QmlParser;
QmlParser::Object::Object()
-: type(-1), metatype(0), extObject(0), defaultProperty(0), line(-1),
+: type(-1), metatype(0), extObject(0), defaultProperty(0), line(-1), column(-1),
dynamicPropertiesProperty(0), dynamicSignalsProperty(0)
{
}
@@ -127,12 +127,12 @@ QmlParser::Object::DynamicSignal::DynamicSignal(const DynamicSignal &o)
}
QmlParser::Property::Property()
-: type(0), index(-1), value(0), isDefault(true), line(-1)
+: type(0), index(-1), value(0), isDefault(true), line(-1), column(-1)
{
}
QmlParser::Property::Property(const QByteArray &n)
-: type(0), index(-1), value(0), name(n), isDefault(false), line(-1)
+: type(0), index(-1), value(0), name(n), isDefault(false), line(-1), column(-1)
{
}
@@ -161,7 +161,7 @@ void QmlParser::Property::addValue(Value *v)
}
QmlParser::Value::Value()
-: type(Unknown), object(0), line(-1)
+: type(Unknown), object(0), line(-1), column(-1)
{
}
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index e29cdbf..17b367d6 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -103,6 +103,7 @@ namespace QmlParser
QHash<QByteArray, Property *> properties;
qint64 line;
+ qint64 column;
struct DynamicProperty {
DynamicProperty();
@@ -167,6 +168,7 @@ namespace QmlParser
Object *object;
qint64 line;
+ qint64 column;
};
class Property : public QmlRefCount
@@ -197,6 +199,7 @@ namespace QmlParser
bool isDefault;
qint64 line;
+ qint64 column;
};
}
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index 317a3bf..618eb2e 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -65,10 +65,12 @@ protected:
Object *defineObjectBinding(int line,
AST::UiQualifiedId *propertyName,
const QString &objectType,
+ AST::SourceLocation typeLocation,
AST::UiObjectInitializer *initializer = 0);
Object *defineObjectBinding_helper(int line,
AST::UiQualifiedId *propertyName,
const QString &objectType,
+ AST::SourceLocation typeLocation,
AST::UiObjectInitializer *initializer = 0);
QString getPrimitive(const QByteArray &propertyName, AST::ExpressionNode *expr);
void defineProperty(const QString &propertyName, int line, const QString &primitive);
@@ -194,11 +196,17 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const
Object *ProcessAST::defineObjectBinding_helper(int line,
AST::UiQualifiedId *propertyName,
const QString &objectType,
+ AST::SourceLocation typeLocation,
AST::UiObjectInitializer *initializer)
{
bool isType = !objectType.isEmpty() && objectType.at(0).isUpper() && !objectType.contains(QLatin1Char('.'));
+
if (!isType) {
- qWarning() << "bad name for a class"; // ### FIXME
+ QmlError error;
+ error.setDescription("Expected type name");
+ error.setLine(typeLocation.startLine);
+ error.setColumn(typeLocation.startColumn);
+ _parser->_errors << error;
return false;
}
@@ -235,7 +243,7 @@ Object *ProcessAST::defineObjectBinding_helper(int line,
if (!_parser->scriptFile().isEmpty()) {
_stateStack.pushObject(obj);
- Object *scriptObject= defineObjectBinding(line, 0, QLatin1String("Script"));
+ Object *scriptObject= defineObjectBinding(line, 0, QLatin1String("Script"), AST::SourceLocation());
_stateStack.pushObject(scriptObject);
defineProperty(QLatin1String("src"), line, _parser->scriptFile());
_stateStack.pop(); // scriptObject
@@ -264,11 +272,12 @@ Object *ProcessAST::defineObjectBinding_helper(int line,
Object *ProcessAST::defineObjectBinding(int line,
AST::UiQualifiedId *qualifiedId,
const QString &objectType,
+ AST::SourceLocation typeLocation,
AST::UiObjectInitializer *initializer)
{
if (objectType == QLatin1String("Connection")) {
- Object *obj = defineObjectBinding_helper(line, 0, QLatin1String("Connection"));
+ Object *obj = defineObjectBinding_helper(line, 0, objectType, typeLocation);
_stateStack.pushObject(obj);
@@ -297,7 +306,7 @@ Object *ProcessAST::defineObjectBinding(int line,
return obj;
}
- return defineObjectBinding_helper(line, qualifiedId, objectType, initializer);
+ return defineObjectBinding_helper(line, qualifiedId, objectType, typeLocation, initializer);
}
void ProcessAST::defineProperty(const QString &propertyName, int line, const QString &primitive)
@@ -326,52 +335,76 @@ bool ProcessAST::visit(AST::UiImport *node)
return false;
}
+// UiObjectMember: T_PUBLIC T_DEFAULT UiMemberType T_IDENTIFIER T_COLON Expression
+// UiObjectMember: T_PUBLIC T_DEFAULT UiMemberType T_IDENTIFIER
// UiObjectMember: T_PUBLIC UiMemberType T_IDENTIFIER T_COLON Expression
// UiObjectMember: T_PUBLIC UiMemberType T_IDENTIFIER
//
// UiMemberType: "property" | "signal"
bool ProcessAST::visit(AST::UiPublicMember *node)
{
- const QString memberType = node->memberType->asString();
- const QString name = node->name->asString();
-
- if (memberType == QLatin1String("property")) {
- _stateStack.pushProperty(QLatin1String("properties"), node->publicToken.startLine);
-
- Object *obj = defineObjectBinding(node->identifierToken.startLine,
- 0,
- QLatin1String("Property"));
-
- _stateStack.pushObject(obj);
+ if(node->type == AST::UiPublicMember::Signal) {
+ const QString name = node->name->asString();
- defineProperty(QLatin1String("name"), node->identifierToken.startLine, name);
- if (node->expression) // default value
- defineProperty(QLatin1String("value"), node->identifierToken.startLine, getPrimitive("value", node->expression));
+ Object::DynamicSignal signal;
+ signal.name = name.toUtf8();
- _stateStack.pop(); // object
- _stateStack.pop(); // properties
-
- } else if (memberType == QLatin1String("signal")) {
- _stateStack.pushProperty(QLatin1String("signals"), node->publicToken.startLine);
-
- Object *obj = defineObjectBinding(node->identifierToken.startLine,
- 0,
- QLatin1String("Signal"));
+ _stateStack.top().object->dynamicSignals << signal;
+ } else {
+ const QString memberType = node->memberType->asString();
+ const QString name = node->name->asString();
+
+ const struct TypeNameToType {
+ const char *name;
+ Object::DynamicProperty::Type type;
+ } propTypeNameToTypes[] = {
+ { "int", Object::DynamicProperty::Int },
+ { "bool", Object::DynamicProperty::Bool },
+ { "double", Object::DynamicProperty::Real },
+ { "real", Object::DynamicProperty::Real },
+ { "string", Object::DynamicProperty::String },
+ { "color", Object::DynamicProperty::Color },
+ { "date", Object::DynamicProperty::Date },
+ { "var", Object::DynamicProperty::Variant },
+ { "variant", Object::DynamicProperty::Variant }
+ };
+ const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) /
+ sizeof(propTypeNameToTypes[0]);
+
+ bool typeFound = false;
+ Object::DynamicProperty::Type type;
+ for(int ii = 0; !typeFound && ii < propTypeNameToTypesCount; ++ii) {
+ if(QLatin1String(propTypeNameToTypes[ii].name) == memberType) {
+ type = propTypeNameToTypes[ii].type;
+ typeFound = true;
+ }
+ }
+
+ if(!typeFound) {
+ QmlError error;
+ error.setDescription("Expected property type");
+ error.setLine(node->typeToken.startLine);
+ error.setColumn(node->typeToken.startColumn);
+ _parser->_errors << error;
+ return false;
+ }
- _stateStack.pushObject(obj);
+ Object::DynamicProperty property;
+ property.isDefaultProperty = node->isDefaultMember;
+ property.type = type;
+ property.name = name.toUtf8();
- defineProperty(QLatin1String("name"), node->identifierToken.startLine, name);
+ if (node->expression) { // default value
+ property.defaultValue = new Property;
+ Value *value = new Value;
+ value->primitive = getPrimitive("value", node->expression);
+ property.defaultValue->values << value;
+ }
- _stateStack.pop(); // object
- _stateStack.pop(); // signals
- } else {
- qWarning() << "bad public identifier" << memberType; // ### FIXME
+ _stateStack.top().object->dynamicProperties << property;
}
-
- // ### TODO drop initializer (unless some example needs differnet properties than name and type and value.
-
- return false;
+ return true;
}
@@ -382,6 +415,7 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node)
defineObjectBinding(node->identifierToken.startLine,
0,
node->name->asString(),
+ node->identifierToken,
node->initializer);
return false;
@@ -394,6 +428,7 @@ bool ProcessAST::visit(AST::UiObjectBinding *node)
defineObjectBinding(node->identifierToken.startLine,
node->qualifiedId,
node->name->asString(),
+ node->identifierToken,
node->initializer);
return false;
@@ -456,7 +491,8 @@ bool ProcessAST::visit(AST::UiScriptBinding *node)
Value *v = new Value;
v->primitive = primitive;
- v->line = node->colonToken.startLine;
+ v->line = node->statement->firstSourceLocation().startLine;
+ v->column = node->statement->firstSourceLocation().startColumn;
prop->addValue(v);
while (propertyCount--)
@@ -515,7 +551,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
QmlScriptParser::QmlScriptParser()
- : root(0), _errorLine(-1)
+: root(0)
{
}
@@ -536,13 +572,18 @@ bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url)
return true;
}
- _error = xmlParser.errorDescription();
- _errorLine = 0; // ### FIXME
+ QmlError error;
+ error.setUrl(url);
+ error.setDescription(xmlParser.errorDescription());
+ _errors << error;
+
return false;
}
const QString fileName = url.toString();
- const QString code = QString::fromUtf8(data); // ### FIXME
+
+ QTextStream stream(data, QIODevice::ReadOnly);
+ const QString code = stream.readAll();
JavaScriptParser parser;
JavaScriptEnginePrivate driver;
@@ -554,26 +595,34 @@ bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url)
lexer.setCode(code, /*line = */ 1);
driver.setLexer(&lexer);
- if (! parser.parse(&driver)) {
- _error = parser.errorMessage();
- _errorLine = parser.errorLineNumber();
- return false;
- }
+ if (! parser.parse(&driver) || !_errors.isEmpty()) {
- ProcessAST process(this);
- process(code, parser.ast());
+ // Extract errors from the parser
+ foreach (const JavaScriptParser::DiagnosticMessage &m, parser.diagnosticMessages()) {
- return true;
-}
+ if (m.isWarning())
+ continue;
-QString QmlScriptParser::errorDescription() const
-{
- return _error;
-}
+ QmlError error;
+ error.setUrl(url);
+ error.setDescription(m.message);
+ error.setLine(m.line);
+ error.setColumn(m.column);
+ _errors << error;
-int QmlScriptParser::errorLine() const
-{
- return _errorLine;
+ }
+ }
+
+ if (_errors.isEmpty()) {
+ ProcessAST process(this);
+ process(code, parser.ast());
+
+ // Set the url for process errors
+ for(int ii = 0; ii < _errors.count(); ++ii)
+ _errors[ii].setUrl(url);
+ }
+
+ return _errors.isEmpty();
}
QMap<QString,QString> QmlScriptParser::nameSpacePaths() const
@@ -591,6 +640,11 @@ Object *QmlScriptParser::tree() const
return root;
}
+QList<QmlError> QmlScriptParser::errors() const
+{
+ return _errors;
+}
+
void QmlScriptParser::clear()
{
if (root) {
@@ -599,9 +653,8 @@ void QmlScriptParser::clear()
}
_nameSpacePaths.clear();
_typeNames.clear();
- _error.clear();
+ _errors.clear();
_scriptFile.clear();
- _errorLine = 0;
}
int QmlScriptParser::findOrCreateTypeId(const QString &name)
diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h
index 0d89268..4155bba 100644
--- a/src/declarative/qml/qmlscriptparser_p.h
+++ b/src/declarative/qml/qmlscriptparser_p.h
@@ -3,6 +3,7 @@
#include <QtCore/QList>
#include <QtCore/QUrl>
+#include <QtDeclarative/qmlerror.h>
#include <qml.h>
QT_BEGIN_HEADER
@@ -23,8 +24,6 @@ public:
~QmlScriptParser();
bool parse(const QByteArray &data, const QUrl &url = QUrl());
- QString errorDescription() const;
- int errorLine() const;
QMap<QString,QString> nameSpacePaths() const;
QStringList types() const;
@@ -33,6 +32,8 @@ public:
void clear();
+ QList<QmlError> errors() const;
+
// ### private:
int findOrCreateTypeId(const QString &name);
void setTree(QmlParser::Object *tree);
@@ -42,12 +43,12 @@ public:
void addNamespacePath(const QString &path);
-private:
+// ### private:
+ QList<QmlError> _errors;
+
QMap<QString,QString> _nameSpacePaths;
QmlParser::Object *root;
QStringList _typeNames;
- QString _error;
- int _errorLine;
QString _scriptFile;
};
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 253e9a7..a3bfd62 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -45,7 +45,7 @@
#include <private/qmlstringconverters_p.h>
#include "private/qmetaobjectbuilder_p.h"
#include <qml.h>
-#include <qmlcustomparser.h>
+#include <private/qmlcustomparser_p.h>
#include <qperformancelog.h>
#include <QStack>
#include <private/qmlcompiledcomponent_p.h>
@@ -176,9 +176,14 @@ QmlVME::QmlVME()
#define VME_EXCEPTION(desc) \
{ \
- exceptionLine = instr.line; \
- QDebug d(&exceptionDescription); \
- d << desc; \
+ QString str; \
+ QDebug d(&str); \
+ d << desc; \
+ QmlError error; \
+ error.setDescription(str); \
+ error.setLine(instr.line); \
+ error.setUrl(comp->url); \
+ vmeErrors << error; \
break; \
}
@@ -224,6 +229,8 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QStack<QmlMetaProperty> pushedProperties;
QObject **savedObjects = 0;
+ vmeErrors.clear();
+
if (start == -1) start = 0;
if (count == -1) count = comp->bytecode.count();
@@ -257,6 +264,11 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
if (!o)
VME_EXCEPTION("Unable to create object of type" << types.at(instr.create.type).className);
+ if (instr.create.data != -1) {
+ QmlCustomParser *customParser =
+ types.at(instr.create.type).type->customParser();
+ customParser->setCustomData(o, datas.at(instr.create.data));
+ }
if (!stack.isEmpty()) {
QObject *parent = stack.top();
o->setParent(parent);
@@ -1067,17 +1079,12 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
bool QmlVME::isError() const
{
- return exceptionLine != -1;
-}
-
-qint64 QmlVME::errorLine() const
-{
- return exceptionLine;
+ return !vmeErrors.isEmpty();
}
-QString QmlVME::errorDescription() const
+QList<QmlError> QmlVME::errors() const
{
- return exceptionDescription;
+ return vmeErrors;
}
void QmlVME::runStoreInstruction(QStack<QObject *> &stack,
diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qmlvme_p.h
index 2a3be06..86cd040 100644
--- a/src/declarative/qml/qmlvme_p.h
+++ b/src/declarative/qml/qmlvme_p.h
@@ -44,6 +44,7 @@
#include <QString>
#include <QStack>
+#include <qmlerror.h>
class QObject;
QT_BEGIN_NAMESPACE
@@ -60,13 +61,13 @@ public:
QObject *run(QmlContext *, QmlCompiledComponent *, int start = -1, int end = -1);
bool isError() const;
- qint64 errorLine() const;
- QString errorDescription() const;
+ QList<QmlError> errors() const;
private:
void runStoreInstruction(QStack<QObject *> &stack,
QmlInstruction &, QmlCompiledData *);
+ QList<QmlError> vmeErrors;
qint64 exceptionLine;
QString exceptionDescription;
};
diff --git a/src/declarative/qml/qmlxmlparser.cpp b/src/declarative/qml/qmlxmlparser.cpp
index b3565a0..35d2c0e 100644
--- a/src/declarative/qml/qmlxmlparser.cpp
+++ b/src/declarative/qml/qmlxmlparser.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qmlxmlparser_p.h"
-#include "qmlcustomparser.h"
+#include "qmlcustomparser_p.h"
#include <qfxperf.h>
#include <QXmlStreamReader>
#include <QStack>
diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp
index 8b38e08..603e6ba 100644
--- a/src/declarative/qml/script/qmlbasicscript.cpp
+++ b/src/declarative/qml/script/qmlbasicscript.cpp
@@ -252,6 +252,7 @@ struct QmlBasicScriptCompiler
};
/*!
+ \internal
\class QmlBasicScript
\brief The QmlBasicScript class provides a fast implementation of a limited subset of JavaScript bindings.
diff --git a/src/declarative/test/qfxtestview.cpp b/src/declarative/test/qfxtestview.cpp
index 67b6c15..94bcb30 100644
--- a/src/declarative/test/qfxtestview.cpp
+++ b/src/declarative/test/qfxtestview.cpp
@@ -59,8 +59,8 @@ QFxTestView::QFxTestView(const QString &filename, const QString &testdir)
QFile file(filename);
file.open(QFile::ReadOnly);
- QString xml = QString::fromUtf8(file.readAll());
- setXml(xml, filename);
+ QString qml = QString::fromUtf8(file.readAll());
+ setQml(qml, filename);
execute();
}
diff --git a/src/declarative/timeline/qmltimeline.cpp b/src/declarative/timeline/qmltimeline.cpp
index b9f79ac..dcc8745 100644
--- a/src/declarative/timeline/qmltimeline.cpp
+++ b/src/declarative/timeline/qmltimeline.cpp
@@ -51,10 +51,6 @@
QT_BEGIN_NAMESPACE
-//
-// Timeline stuff
-//
-
struct Update {
Update(QmlTimeLineValue *_g, qreal _v)
: g(_g), v(_v) {}
@@ -561,7 +557,7 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
}
}
-/*!
+/*
Synchronize all currently and future scheduled values in this timeline to
the longest action currently scheduled.
@@ -868,9 +864,10 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
}
/*!
+ \internal
\class QmlTimeLineValue
\ingroup group_animation
- \brief The QmlTimeLineValue class is modified by QmlTimeLine.
+ \brief The QmlTimeLineValue class provides a value that can be modified by QmlTimeLine.
*/
/*!
diff --git a/src/declarative/util/qbindablemap.cpp b/src/declarative/util/qbindablemap.cpp
index 341dd31..c8c8ced 100644
--- a/src/declarative/util/qbindablemap.cpp
+++ b/src/declarative/util/qbindablemap.cpp
@@ -87,8 +87,8 @@ private:
Then, in QML:
\code
- <Text text="{owner.name}"/>
- <Text text="{owner.phone}"/>
+ Text { text: owner.name }
+ Text { text: owner.phone }
\endcode
The binding is dynamic - whenever a key's value is updated, anything bound to that
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp
index e285890..f71b87e 100644
--- a/src/declarative/util/qfxview.cpp
+++ b/src/declarative/util/qfxview.cpp
@@ -49,6 +49,7 @@
#include "qicon.h"
#include "qurl.h"
#include "qboxlayout.h"
+#include "qbasictimer.h"
#include "qmlbindablevalue.h"
#include "qml.h"
@@ -96,10 +97,12 @@ public:
QFxItem *root;
QUrl source;
- QString xml;
+ QString qml;
QmlEngine engine;
QmlComponent *component;
+ QBasicTimer resizetimer;
+
void init();
};
@@ -110,20 +113,15 @@ public:
QFxView currently provides a minimal interface for displaying QML
files, and connecting between QML and C++ Qt objects.
- Typcial usage:
+ Typical usage:
\code
...
QFxView *view = new QFxView(this);
vbox->addWidget(view);
- QFile file(fileName);
- file.open(QFile::ReadOnly);
- QString xml = file.readAll();
- view->setXml(xml, fileName);
-
- QFileInfo fi(file);
- view->setPath(fi.path());
-
+ QUrl url(fileName);
+ view->setUrl(url);
+ ...
view->execute();
...
\endcode
@@ -142,7 +140,7 @@ QFxView::QFxView(QWidget *parent)
/*!
\fn QFxView::QFxView(QSimpleCanvas::CanvasMode mode, QWidget *parent)
-
+ \internal
Constructs a QFxView with the given \a parent. The canvas
\a mode can be QSimpleCanvas::GraphicsView or
QSimpleCanvas::SimpleCanvas.
@@ -170,8 +168,8 @@ void QFxViewPrivate::init()
}
/*!
- The destructor clears the instance and deletes the internal
- representation.
+ The destructor clears the view's \l {QFxItem} {items} and
+ deletes the internal representation.
\sa clearItems()
*/
@@ -182,54 +180,63 @@ QFxView::~QFxView()
}
/*!
- Sets the source to the \a url. The XML string is set to
+ Sets the source to the \a url. The QML string is set to
empty.
*/
void QFxView::setUrl(const QUrl& url)
{
d->source = url;
- d->xml = QString();
+ d->qml = QString();
}
/*!
Sets the source to the URL from the \a filename, and sets
- the XML string to \a xml.
+ the QML string to \a qml.
*/
-void QFxView::setXml(const QString &xml, const QString &filename)
+void QFxView::setQml(const QString &qml, const QString &filename)
{
d->source = QUrl::fromLocalFile(filename);
- d->xml = xml;
+ d->qml = qml;
}
/*!
- Returns the XML string.
+ Returns the QML string.
*/
-QString QFxView::xml() const
+QString QFxView::qml() const
{
- return d->xml;
+ return d->qml;
}
/*!
- Returns a pointer to the QmlEngine.
+ Returns a pointer to the QmlEngine used for instantiating
+ QML Components.
*/
QmlEngine* QFxView::engine()
{
return &d->engine;
}
+/*!
+ This function returns the root of the context hierarchy. Each QML
+ component is instantiated in a QmlContext. QmlContext's are
+ essential for passing data to QML components. In QML, contexts are
+ arranged hierarchically and this hierarchy is managed by the
+ QmlEngine.
+ */
QmlContext* QFxView::rootContext()
{
return d->engine.rootContext();
}
+/*!
+ Displays the Qt Declarative user interface.
+*/
void QFxView::execute()
{
- rootContext()->activate();
-
- if (d->xml.isEmpty()) {
+ if (d->qml.isEmpty()) {
d->component = new QmlComponent(&d->engine, d->source, this);
} else {
- d->component = new QmlComponent(&d->engine, d->xml.toUtf8(), d->source);
+ d->component = new QmlComponent(&d->engine, d->qml.toUtf8(), d->source);
}
if (!d->component->isLoading()) {
@@ -239,6 +246,48 @@ void QFxView::execute()
}
}
+/*!
+ \internal
+*/
+void QFxView::printErrorLine(const QmlError &error)
+{
+ QUrl url = error.url();
+ if (error.line() > 0 && error.column() > 0 &&
+ url.scheme() == QLatin1String("file")) {
+ QString file = url.toLocalFile();
+ QFile f(file);
+ if (f.open(QIODevice::ReadOnly)) {
+ QByteArray data = f.readAll();
+ QTextStream stream(data, QIODevice::ReadOnly);
+ const QString code = stream.readAll();
+ const QStringList lines = code.split(QLatin1Char('\n'));
+
+ if (lines.count() >= error.line()) {
+ const QString &line = lines.at(error.line() - 1);
+ qWarning() << qPrintable(line);
+
+ int column = qMax(0, error.column() - 1);
+ column = qMin(column, line.length());
+
+ QByteArray ind;
+ ind.reserve(column);
+ for (int i = 0; i < column; ++i) {
+ const QChar ch = line.at(i);
+ if (ch.isSpace())
+ ind.append(ch.unicode());
+ else
+ ind.append(' ');
+ }
+ ind.append('^');
+ qWarning() << ind.constData();
+ }
+ }
+ }
+}
+
+/*!
+ \internal
+ */
void QFxView::continueExecute()
{
disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
@@ -248,8 +297,26 @@ void QFxView::continueExecute()
return;
}
+ if(d->component->isError()) {
+ QList<QmlError> errors = d->component->errors();
+ foreach (const QmlError &error, errors) {
+ qWarning() << error;
+ }
+
+ return;
+ }
+
QObject *obj = d->component->create();
- rootContext()->deactivate();
+
+ if(d->component->isError()) {
+ QList<QmlError> errors = d->component->errors();
+ foreach (const QmlError &error, errors) {
+ qWarning() << error;
+ }
+
+ return;
+ }
+
if (obj) {
if (QFxItem *item = qobject_cast<QFxItem *>(obj)) {
item->QSimpleCanvasItem::setParent(QSimpleCanvas::root());
@@ -262,7 +329,7 @@ void QFxView::continueExecute()
d->root = item;
connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
- sizeChanged();
+ emit sceneResized(QSize(d->root->width(),d->root->height()));
} else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
window()->setAttribute(Qt::WA_NoSystemBackground, false);
@@ -280,19 +347,63 @@ void QFxView::continueExecute()
}
}
+/*! \fn void QFxView::sceneResized(QSize size)
+ This signal is emitted when the view is resized.
+ */
+
+/*!
+ \internal
+ */
void QFxView::sizeChanged()
{
- if (d->root)
- emit sceneResized(QSize(d->root->width(),d->root->height()));
+ // delay, so we catch both width and height changing.
+ d->resizetimer.start(0,this);
}
-QFxItem* QFxView::addItem(const QString &xml, QFxItem* parent)
+/*!
+ If the \l {QTimerEvent} {timer event} \a e is this
+ view's resize timer, sceneResized() is emitted.
+ */
+void QFxView::timerEvent(QTimerEvent* e)
+{
+ if (e->timerId() == d->resizetimer.timerId()) {
+ if (d->root)
+ emit sceneResized(QSize(d->root->width(),d->root->height()));
+ d->resizetimer.stop();
+ }
+}
+
+/*!
+ Creates a \l{QmlComponent} {component} from the \a qml
+ string, and returns it as an \l {QFxItem} {item}. If the
+ \a parent item is provided, it becomes the new item's
+ parent. \a parent should be in this view's item hierarchy.
+ */
+QFxItem* QFxView::addItem(const QString &qml, QFxItem* parent)
{
if (!d->root)
return 0;
- QmlComponent component(&d->engine, xml.toUtf8(), QUrl());
+ QmlComponent component(&d->engine, qml.toUtf8(), QUrl());
+ if(d->component->isError()) {
+ QList<QmlError> errors = d->component->errors();
+ foreach (const QmlError &error, errors) {
+ qWarning() << error;
+ }
+
+ return 0;
+ }
+
QObject *obj = component.create();
+ if(d->component->isError()) {
+ QList<QmlError> errors = d->component->errors();
+ foreach (const QmlError &error, errors) {
+ qWarning() << error;
+ }
+
+ return 0;
+ }
+
if (obj){
QFxItem *item = static_cast<QFxItem *>(obj);
if (!parent)
@@ -304,12 +415,19 @@ QFxItem* QFxView::addItem(const QString &xml, QFxItem* parent)
return 0;
}
+/*!
+ Deletes the view's \l {QFxItem} {items} and the \l {QmlEngine}
+ {QML engine's} Component cache.
+ */
void QFxView::reset()
{
clearItems();
d->engine.clearComponentCache();
}
+/*!
+ Deletes the view's \l {QFxItem} {items}.
+ */
void QFxView::clearItems()
{
if (!d->root)
@@ -318,11 +436,18 @@ void QFxView::clearItems()
d->root = 0;
}
+/*!
+ Returns the view's root \l {QFxItem} {item}.
+ */
QFxItem *QFxView::root() const
{
return d->root;
}
+/*!
+ This function handles the \l {QResizeEvent} {resize event}
+ \a e.
+ */
void QFxView::resizeEvent(QResizeEvent *e)
{
if (d->root) {
@@ -332,17 +457,26 @@ void QFxView::resizeEvent(QResizeEvent *e)
QSimpleCanvas::resizeEvent(e);
}
+/*! \fn void QFxView::focusInEvent(QFocusEvent *e)
+ This virtual function does nothing in this class.
+ */
void QFxView::focusInEvent(QFocusEvent *)
{
// Do nothing (do not call QWidget::update())
}
+
+/*! \fn void QFxView::focusOutEvent(QFocusEvent *e)
+ This virtual function does nothing in this class.
+ */
void QFxView::focusOutEvent(QFocusEvent *)
{
// Do nothing (do not call QWidget::update())
}
-
+/*!
+ \internal
+ */
void QFxView::dumpRoot()
{
root()->dump();
diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h
index 3c4be20..f575f27 100644
--- a/src/declarative/util/qfxview.h
+++ b/src/declarative/util/qfxview.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef _QFXVIEW_H_
-#define _QFXVIEW_H_
+#ifndef QFXVIEW_H
+#define QFXVIEW_H
#include <qfxglobal.h>
#include <QtCore/qdatetime.h>
@@ -48,16 +48,16 @@
#include <QtGui/qwidget.h>
#include <qsimplecanvas.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+
class QFxItem;
class QmlEngine;
class QmlContext;
-class Canvas;
+class QmlError;
class QFxViewPrivate;
class Q_DECLARATIVE_EXPORT QFxView : public QSimpleCanvas
@@ -70,20 +70,21 @@ public:
virtual ~QFxView();
void setUrl(const QUrl&);
- void setXml(const QString &xml, const QString &filename=QString());
- QString xml() const;
+ void setQml(const QString &qml, const QString &filename=QString());
+ QString qml() const;
QmlEngine* engine();
QmlContext* rootContext();
virtual void execute();
virtual void reset();
- virtual QFxItem* addItem(const QString &xml, QFxItem* parent=0);
+ virtual QFxItem* addItem(const QString &qml, QFxItem* parent=0);
virtual void clearItems();
virtual QFxItem *root() const;
void dumpRoot();
+ static void printErrorLine(const QmlError &);
Q_SIGNALS:
void sceneResized(QSize size);
@@ -95,14 +96,15 @@ protected:
virtual void resizeEvent(QResizeEvent *);
void focusInEvent(QFocusEvent *);
void focusOutEvent(QFocusEvent *);
+ void timerEvent(QTimerEvent*);
private:
friend class QFxViewPrivate;
QFxViewPrivate *d;
};
-
QT_END_NAMESPACE
QT_END_HEADER
-#endif // _QFXVIEW_H_
+
+#endif // QFXVIEW_H
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index c09b378..4b8ce4e 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -177,12 +177,14 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
whenever the \l MouseRegion is pressed.
\code
- <Rect width="100" height="100">
- <x>
- <NumericAnimation running="{MyMouse.pressed}" from="0" to="100" />
- </x>
- <MouseRegion id="MyMouse" />
- </Rect>
+ Rect {
+ width: 100; height: 100
+ x: NumericAnimation {
+ running: MyMouse.pressed
+ from: 0; to: 100
+ }
+ MouseRegion { id: MyMouse }
+ }
\endcode
Likewise, the \c running property can be read to determine if the animation
@@ -190,8 +192,8 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
or not the animation is running.
\code
- <NumericAnimation id="MyAnimation" />
- <Text text="{MyAnimation.running?'Animation is running':'Animation is not running'}" />
+ NumericAnimation { id: MyAnimation }
+ Text { text: MyAnimation.running ? "Animation is running" : "Animation is not running" }
\endcode
Animations can also be started and stopped imperatively from JavaScript
@@ -211,7 +213,7 @@ void QmlAbstractAnimationPrivate::commence()
q->prepare(userProperty.value);
q->qtAnimation()->start();
- if (!q->qtAnimation()->state() == QAbstractAnimation::Running) {
+ if (q->qtAnimation()->state() != QAbstractAnimation::Running) {
running = false;
emit q->completed();
}
@@ -304,11 +306,9 @@ void QmlAbstractAnimation::setFinishPlaying(bool f)
In the following example, the rectangle will spin indefinately.
\code
- <Rect>
- <rotation>
- <NumericAnimation running="true" repeat="true" from="0" to="360" />
- </rotation>
- </Rect>
+ Rect {
+ rotation: NumericAnimation { running: true; repeat: true; from: 0 to: 360 }
+ }
\endcode
*/
bool QmlAbstractAnimation::repeat() const
@@ -435,11 +435,9 @@ void QmlAbstractAnimation::start()
Normally \c stop() stops the animation immediately, and the animation has
no further influence on property values. In this example animation
\code
- <Rect>
- <x>
- <NumericAnimation from="0" to="100" duration="500" />
- </x>
- </Rect>
+ Rect {
+ x: NumericAnimation { from: 0; to: 100; duration: 500 }
+ }
\endcode
was stopped at time 250ms, the \c x property will have a value of 50.
@@ -475,11 +473,9 @@ void QmlAbstractAnimation::restart()
Unlike \c stop(), \c complete() immediately fast-forwards the animation to
its end. In the following example,
\code
- <Rect>
- <x>
- <NumericAnimation from="0" to="100" duration="500" />
- </x>
- </Rect>
+ Rect {
+ x: NumericAnimation { from: 0; to: 100; duration: 500 }
+ }
\endcode
calling \c stop() at time 250ms will result in the \c x property having
a value of 50, while calling \c complete() will set the \c x property to
@@ -529,11 +525,11 @@ void QmlAbstractAnimation::timelineComplete()
A 500ms animation sequence, with a 100ms pause between two animations:
\code
- <SequentialAnimation>
- <NumericAnimation ... duration="200"/>
- <PauseAnimation duration="100"/>
- <NumericAnimation ... duration="200"/>
- </SequentialAnimation>
+ SequentialAnimation {
+ NumericAnimation { ... duration: 200 }
+ PauseAnimation { duration: 100 }
+ NumericAnimation { ... duration: 200 }
+ }
\endcode
*/
/*!
@@ -621,7 +617,7 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
\brief The ColorAnimation allows you to animate color changes.
\code
- <ColorAnimation from="white" to="#c0c0c0" duration="100"/>
+ ColorAnimation { from: "white"; to: "#c0c0c0"; duration: 100 }
\endcode
The default property animated is \c color, but like other animations,
@@ -811,9 +807,9 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
struct NTransitionData : public QmlTimeLineValue
{
QmlStateActions actions;
- void write(QmlMetaProperty &property, const QColor &color)
+ void write(QmlMetaProperty &property, const QVariant &color)
{
- if (property.propertyType() == qMetaTypeId<QColor>()) {
+ if (property.propertyType() == QVariant::Color) {
property.write(color);
}
}
@@ -837,13 +833,8 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
QColor from(action.fromValue.value<QColor>());
- //XXX consolidate somewhere
- uint red = uint(qreal(from.red()) + v * (qreal(to.red()) - qreal(from.red())));
- uint green = uint(qreal(from.green()) + v * (qreal(to.green()) - qreal(from.green())));
- uint blue = uint(qreal(from.blue()) + v * (qreal(to.blue()) - qreal(from.blue())));
- uint alpha = uint(qreal(from.alpha()) + v * (qreal(to.alpha()) - qreal(from.alpha())));
-
- write(action.property, QColor(red, green, blue, alpha));
+ QVariant newColor = QmlColorAnimationPrivate::colorInterpolator(&from, &to, v);
+ write(action.property, newColor);
}
}
}
@@ -902,24 +893,20 @@ void QmlColorAnimation::transition(QmlStateActions &actions,
delete data;
}
+QVariantAnimation::Interpolator QmlColorAnimationPrivate::colorInterpolator = 0;
void QmlColorAnimationPrivate::valueChanged(qreal v)
{
if (!fromSourced) {
if (!fromValue.isValid()) {
- fromValue = QColor(qvariant_cast<QColor>(property.read()));
+ fromValue = qvariant_cast<QColor>(property.read());
}
fromSourced = true;
}
- //XXX consolidate somewhere
- uint red = uint(qreal(fromValue.red()) + v * (qreal(toValue.red()) - qreal(fromValue.red())));
- uint green = uint(qreal(fromValue.green()) + v * (qreal(toValue.green()) - qreal(fromValue.green())));
- uint blue = uint(qreal(fromValue.blue()) + v * (qreal(toValue.blue()) - qreal(fromValue.blue())));
- uint alpha = uint(qreal(fromValue.alpha()) + v * (qreal(toValue.alpha()) - qreal(fromValue.alpha())));
-
- if (property.propertyType() == qMetaTypeId<QColor>()) {
- property.write(QColor(red, green, blue, alpha));
+ if (property.propertyType() == QVariant::Color) {
+ QVariant newColor = colorInterpolator(&fromValue, &toValue, v);
+ property.write(newColor);
}
}
QML_DEFINE_TYPE(QmlColorAnimation,ColorAnimation);
@@ -1025,12 +1012,12 @@ QML_DEFINE_TYPE(QmlRunScriptAction, RunScriptAction);
Explicitly set \c theimage.smooth=true during a transition:
\code
- <SetPropertyAction target="{theimage}" property="smooth" value="true"/>
+ SetPropertyAction { target: theimage; property: "smooth"; value: true }
\endcode
Set \c thewebview.url to the value set for the destination state:
\code
- <SetPropertyAction target="{thewebview}" property="url"/>
+ SetPropertyAction { target: thewebview; property: "url" }
\endcode
The SetPropertyAction is immediate -
@@ -1333,7 +1320,7 @@ QML_DEFINE_TYPE(QmlParentChangeAction,ParentChangeAction);
Animate a set of properties over 200ms, from their values in the start state to
their values in the end state of the transition:
\code
- <NumericAnimation properties="x,y,scale" duration="200"/>
+ NumericAnimation { properties: "x,y,scale"; duration: 200 }
\endcode
*/
@@ -1732,10 +1719,10 @@ QmlList<QmlAbstractAnimation *> *QmlAnimationGroup::animations()
object will animate from its current x position to 100, and then back to 0.
\code
- <SequentialAnimation>
- <NumericAnimation target="{MyItem}" property="x" to="100" />
- <NumericAnimation target="{MyItem}" property="x" to="0" />
- <SequentialAnimation>
+ SequentialAnimation {
+ NumericAnimation { target: MyItem; property: "x"; to: 100 }
+ NumericAnimation { target: MyItem; property: "x"; to: 0 }
+ }
\endcode
\sa ParallelAnimation
@@ -1809,10 +1796,10 @@ QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation);
to (100,100) by animating the x and y properties in parallel.
\code
- <ParallelAnimation>
- <NumericAnimation target="{MyItem}" property="x" to="100" />
- <NumericAnimation target="{MyItem}" property="y" to="100" />
- </ParallelAnimation>
+ ParallelAnimation {
+ NumericAnimation { target: MyItem; property: "x"; to: 100 }
+ NumericAnimation { target: MyItem; property: "y"; to: 100 }
+ }
\endcode
\sa SequentialAnimation
@@ -1933,7 +1920,7 @@ void QmlVariantAnimationPrivate::convertVariant(QVariant &variant, QVariant::Typ
Animate a size property over 200ms, from its current size to 20-by-20:
\code
- <VariantAnimation property="size" to="20x20" duration="200"/>
+ VariantAnimation { property: "size"; to: "20x20"; duration: 200 }
\endcode
*/
@@ -2006,7 +1993,7 @@ QVariant QmlVariantAnimation::from() const
void QmlVariantAnimation::setFrom(const QVariant &f)
{
Q_D(QmlVariantAnimation);
- if (!d->from.isNull && f == d->from)
+ if (d->from.isValid() && f == d->from)
return;
d->from = f;
emit fromChanged(f);
@@ -2030,7 +2017,7 @@ QVariant QmlVariantAnimation::to() const
void QmlVariantAnimation::setTo(const QVariant &t)
{
Q_D(QmlVariantAnimation);
- if (!d->to.isNull && t == d->to)
+ if (d->to.isValid() && t == d->to)
return;
d->to = t;
emit toChanged(t);
@@ -2122,18 +2109,16 @@ QList<QObject *> *QmlVariantAnimation::exclude()
void QmlVariantAnimationPrivate::valueChanged(qreal r)
{
if (!fromSourced) {
- if (from.isNull) {
- fromValue = property.read();
- } else {
- fromValue = from;
+ if (!from.isValid()) {
+ from = property.read();
}
fromSourced = true;
}
if (r == 1.) {
- property.write(to.value);
+ property.write(to);
} else {
- QVariant val = interpolateVariant(fromValue, to.value, r);
+ QVariant val = interpolateVariant(from, to, r);
property.write(val);
}
}
@@ -2152,9 +2137,9 @@ void QmlVariantAnimation::prepare(QmlMetaProperty &p)
else
d->property = d->userProperty;
- d->convertVariant(d->to.value, (QVariant::Type)d->property.propertyType());
- if (!d->from.isNull)
- d->convertVariant(d->from.value, (QVariant::Type)d->property.propertyType());
+ d->convertVariant(d->to, (QVariant::Type)d->property.propertyType());
+ if (d->from.isValid())
+ d->convertVariant(d->from, (QVariant::Type)d->property.propertyType());
d->fromSourced = false;
d->value.QmlTimeLineValue::setValue(0.);
@@ -2214,12 +2199,12 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
Action myAction = action;
if (d->from.isValid()) {
- myAction.fromValue = QVariant(d->from);
+ myAction.fromValue = d->from;
} else {
myAction.fromValue = QVariant();
}
if (d->to.isValid())
- myAction.toValue = QVariant(d->to);
+ myAction.toValue = d->to;
d->convertVariant(myAction.fromValue, (QVariant::Type)myAction.property.propertyType());
d->convertVariant(myAction.toValue, (QVariant::Type)myAction.property.propertyType());
@@ -2238,12 +2223,12 @@ void QmlVariantAnimation::transition(QmlStateActions &actions,
myAction.property = QmlMetaProperty(obj, props.at(jj));
if (d->from.isValid()) {
- d->convertVariant(d->from.value, (QVariant::Type)myAction.property.propertyType());
- myAction.fromValue = QVariant(d->from);
+ d->convertVariant(d->from, (QVariant::Type)myAction.property.propertyType());
+ myAction.fromValue = d->from;
}
- d->convertVariant(d->to.value, (QVariant::Type)myAction.property.propertyType());
- myAction.toValue = QVariant(d->to);
+ d->convertVariant(d->to, (QVariant::Type)myAction.property.propertyType());
+ myAction.toValue = d->to;
myAction.bv = 0;
myAction.event = 0;
data->actions << myAction;
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index 728584c..4fcaa47 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -203,7 +203,11 @@ class QmlColorAnimationPrivate : public QmlAbstractAnimationPrivate
Q_DECLARE_PUBLIC(QmlColorAnimation);
public:
QmlColorAnimationPrivate()
- : QmlAbstractAnimationPrivate(), fromSourced(false), ca(0), value(this, &QmlColorAnimationPrivate::valueChanged) {}
+ : QmlAbstractAnimationPrivate(), fromSourced(false), ca(0), value(this, &QmlColorAnimationPrivate::valueChanged)
+ {
+ if (!colorInterpolator)
+ colorInterpolator = QVariantAnimationPrivate::getInterpolator(QVariant::Color);
+ }
void init();
@@ -218,6 +222,8 @@ public:
virtual void valueChanged(qreal);
QmlTimeLineValueProxy<QmlColorAnimationPrivate> value;
+
+ static QVariantAnimation::Interpolator colorInterpolator;
};
class QmlRunScriptActionPrivate : public QmlAbstractAnimationPrivate
@@ -348,8 +354,8 @@ public:
void init();
- QmlNullableValue<QVariant> from;
- QmlNullableValue<QVariant> to;
+ QVariant from;
+ QVariant to;
QString easing;
@@ -358,7 +364,7 @@ public:
QList<QObject *> exclude;
bool fromSourced;
- QVariant fromValue;
+
QmlTimeLineValueAnimator *va;
virtual void valueChanged(qreal);
diff --git a/src/declarative/util/qmlbehaviour.cpp b/src/declarative/util/qmlbehaviour.cpp
index 58e515f..354c7e3 100644
--- a/src/declarative/util/qmlbehaviour.cpp
+++ b/src/declarative/util/qmlbehaviour.cpp
@@ -105,15 +105,19 @@ public:
\qmlclass Behaviour QmlBehaviour
\brief The Behaviour element allows you to specify a default animation for a property change.
- In example below, Rect1 will use a bounce easing curve over 200 millisecond for any changes to its y property:
+ In example below, the rect will use a bounce easing curve over 200 millisecond for any changes to its y property:
\code
- <Rect id="Rect1" y="200" width="20" height="20" color="#00ff00">
- <y>
- <Behaviour>
- <NumericAnimation easing="easeOutBounce(amplitude:100)" duration="200" />
- </Behaviour>
- </y>
- </Rect>
+ Rect {
+ width: 20; height: 20
+ color: "#00ff00"
+ y: 200 //initial value
+ y: Behaviour {
+ NumericAnimation {
+ easing: "easeOutBounce(amplitude:100)"
+ duration: 200
+ }
+ }
+ }
\endcode
*/
diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp
index 3b51c6a..59bfd75 100644
--- a/src/declarative/util/qmlbind.cpp
+++ b/src/declarative/util/qmlbind.cpp
@@ -77,8 +77,8 @@ QML_DEFINE_TYPE(QmlBind,Bind);
property into QML. You could use Bind to update the enteredText property
like this.
\code
- <TextEdit id="myTextField" text="Please type here..." />
- <Bind target="{app}" property="enteredText" value="{myTextField.text}" />
+ TextEdit { id: myTextField; text: "Please type here..." }
+ Bind { target: app; property: "enteredText"; value: myTextField.text />
\endcode
Whenever the text in the TextEdit is updated, the C++ property will be
updated also.
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp
index 5cd4371..8f6c908 100644
--- a/src/declarative/util/qmlconnection.cpp
+++ b/src/declarative/util/qmlconnection.cpp
@@ -62,7 +62,7 @@ public:
/*!
\qmlclass Connection QmlConnection
- \brief The Connection element describes generalized connections to signals.
+ \brief A Connection object describes generalized connections to signals.
JavaScript-in-HTML style signal properties do not allow:
\list
@@ -73,31 +73,40 @@ public:
\i signals in classes with coincidentally-named on<Signal> properties
\endlist
- When any of these is needed, the Connection element can be used instead.
+ When any of these is needed, the Connection object can be used instead.
Where a signal could be connected like this:
- \code
- <MouseRegion onClicked="foo(x+123,y+456)" />
- \endcode
+ \qml
+MouseRegion {
+ onClicked: { foo(x+123,y+456) }
+}
+ \endqml
- An equivalent binding can be made with a Connection element:
+ An equivalent binding can be made with a Connection object:
- \code
- <MouseRegion>
- <Connection signal="clicked(x,y)" script="foo(x+123,y+456)" />
- </MouseRegion>
- \endcode
+ \qml
+MouseRegion {
+ Connection {
+ signal: "clicked(x,y)"
+ script: { foo(x+123,y+456) }
+ }
+}
+ \endqml
- More generally, the Connection element can be a child of some other element than
+ More generally, the Connection object can be a child of some other object than
the sender of the signal, and the script is the default attribute:
- \code
- <MouseRegion id="mr"/>
- ...
- <Connection sender="{mr}" signal="clicked(x,y)">
- foo(x+123,y+456)
- </Connection>
- \endcode
+ \qml
+MouseRegion {
+ id: mr
+}
+...
+Connection {
+ sender: mr
+ signal: "clicked(x,y)"
+ script: { foo(x+123,y+456) }
+}
+ \endqml
*/
/*!
@@ -257,9 +266,12 @@ void QmlConnection::setScript(const QString& script)
The signal must have its formal parameter names given in parentheses:
- \code
- <Connection signal="clicked(x,y)" ... />
- \endcode
+ \qml
+Connection {
+ signal: "clicked(x,y)"
+ script: { ... }
+}
+ \endqml
*/
/*!
diff --git a/src/declarative/util/qmldatetimeformatter.cpp b/src/declarative/util/qmldatetimeformatter.cpp
index efddd81..94b87ee 100644
--- a/src/declarative/util/qmldatetimeformatter.cpp
+++ b/src/declarative/util/qmldatetimeformatter.cpp
@@ -74,8 +74,8 @@ public:
\brief The DateTimeFormatter allows you to control the format of a date string.
\code
- <DateTimeFormatter id="Formatter" date="{System.date}"/>
- <Text text="{Formatter.dateText}"/>
+ DateTimeFormatter { id: Formatter; date: System.date }
+ Text { text: Formatter.dateText }
\endcode
By default, the text properties (dateText, timeText, and dateTimeText) will return the
@@ -110,18 +110,18 @@ QmlDateTimeFormatter::~QmlDateTimeFormatter()
will use the system locale's default 'short' setting.
\code
- <!-- specify source date (assuming today is February 19, 2009) -->
- <DateTimeFormatter id="formatter" dateTime="{Today.date}"/>
+ // specify source date (assuming today is February 19, 2009)
+ DateTimeFormatter { id: formatter; dateTime: Today.date }
- <!-- display the full date and time -->
- <Text text="{formatter.dateText}"/>
+ // display the full date and time
+ Text { text: formatter.dateText }
\endcode
Would be equivalent to the following for a US English locale:
\code
- <!-- display the date -->
- <Text text="2/19/09"/>
+ // display the date
+ Text { text: "2/19/09" }
\endcode
*/
QString QmlDateTimeFormatter::dateTimeText() const
@@ -150,14 +150,14 @@ QString QmlDateTimeFormatter::timeText() const
The source date and time to be used by the formatter.
\code
- <!-- setting the date and time -->
- <DateTimeFormatter date="{System.date}" time="{System.time}"/>
+ // setting the date and time
+ DateTimeFormatter { date: System.date; time: System.time }
\endcode
For convienience it is possible to set the datetime property to set both the date and the time.
\code
- <!-- setting the datetime -->
- <DateTimeFormatter dateTime="{System.dateTime}"/>
+ // setting the datetime
+ DateTimeFormatter { dateTime: System.dateTime }
\endcode
There can only be one instance of date and time per formatter; if date, time, and dateTime are all
@@ -208,8 +208,8 @@ QDateTime QmlDateTimeFormatter::dateTime() const
Syntax for the format is based on the QDateTime::toString() formatting options.
\code
- <!-- Format the date such that the dateText is: '1997-12-12'>
- <DateFormatter id="formatter" dateTime="{Today.dateTime}" formatDate="yyyy-MM-d"/>
+ // Format the date such that the dateText is: '1997-12-12'
+ DateTimeFormatter { id: formatter; dateTime: Today.dateTime; formatDate: "yyyy-MM-d" }
\endcode
Assigning an empty string to a particular format will reset it.
diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp
index 35f3c49..8e5ae69 100644
--- a/src/declarative/util/qmlfollow.cpp
+++ b/src/declarative/util/qmlfollow.cpp
@@ -55,7 +55,7 @@ class QmlFollowPrivate : public QObjectPrivate
public:
QmlFollowPrivate()
: sourceValue(0), maxVelocity(0), lastTime(0)
- , mass(1.0), spring(0.), damping(0.), velocity(0), enabled(true), mode(Track), clock(this) {}
+ , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.005), enabled(true), mode(Track), clock(this) {}
QmlMetaProperty property;
qreal currentValue;
@@ -67,6 +67,7 @@ public:
qreal spring;
qreal damping;
qreal velocity;
+ qreal epsilon;
bool enabled;
enum Mode {
@@ -111,7 +112,7 @@ void QmlFollowPrivate::tick(int time)
}
currentValue += velocity * 10.0 / 1000.0;
}
- if (qAbs(velocity) < 0.5 && qAbs(sourceValue - currentValue) < 0.5) {
+ if (qAbs(velocity) < epsilon && qAbs(sourceValue - currentValue) < epsilon) {
velocity = 0.0;
currentValue = sourceValue;
clock.stop();
@@ -174,19 +175,29 @@ void QmlFollowPrivate::stop()
In example below, Rect2 will follow Rect1 moving with a velocity of up to 200:
\code
- <Rect id="Rect1" y="{200}" width="20" height="20" color="#00ff00">
- <y>
- <SequentialAnimation running="true" repeat="true">
- <NumericAnimation to="{200}" easing="easeOutBounce(amplitude:100)" duration="2000" />
- <PauseAnimation duration="1000" />
- </SequentialAnimation>
- </y>
- </Rect>
- <Rect id="Rect2" x="{Rect1.width}" width="20" height="20" color="#ff0000">
- <y>
- <Follow source="{Rect1.y}" velocity="200"/>
- </y>
- </Rect>
+ Rect {
+ id: Rect1
+ width: 20; height: 20
+ color: "#00ff00"
+ y: 200 //initial value
+ y: SequentialAnimation {
+ running: true
+ repeat: true
+ NumericAnimation {
+ to: 200
+ easing: "easeOutBounce(amplitude:100)"
+ duration: 2000
+ }
+ PauseAnimation { duration: 1000 }
+ }
+ }
+ Rect {
+ id: Rect2
+ x: Rect1.width
+ width: 20; height: 20
+ color: "#ff0000"
+ y: Follow { source: Rect1.y; velocity: 200 }
+ }
\endcode
*/
@@ -290,6 +301,30 @@ void QmlFollow::setDamping(qreal damping)
d->damping = damping;
}
+
+/*!
+ \qmlproperty qreal Follow::epsilon
+ This property holds the spring epsilon
+
+ The epsilon is the rate and amount of change in the value which is close enough
+ to 0 to be considered equal to zero. This will depend on the usage of the value.
+ For pixel positions, 0.25 would suffice. For scale, 0.005 will suffice.
+
+ The default is 0.005. Small performance improvements can result in tuning this
+ value.
+*/
+qreal QmlFollow::epsilon() const
+{
+ Q_D(const QmlFollow);
+ return d->epsilon;
+}
+
+void QmlFollow::setEpsilon(qreal epsilon)
+{
+ Q_D(QmlFollow);
+ d->epsilon = epsilon;
+}
+
/*!
\qmlproperty qreal Follow::followValue
The current value.
diff --git a/src/declarative/util/qmlfollow.h b/src/declarative/util/qmlfollow.h
index aac4c01..bd9363a 100644
--- a/src/declarative/util/qmlfollow.h
+++ b/src/declarative/util/qmlfollow.h
@@ -63,6 +63,7 @@ class Q_DECLARATIVE_EXPORT QmlFollow : public QmlPropertyValueSource,
Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity);
Q_PROPERTY(qreal spring READ spring WRITE setSpring);
Q_PROPERTY(qreal damping READ damping WRITE setDamping);
+ Q_PROPERTY(qreal epsilon READ epsilon WRITE setEpsilon);
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled);
Q_PROPERTY(qreal followValue READ value NOTIFY valueChanged);
@@ -80,6 +81,8 @@ public:
void setSpring(qreal spring);
qreal damping() const;
void setDamping(qreal damping);
+ qreal epsilon() const;
+ void setEpsilon(qreal epsilon);
bool enabled() const;
void setEnabled(bool enabled);
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 54aea2c..4837180 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -42,7 +42,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qstack.h>
#include <QXmlStreamReader>
-#include "qmlcustomparser.h"
+#include <private/qmlcustomparser_p.h>
#include "qmlopenmetaobject.h"
#include <qmlcontext.h>
#include <qmlbindablevalue.h>
@@ -53,55 +53,23 @@ QT_BEGIN_NAMESPACE
#define DATA_ROLE_ID 1
#define DATA_ROLE_NAME "data"
-Q_DECLARE_METATYPE(QListModelInterface *);
-class QmlListModelPrivate
+struct ListInstruction
{
-public:
- QmlListModelPrivate(QmlListModel *m)
- : q(m),
- type(QmlListModel::Invalid),
- listModelInterface(0),
- singleObject(0),
- roleCacheValid(false)
- {
- }
-
- void clear()
- {
- type = QmlListModel::Invalid;
- model = QVariant();
- if (listModelInterface)
- listModelInterface->disconnect(q);
- listModelInterface = 0;
- singleObject = 0;
- roleCacheValid = false;
- roleCache.clear();
- }
-
- void updateRoleCache()
- {
- if (roleCacheValid)
- return;
-
- roleCacheValid = true;
- if (type == QmlListModel::SingleObject)
- roleCache = QmlMetaProperty::properties(singleObject);
- }
-
- QmlListModel *q;
-
- QmlListModel::ModelType type;
-
- QVariant model;
- QListModelInterface *listModelInterface;
- QObject *singleObject;
+ enum { Push, Pop, Value, Set } type;
+ int dataIdx;
+};
- bool roleCacheValid;
- QStringList roleCache;
+struct ListModelData
+{
+ int dataOffset;
+ int instrCount;
+ ListInstruction *instructions() const { return (ListInstruction *)((char *)this + sizeof(ListModelData)); }
};
+Q_DECLARE_METATYPE(QListModelInterface *);
+
/*!
- \qmlclass ListModel QmlListModel
+ \qmlclass ListModel
\brief The ListModel element defines a free-form list data source.
The ListModel is a simple XML heirarchy of items containing data roles.
@@ -140,157 +108,6 @@ public:
<ListView model="{FruitModel}" delegate="{FruitDelegate}" anchors.fill="{parent}"/>
\endcode
*/
-/*!
- \internal
- \class QmlListModel
-*/
-QmlListModel::QmlListModel(QObject *parent)
-: QListModelInterface(parent), d(new QmlListModelPrivate(this))
-{
-}
-
-QmlListModel::~QmlListModel()
-{
- delete d; d = 0;
-}
-
-QmlListModel::ModelType QmlListModel::modelType() const
-{
- return d->type;
-}
-
-bool QmlListModel::setModel(const QVariant &model)
-{
- d->clear();
-
- QListModelInterface *iface = qvariant_cast<QListModelInterface *>(model);
- if (iface) {
- QObject::connect(iface, SIGNAL(itemsInserted(int,int)),
- this, SIGNAL(itemsInserted(int,int)));
- QObject::connect(iface, SIGNAL(itemsRemoved(int,int)),
- this, SIGNAL(itemsRemoved(int,int)));
- QObject::connect(iface, SIGNAL(itemsMoved(int,int,int)),
- this, SIGNAL(itemsMoved(int,int,int)));
- QObject::connect(iface, SIGNAL(itemsChanged(int,int,QList<int>)),
- this, SIGNAL(itemsChanged(int,int,QList<int>)));
- d->listModelInterface = iface;
- d->type = ListInterface;
- d->model = model;
- return true;
- }
-
- QObject *object = qvariant_cast<QObject *>(model);
- if (object) {
- d->singleObject = object;
- d->type = SingleObject;
- d->model = model;
- return true;
- }
-
- if (QmlMetaType::isList(model)) {
- d->type = SimpleList;
- d->model = model;
- return true;
- }
-
- return false;
-}
-
-QVariant QmlListModel::model() const
-{
- return d->model;
-}
-
-QList<int> QmlListModel::roles() const
-{
- d->updateRoleCache();
- switch(modelType()) {
- case Invalid:
- return QList<int>();
- case SimpleList:
- return QList<int>() << DATA_ROLE_ID;
- case ListInterface:
- return d->listModelInterface->roles();
- case SingleObject:
- {
- QList<int> rv;
- for (int ii = 0; ii < d->roleCache.count(); ++ii)
- rv << ii;
- return rv;
- }
- break;
- };
- return QList<int>();
-}
-
-QString QmlListModel::toString(int role) const
-{
- d->updateRoleCache();
- switch(modelType()) {
- case Invalid:
- return QString();
- case SimpleList:
- if (role == DATA_ROLE_ID)
- return QLatin1String(DATA_ROLE_NAME);
- else
- return QString();
- case ListInterface:
- return d->listModelInterface->toString(role);
- case SingleObject:
- if (role >= d->roleCache.count())
- return QString();
- else
- return d->roleCache.at(role);
- };
- return QString();
-}
-
-/*!
- \qmlproperty int ListModel::count
- This property holds the number of items in the list.
-*/
-int QmlListModel::count() const
-{
- switch(modelType()) {
- case Invalid:
- return 0;
- case SimpleList:
- return QmlMetaType::listCount(model());
- case ListInterface:
- return d->listModelInterface->count();
- case SingleObject:
- return 1;
- }
- return 0;
-}
-
-QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const
-{
- d->updateRoleCache();
- QHash<int, QVariant> rv;
- switch(modelType()) {
- case Invalid:
- break;
- case SimpleList:
- if (roles.contains(DATA_ROLE_ID))
- rv.insert(DATA_ROLE_ID, QmlMetaType::listAt(d->model, index));
- break;
- case ListInterface:
- return d->listModelInterface->data(index, roles);
- case SingleObject:
- {
- for (int ii = 0; ii < roles.count(); ++ii) {
- QmlMetaProperty prop(d->singleObject, toString(roles.at(ii)));
- rv.insert(roles.at(ii), prop.read());
- }
- }
- break;
- };
-
- return rv;
-}
-
-
struct ModelNode;
class ListModel : public QListModelInterface
@@ -484,20 +301,181 @@ int ListModel::count() const
return _root->values.count();
}
-struct ListInstruction
-{
- enum { Push, Pop, Value, Set } type;
- int dataIdx;
-};
-
class ListModelParser : public QmlCustomParser
{
public:
virtual QByteArray compile(QXmlStreamReader& reader, bool *);
+ QByteArray compile(const QList<QmlCustomParserProperty> &, bool *ok);
virtual QVariant create(const QByteArray &);
+
+ bool compileProperty(const QmlCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data);
+ void setCustomData(QObject *, const QByteArray &);
};
QML_DEFINE_CUSTOM_PARSER(ListModel, ListModelParser);
+bool ListModelParser::compileProperty(const QmlCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data)
+{
+ QList<QVariant> values = prop.assignedValues();
+ for(int ii = 0; ii < values.count(); ++ii) {
+ const QVariant &value = values.at(ii);
+
+ if(value.userType() == qMetaTypeId<QmlCustomParserNode>()) {
+ QmlCustomParserNode node =
+ qvariant_cast<QmlCustomParserNode>(value);
+
+ {
+ ListInstruction li;
+ li.type = ListInstruction::Push;
+ li.dataIdx = -1;
+ instr << li;
+ }
+
+ QList<QmlCustomParserProperty> props = node.properties();
+ for(int jj = 0; jj < props.count(); ++jj) {
+ const QmlCustomParserProperty &nodeProp = props.at(jj);
+ if(nodeProp.name() == "")
+ return false;
+
+ ListInstruction li;
+ int ref = data.count();
+ data.append(nodeProp.name());
+ data.append('\0');
+ li.type = ListInstruction::Set;
+ li.dataIdx = ref;
+ instr << li;
+
+ if(!compileProperty(nodeProp, instr, data))
+ return false;
+
+ li.type = ListInstruction::Pop;
+ li.dataIdx = -1;
+ instr << li;
+ }
+
+ {
+ ListInstruction li;
+ li.type = ListInstruction::Pop;
+ li.dataIdx = -1;
+ instr << li;
+ }
+
+ } else {
+
+ int ref = data.count();
+ QByteArray d = value.toString().toLatin1();
+ d.append('\0');
+ data.append(d);
+
+ ListInstruction li;
+ li.type = ListInstruction::Value;
+ li.dataIdx = ref;
+ instr << li;
+
+ }
+ }
+
+ return true;
+}
+
+QByteArray ListModelParser::compile(const QList<QmlCustomParserProperty> &customProps, bool *ok)
+{
+ *ok = true;
+ QList<ListInstruction> instr;
+ QByteArray data;
+
+ for(int ii = 0; ii < customProps.count(); ++ii) {
+ const QmlCustomParserProperty &prop = customProps.at(ii);
+ if(prop.name() != "") { // isn't default property
+ *ok = false;
+ return QByteArray();
+ }
+
+ if(!compileProperty(prop, instr, data)) {
+ *ok = false;
+ return QByteArray();
+ }
+ }
+
+ int size = sizeof(ListModelData) +
+ instr.count() * sizeof(ListInstruction) +
+ data.count();
+
+ QByteArray rv;
+ rv.resize(size);
+
+ ListModelData *lmd = (ListModelData *)rv.data();
+ lmd->dataOffset = sizeof(ListModelData) +
+ instr.count() * sizeof(ListInstruction);
+ lmd->instrCount = instr.count();
+ for (int ii = 0; ii < instr.count(); ++ii)
+ lmd->instructions()[ii] = instr.at(ii);
+ ::memcpy(rv.data() + lmd->dataOffset, data.constData(), data.count());
+
+ return rv;
+}
+
+void ListModelParser::setCustomData(QObject *obj, const QByteArray &d)
+{
+ ListModel *rv = static_cast<ListModel *>(obj);
+
+ ModelNode *root = new ModelNode;
+ rv->_root = root;
+ QStack<ModelNode *> nodes;
+ nodes << root;
+
+ const ListModelData *lmd = (const ListModelData *)d.constData();
+ const char *data = ((const char *)lmd) + lmd->dataOffset;
+
+ for (int ii = 0; ii < lmd->instrCount; ++ii) {
+ const ListInstruction &instr = lmd->instructions()[ii];
+
+ switch(instr.type) {
+ case ListInstruction::Push:
+ {
+ ModelNode *n = nodes.top();
+ ModelNode *n2 = new ModelNode;
+ n->values << qVariantFromValue(n2);
+ nodes.push(n2);
+ }
+ break;
+
+ case ListInstruction::Pop:
+ nodes.pop();
+ break;
+
+ case ListInstruction::Value:
+ {
+ ModelNode *n = nodes.top();
+ n->values.append(QByteArray(data + instr.dataIdx));
+ }
+ break;
+
+ case ListInstruction::Set:
+ {
+ ModelNode *n = nodes.top();
+ ModelNode *n2 = new ModelNode;
+ n->properties.insert(QLatin1String(data + instr.dataIdx), n2);
+ nodes.push(n2);
+ }
+ break;
+ }
+ }
+}
+
+class ListModel2 : public ListModel
+{
+Q_OBJECT
+};
+QML_DECLARE_TYPE(ListModel2);
+QML_DEFINE_CUSTOM_TYPE(ListModel2, ListModel2, ListModelParser);
+
+class ListElement : public QObject
+{
+Q_OBJECT
+};
+QML_DECLARE_TYPE(ListElement);
+QML_DEFINE_TYPE(ListElement,ListElement);
+
static void dump(ModelNode *node, int ind)
{
QByteArray indentBa(ind * 4, ' ');
@@ -534,13 +512,6 @@ ModelNode::~ModelNode()
if (modelCache) { delete modelCache; modelCache = 0; }
}
-struct ListModelData
-{
- int dataOffset;
- int instrCount;
- ListInstruction *instructions() const { return (ListInstruction *)((char *)this + sizeof(ListModelData)); }
-};
-
QByteArray ListModelParser::compile(QXmlStreamReader& reader, bool *ok)
{
*ok = true;
diff --git a/src/declarative/util/qmllistmodel.h b/src/declarative/util/qmllistmodel.h
index 3dcac4f..36aa009 100644
--- a/src/declarative/util/qmllistmodel.h
+++ b/src/declarative/util/qmllistmodel.h
@@ -57,40 +57,10 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlListModelPrivate;
-class Q_DECLARATIVE_EXPORT QmlListModel : public QListModelInterface
-{
-Q_OBJECT
-public:
- QmlListModel(QObject *parent = 0);
- virtual ~QmlListModel();
-
- enum ModelType {
- Invalid,
- SimpleList,
- ListInterface,
- SingleObject
- };
-
- ModelType modelType() const;
- bool setModel(const QVariant &);
- QVariant model() const;
-
- 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:
- QmlListModelPrivate *d;
-};
-QML_DECLARE_TYPE(QmlListModel);
-
-#endif // QMLLISTMODEL_H
QT_END_NAMESPACE
QT_END_HEADER
+
+#endif // QMLLISTMODEL_H
diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp
index fbaf56e..7e33502 100644
--- a/src/declarative/util/qmlscript.cpp
+++ b/src/declarative/util/qmlscript.cpp
@@ -85,13 +85,13 @@ public:
within a QmlScript, it is best to limit yourself to defining functions.
\qml
- <Script>
+ Script {
function debugMyComponent() {
print(text.text);
print(otherinterestingitem.property);
}
- </Script>
- <MouseRegion onClicked="debugMyComponent()" />
+ }
+ MouseRegion { onClicked: debugMyComponent() }
\endqml
\note QmlScript executes JavaScript as soon as it is specified.
@@ -136,7 +136,7 @@ void QmlScript::setScript(const QString &script)
the file specified.
*/
/*!
- \property QmlScript::src
+ \property QmlScript::source
\brief the path to a script file.
*/
QString QmlScript::source() const
diff --git a/src/declarative/util/qmlsetproperties.cpp b/src/declarative/util/qmlsetproperties.cpp
index 108f2b2..9b5a58e 100644
--- a/src/declarative/util/qmlsetproperties.cpp
+++ b/src/declarative/util/qmlsetproperties.cpp
@@ -108,7 +108,12 @@ void QmlSetPropertiesMetaObject::propertyWrite(int id)
you normally would specify them for the actual item:
\code
- <SetProperties target="{myRect}" x="52" y="300" width="48"/>
+ SetProperties {
+ target: myRect
+ x: 52
+ y: 300
+ width: 48
+ }
\endcode
\c target is a property of \c SetProperties, so if the property you want to change
@@ -129,7 +134,12 @@ void QmlSetPropertiesMetaObject::propertyWrite(int id)
you normally would specify them for the actual item:
\code
- <SetProperties target="{myRect}" x="52" y="300" width="48"/>
+ SetProperties {
+ target: myRect
+ x: 52
+ y: 300
+ width: 48
+ }
\endcode
\c target is a property of \c SetProperties, so if the property you want to change
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index 8a10ca3..01f9cdd 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -59,6 +59,7 @@ public:
};
/*!
+ \preliminary
\qmlclass ParentChange
\brief The ParentChange element allows you to reparent an object in a state.
*/
@@ -211,17 +212,36 @@ QmlRunScript::ActionList QmlRunScript::actions()
the current state:
\code
- <Rect id="myrect" width="50" height="50" color="red"/>
-
- <states>
- <State name="Position1">
- <SetProperty target="{myrect}" property="x" value="150"/>
- <SetProperty target="{myrect}" property="y" value="50"/>
- </State>
- <State name="Position2">
- <SetProperty target="{myrect}" property="y" value="200"/>
- </State>
- </states>
+ Rect {
+ id: myrect
+ width: 50
+ height: 50
+ color: "red"
+ }
+
+ states: [
+ State {
+ name: "Position1"
+ SetProperty {
+ target: myrect
+ property: "x"
+ value: 150
+ }
+ SetProperty {
+ target: myrect
+ property: "y"
+ value: 50
+ }
+ },
+ State {
+ name: "Position2"
+ SetProperty {
+ target: myrect
+ property: "y"
+ value: 200
+ }
+ }
+ ]
\endcode
\sa SetProperties
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index a515f58..47e70ad 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -188,9 +188,11 @@ void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
be applied. By default fromState and toState are both "*" (any state). In the following example,
the transition is applied when changing from state1 to state2.
\code
- <Transition fromState="state1" toState="state2">
+ Transition {
+ fromState: "state1"
+ toState: "state2"
...
- </Transition>
+ }
\endcode
*/
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index d471aaa..5f110e3 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -2049,7 +2049,7 @@ QPainterPath QPainterPath::translated(qreal dx, qreal dy) const
}
/*!
- \fn void QPainterPath::translated(const QPointF &offset)
+ \fn void QPainterPath::translated(const QPointF &offset) const
\overload
\since 4.6