summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/extra/qfxanimatedimageitem.cpp2
-rw-r--r--src/declarative/extra/qfxparticles.cpp8
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp4
-rw-r--r--src/declarative/fx/qfxeffects.cpp14
-rw-r--r--src/declarative/fx/qfxflickable.cpp2
-rw-r--r--src/declarative/fx/qfxfocuspanel.cpp2
-rw-r--r--src/declarative/fx/qfxfocusscope.cpp2
-rw-r--r--src/declarative/fx/qfxgridview.cpp2
-rw-r--r--src/declarative/fx/qfxitem.cpp6
-rw-r--r--src/declarative/fx/qfxlistview.cpp31
-rw-r--r--src/declarative/fx/qfxloader.cpp2
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp2
-rw-r--r--src/declarative/fx/qfxpath.cpp12
-rw-r--r--src/declarative/fx/qfxpathview.cpp2
-rw-r--r--src/declarative/fx/qfxpositioners.cpp4
-rw-r--r--src/declarative/fx/qfxrepeater.cpp2
-rw-r--r--src/declarative/fx/qfxtextedit.cpp2
-rw-r--r--src/declarative/fx/qfxtextinput.cpp2
-rw-r--r--src/declarative/fx/qfxwebview.cpp2
-rw-r--r--src/declarative/qml/qml.pri3
-rw-r--r--src/declarative/qml/qmlbinding.cpp6
-rw-r--r--src/declarative/qml/qmlcompiler.cpp31
-rw-r--r--src/declarative/qml/qmlcompiler_p.h18
-rw-r--r--src/declarative/qml/qmlcomponent.cpp48
-rw-r--r--src/declarative/qml/qmlcomponent.h8
-rw-r--r--src/declarative/qml/qmlcomponent_p.h3
-rw-r--r--src/declarative/qml/qmlcomponentjs.cpp131
-rw-r--r--src/declarative/qml/qmlcomponentjs_p.h98
-rw-r--r--src/declarative/qml/qmlcomponentjs_p_p.h77
-rw-r--r--src/declarative/qml/qmlengine.cpp155
-rw-r--r--src/declarative/qml/qmlengine_p.h2
-rw-r--r--src/declarative/qml/qmlexpression.cpp16
-rw-r--r--src/declarative/qml/qmlexpression_p.h2
-rw-r--r--src/declarative/util/qmlanimation.cpp2
-rw-r--r--src/declarative/util/qmllistmodel.cpp2
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp9
-rw-r--r--src/declarative/util/qmlspringfollow.cpp11
-rw-r--r--src/declarative/util/qmlstate.cpp2
-rw-r--r--src/declarative/util/qmlstateoperations.cpp4
-rw-r--r--src/declarative/util/qmltimer.cpp2
40 files changed, 214 insertions, 519 deletions
diff --git a/src/declarative/extra/qfxanimatedimageitem.cpp b/src/declarative/extra/qfxanimatedimageitem.cpp
index a0ebd66..2e6688e 100644
--- a/src/declarative/extra/qfxanimatedimageitem.cpp
+++ b/src/declarative/extra/qfxanimatedimageitem.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlclass AnimatedImage
+ \qmlclass AnimatedImage QFxAnimatedImageItem
\inherits Image
This item provides for playing animations stored as images containing a series of frames,
diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp
index bf25671..aaeed84 100644
--- a/src/declarative/extra/qfxparticles.cpp
+++ b/src/declarative/extra/qfxparticles.cpp
@@ -359,7 +359,6 @@ public:
qreal minX;
qreal maxY;
qreal minY;
- QVarLengthArray<QDrawPixmaps::Data, 50> pixmapData;
QFxParticlesPrivate* d;
};
@@ -384,7 +383,6 @@ public:
{
Q_Q(QFxParticles);
paintItem = new QFxParticlesPainter(this, q);
- paintItem->pixmapData.resize(count);
}
void tick(int time);
@@ -702,8 +700,6 @@ void QFxParticles::setCount(int cnt)
int oldCount = d->count;
d->count = cnt;
- if (cnt > oldCount)
- d->paintItem->pixmapData.resize(d->count);
d->addParticleTime = 0;
d->addParticleCount = d->particles.count();
if (!oldCount && d->clock.state() != QAbstractAnimation::Running && d->count) {
@@ -1104,6 +1100,10 @@ void QFxParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, Q
const int myX = x() + parentItem()->x();
const int myY = y() + parentItem()->y();
+ static QVarLengthArray<QDrawPixmaps::Data, 256> pixmapData;
+ if (pixmapData.count() < d->particles.count())
+ pixmapData.resize(d->particles.count());
+
const QRectF sourceRect = d->image.rect();
for (int i = 0; i < d->particles.count(); ++i) {
const QFxParticle &particle = d->particles.at(i);
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 6a5ddea..062a2a4 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -62,7 +62,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,XmlRole,QmlXmlListModelRole)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,XmlListModel,QmlXmlListModel)
/*!
- \qmlclass XmlRole
+ \qmlclass XmlRole QmlXmlListModelRole
\brief The XmlRole element allows you to specify a role for an XmlListModel.
*/
@@ -411,7 +411,7 @@ void QmlXmlRoleList::insert(int i, QmlXmlListModelRole *role)
*/
/*!
- \qmlclass XmlListModel
+ \qmlclass XmlListModel QmlXmlListModel
\brief The XmlListModel element allows you to specify a model using XPath expressions.
XmlListModel allows you to construct a model from XML data that can then be used as a data source
diff --git a/src/declarative/fx/qfxeffects.cpp b/src/declarative/fx/qfxeffects.cpp
index 0ffe07c..8467dd7 100644
--- a/src/declarative/fx/qfxeffects.cpp
+++ b/src/declarative/fx/qfxeffects.cpp
@@ -49,7 +49,7 @@ QML_DECLARE_TYPE(QGraphicsBlurEffect)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Blur,QGraphicsBlurEffect)
/*!
- \qmlclass Blur
+ \qmlclass Blur QGraphicsBlurEffect
\brief The Blur object provides a blur effect.
A blur effect blurs the source item. This effect is useful for reducing details,
@@ -86,7 +86,7 @@ QML_DECLARE_TYPE(QGraphicsGrayscaleEffect)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Grayscale,QGraphicsGrayscaleEffect)
/*!
- \qmlclass Grayscale
+ \qmlclass Grayscale QGraphicsGrayscaleEffect
\brief The Grayscale object provides a grayscale effect.
A grayscale effect renders the source item in shades of gray.
@@ -105,7 +105,7 @@ QML_DECLARE_TYPE(QGraphicsColorizeEffect)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Colorize,QGraphicsColorizeEffect)
/*!
- \qmlclass Colorize
+ \qmlclass Colorize QGraphicsColorizeEffect
\brief The Colorize object provides a colorize effect.
A colorize effect renders the source item with a tint of its color.
@@ -133,7 +133,7 @@ QML_DECLARE_TYPE(QGraphicsPixelizeEffect)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Pixelize,QGraphicsPixelizeEffect)
/*!
- \qmlclass Pixelize
+ \qmlclass Pixelize QGraphicsPixelizeEffect
\brief The Pixelize object provides a pixelize effect.
A pixelize effect renders the source item in lower resolution. The resolution
@@ -159,7 +159,7 @@ QML_DECLARE_TYPE(QGraphicsDropShadowEffect)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,DropShadow,QGraphicsDropShadowEffect)
/*!
- \qmlclass DropShadow
+ \qmlclass DropShadow QGraphicsDropShadowEffect
\brief The DropShadow object provides a drop shadow effect.
A drop shadow effect renders the source item with a drop shadow. The color of
@@ -202,7 +202,7 @@ QML_DECLARE_TYPE(QGraphicsOpacityEffect)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Opacity,QGraphicsOpacityEffect)
/*!
- \qmlclass Opacity
+ \qmlclass Opacity QGraphicsOpacityEffect
\brief The Opacity object provides an opacity effect.
An opacity effect renders the source with an opacity. This effect is useful
@@ -228,7 +228,7 @@ QML_DECLARE_TYPE(QGraphicsBloomEffect)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Bloom,QGraphicsBloomEffect)
/*!
- \qmlclass Bloom
+ \qmlclass Bloom QGraphicsBloomEffect
\brief The Bloom object provides a bloom/glow effect.
A bloom/glow effect adds fringes of light around bright areas in the source item.
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index bf5e1bb..f1ab44f 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -344,7 +344,7 @@ void QFxFlickablePrivate::updateBeginningEnd()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flickable,QFxFlickable)
/*!
- \qmlclass Flickable
+ \qmlclass Flickable QFxFlickable
\brief The Flickable item provides a surface that can be "flicked".
\inherits Item
diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp
index 15ba804..959f9c3 100644
--- a/src/declarative/fx/qfxfocuspanel.cpp
+++ b/src/declarative/fx/qfxfocuspanel.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusPanel,QFxFocusPanel)
/*!
- \qmlclass FocusPanel
+ \qmlclass FocusPanel QFxFocusPanel
\brief The FocusPanel item explicitly creates a focus panel.
\inherits Item
diff --git a/src/declarative/fx/qfxfocusscope.cpp b/src/declarative/fx/qfxfocusscope.cpp
index 2ca43b9..d52d03d 100644
--- a/src/declarative/fx/qfxfocusscope.cpp
+++ b/src/declarative/fx/qfxfocusscope.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusScope,QFxFocusScope)
/*!
- \qmlclass FocusScope
+ \qmlclass FocusScope QFxFocusScope
\brief The FocusScope object explicitly creates a focus scope.
\inherits Item
diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp
index dea06bf..032c2b1 100644
--- a/src/declarative/fx/qfxgridview.cpp
+++ b/src/declarative/fx/qfxgridview.cpp
@@ -658,7 +658,7 @@ void QFxGridViewPrivate::updateCurrent(int modelIndex)
//----------------------------------------------------------------------------
/*!
- \qmlclass GridView
+ \qmlclass GridView QFxGridView
\inherits Flickable
\brief The GridView item provides a grid view of items provided by a model.
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 88dac8d..06cc654 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -79,7 +79,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
#include "qfxeffects.cpp"
/*!
- \qmlclass Transform
+ \qmlclass Transform QGraphicsTransform
\brief The Transform elements provide a way of building advanced transformations on Items.
The Transform elements let you create and control advanced transformations that can be configured
@@ -92,7 +92,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
*/
/*!
- \qmlclass Scale
+ \qmlclass Scale QGraphicsScale
\brief The Scale object provides a way to scale an Item.
The Scale object gives more control over scaling than using Item's scale property. Specifically,
@@ -130,7 +130,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
*/
/*!
- \qmlclass Rotation
+ \qmlclass Rotation QGraphicsRotation
\brief The Rotation object provides a way to rotate an Item.
The Rotation object gives more control over rotation than using Item's rotation property.
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index b959594..4928ef4 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -954,7 +954,7 @@ void QFxListViewPrivate::flickY(qreal velocity)
//----------------------------------------------------------------------------
/*!
- \qmlclass ListView
+ \qmlclass ListView QFxListView
\inherits Flickable
\brief The ListView item provides a list view of items provided by a model.
@@ -1679,37 +1679,46 @@ void QFxListView::trackedPositionChanged()
return;
if (!isFlicking() && !d->moving && d->moveReason != QFxListViewPrivate::Mouse) {
const qreal trackedPos = d->trackedItem->position();
+ const qreal viewPos = d->position();
if (d->haveHighlightRange) {
if (d->highlightRange == StrictlyEnforceRange) {
- qreal pos = d->position();
+ qreal pos = viewPos;
if (trackedPos > pos + d->highlightRangeEnd - d->trackedItem->size())
pos = trackedPos - d->highlightRangeEnd + d->trackedItem->size();
if (trackedPos < pos + d->highlightRangeStart)
pos = trackedPos - d->highlightRangeStart;
d->setPosition(pos);
} else {
- qreal pos = d->position();
+ qreal pos = viewPos;
if (trackedPos < d->startPosition() + d->highlightRangeStart) {
pos = d->startPosition();
} else if (d->trackedItem->endPosition() > d->endPosition() - d->size() + d->highlightRangeEnd) {
pos = d->endPosition() - d->size();
} else {
- if (trackedPos < d->position() + d->highlightRangeStart) {
+ if (trackedPos < viewPos + d->highlightRangeStart) {
pos = trackedPos - d->highlightRangeStart;
- } else if (trackedPos > d->position() + d->highlightRangeEnd - d->trackedItem->size()) {
+ } else if (trackedPos > viewPos + d->highlightRangeEnd - d->trackedItem->size()) {
pos = trackedPos - d->highlightRangeEnd + d->trackedItem->size();
}
}
d->setPosition(pos);
}
} else {
- if (trackedPos < d->position()) {
- d->setPosition(trackedPos);
+ if (trackedPos < viewPos && d->currentItem->position() < viewPos) {
+ d->setPosition(d->currentItem->position() < trackedPos ? trackedPos : d->currentItem->position());
d->fixupPosition();
- } else if (d->trackedItem->endPosition() > d->position() + d->size()) {
- qreal pos = d->trackedItem->endPosition() - d->size();
- if (d->trackedItem->size() > d->size())
- pos = trackedPos;
+ } else if (d->trackedItem->endPosition() > viewPos + d->size()
+ && d->currentItem->endPosition() > viewPos + d->size()) {
+ qreal pos;
+ if (d->trackedItem->endPosition() < d->currentItem->endPosition()) {
+ pos = d->trackedItem->endPosition() - d->size();
+ if (d->trackedItem->size() > d->size())
+ pos = trackedPos;
+ } else {
+ pos = d->currentItem->endPosition() - d->size();
+ if (d->currentItem->size() > d->size())
+ pos = d->currentItem->position();
+ }
d->setPosition(pos);
d->fixupPosition();
}
diff --git a/src/declarative/fx/qfxloader.cpp b/src/declarative/fx/qfxloader.cpp
index b0d0e78..9bc08c0 100644
--- a/src/declarative/fx/qfxloader.cpp
+++ b/src/declarative/fx/qfxloader.cpp
@@ -56,7 +56,7 @@ QFxLoaderPrivate::~QFxLoaderPrivate()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Loader,QFxLoader)
/*!
- \qmlclass Loader
+ \qmlclass Loader QFxLoader
\inherits Item
\brief The Loader item allows dynamically loading an Item-based
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index f8f9f7e..7f37a83 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -120,7 +120,7 @@ void QFxDrag::setYmax(qreal m)
}
/*!
- \qmlclass MouseRegion
+ \qmlclass MouseRegion QFxMouseRegion
\brief The MouseRegion item enables simple mouse handling.
\inherits Item
diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp
index fbc716d..6ac2ea0 100644
--- a/src/declarative/fx/qfxpath.cpp
+++ b/src/declarative/fx/qfxpath.cpp
@@ -57,7 +57,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathQuad,QFxPathQuad)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PathCubic,QFxPathCubic)
/*!
- \qmlclass PathElement
+ \qmlclass PathElement QFxPathElement
\brief PathElement is the base path type.
This type is the base for all path types. It cannot
@@ -464,7 +464,7 @@ void QFxCurve::setY(qreal y)
/****************************************************************************/
/*!
- \qmlclass PathAttribute
+ \qmlclass PathAttribute QFxPathAttribute
\brief The PathAttribute allows setting an attribute at a given position in a Path.
The PathAttribute object allows attibutes consisting of a name and
@@ -543,7 +543,7 @@ void QFxPathAttribute::setValue(qreal value)
/****************************************************************************/
/*!
- \qmlclass PathLine
+ \qmlclass PathLine QFxPathLine
\brief The PathLine defines a straight line.
The example below creates a path consisting of a straight line from
@@ -583,7 +583,7 @@ void QFxPathLine::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathQuad
+ \qmlclass PathQuad QFxPathQuad
\brief The PathQuad defines a quadratic Bezier curve with a control point.
The following QML produces the path shown below:
@@ -667,7 +667,7 @@ void QFxPathQuad::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathCubic
+ \qmlclass PathCubic QFxPathCubic
\brief The PathCubic defines a cubic Bezier curve with two control points.
The following QML produces the path shown below:
@@ -777,7 +777,7 @@ void QFxPathCubic::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathPercent
+ \qmlclass PathPercent QFxPathPercent
\brief The PathPercent manipulates the way a path is interpreted.
The examples below show the normal distrubution of items along a path
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index bb52813..fed88cd 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -97,7 +97,7 @@ private:
*/
/*!
- \qmlclass PathView
+ \qmlclass PathView QFxPathView
\brief The PathView element lays out model-provided items on a path.
\inherits Item
diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp
index 3dac816..1085ca0 100644
--- a/src/declarative/fx/qfxpositioners.cpp
+++ b/src/declarative/fx/qfxpositioners.cpp
@@ -333,7 +333,7 @@ void QFxBasePositioner::applyRemove(const QList<QPair<QString, QVariant> >& chan
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Column,QFxColumn)
/*!
- \qmlclass Column
+ \qmlclass Column QFxColumn
\brief The Column item lines up its children vertically.
\inherits Item
@@ -519,7 +519,7 @@ void QFxColumn::doPositioning()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Row,QFxRow)
/*!
- \qmlclass Row
+ \qmlclass Row QFxRow
\brief The Row item lines up its children horizontally.
\inherits Item
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index 9b833ef..657da55 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -59,7 +59,7 @@ QFxRepeaterPrivate::~QFxRepeaterPrivate()
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater)
/*!
- \qmlclass Repeater
+ \qmlclass Repeater QFxRepeater
\inherits Item
\brief The Repeater item allows you to repeat a component based on a model.
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 85fd525..b7b8b54 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextEdit,QFxTextEdit)
/*!
- \qmlclass TextEdit
+ \qmlclass TextEdit QFxTextEdit
\brief The TextEdit item allows you to add editable formatted text to a scene.
It can display both plain and rich text. For example:
diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp
index a99774f..d23fa04 100644
--- a/src/declarative/fx/qfxtextinput.cpp
+++ b/src/declarative/fx/qfxtextinput.cpp
@@ -54,7 +54,7 @@ QML_DEFINE_NOCREATE_TYPE(QValidator);
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QIntValidator,QIntValidator);
/*!
- \qmlclass TextInput
+ \qmlclass TextInput QFxTextInput
The TextInput item allows you to add an editable line of text to a scene.
TextInput can only display a single line of text, and can only display
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index 2652eda..b465c7e 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -208,7 +208,7 @@ public:
};
/*!
- \qmlclass WebView
+ \qmlclass WebView QFxWebView
\brief The WebView item allows you to add web content to a canvas.
\inherits Item
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index 6c00beb..4c02f95 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -5,7 +5,6 @@ SOURCES += qml/qmlparser.cpp \
qml/qmlexpression.cpp \
qml/qmlbinding.cpp \
qml/qmlmetaproperty.cpp \
- qml/qmlcomponentjs.cpp \
qml/qmlcomponent.cpp \
qml/qmlcontext.cpp \
qml/qmlcustomparser.cpp \
@@ -56,8 +55,6 @@ HEADERS += qml/qmlparser_p.h \
qml/qmlbinding.h \
qml/qmlbinding_p.h \
qml/qmlmetaproperty.h \
- qml/qmlcomponentjs_p.h \
- qml/qmlcomponentjs_p_p.h \
qml/qmlcomponent.h \
qml/qmlcomponent_p.h \
qml/qmlcustomparser_p.h \
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index 50767d6..b637c18 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -170,15 +170,15 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
if (!isUndefined && data->property.object() &&
!data->property.write(value, flags)) {
- QString fileName = data->fileName;
+ QUrl url = data->url;
int line = data->line;
- if (fileName.isEmpty()) fileName = QLatin1String("<Unknown File>");
+ if (url.isEmpty()) url = QUrl(QLatin1String("<Unknown File>"));
const char *valueType = 0;
if (value.userType() == QVariant::Invalid) valueType = "null";
else valueType = QMetaType::typeName(value.userType());
- data->error.setUrl(fileName);
+ data->error.setUrl(url);
data->error.setLine(line);
data->error.setColumn(-1);
data->error.setDescription(QLatin1String("Unable to assign ") +
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index cc177f9..4798406 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -76,6 +76,7 @@
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(compilerDump, QML_COMPILER_DUMP);
+DEFINE_BOOL_CONFIG_OPTION(compilerStatDump, QML_COMPILER_STATISTICS_DUMP);
using namespace QmlParser;
@@ -613,6 +614,8 @@ bool QmlCompiler::compile(QmlEngine *engine,
if (!isError()) {
if (compilerDump())
out->dumpInstructions();
+ if (compilerStatDump())
+ dumpStats();
} else {
reset(out);
}
@@ -664,6 +667,8 @@ void QmlCompiler::compileTree(Object *tree)
bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
{
+ componentStat.objects++;
+
Q_ASSERT (obj->type != -1);
const QmlCompiledData::TypeReference &tr =
output->types.at(obj->type);
@@ -1148,15 +1153,21 @@ bool QmlCompiler::buildComponentFromRoot(QmlParser::Object *obj,
const BindingContext &ctxt)
{
ComponentCompileState oldComponentCompileState = compileState;
+ ComponentStat oldComponentStat = componentStat;
+
compileState = ComponentCompileState();
compileState.root = obj;
+ componentStat = ComponentStat();
+ componentStat.lineNumber = obj->location.start.line;
+
if (obj)
COMPILE_CHECK(buildObject(obj, ctxt));
COMPILE_CHECK(completeComponentBuild());
compileState = oldComponentCompileState;
+ componentStat = oldComponentStat;
return true;
}
@@ -1646,6 +1657,7 @@ void QmlCompiler::saveComponentState()
Q_ASSERT(!savedCompileStates.contains(compileState.root));
savedCompileStates.insert(compileState.root, compileState);
+ savedComponentStats.append(componentStat);
}
QmlCompiler::ComponentCompileState
@@ -2454,6 +2466,8 @@ int QmlCompiler::genContextCache()
bool QmlCompiler::completeComponentBuild()
{
+ componentStat.ids = compileState.ids.count();
+
for (int ii = 0; ii < compileState.aliasingObjects.count(); ++ii) {
Object *aliasObject = compileState.aliasingObjects.at(ii);
COMPILE_CHECK(buildDynamicMeta(aliasObject, ResolveAliases));
@@ -2478,6 +2492,8 @@ bool QmlCompiler::completeComponentBuild()
QByteArray(bs.compileData(), bs.compileDataSize());
type = QmlExpressionPrivate::BasicScriptEngineData;
binding.isBasicScript = true;
+
+ componentStat.optimizedBindings++;
} else {
type = QmlExpressionPrivate::PreTransformedQtScriptData;
@@ -2495,6 +2511,8 @@ bool QmlCompiler::completeComponentBuild()
QByteArray((const char *)expression.constData(),
expression.length() * sizeof(QChar));
binding.isBasicScript = false;
+
+ componentStat.scriptBindings++;
}
binding.compiledData.prepend(QByteArray((const char *)&type,
sizeof(quint32)));
@@ -2505,6 +2523,19 @@ bool QmlCompiler::completeComponentBuild()
return true;
}
+void QmlCompiler::dumpStats()
+{
+ qWarning().nospace() << "QML Document: " << output->url.toString();
+ for (int ii = 0; ii < savedComponentStats.count(); ++ii) {
+ const ComponentStat &stat = savedComponentStats.at(ii);
+ qWarning().nospace() << " Component Line " << stat.lineNumber;
+ qWarning().nospace() << " Total Objects: " << stat.objects;
+ qWarning().nospace() << " IDs Used: " << stat.ids;
+ qWarning().nospace() << " Optimized Bindings: " << stat.optimizedBindings;
+ qWarning().nospace() << " QScript Bindings: " << stat.scriptBindings;
+ }
+}
+
/*!
Returns true if from can be assigned to a (QObject) property of type
to.
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index 9a37832..51c165e 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -255,6 +255,8 @@ private:
void addId(const QString &, QmlParser::Object *);
+ void dumpStats();
+
struct BindingReference {
QmlParser::Variant expression;
QmlParser::Property *property;
@@ -280,9 +282,25 @@ private:
};
ComponentCompileState compileState;
+ struct ComponentStat
+ {
+ ComponentStat()
+ : ids(0), scriptBindings(0), optimizedBindings(0), objects(0) {}
+
+ int lineNumber;
+
+ int ids;
+ int scriptBindings;
+ int optimizedBindings;
+ int objects;
+ };
+ ComponentStat componentStat;
+
void saveComponentState();
+
ComponentCompileState componentState(QmlParser::Object *);
QHash<QmlParser::Object *, ComponentCompileState> savedCompileStates;
+ QList<ComponentStat> savedComponentStats;
QList<QmlError> exceptions;
QmlCompiledData *output;
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 65af9a5..63f3cfb 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -409,6 +409,9 @@ valid for components created directly from QML.
*/
QmlContext *QmlComponent::creationContext() const
{
+ Q_D(const QmlComponent);
+ if(d->creationContext)
+ return d->creationContext;
QmlDeclarativeData *ddata = QmlDeclarativeData::get(this);
if (ddata)
return ddata->context;
@@ -417,6 +420,17 @@ QmlContext *QmlComponent::creationContext() const
}
/*!
+ \internal
+ Sets the QmlContext the component was created in. This is only
+ desirable for components created in QML script.
+*/
+void QmlComponent::setCreationContext(QmlContext* c)
+{
+ Q_D(QmlComponent);
+ d->creationContext = c;
+}
+
+/*!
Load the QmlComponent from the provided \a url.
*/
void QmlComponent::loadUrl(const QUrl &url)
@@ -462,6 +476,24 @@ QList<QmlError> QmlComponent::errors() const
}
/*!
+ \internal
+ errorsString is only meant as a way to get the errors in script
+*/
+QString QmlComponent::errorsString() const
+{
+ Q_D(const QmlComponent);
+ QString ret;
+ if(!isError())
+ return ret;
+ foreach(const QmlError &e, d->errors) {
+ ret += e.url().toString() + QLatin1String(":") +
+ QString::number(e.line()) + QLatin1String(" ") +
+ e.description() + QLatin1String("\n");
+ }
+ return ret;
+}
+
+/*!
Return the component URL. This is the URL passed to either the constructor,
or the loadUrl() or setData() methods.
*/
@@ -481,6 +513,22 @@ QmlComponent::QmlComponent(QmlComponentPrivate &dd, QObject *parent)
/*!
+ \internal
+ A version of create which returns a scriptObject, for use in script
+*/
+QScriptValue QmlComponent::createObject()
+{
+ Q_D(QmlComponent);
+ QmlContext* ctxt = creationContext();
+ if(!ctxt){
+ qWarning() << QLatin1String("createObject can only be used in QML");
+ return QScriptValue();
+ }
+ QObject* ret = create(ctxt);
+ return QmlEnginePrivate::qmlScriptObject(ret, d->engine);
+}
+
+/*!
Create an object instance from this component. Returns 0 if creation
failed. \a context specifies the context within which to create the object
instance.
diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h
index 2aa77d3..bd72f20 100644
--- a/src/declarative/qml/qmlcomponent.h
+++ b/src/declarative/qml/qmlcomponent.h
@@ -64,6 +64,10 @@ class Q_DECLARATIVE_EXPORT QmlComponent : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlComponent)
+ Q_PROPERTY(bool isNull READ isNull NOTIFY statusChanged)
+ Q_PROPERTY(bool isReady READ isReady NOTIFY statusChanged)
+ Q_PROPERTY(bool isError READ isError NOTIFY statusChanged)
+ Q_PROPERTY(bool isLoading READ isLoading NOTIFY statusChanged)
public:
QmlComponent(QObject *parent = 0);
@@ -84,6 +88,7 @@ public:
bool isLoading() const;
QList<QmlError> errors() const;
+ Q_INVOKABLE QString errorsString() const;
qreal progress() const;
@@ -93,9 +98,12 @@ public:
virtual QObject *beginCreate(QmlContext *);
virtual void completeCreate();
+ Q_INVOKABLE QScriptValue createObject();
+
void loadUrl(const QUrl &url);
void setData(const QByteArray &, const QUrl &baseUrl);
+ void setCreationContext(QmlContext*);
QmlContext *creationContext() const;
static QmlComponentAttached *qmlAttachedProperties(QObject *);
diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h
index 4b1a076..e69f541 100644
--- a/src/declarative/qml/qmlcomponent_p.h
+++ b/src/declarative/qml/qmlcomponent_p.h
@@ -76,7 +76,7 @@ class QmlComponentPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QmlComponent)
public:
- QmlComponentPrivate() : typeData(0), progress(0.), start(-1), count(-1), cc(0), componentAttacheds(0), completePending(false), engine(0) {}
+ QmlComponentPrivate() : typeData(0), progress(0.), start(-1), count(-1), cc(0), componentAttacheds(0), completePending(false), engine(0), creationContext(0) {}
QObject *create(QmlContext *context, const QBitField &);
@@ -104,6 +104,7 @@ public:
bool completePending;
QmlEngine *engine;
+ QmlContext *creationContext;
void clear();
diff --git a/src/declarative/qml/qmlcomponentjs.cpp b/src/declarative/qml/qmlcomponentjs.cpp
deleted file mode 100644
index 4a63542..0000000
--- a/src/declarative/qml/qmlcomponentjs.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmlcomponentjs_p.h"
-#include "qmlcomponentjs_p_p.h"
-#include "qmlengine_p.h"
-#include "qmlcomponent.h"
-
-QT_BEGIN_NAMESPACE
-
-QmlComponentJS::QmlComponentJS(QmlEngine *engine, QObject *parent)
- : QmlComponent(*(new QmlComponentJSPrivate), parent)
-{
- Q_D(QmlComponentJS);
- d->engine = engine;
- connect(this, SIGNAL(statusChanged(QmlComponent::Status)),
- this, SLOT(statusChange(QmlComponent::Status)));
-}
-
-QmlComponentJS::QmlComponentJS(QmlEngine *engine, const QUrl &url, QObject *parent)
- : QmlComponent(*(new QmlComponentJSPrivate), parent)
-{
- Q_D(QmlComponentJS);
- d->engine = engine;
- loadUrl(url);
- connect(this, SIGNAL(statusChanged(QmlComponent::Status)),
- this, SLOT(statusChange(QmlComponent::Status)));
-}
-
-void QmlComponentJS::setContext(QmlContext* c)
-{
- Q_D(QmlComponentJS);
- d->ctxt =c;
-}
-/*!
- Create a script object instance from this component. Returns a null
- script object if creation failed. It will create the instance in the
- same context that it was created it. QmlComponentJS is only
- meant to be created from with script - C++ developers should just use
- QmlComponent directly.
-
- Similar to QmlComponent::create(), but creates an object suitable
- for usage within scripts.
-*/
-QScriptValue QmlComponentJS::createObject()
-{
- Q_D(QmlComponentJS);
- QObject* ret = create(d->ctxt);
- return QmlEnginePrivate::qmlScriptObject(ret, d->engine);
-}
-
-/*!
- Return the list of errors that occured during the last compile or create
- operation, as a single string. An empty string is returned if isError()
- is not set.
-
- This function is similar to errors(), except more useful when called from
- QML. C++ code should usually use errors().
-
- \sa errors()
-*/
-QString QmlComponentJS::errorsString() const
-{
- Q_D(const QmlComponentJS);
- QString ret;
- if(!isError())
- return ret;
- foreach(const QmlError &e, d->errors) {
- ret += e.url().toString() + QLatin1String(":") +
- QString::number(e.line()) + QLatin1String(" ") +
- e.description() + QLatin1String("\n");
- }
- return ret;
-}
-
-
-void QmlComponentJS::statusChange(QmlComponent::Status newStatus)
-{
- Q_D(QmlComponentJS);
- if(newStatus == d->prevStatus)
- return;
- if(newStatus == QmlComponent::Null || d->prevStatus == QmlComponent::Null)
- emit isNullChanged();
- if(newStatus == QmlComponent::Ready || d->prevStatus == QmlComponent::Ready)
- emit isReadyChanged();
- if(newStatus == QmlComponent::Loading || d->prevStatus == QmlComponent::Loading)
- emit isLoadingChanged();
- if(newStatus == QmlComponent::Error || d->prevStatus == QmlComponent::Error)
- emit isErrorChanged();
- d->prevStatus = newStatus;
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlcomponentjs_p.h b/src/declarative/qml/qmlcomponentjs_p.h
deleted file mode 100644
index 488f355..0000000
--- a/src/declarative/qml/qmlcomponentjs_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLCOMPONENTJS_P_H
-#define QMLCOMPONENTJS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include <QtCore/qstring.h>
-#include <QtDeclarative/qfxglobal.h>
-#include <QtDeclarative/qml.h>
-#include <QtDeclarative/qmlcomponent.h>
-#include <QtDeclarative/qmlerror.h>
-
-QT_BEGIN_NAMESPACE
-
-class QmlComponentJSPrivate;
-class QmlEngine;
-class QmlContext;
-class Q_DECLARATIVE_EXPORT QmlComponentJS : public QmlComponent
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlComponentJS)
- Q_PROPERTY(bool isNull READ isNull NOTIFY isNullChanged)
- Q_PROPERTY(bool isReady READ isReady NOTIFY isReadyChanged)
- Q_PROPERTY(bool isError READ isError NOTIFY isErrorChanged)
- Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged)
- friend class QmlEngine;
-public:
- QmlComponentJS(QmlEngine *, const QUrl &url, QObject *parent = 0);
- QmlComponentJS(QmlEngine *, QObject *parent=0);
-
- Q_INVOKABLE QScriptValue createObject();
- Q_INVOKABLE QString errorsString() const;
-
- void setContext(QmlContext* c);
-Q_SIGNALS:
- void isNullChanged();
- void isErrorChanged();
- void isReadyChanged();
- void isLoadingChanged();
-private Q_SLOTS:
- void statusChange(QmlComponent::Status newStatus);
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlComponentJS)
-
-#endif // QMLCOMPONENTJS_P_H
diff --git a/src/declarative/qml/qmlcomponentjs_p_p.h b/src/declarative/qml/qmlcomponentjs_p_p.h
deleted file mode 100644
index 4cb412e..0000000
--- a/src/declarative/qml/qmlcomponentjs_p_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLCOMPONENTJS_P_P_H
-#define QMLCOMPONENTJS_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qmlcomponent.h"
-#include "qmlcomponentjs_p.h"
-#include "qmlcomponent_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QmlContext;
-class QmlComponentJSPrivate : public QmlComponentPrivate
-{
- Q_DECLARE_PUBLIC(QmlComponentJS)
-public:
- QmlComponentJSPrivate() : QmlComponentPrivate(),
- prevStatus(QmlComponentJS::Null), ctxt(0)
- { }
-
- QmlComponent::Status prevStatus;
- QmlContext* ctxt;
-};
-
-QT_END_NAMESPACE
-
-#endif // QMLCOMPONENTJS_P_P_H
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index f7f770e..71a6132 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -75,8 +75,8 @@
#include <QtGui/qcolor.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qsound.h>
+#include <QGraphicsObject>
#include <qmlcomponent.h>
-#include <private/qmlcomponentjs_p.h>
#include <private/qmlmetaproperty_p.h>
#include <private/qmlbinding_p.h>
#include <private/qmlvme_p.h>
@@ -110,14 +110,6 @@ struct StaticQtMetaObject : public QObject
{ return &static_cast<StaticQtMetaObject*> (0)->staticQtMetaObject; }
};
-QScriptValue desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
-{
- if(!ctxt->argumentCount())
- return e->newVariant(QVariant(false));
- bool ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString()));
- return e->newVariant(QVariant(ret));
-}
-
static QString userLocalDataPath(const QString& app)
{
return QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/") + app;
@@ -130,11 +122,10 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
inProgressCreations(0), scriptEngine(this), componentAttacheds(0), rootComponent(0),
networkAccessManager(0), typeManager(e), uniqueId(1)
{
+ // Note that all documentation for stuff put on the global object goes in
+ // doc/src/declarative/globalobject.qdoc
QScriptValue qtObject =
scriptEngine.newQMetaObject(StaticQtMetaObject::get());
- QScriptValue desktopObject = scriptEngine.newObject();
- desktopObject.setProperty(QLatin1String("openUrl"),scriptEngine.newFunction(desktopOpenUrl, 1));
- qtObject.setProperty(QLatin1String("DesktopServices"), desktopObject);
scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject);
offlineStoragePath = userLocalDataPath(QLatin1String("QML/OfflineStorage"));
@@ -156,6 +147,7 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
//misc methods
qtObject.setProperty(QLatin1String("playSound"), scriptEngine.newFunction(QmlEnginePrivate::playSound, 1));
+ qtObject.setProperty(QLatin1String("openUrlExternally"),scriptEngine.newFunction(desktopOpenUrl, 1));
scriptEngine.globalObject().setProperty(QLatin1String("createQmlObject"),
scriptEngine.newFunction(QmlEnginePrivate::createQmlObject, 1));
@@ -595,63 +587,10 @@ QmlContext *QmlEnginePrivate::getContext(QScriptContext *ctxt)
return contextClass->contextFromValue(scopeNode);
}
-/*!
- This function is intended for use inside QML only. In C++ just create a
- component object as usual.
-
- This function takes the URL of a QML file as its only argument. It returns
- a component object which can be used to create and load that QML file.
-
- Example QmlJS is below, remember that QML files that might be loaded
- over the network cannot be expected to be ready immediately.
- \code
- var component;
- var sprite;
- function finishCreation(){
- if(component.isReady()){
- sprite = component.createObject();
- if(sprite == 0){
- // Error Handling
- }else{
- sprite.parent = page;
- sprite.x = 200;
- //...
- }
- }else if(component.isError()){
- // Error Handling
- }
- }
-
- component = createComponent("Sprite.qml");
- if(component.isReady()){
- finishCreation();
- }else{
- component.statusChanged.connect(finishCreation);
- }
- \endcode
-
- If you are certain the files will be local, you could simplify to
-
- \code
- component = createComponent("Sprite.qml");
- sprite = component.createObject();
- if(sprite == 0){
- // Error Handling
- print(component.errorsString());
- }else{
- sprite.parent = page;
- sprite.x = 200;
- //...
- }
- \endcode
-
- If you want to just create an arbitrary string of QML, instead of
- loading a qml file, consider the createQmlObject() function.
-*/
QScriptValue QmlEnginePrivate::createComponent(QScriptContext *ctxt,
QScriptEngine *engine)
{
- QmlComponentJS* c;
+ QmlComponent* c;
QmlEnginePrivate *activeEnginePriv =
static_cast<QmlScriptEngine*>(engine)->p;
@@ -659,42 +598,17 @@ QScriptValue QmlEnginePrivate::createComponent(QScriptContext *ctxt,
QmlContext* context = activeEnginePriv->getContext(ctxt);
if(ctxt->argumentCount() != 1) {
- c = new QmlComponentJS(activeEngine);
+ c = new QmlComponent(activeEngine);
}else{
QUrl url = QUrl(context->resolvedUrl(ctxt->argument(0).toString()));
if(!url.isValid())
url = QUrl(ctxt->argument(0).toString());
- c = new QmlComponentJS(activeEngine, url, activeEngine);
+ c = new QmlComponent(activeEngine, url, activeEngine);
}
- c->setContext(context);
+ c->setCreationContext(context);
return engine->newQObject(c);
}
-/*!
- Creates a new object from the specified string of QML. It requires a
- second argument, which is the id of an existing QML object to use as
- the new object's parent. If a third argument is provided, this is used
- as the filepath that the qml came from.
-
- Example (where targetItem is the id of an existing QML item):
- \code
- newObject = createQmlObject('import Qt 4.6; Rectangle {color: "red"; width: 20; height: 20}',
- targetItem, "dynamicSnippet1");
- \endcode
-
- This function is intended for use inside QML only. It is intended to behave
- similarly to eval, but for creating QML elements.
-
- Returns the created object, or null if there is an error. In the case of an
- error, details of the error are output using qWarning().
-
- Note that this function returns immediately, and therefore may not work if
- the QML loads new components. If you are trying to load a new component,
- for example from a QML file, consider the createComponent() function
- instead. 'New components' refers to external QML files that have not yet
- been loaded, and so it is safe to use createQmlObject to load built-in
- components.
-*/
QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine)
{
QmlEnginePrivate *activeEnginePriv =
@@ -708,8 +622,6 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
QUrl url;
if(ctxt->argumentCount() > 2)
url = QUrl(ctxt->argument(2).toString());
- else
- url = QUrl(QLatin1String("DynamicQML"));
QObject *parentArg = activeEnginePriv->objectClass->toQObject(ctxt->argument(1));
QmlContext *qmlCtxt = qmlContext(parentArg);
if (url.isEmpty()) {
@@ -719,6 +631,7 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
}
QmlComponent component(activeEngine, qml.toUtf8(), url);
+
if(component.isError()) {
QList<QmlError> errors = component.errors();
qWarning() <<"QmlEngine::createQmlObject():";
@@ -741,38 +654,15 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
if(obj) {
obj->setParent(parentArg);
- obj->setProperty("parent", QVariant::fromValue<QObject*>(parentArg));
+ QGraphicsObject* gobj = qobject_cast<QGraphicsObject*>(obj);
+ QGraphicsObject* gparent = qobject_cast<QGraphicsObject*>(parentArg);
+ if(gobj && gparent)
+ gobj->setParentItem(gparent);
return qmlScriptObject(obj, activeEngine);
}
return engine->nullValue();
}
-/*!
- This function is intended for use inside QML only. In C++ just create a
- QVector3D as usual.
-
- This function takes three numeric components and combines them into a
- QVector3D value that can be used with any property that takes a
- QVector3D argument. The following QML code:
-
- \code
- transform: Rotation {
- id: rotation
- origin.x: Container.width / 2;
- axis: vector(0, 1, 1)
- }
- \endcode
-
- is equivalent to:
-
- \code
- transform: Rotation {
- id: rotation
- origin.x: Container.width / 2;
- axis.x: 0; axis.y: 1; axis.z: 0
- }
- \endcode
-*/
QScriptValue QmlEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() < 3)
@@ -898,19 +788,14 @@ QScriptValue QmlEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *en
return engine->undefinedValue();
}
-/*!
- This function allows tinting one color with another.
-
- 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.
-
- \qml
- Rectangle { x: 0; width: 80; height: 80; color: "lightsteelblue" }
- Rectangle { x: 100; width: 80; height: 80; color: Qt.tint("lightsteelblue", "#10FF0000") }
- \endqml
- \image declarative-rect_tint.png
+QScriptValue QmlEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
+{
+ if(ctxt->argumentCount() < 1)
+ return e->newVariant(QVariant(false));
+ bool ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString()));
+ return e->newVariant(QVariant(ret));
+}
- Tint is most useful when a subtle change is intended to be conveyed due to some event; you can then use tinting to more effectively tune the visible color.
-*/
QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() < 2)
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index 18f7f35..b050ef6 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -255,6 +255,7 @@ public:
QVariant scriptValueToVariant(const QScriptValue &);
static QScriptValue qmlScriptObject(QObject*, QmlEngine*);
+
static QScriptValue createComponent(QScriptContext*, QScriptEngine*);
static QScriptValue createQmlObject(QScriptContext*, QScriptEngine*);
static QScriptValue vector(QScriptContext*, QScriptEngine*);
@@ -269,6 +270,7 @@ public:
static QScriptValue tint(QScriptContext*, QScriptEngine*);
static QScriptValue playSound(QScriptContext*, QScriptEngine*);
+ static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*);
static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; }
static QmlEngine *getEngine(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p->q_func(); }
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index dc2d4cd..3924b35 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -92,7 +92,7 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, const QString &expr,
void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
QObject *me, const QUrl &url, int lineNumber)
{
- data->fileName = url.toString();
+ data->url = url;
data->line = lineNumber;
quint32 *exprData = (quint32 *)expr;
@@ -113,7 +113,7 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
#if !defined(Q_OS_SYMBIAN) //XXX Why doesn't this work?
if (!dd->programs.at(progIdx)) {
dd->programs[progIdx] =
- new QScriptProgram(data->expression, data->fileName, data->line);
+ new QScriptProgram(data->expression, data->url.toString(), data->line);
}
#endif
@@ -310,12 +310,12 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
if (data->expressionRewritten) {
data->expressionFunction = scriptEngine->evaluate(data->expression,
- data->fileName, data->line);
+ data->url.toString(), data->line);
} else {
QmlRewrite::RewriteBinding rewriteBinding;
const QString code = rewriteBinding(data->expression);
- data->expressionFunction = scriptEngine->evaluate(code, data->fileName, data->line);
+ data->expressionFunction = scriptEngine->evaluate(code, data->url.toString(), data->line);
}
scriptEngine->popContext();
@@ -484,7 +484,7 @@ void QmlExpression::setTrackChange(bool trackChange)
QUrl QmlExpression::sourceFile() const
{
Q_D(const QmlExpression);
- return QUrl(d->data->fileName);
+ return d->data->url;
}
/*!
@@ -498,13 +498,13 @@ int QmlExpression::lineNumber() const
}
/*!
- Set the location of this expression to \a line of \a fileName. This information
+ Set the location of this expression to \a line of \a url. This information
is used by the script engine.
*/
-void QmlExpression::setSourceLocation(const QUrl &fileName, int line)
+void QmlExpression::setSourceLocation(const QUrl &url, int line)
{
Q_D(QmlExpression);
- d->data->fileName = fileName.toString();
+ d->data->url = url;
d->data->line = line;
}
diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h
index 24c3987..ea572c3 100644
--- a/src/declarative/qml/qmlexpression_p.h
+++ b/src/declarative/qml/qmlexpression_p.h
@@ -98,7 +98,7 @@ public:
QObject *me;
bool trackChange;
- QString fileName;
+ QUrl url;
int line;
struct SignalGuard : public QGuard<QObject> {
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index d93af1f..5d6b4bb 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -139,7 +139,7 @@ QEasingCurve stringToCurve(const QString &curve)
QML_DEFINE_NOCREATE_TYPE(QmlAbstractAnimation)
/*!
- \qmlclass Animation
+ \qmlclass Animation QmlAbstractAnimation
\brief The Animation element is the base of all QML animations.
The Animation element cannot be used directly in a QML file. It exists
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 23ff60b..26aa7a7 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -72,7 +72,7 @@ struct ListModelData
static void dump(ModelNode *node, int ind);
/*!
- \qmlclass ListModel
+ \qmlclass ListModel QmlListModel
\brief The ListModel element defines a free-form list data source.
The ListModel is a simple hierarchy of elements containing data roles. The contents can
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index 325e7cf..d2c002b 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -127,11 +127,12 @@ public:
QObject *object;
QByteArray data;
- bool decoded;
- void decode();
- bool restore;
- bool isExplicit;
+ bool decoded : 1;
+ bool restore : 1;
+ bool isExplicit : 1;
+
+ void decode();
QList<QPair<QByteArray, QVariant> > properties;
QList<QPair<QByteArray, QmlExpression *> > expressions;
diff --git a/src/declarative/util/qmlspringfollow.cpp b/src/declarative/util/qmlspringfollow.cpp
index a12ef49..82a856d 100644
--- a/src/declarative/util/qmlspringfollow.cpp
+++ b/src/declarative/util/qmlspringfollow.cpp
@@ -56,8 +56,8 @@ class QmlSpringFollowPrivate : public QObjectPrivate
public:
QmlSpringFollowPrivate()
: sourceValue(0), maxVelocity(0), lastTime(0)
- , mass(1.0), useMass(false), spring(0.), damping(0.), velocity(0), epsilon(0.01)
- , modulus(0.0), haveModulus(false), enabled(true), mode(Track), clock(this) {}
+ , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01)
+ , modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {}
QmlMetaProperty property;
qreal currentValue;
@@ -66,14 +66,15 @@ public:
qreal velocityms;
int lastTime;
qreal mass;
- bool useMass;
qreal spring;
qreal damping;
qreal velocity;
qreal epsilon;
qreal modulus;
- bool haveModulus;
- bool enabled;
+
+ bool useMass : 1;
+ bool haveModulus : 1;
+ bool enabled : 1;
enum Mode {
Track,
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index fb3ef5c..f64b6ab 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -125,7 +125,7 @@ QmlStateOperation::QmlStateOperation(QObjectPrivate &dd, QObject *parent)
}
/*!
- \qmlclass State
+ \qmlclass State QmlState
\brief The State element defines configurations of objects and properties.
A state is specified as a set of batched changes from the default configuration.
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index 2cb1a94..af7f797 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -138,7 +138,7 @@ void QmlParentChangePrivate::doChange(QFxItem *targetParent, QFxItem *stackBefor
/*!
\preliminary
- \qmlclass ParentChange
+ \qmlclass ParentChange QmlParentChange
\brief The ParentChange element allows you to reparent an Item in a state change.
ParentChange reparents an Item while preserving its visual appearance (position, rotation,
@@ -352,7 +352,7 @@ QmlStateChangeScript::ActionList QmlStateChangeScript::actions()
}
/*!
- \qmlclass AnchorChanges
+ \qmlclass AnchorChanges QmlAnchorChanges
\brief The AnchorChanges element allows you to change the anchors of an item in a state.
\snippet examples/declarative/anchors/anchor-changes.qml 0
diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp
index ee90143..5c963b8 100644
--- a/src/declarative/util/qmltimer.cpp
+++ b/src/declarative/util/qmltimer.cpp
@@ -66,7 +66,7 @@ public:
};
/*!
- \qmlclass Timer QFxTimer
+ \qmlclass Timer QmlTimer
\brief The Timer item triggers a handler at a specified interval.
A timer can be used to trigger an action either once, or repeatedly