summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-05-07 09:15:32 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-05-07 09:15:32 (GMT)
commit695ddc4a13233c8e6f626fa205336f90f8c5a565 (patch)
tree88da8a1d80219e5788db3f4e138d1d281bb3d816 /src/declarative
parent1824eb63f6b2f8baa26b20c57fc50db84eefaa30 (diff)
parent67bf465253db71c0eddbc6ffcb811dd65c00b207 (diff)
downloadQt-695ddc4a13233c8e6f626fa205336f90f8c5a565.zip
Qt-695ddc4a13233c8e6f626fa205336f90f8c5a565.tar.gz
Qt-695ddc4a13233c8e6f626fa205336f90f8c5a565.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts: examples/declarative/dynamic/qml/itemCreation.js
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp21
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp23
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp15
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp10
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp17
-rw-r--r--src/declarative/qml/qdeclarativecontext_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp50
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp3
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp21
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp12
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp2
-rw-r--r--src/declarative/util/qdeclarativeview.cpp16
18 files changed, 137 insertions, 76 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index ef6d3df..7b413fb 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -378,9 +378,11 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
if (model->completePending()) {
// complete
listItem->item->setZValue(1);
+ listItem->item->setParentItem(q->viewport());
model->completeItem();
+ } else {
+ listItem->item->setParentItem(q->viewport());
}
- listItem->item->setParentItem(q->viewport());
unrequestedItems.remove(listItem->item);
}
requestedIndex = -1;
@@ -1054,7 +1056,7 @@ void QDeclarativeGridView::setModel(const QVariant &model)
}
/*!
- \qmlproperty component GridView::delegate
+ \qmlproperty Component GridView::delegate
The delegate provides a template defining each item instantiated by the view.
The index is exposed as an accessible \c index property. Properties of the
@@ -1172,7 +1174,7 @@ int QDeclarativeGridView::count() const
}
/*!
- \qmlproperty component GridView::highlight
+ \qmlproperty Component GridView::highlight
This property holds the component to use as the highlight.
An instance of the highlight component will be created for each view.
@@ -1415,6 +1417,9 @@ void QDeclarativeGridView::setWrapEnabled(bool wrap)
set to 40, then up to 2 delegates above and 2 delegates below the visible
area may be retained.
+ Note that cacheBuffer is not a pixel buffer - it only maintains additional
+ instantiated delegates.
+
Setting this value can make scrolling the list smoother at the expense
of additional memory usage. It is not a substitute for creating efficient
delegates; the fewer elements in a delegate, the faster a view may be
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 0395766..9433ba0 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -720,7 +720,7 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event)
*/
/*!
- \qmlproperty List<Object> Keys::forwardTo
+ \qmlproperty list<Object> Keys::forwardTo
This property provides a way to forward key presses, key releases, and keyboard input
coming from input methods to other items. This can be useful when you want
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 8485071..416e0a8 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -573,9 +573,11 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
if (model->completePending()) {
// complete
listItem->item->setZValue(1);
+ listItem->item->setParentItem(q->viewport());
model->completeItem();
+ } else {
+ listItem->item->setParentItem(q->viewport());
}
- listItem->item->setParentItem(q->viewport());
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
if (sectionCriteria && sectionCriteria->delegate()) {
@@ -648,7 +650,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
FxListItem *item = 0;
int pos = itemEnd + 1;
while (modelIndex < model->count() && pos <= fillTo) {
- //qDebug() << "refill: append item" << modelIndex << "pos" << pos;
+// qDebug() << "refill: append item" << modelIndex << "pos" << pos;
if (!(item = createItem(modelIndex)))
break;
item->setPosition(pos);
@@ -659,8 +661,8 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
if (doBuffer) // never buffer more than one item per frame
break;
}
- while (visibleIndex > 0 && visibleIndex <= model->count() && visiblePos > fillFrom) {
- //qDebug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos;
+ while (visibleIndex > 0 && visibleIndex <= model->count() && visiblePos-1 >= fillFrom) {
+// qDebug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos;
if (!(item = createItem(visibleIndex-1)))
break;
--visibleIndex;
@@ -676,7 +678,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
while (visibleItems.count() > 1 && (item = visibleItems.first()) && item->endPosition() < bufferFrom) {
if (item->attached->delayRemove())
break;
- //qDebug() << "refill: remove first" << visibleIndex << "top end pos" << item->endPosition();
+// qDebug() << "refill: remove first" << visibleIndex << "top end pos" << item->endPosition();
if (item->index != -1)
visibleIndex++;
visibleItems.removeFirst();
@@ -686,7 +688,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
while (visibleItems.count() > 1 && (item = visibleItems.last()) && item->position() > bufferTo) {
if (item->attached->delayRemove())
break;
- //qDebug() << "refill: remove last" << visibleIndex+visibleItems.count()-1;
+// qDebug() << "refill: remove last" << visibleIndex+visibleItems.count()-1 << item->position();
visibleItems.removeLast();
releaseItem(item);
changed = true;
@@ -1488,7 +1490,7 @@ void QDeclarativeListView::setModel(const QVariant &model)
}
/*!
- \qmlproperty component ListView::delegate
+ \qmlproperty Component ListView::delegate
The delegate provides a template defining each item instantiated by the view.
The index is exposed as an accessible \c index property. Properties of the
@@ -1608,7 +1610,7 @@ int QDeclarativeListView::count() const
}
/*!
- \qmlproperty component ListView::highlight
+ \qmlproperty Component ListView::highlight
This property holds the component to use as the highlight.
An instance of the highlight component will be created for each list.
@@ -1848,6 +1850,9 @@ void QDeclarativeListView::setWrapEnabled(bool wrap)
set to 40, then up to 2 delegates above and 2 delegates below the visible
area may be retained.
+ Note that cacheBuffer is not a pixel buffer - it only maintains additional
+ instantiated delegates.
+
Setting this value can make scrolling the list smoother at the expense
of additional memory usage. It is not a substitute for creating efficient
delegates; the fewer elements in a delegate, the faster a view may be
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index d178107..74f2338 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -288,6 +288,17 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
*/
/*!
+ \qmlsignal MouseArea::onCanceled()
+
+ This handler is called when the mouse events are canceled, either because the event was not accepted or
+ another element stole the mouse event handling. This signal is for advanced users, it's useful in case there
+ is more than one mouse areas handling input, or when there is a mouse area inside a flickable. In the latter
+ case, if you do some logic on pressed and then start dragging, the flickable will steal the mouse handling
+ from the mouse area. In these cases, to reset the logic when there is no mouse handling anymore, you should
+ use onCanceled, in addition to onReleased.
+*/
+
+/*!
\internal
\class QDeclarativeMouseArea
\brief The QDeclarativeMouseArea class provides a simple mouse handling abstraction for use within Qml.
@@ -562,10 +573,12 @@ bool QDeclarativeMouseArea::sceneEvent(QEvent *event)
// state
d->pressed = false;
setKeepMouseGrab(false);
- QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, false);
- emit released(&me);
+ emit canceled();
emit pressedChanged();
- setHovered(false);
+ if (d->hovered) {
+ d->hovered = false;
+ emit hoveredChanged();
+ }
}
}
return rv;
@@ -746,7 +759,7 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
/*!
\qmlproperty Item MouseArea::drag.target
\qmlproperty bool MouseArea::drag.active
- \qmlproperty Axis MouseArea::drag.axis
+ \qmlproperty enumeration MouseArea::drag.axis
\qmlproperty real MouseArea::drag.minimumX
\qmlproperty real MouseArea::drag.maximumX
\qmlproperty real MouseArea::drag.minimumY
@@ -757,7 +770,7 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
\list
\i \c target specifies the item to drag.
\i \c active specifies if the target item is being currently dragged.
- \i \c axis specifies whether dragging can be done horizontally (XAxis), vertically (YAxis), or both (XandYAxis)
+ \i \c axis specifies whether dragging can be done horizontally (Drag.XAxis), vertically (Drag.YAxis), or both (Drag.XandYAxis)
\i the minimum and maximum properties limit how far the target can be dragged along the corresponding axes.
\endlist
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index e3f523b..df77ac6 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -163,6 +163,7 @@ Q_SIGNALS:
void doubleClicked(QDeclarativeMouseEvent *mouse);
void entered();
void exited();
+ void canceled();
protected:
void setHovered(bool);
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
index 6430fae..c4f0b86 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
@@ -210,6 +210,8 @@ void QDeclarativePaintedItem::geometryChanged(const QRectF &newGeometry,
if (newGeometry.width() != oldGeometry.width() ||
newGeometry.height() != oldGeometry.height())
clearCache();
+
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
}
QVariant QDeclarativePaintedItem::itemChange(GraphicsItemChange change,
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 5c3a3c0..040fc98 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -561,7 +561,7 @@ void QDeclarativePathViewPrivate::setOffset(qreal o)
}
/*!
- \qmlproperty component PathView::highlight
+ \qmlproperty Component PathView::highlight
This property holds the component to use as the highlight.
An instance of the highlight component will be created for each view.
@@ -790,7 +790,7 @@ void QDeclarativePathView::setInteractive(bool interactive)
}
/*!
- \qmlproperty component PathView::delegate
+ \qmlproperty Component PathView::delegate
The delegate provides a template defining each item instantiated by the view.
The index is exposed as an accessible \c index property. Properties of the
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index d0ee2ee..d095dbe 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -728,7 +728,7 @@ void QDeclarativeTextEdit::setPersistentSelection(bool on)
}
/*
- \qmlproperty number TextEdit::textMargin
+ \qmlproperty real TextEdit::textMargin
The margin, in pixels, around the text in the TextEdit.
*/
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index a1fa8c6..9ae4e1a 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -706,14 +706,15 @@ bool QDeclarativeTextInput::hasAcceptableInput() const
}
/*!
- \qmlproperty TextInput.EchoMode TextInput::echoMode
+ \qmlproperty enumeration TextInput::echoMode
Specifies how the text should be displayed in the TextInput.
- The default is Normal, which displays the text as it is. Other values
- are Password, which displays asterixes instead of characters, NoEcho,
- which displays nothing, and PasswordEchoOnEdit, which displays all but the
- current character as asterixes.
-
+ \list
+ \o TextInput.Normal - Displays the text as it is. (Default)
+ \o TextInput.Password - Displays asterixes instead of characters.
+ \o TextInput.NoEcho - Displays nothing.
+ \o TextInput.PasswordEchoOnEdit - Displays all but the current character as asterixes.
+ \endlist
*/
QDeclarativeTextInput::EchoMode QDeclarativeTextInput::echoMode() const
{
@@ -1084,7 +1085,7 @@ void QDeclarativeTextInput::setPasswordCharacter(const QString &str)
\qmlproperty string TextInput::displayText
This is the text displayed in the TextInput.
-
+
If \l echoMode is set to TextInput::Normal, this holds the
same value as the TextInput::text property. Otherwise,
this property holds the text visible to the user, while
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index f01d4c2..1038c83 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -44,6 +44,7 @@
#include "qdeclarativeitem.h"
#include <qdeclarativecontext.h>
+#include <qdeclarativecontext_p.h>
#include <qdeclarativeengine.h>
#include <qdeclarativeexpression.h>
#include <qdeclarativepackage_p.h>
@@ -759,7 +760,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model)
}
/*!
- \qmlproperty component VisualDataModel::delegate
+ \qmlproperty Component VisualDataModel::delegate
The delegate provides a template defining each item instantiated by a view.
The index is exposed as an accessible \c index property. Properties of the
@@ -963,6 +964,13 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q
}
if (d->m_cache.releaseItem(obj)) {
+ // Remove any bindings to avoid warnings due to parent change.
+ QObjectPrivate *p = QObjectPrivate::get(obj);
+ Q_ASSERT(p->declarativeData);
+ QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
+ if (d->ownContext && d->context)
+ d->context->clearExpressions();
+
if (inPackage) {
emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj));
} else {
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index ae4223e..b61b8cb 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -528,13 +528,8 @@ void QDeclarativeContextData::invalidate()
parent = 0;
}
-void QDeclarativeContextData::destroy()
+void QDeclarativeContextData::clearExpressions()
{
- if (linkedContext)
- linkedContext->destroy();
-
- if (engine) invalidate();
-
QDeclarativeAbstractExpression *expression = expressions;
while (expression) {
QDeclarativeAbstractExpression *nextExpression = expression->m_nextExpression;
@@ -546,6 +541,16 @@ void QDeclarativeContextData::destroy()
expression = nextExpression;
}
expressions = 0;
+}
+
+void QDeclarativeContextData::destroy()
+{
+ if (linkedContext)
+ linkedContext->destroy();
+
+ if (engine) invalidate();
+
+ clearExpressions();
while (contextObjects) {
QDeclarativeData *co = contextObjects;
diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h
index c7fb099..6b6cd0a 100644
--- a/src/declarative/qml/qdeclarativecontext_p.h
+++ b/src/declarative/qml/qdeclarativecontext_p.h
@@ -113,6 +113,7 @@ class QDeclarativeContextData
public:
QDeclarativeContextData();
QDeclarativeContextData(QDeclarativeContext *);
+ void clearExpressions();
void destroy();
void invalidate();
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 6ddd01e..9f5cafe 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -329,8 +329,10 @@ void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o)
QObjectPrivate *p = QObjectPrivate::get(o);
Q_ASSERT(p->declarativeData);
QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
- if (d->ownContext)
+ if (d->ownContext && d->context) {
d->context->destroy();
+ d->context = 0;
+ }
}
void QDeclarativeData::destroyed(QAbstractDeclarativeData *d, QObject *o)
@@ -962,7 +964,7 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS
Q_ASSERT(context);
if(ctxt->argumentCount() != 1) {
- return ctxt->throwError("Qt.createComponent(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.createComponent(): Invalid arguments"));
}else{
QString arg = ctxt->argument(0).toString();
if (arg.isEmpty())
@@ -982,7 +984,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
if(ctxt->argumentCount() < 2 || ctxt->argumentCount() > 3)
- return ctxt->throwError("Qt.createQmlObject(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.createQmlObject(): Invalid arguments"));
QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt);
Q_ASSERT(context);
@@ -1002,7 +1004,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QObject *parentArg = activeEnginePriv->objectClass->toQObject(ctxt->argument(1));
if(!parentArg)
- return ctxt->throwError("Qt.createQmlObject(): Missing parent object");
+ return ctxt->throwError(QLatin1String("Qt.createQmlObject(): Missing parent object"));
QDeclarativeComponent component(activeEngine);
component.setData(qml.toUtf8(), url);
@@ -1027,7 +1029,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
}
if (!component.isReady())
- return ctxt->throwError("Qt.createQmlObject(): Component is not ready");
+ return ctxt->throwError(QLatin1String("Qt.createQmlObject(): Component is not ready"));
QObject *obj = component.beginCreate(context->asQDeclarativeContext());
if(obj)
@@ -1076,7 +1078,7 @@ QScriptValue QDeclarativeEnginePrivate::isQtObject(QScriptContext *ctxt, QScript
QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 3)
- return ctxt->throwError("Qt.vector(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.vector(): Invalid arguments"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
qsreal z = ctxt->argument(2).toNumber();
@@ -1087,7 +1089,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError("Qt.formatDate(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.formatDate(): Invalid arguments"));
QDate date = ctxt->argument(0).toDateTime().date();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1098,7 +1100,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else {
- return ctxt->throwError("Qt.formatDate(): Invalid date format");
+ return ctxt->throwError(QLatin1String("Qt.formatDate(): Invalid date format"));
}
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
@@ -1108,7 +1110,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError("Qt.formatTime(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.formatTime(): Invalid arguments"));
QTime date = ctxt->argument(0).toDateTime().time();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1119,7 +1121,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else {
- return ctxt->throwError("Qt.formatTime(): Invalid time format");
+ return ctxt->throwError(QLatin1String("Qt.formatTime(): Invalid time format"));
}
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
@@ -1129,7 +1131,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError("Qt.formatDateTime(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.formatDateTime(): Invalid arguments"));
QDateTime date = ctxt->argument(0).toDateTime();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1140,7 +1142,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else {
- return ctxt->throwError("Qt.formatDateTime(): Invalid datetime format");
+ return ctxt->throwError(QLatin1String("Qt.formatDateTime(): Invalid datetime format"));
}
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
@@ -1150,7 +1152,7 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return ctxt->throwError("Qt.rgba(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.rgba(): Invalid arguments"));
qsreal r = ctxt->argument(0).toNumber();
qsreal g = ctxt->argument(1).toNumber();
qsreal b = ctxt->argument(2).toNumber();
@@ -1172,7 +1174,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return ctxt->throwError("Qt.hsla(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.hsla(): Invalid arguments"));
qsreal h = ctxt->argument(0).toNumber();
qsreal s = ctxt->argument(1).toNumber();
qsreal l = ctxt->argument(2).toNumber();
@@ -1193,7 +1195,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 4)
- return ctxt->throwError("Qt.rect(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.rect(): Invalid arguments"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
@@ -1209,7 +1211,7 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.point(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.point(): Invalid arguments"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QPointF(x, y)));
@@ -1218,7 +1220,7 @@ QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngin
QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.size(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.size(): Invalid arguments"));
qsreal w = ctxt->argument(0).toNumber();
qsreal h = ctxt->argument(1).toNumber();
return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QSizeF(w, h)));
@@ -1227,7 +1229,7 @@ QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1 && ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.lighter(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.lighter(): Invalid arguments"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1249,7 +1251,7 @@ QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEng
QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1 && ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.darker(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.darker(): Invalid arguments"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1282,7 +1284,7 @@ QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QSc
QScriptValue QDeclarativeEnginePrivate::fontFamilies(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() != 0)
- return ctxt->throwError("Qt.fontFamilies(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.fontFamilies(): Invalid arguments"));
QDeclarativeEnginePrivate *p = QDeclarativeEnginePrivate::get(e);
QFontDatabase database;
@@ -1292,7 +1294,7 @@ QScriptValue QDeclarativeEnginePrivate::fontFamilies(QScriptContext *ctxt, QScri
QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
{
if (ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.md5(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.md5(): Invalid arguments"));
QByteArray data = ctxt->argument(0).toString().toUtf8();
QByteArray result = QCryptographicHash::hash(data, QCryptographicHash::Md5);
@@ -1303,7 +1305,7 @@ QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
{
if (ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.btoa(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.btoa(): Invalid arguments"));
QByteArray data = ctxt->argument(0).toString().toUtf8();
@@ -1313,7 +1315,7 @@ QScriptValue QDeclarativeEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
{
if (ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.atob(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.atob(): Invalid arguments"));
QByteArray data = ctxt->argument(0).toString().toUtf8();
@@ -1414,7 +1416,7 @@ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptE
QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.tint(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.tint(): Invalid arguments"));
//get color
QVariant v = ctxt->argument(0).toVariant();
QColor color;
diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index ffed14e..c980a2a 100644
--- a/src/declarative/qml/qdeclarativeinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -78,8 +78,9 @@ QT_BEGIN_NAMESPACE
\endcode
*/
-struct QDeclarativeInfoPrivate
+class QDeclarativeInfoPrivate
{
+public:
QDeclarativeInfoPrivate() : ref (1), object(0) {}
int ref;
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index b7e1832..94205fe 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -46,6 +46,7 @@
#include "private/qdeclarativerefcount_p.h"
#include "private/qdeclarativeengine_p.h"
#include "private/qdeclarativeexpression_p.h"
+#include "qdeclarativeglobal_p.h"
#include <QtCore/qobject.h>
#include <QtScript/qscriptvalue.h>
@@ -94,6 +95,8 @@
QT_BEGIN_NAMESPACE
+DEFINE_BOOL_CONFIG_OPTION(xhrDump, QML_XHR_DUMP);
+
class DocumentImpl;
class NodeImpl
{
@@ -1131,6 +1134,14 @@ void QDeclarativeXMLHttpRequest::requestFromUrl(const QUrl &url)
}
}
+ if (xhrDump()) {
+ qWarning().nospace() << "XMLHttpRequest: " << qPrintable(m_method) << " " << qPrintable(url.toString());
+ if (!m_data.isEmpty()) {
+ qWarning().nospace() << " "
+ << qPrintable(QString::fromUtf8(m_data));
+ }
+ }
+
if (m_method == QLatin1String("GET"))
m_network = networkAccessManager()->get(request);
else if (m_method == QLatin1String("HEAD"))
@@ -1264,6 +1275,16 @@ void QDeclarativeXMLHttpRequest::finished()
if (cbv.isError()) printError(cbv);
}
m_responseEntityBody.append(m_network->readAll());
+
+ if (xhrDump()) {
+ qWarning().nospace() << "XMLHttpRequest: RESPONSE " << qPrintable(m_url.toString());
+ if (!m_responseEntityBody.isEmpty()) {
+ qWarning().nospace() << " "
+ << qPrintable(QString::fromUtf8(m_responseEntityBody));
+ }
+ }
+
+
m_data.clear();
destroyNetwork();
if (m_state < Loading) {
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 206621b..0f7c946 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -755,7 +755,7 @@ void QDeclarativeScriptAction::setScript(const QDeclarativeScriptString &script)
}
/*!
- \qmlproperty QString ScriptAction::scriptName
+ \qmlproperty string ScriptAction::scriptName
This property holds the the name of the StateChangeScript to run.
This property is only valid when ScriptAction is used as part of a transition.
@@ -791,7 +791,7 @@ void QDeclarativeScriptActionPrivate::execute()
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.evaluate();
- if (expr.hasError())
+ if (expr.hasError())
qmlInfo(q) << expr.error();
}
}
@@ -844,7 +844,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation()
The PropertyAction is immediate -
the target property is not animated to the selected value in any way.
-
+
\sa QtDeclarative
*/
/*!
@@ -2347,7 +2347,7 @@ QDeclarativeParentAnimation::~QDeclarativeParentAnimation()
}
/*!
- \qmlproperty item ParentAnimation::target
+ \qmlproperty Item ParentAnimation::target
The item to reparent.
When used in a transition, if no target is specified all
@@ -2370,7 +2370,7 @@ void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target)
}
/*!
- \qmlproperty item ParentAnimation::newParent
+ \qmlproperty Item ParentAnimation::newParent
The new parent to animate to.
If not set, then the parent defined in the end state of the transition.
@@ -2392,7 +2392,7 @@ void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent)
}
/*!
- \qmlproperty item ParentAnimation::via
+ \qmlproperty Item ParentAnimation::via
The item to reparent via. This provides a way to do an unclipped animation
when both the old parent and new parent are clipped
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 3810256..0985a6b 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -591,7 +591,7 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap)
Changes the \a property of the item at \a index in the list model to \a value.
\code
- fruitModel.set(3, "cost", 5.95)
+ fruitModel.setProperty(3, "cost", 5.95)
\endcode
The \a index must be an element in the list.
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 62d913c..833e284 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -484,10 +484,7 @@ QSize QDeclarativeViewPrivate::rootObjectSize()
QSize rootObjectSize(0,0);
int widthCandidate = -1;
int heightCandidate = -1;
- if (declarativeItemRoot) {
- widthCandidate = declarativeItemRoot->width();
- heightCandidate = declarativeItemRoot->height();
- } else if (root) {
+ if (root) {
QSizeF size = root->boundingRect().size();
widthCandidate = size.width();
heightCandidate = size.height();
@@ -614,16 +611,15 @@ bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e)
/*!
\internal
- Preferred size follows the root object in
- resize mode SizeViewToRootObject and
- the view in resize mode SizeRootObjectToView.
+ Preferred size follows the root object geometry.
*/
QSize QDeclarativeView::sizeHint() const
{
- if (d->resizeMode == SizeRootObjectToView) {
+ QSize rootObjectSize = d->rootObjectSize();
+ if (rootObjectSize.isEmpty()) {
return size();
- } else { // d->resizeMode == SizeViewToRootObject
- return d->rootObjectSize();
+ } else {
+ return rootObjectSize;
}
}