summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-07 04:01:41 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-07 04:01:41 (GMT)
commitd4e0060d3e8961f0c802289dd6eebf9688be2fc7 (patch)
tree472590cd15e6372e32ad334dcdd3cb4cc731f02a
parent19a566f82a7c684423331a8caab70ec594afd1ce (diff)
parentf2d08b168a116dd048ec1a38dd3b710de08a4a8e (diff)
downloadQt-d4e0060d3e8961f0c802289dd6eebf9688be2fc7.zip
Qt-d4e0060d3e8961f0c802289dd6eebf9688be2fc7.tar.gz
Qt-d4e0060d3e8961f0c802289dd6eebf9688be2fc7.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Cleanup minehunt example Keep track of the item count to avoid calling model->count() during batched changes Allow iteration over the Item.children property Add QListModelInterface::modelReset() signal and emit this in Compile Allow MouseArea.Drag.target to be reset. Document MouseEvent.accepted. Initialize drag movement correctly if drag.target is set after mouse move. Expand test. Honor the startDragThreshold in MouseArea drag. Don't crash if a target isn't specified for AnchorChanges. Optimization: Only allocate QScriptValue if we need too Crash: Assign context in CreateSimpleObject too Optimization: Minor object allocation speedup Optimization: Improve allocation strategy for QDeclarativeDeclarativeData
-rw-r--r--demos/declarative/minehunt/minehunt.qml274
-rw-r--r--src/corelib/kernel/qobject.cpp8
-rw-r--r--src/corelib/kernel/qobject_p.h5
-rw-r--r--src/declarative/3rdparty/qlistmodelinterface.cpp6
-rw-r--r--src/declarative/3rdparty/qlistmodelinterface_p.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp35
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp38
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp6
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp45
-rw-r--r--src/declarative/qml/qdeclarativedeclarativedata_p.h14
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp21
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h7
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp10
-rw-r--r--src/declarative/qml/qdeclarativemetatype_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp10
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp28
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp12
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp25
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel_p.h1
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp20
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h5
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml21
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp33
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml28
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp45
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml14
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp15
-rw-r--r--tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp54
35 files changed, 562 insertions, 278 deletions
diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml
index 2ca6c4c..2798b4f 100644
--- a/demos/declarative/minehunt/minehunt.qml
+++ b/demos/declarative/minehunt/minehunt.qml
@@ -3,188 +3,142 @@ import "MinehuntCore" 1.0
Item {
id: field
- width: 370
- height: 480
-
- property int clickx : 0
- property int clicky : 0
-
- resources: [
- Component {
- id: tile
- Flipable {
- id: flipable
- width: 40
- height: 40
- property int angle: 0;
- transform: Rotation {
- origin.x: 20
- origin.y: 20
- axis.x: 1
- axis.z: 0
- angle: flipable.angle;
+ property int clickx: 0
+ property int clicky: 0
+
+ width: 450; height: 450
+
+ Component {
+ id: tile
+
+ Flipable {
+ id: flipable
+ property int angle: 0
+
+ width: 40; height: 40
+ transform: Rotation { origin.x: 20; origin.y: 20; axis.x: 1; axis.z: 0; angle: flipable.angle }
+
+ front: Image {
+ source: "MinehuntCore/pics/front.png"; width: 40; height: 40
+
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter
+ source: "MinehuntCore/pics/flag.png"; opacity: modelData.hasFlag
+
+ Behavior on opacity { NumberAnimation { property: "opacity"; duration: 250 } }
}
- front: Image {
- source: "MinehuntCore/pics/front.png"
- width: 40
- height: 40
- Image {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source: "MinehuntCore/pics/flag.png"
- opacity: modelData.hasFlag
- Behavior on opacity {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
+ }
+
+ back: Image {
+ source: "MinehuntCore/pics/back.png"
+ width: 40; height: 40
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter
+ text: modelData.hint; color: "white"; font.bold: true
+ opacity: !modelData.hasMine && modelData.hint > 0
}
- back: Image {
- source: "MinehuntCore/pics/back.png"
- width: 40
- height: 40
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- text: modelData.hint
- color: "white"
- font.bold: true
- opacity: !modelData.hasMine && modelData.hint > 0
- }
- Image {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source: "MinehuntCore/pics/bomb.png"
- opacity: modelData.hasMine
- }
- Explosion {
- id: expl
- }
+
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter
+ source: "MinehuntCore/pics/bomb.png"; opacity: modelData.hasMine
}
- states: [
- State {
- name: "back"
- when: modelData.flipped
- PropertyChanges { target: flipable; angle: 180 }
- }
- ]
- transitions: [
- Transition {
- SequentialAnimation {
- PauseAnimation {
- duration: {
- var ret;
- if(flipable.parent != null)
- ret = Math.abs(flipable.parent.x-field.clickx)
- + Math.abs(flipable.parent.y-field.clicky);
- else
- ret = 0;
- if (ret > 0) {
- if (modelData.hasMine && modelData.flipped) {
- ret*3;
- } else {
- ret;
- }
- } else {
- 0;
- }
+
+ Explosion { id: expl }
+ }
+
+ states: State {
+ name: "back"; when: modelData.flipped
+ PropertyChanges { target: flipable; angle: 180 }
+ }
+
+ transitions: Transition {
+ SequentialAnimation {
+ PauseAnimation {
+ duration: {
+ var ret
+ if (flipable.parent != null)
+ ret = Math.abs(flipable.parent.x - field.clickx)
+ + Math.abs(flipable.parent.y - field.clicky)
+ else
+ ret = 0
+ if (ret > 0) {
+ if (modelData.hasMine && modelData.flipped) {
+ ret * 3
+ } else {
+ ret
}
+ } else {
+ 0
}
- NumberAnimation {
- easing.type: "InOutQuad"
- properties: "angle"
- }
- ScriptAction{
- script: if(modelData.hasMine && modelData.flipped){expl.explode = true;}
- }
- }
- }
- ]
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton | Qt.RightButton
- onPressed: {
- field.clickx = flipable.parent.x;
- field.clicky = flipable.parent.y;
- var row = Math.floor(index/9);
- var col = index - (Math.floor(index/9) * 9);
- if (mouse.button==undefined || mouse.button==Qt.RightButton) {
- flag(row,col);
- } else {
- flip(row,col);
}
}
+ NumberAnimation { easing.type: "InOutQuad"; properties: "angle" }
+ ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } }
}
}
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ field.clickx = flipable.parent.x
+ field.clicky = flipable.parent.y
+ var row = Math.floor(index / 9)
+ var col = index - (Math.floor(index / 9) * 9)
+ if (mouse.button == undefined || mouse.button == Qt.RightButton)
+ flag(row, col)
+ else
+ flip(row, col)
+ }
+ onPressAndHold: {
+ field.clickx = flipable.parent.x
+ field.clicky = flipable.parent.y
+ var row = Math.floor(index / 9)
+ var col = index - (Math.floor(index / 9) * 9)
+ flag(row, col)
+ }
+ }
}
- ]
- Image {
- source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg"
- fillMode: Image.Tile
}
- Repeater {
- id: repeater
- model: tiles
- x: 1
- y: 1
- Component {
- Loader {
- sourceComponent: tile
- x: (index - (Math.floor(index/9) * 9)) * 41
- y: Math.floor(index/9) * 41
- }
+
+ Image { source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg"; anchors.fill: parent; fillMode: Image.Tile }
+
+ Grid {
+ anchors.horizontalCenter: parent.horizontalCenter
+ columns: 9; spacing: 1
+
+ Repeater {
+ id: repeater
+ model: tiles
+ Component { Loader { sourceComponent: tile } }
}
}
+
Row {
id: gamedata
- // width: 370
- // height: 100
- y: 400
- x: 20
- spacing: 20
+ x: 20; spacing: 20
+ anchors.bottom: field.bottom; anchors.bottomMargin: 15
+
Column {
spacing: 2
- width: childrenRect.width
- Image {
- // x: 100
- // y: 20
- source: "MinehuntCore/pics/bomb-color.png"
- }
- Text {
- // x: 100
- // y: 60
- anchors.horizontalCenter: parent.horizontalCenter
- color: "white"
- text: numMines
- }
+ Image { source: "MinehuntCore/pics/bomb-color.png" }
+ Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numMines }
}
+
Column {
spacing: 2
- width: childrenRect.width
- Image {
- // x: 140
- // y: 20
- source: "MinehuntCore/pics/flag-color.png"
- }
- Text {
- // x: 140
- // y: 60
- anchors.horizontalCenter: parent.horizontalCenter
- color: "white"
- text: numFlags
- }
+ Image { source: "MinehuntCore/pics/flag-color.png" }
+ Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numFlags }
}
}
+
Image {
- y: 390
- anchors.right: field.right
- anchors.rightMargin: 20
- source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png'
- MouseArea {
- anchors.fill: parent
- onPressed: { reset() }
+ anchors.bottom: field.bottom; anchors.bottomMargin: 15
+ anchors.right: field.right; anchors.rightMargin: 20
+ source: isPlaying ? 'MinehuntCore/pics/face-smile.png'
+ : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png'
+
+ MouseArea { anchors.fill: parent; onPressed: reset() }
}
- }
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 330de20..411f22e 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -125,8 +125,10 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *)
}
}
+void (*QDeclarativeData::destroyed)(QDeclarativeData *, QObject *) = 0;
+void (*QDeclarativeData::parentChanged)(QDeclarativeData *, QObject *, QObject *) = 0;
+
QObjectData::~QObjectData() {}
-QDeclarativeData::~QDeclarativeData() {}
QObjectPrivate::QObjectPrivate(int version)
: threadData(0), connectionLists(0), senders(0), currentSender(0), currentChildBeingDeleted(0)
@@ -876,7 +878,7 @@ QObject::~QObject()
}
if (d->declarativeData)
- d->declarativeData->destroyed(this);
+ QDeclarativeData::destroyed(d->declarativeData, this);
{
QMutex *signalSlotMutex = 0;
@@ -2025,7 +2027,7 @@ void QObjectPrivate::setParent_helper(QObject *o)
}
}
if (!wasDeleted && declarativeData)
- declarativeData->parentChanged(q, o);
+ QDeclarativeData::parentChanged(declarativeData, q, o);
}
/*!
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 3b59abb..e5d904c 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -87,9 +87,8 @@ enum { QObjectPrivateVersion = QT_VERSION };
class Q_CORE_EXPORT QDeclarativeData
{
public:
- virtual ~QDeclarativeData();
- virtual void destroyed(QObject *) = 0;
- virtual void parentChanged(QObject *, QObject *) = 0;
+ static void (*destroyed)(QDeclarativeData *, QObject *);
+ static void (*parentChanged)(QDeclarativeData *, QObject *, QObject *);
};
class Q_CORE_EXPORT QObjectPrivate : public QObjectData
diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/3rdparty/qlistmodelinterface.cpp
index 98d6a5b..20501a0 100644
--- a/src/declarative/3rdparty/qlistmodelinterface.cpp
+++ b/src/declarative/3rdparty/qlistmodelinterface.cpp
@@ -106,4 +106,10 @@ QT_BEGIN_NAMESPACE
\a roles changed.
*/
+/*! \fn void QListModelInterface::modelReset()
+ Emit this signal when all of the model data has changed.
+ This is more efficient than forcing the receivier to handle multiple
+ inserted and removed signals etc.
+*/
+
QT_END_NAMESPACE
diff --git a/src/declarative/3rdparty/qlistmodelinterface_p.h b/src/declarative/3rdparty/qlistmodelinterface_p.h
index 07592ad..da91d12 100644
--- a/src/declarative/3rdparty/qlistmodelinterface_p.h
+++ b/src/declarative/3rdparty/qlistmodelinterface_p.h
@@ -72,6 +72,7 @@ class Q_DECLARATIVE_EXPORT QListModelInterface : public QObject
void itemsRemoved(int index, int count);
void itemsMoved(int from, int to, int count);
void itemsChanged(int index, int count, const QList<int> &roles);
+ void modelReset();
protected:
QListModelInterface(QObjectPrivate &dd, QObject *parent)
diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp
index 6118ea8..a181071 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp
@@ -133,6 +133,17 @@ Item {
These properties hold the position of the mouse event.
*/
+
+/*!
+ \qmlproperty bool MouseEvent::accepted
+
+ Setting \a accepted to true prevents the mouse event from being
+ propagated to items below this item.
+
+ Generally, if the item acts on the mouse event then it should be accepted
+ so that items lower in the stacking order do not also respond to the same event.
+*/
+
/*!
\qmlproperty enum MouseEvent::button
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 8247f17..3ad18cf 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -102,7 +102,7 @@ public:
QDeclarativeGridViewPrivate()
: currentItem(0), flow(QDeclarativeGridView::LeftToRight)
, visibleIndex(0) , currentIndex(-1)
- , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1)
+ , cellWidth(100), cellHeight(100), columns(1), itemCount(0), requestedIndex(-1)
, highlightRangeStart(0), highlightRangeEnd(0), highlightRange(QDeclarativeGridView::NoHighlightRange)
, highlightComponent(0), highlight(0), trackedItem(0)
, moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0)
@@ -315,6 +315,7 @@ public:
int cellHeight;
int columns;
int requestedIndex;
+ int itemCount;
qreal highlightRangeStart;
qreal highlightRangeEnd;
QDeclarativeGridView::HighlightRangeMode highlightRange;
@@ -358,6 +359,7 @@ void QDeclarativeGridViewPrivate::clear()
currentItem = 0;
createHighlight();
trackedItem = 0;
+ itemCount = 0;
}
FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
@@ -403,6 +405,7 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
if (!isValid() || !q->isComponentComplete())
return;
+ itemCount = model->count();
qreal bufferFrom = from - buffer;
qreal bufferTo = to + buffer;
qreal fillFrom = from;
@@ -546,6 +549,10 @@ void QDeclarativeGridViewPrivate::layout()
{
Q_Q(QDeclarativeGridView);
layoutScheduled = false;
+ if (!isValid()) {
+ clear();
+ return;
+ }
if (visibleItems.count()) {
qreal rowPos = visibleItems.first()->rowPos();
qreal colPos = visibleItems.first()->colPos();
@@ -1780,13 +1787,15 @@ void QDeclarativeGridView::componentComplete()
{
Q_D(QDeclarativeGridView);
QDeclarativeFlickable::componentComplete();
- d->updateGrid();
- refill();
- if (d->currentIndex < 0)
- d->updateCurrent(0);
- else
- d->updateCurrent(d->currentIndex);
- d->fixupPosition();
+ if (d->isValid()) {
+ d->updateGrid();
+ refill();
+ if (d->currentIndex < 0)
+ d->updateCurrent(0);
+ else
+ d->updateCurrent(d->currentIndex);
+ d->fixupPosition();
+ }
}
void QDeclarativeGridView::trackedPositionChanged()
@@ -1859,6 +1868,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count)
} else if (d->currentIndex < 0) {
d->updateCurrent(0);
}
+ d->itemCount += count;
emit countChanged();
return;
}
@@ -1889,6 +1899,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count)
emit currentIndexChanged();
}
d->scheduleLayout();
+ d->itemCount += count;
emit countChanged();
return;
}
@@ -1976,6 +1987,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count)
for (int j = 0; j < added.count(); ++j)
added.at(j)->attached->emitAdd();
+ d->itemCount += count;
emit countChanged();
}
@@ -1984,6 +1996,8 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count)
Q_D(QDeclarativeGridView);
if (!isComponentComplete())
return;
+
+ d->itemCount -= count;
bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count;
bool removedVisible = false;
@@ -2031,7 +2045,8 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count)
d->releaseItem(d->currentItem);
d->currentItem = 0;
d->currentIndex = -1;
- d->updateCurrent(qMin(modelIndex, d->model->count()-1));
+ if (d->itemCount)
+ d->updateCurrent(qMin(modelIndex, d->itemCount-1));
}
// update visibleIndex
@@ -2046,7 +2061,7 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count)
if (removedVisible && d->visibleItems.isEmpty()) {
d->timeline.clear();
d->setPosition(0);
- if (d->model->count() == 0)
+ if (d->itemCount == 0)
update();
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index e85d60f..31d97f3 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -152,7 +152,7 @@ public:
: currentItem(0), orient(QDeclarativeListView::Vertical)
, visiblePos(0), visibleIndex(0)
, averageSize(100.0), currentIndex(-1), requestedIndex(-1)
- , highlightRangeStart(0), highlightRangeEnd(0)
+ , itemCount(0), highlightRangeStart(0), highlightRangeEnd(0)
, highlightComponent(0), highlight(0), trackedItem(0)
, moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0)
, sectionCriteria(0), spacing(0.0)
@@ -447,6 +447,7 @@ public:
qreal averageSize;
int currentIndex;
int requestedIndex;
+ int itemCount;
qreal highlightRangeStart;
qreal highlightRangeEnd;
QDeclarativeComponent *highlightComponent;
@@ -501,6 +502,7 @@ void QDeclarativeListViewPrivate::init()
void QDeclarativeListViewPrivate::clear()
{
+ timeline.clear();
for (int i = 0; i < visibleItems.count(); ++i)
releaseItem(visibleItems.at(i));
visibleItems.clear();
@@ -516,6 +518,8 @@ void QDeclarativeListViewPrivate::clear()
trackedItem = 0;
minExtentDirty = true;
maxExtentDirty = true;
+ setPosition(0);
+ itemCount = 0;
}
FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
@@ -594,6 +598,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
Q_Q(QDeclarativeListView);
if (!isValid() || !q->isComponentComplete())
return;
+ itemCount = model->count();
qreal bufferFrom = from - buffer;
qreal bufferTo = to + buffer;
qreal fillFrom = from;
@@ -698,6 +703,10 @@ void QDeclarativeListViewPrivate::layout()
{
Q_Q(QDeclarativeListView);
layoutScheduled = false;
+ if (!isValid()) {
+ clear();
+ return;
+ }
updateSections();
if (!visibleItems.isEmpty()) {
int oldEnd = visibleItems.last()->endPosition();
@@ -711,8 +720,6 @@ void QDeclarativeListViewPrivate::layout()
if (currentItem && currentIndex > lastVisibleIndex())
currentItem->setPosition(currentItem->position() + (visibleItems.last()->endPosition() - oldEnd));
}
- if (!isValid())
- return;
q->refill();
minExtentDirty = true;
maxExtentDirty = true;
@@ -2314,13 +2321,15 @@ void QDeclarativeListView::componentComplete()
{
Q_D(QDeclarativeListView);
QDeclarativeFlickable::componentComplete();
- refill();
- d->moveReason = QDeclarativeListViewPrivate::SetIndex;
- if (d->currentIndex < 0)
- d->updateCurrent(0);
- else
- d->updateCurrent(d->currentIndex);
- d->fixupPosition();
+ if (d->isValid()) {
+ refill();
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
+ if (d->currentIndex < 0)
+ d->updateCurrent(0);
+ else
+ d->updateCurrent(d->currentIndex);
+ d->fixupPosition();
+ }
}
void QDeclarativeListView::refill()
@@ -2401,6 +2410,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count)
} else if (d->currentIndex < 0) {
d->updateCurrent(0);
}
+ d->itemCount += count;
emit countChanged();
return;
}
@@ -2432,6 +2442,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count)
emit currentIndexChanged();
}
d->scheduleLayout();
+ d->itemCount += count;
emit countChanged();
return;
}
@@ -2524,6 +2535,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count)
for (int j = 0; j < added.count(); ++j)
added.at(j)->attached->emitAdd();
+ d->itemCount += count;
emit countChanged();
}
@@ -2534,6 +2546,7 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count)
return;
d->moveReason = QDeclarativeListViewPrivate::Other;
d->updateUnrequestedIndexes();
+ d->itemCount -= count;
FxListItem *firstVisible = d->firstVisibleItem();
int preRemovedSize = 0;
@@ -2586,7 +2599,8 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count)
d->releaseItem(d->currentItem);
d->currentItem = 0;
d->currentIndex = -1;
- d->updateCurrent(qMin(modelIndex, d->model->count()-1));
+ if (d->itemCount)
+ d->updateCurrent(qMin(modelIndex, d->itemCount-1));
}
// update visibleIndex
@@ -2602,7 +2616,7 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count)
d->visiblePos = d->header ? d->header->size() : 0;
d->timeline.clear();
d->setPosition(0);
- if (d->model->count() == 0)
+ if (d->itemCount == 0)
update();
}
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 816aa78..c95bd29 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -71,6 +71,14 @@ void QDeclarativeDrag::setTarget(QGraphicsObject *t)
emit targetChanged();
}
+void QDeclarativeDrag::resetTarget()
+{
+ if (!_target)
+ return;
+ _target = 0;
+ emit targetChanged();
+}
+
QDeclarativeDrag::Axis QDeclarativeDrag::axis() const
{
return _axis;
@@ -412,8 +420,8 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (d->drag && d->drag->target()) {
if (!d->moved) {
- if (d->dragX) d->startX = drag()->target()->x();
- if (d->dragY) d->startY = drag()->target()->y();
+ d->startX = drag()->target()->x();
+ d->startY = drag()->target()->y();
}
QPointF startLocalPos;
@@ -439,7 +447,7 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
- if (d->dragX) {
+ if (d->dragX && d->dragged) {
qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX;
if (x < drag()->xmin())
x = drag()->xmin();
@@ -447,7 +455,7 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
x = drag()->xmax();
drag()->target()->setX(x);
}
- if (d->dragY) {
+ if (d->dragY && d->dragged) {
qreal y = (curLocalPos.y() - startLocalPos.y()) + d->startY;
if (y < drag()->ymin())
y = drag()->ymin();
@@ -455,8 +463,8 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
y = drag()->ymax();
drag()->target()->setY(y);
}
+ d->moved = true;
}
- d->moved = true;
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
emit positionChanged(&me);
}
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index db49b57..58faac1 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -55,7 +55,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDrag : public QObject
Q_OBJECT
Q_ENUMS(Axis)
- Q_PROPERTY(QGraphicsObject *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(QGraphicsObject *target READ target WRITE setTarget NOTIFY targetChanged RESET resetTarget)
Q_PROPERTY(Axis axis READ axis WRITE setAxis NOTIFY axisChanged)
Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin NOTIFY minimumXChanged)
Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax NOTIFY maximumXChanged)
@@ -69,6 +69,7 @@ public:
QGraphicsObject *target() const;
void setTarget(QGraphicsObject *);
+ void resetTarget();
enum Axis { XAxis=0x01, YAxis=0x02, XandYAxis=0x03 };
Axis axis() const;
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 2938f51..174459b 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -662,6 +662,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model)
this, SLOT(_q_itemsRemoved(int,int)));
QObject::disconnect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)),
this, SLOT(_q_itemsMoved(int,int,int)));
+ QObject::disconnect(d->m_listModelInterface, SIGNAL(modelReset()), this, SLOT(_q_modelReset()));
d->m_listModelInterface = 0;
} else if (d->m_abstractItemModel) {
QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsInserted(const QModelIndex &,int,int)),
@@ -705,6 +706,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model)
this, SLOT(_q_itemsRemoved(int,int)));
QObject::connect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)),
this, SLOT(_q_itemsMoved(int,int,int)));
+ QObject::connect(d->m_listModelInterface, SIGNAL(modelReset()), this, SLOT(_q_modelReset()));
d->m_metaDataCacheable = true;
if (d->m_delegate && d->m_listModelInterface->count())
emit itemsInserted(0, d->m_listModelInterface->count());
@@ -1152,6 +1154,8 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count,
void QDeclarativeVisualDataModel::_q_itemsInserted(int index, int count)
{
Q_D(QDeclarativeVisualDataModel);
+ if (!count)
+ return;
// XXX - highly inefficient
QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef> items;
for (QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
@@ -1179,6 +1183,8 @@ void QDeclarativeVisualDataModel::_q_itemsInserted(int index, int count)
void QDeclarativeVisualDataModel::_q_itemsRemoved(int index, int count)
{
Q_D(QDeclarativeVisualDataModel);
+ if (!count)
+ return;
// XXX - highly inefficient
QHash<int, QDeclarativeVisualDataModelPrivate::ObjectRef> items;
for (QHash<int, QDeclarativeVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index f4ccce1..b12d6f4 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -881,23 +881,38 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
}
// Create the object
- QDeclarativeInstruction create;
- create.type = QDeclarativeInstruction::CreateObject;
- create.line = obj->location.start.line;
- create.create.column = obj->location.start.column;
- create.create.data = -1;
- if (!obj->custom.isEmpty())
- create.create.data = output->indexForByteArray(obj->custom);
- create.create.type = obj->type;
- if (!output->types.at(create.create.type).type &&
- !obj->bindingBitmask.isEmpty()) {
- Q_ASSERT(obj->bindingBitmask.size() % 4 == 0);
- create.create.bindingBits =
- output->indexForByteArray(obj->bindingBitmask);
+ if (obj->custom.isEmpty() && output->types.at(obj->type).type &&
+ obj != compileState.root) {
+
+ QDeclarativeInstruction create;
+ create.type = QDeclarativeInstruction::CreateSimpleObject;
+ create.line = obj->location.start.line;
+ create.createSimple.create = output->types.at(obj->type).type->createFunction();
+ create.createSimple.typeSize = output->types.at(obj->type).type->createSize();
+ create.createSimple.column = obj->location.start.column;
+ output->bytecode << create;
+
} else {
- create.create.bindingBits = -1;
+
+ QDeclarativeInstruction create;
+ create.type = QDeclarativeInstruction::CreateObject;
+ create.line = obj->location.start.line;
+ create.create.column = obj->location.start.column;
+ create.create.data = -1;
+ if (!obj->custom.isEmpty())
+ create.create.data = output->indexForByteArray(obj->custom);
+ create.create.type = obj->type;
+ if (!output->types.at(create.create.type).type &&
+ !obj->bindingBitmask.isEmpty()) {
+ Q_ASSERT(obj->bindingBitmask.size() % 4 == 0);
+ create.create.bindingBits =
+ output->indexForByteArray(obj->bindingBitmask);
+ } else {
+ create.create.bindingBits = -1;
+ }
+ output->bytecode << create;
+
}
- output->bytecode << create;
// Setup the synthesized meta object if necessary
if (!obj->metadata.isEmpty()) {
diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h
index adfff19..87c5c9c 100644
--- a/src/declarative/qml/qdeclarativedeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h
@@ -64,6 +64,10 @@ class QDeclarativeAbstractBinding;
class QDeclarativeContext;
class QDeclarativePropertyCache;
class QDeclarativeContextData;
+// This class is structured in such a way, that simply zero'ing it is the
+// default state for elemental object allocations. This is crucial in the
+// workings of the QDeclarativeInstruction::CreateSimpleObject instruction.
+// Don't change anything here without first considering that case!
class Q_AUTOTEST_EXPORT QDeclarativeDeclarativeData : public QDeclarativeData
{
public:
@@ -71,10 +75,10 @@ public:
: ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0),
bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0),
- attachedProperties(0), propertyCache(0), guards(0) {}
+ attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) {}
- virtual void destroyed(QObject *);
- virtual void parentChanged(QObject *, QObject *);
+ void destroyed(QObject *);
+ void parentChanged(QObject *, QObject *);
void setImplicitDestructible() {
if (!explicitIndestructibleSet) indestructible = false;
@@ -109,7 +113,9 @@ public:
QHash<int, QObject *> *attachedProperties;
- QScriptValue scriptValue;
+ // ### Can we make this QScriptValuePrivate so we incur no additional allocation
+ // cost?
+ QScriptValue *scriptValue;
QDeclarativePropertyCache *propertyCache;
QDeclarativeGuard<QObject> *guards;
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 52a1f45..f7d1df3 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -346,6 +346,17 @@ Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer);
typedef QMap<QString, QString> StringStringMap;
Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri
+
+static void QDeclarativeDeclarativeData_destroyed(QDeclarativeData *d, QObject *o)
+{
+ static_cast<QDeclarativeDeclarativeData *>(d)->destroyed(o);
+}
+
+static void QDeclarativeDeclarativeData_parentChanged(QDeclarativeData *d, QObject *o, QObject *p)
+{
+ static_cast<QDeclarativeDeclarativeData *>(d)->parentChanged(o, p);
+}
+
void QDeclarativeEnginePrivate::init()
{
Q_Q(QDeclarativeEngine);
@@ -353,6 +364,9 @@ void QDeclarativeEnginePrivate::init()
qRegisterMetaType<QDeclarativeScriptString>("QDeclarativeScriptString");
qRegisterMetaType<QScriptValue>("QScriptValue");
+ QDeclarativeData::destroyed = QDeclarativeDeclarativeData_destroyed;
+ QDeclarativeData::parentChanged = QDeclarativeDeclarativeData_parentChanged;
+
contextClass = new QDeclarativeContextScriptClass(q);
objectClass = new QDeclarativeObjectScriptClass(q);
valueTypeClass = new QDeclarativeValueTypeScriptClass(q);
@@ -848,15 +862,16 @@ void QDeclarativeDeclarativeData::destroyed(QObject *object)
if (ownContext)
context->destroy();
+ if (scriptValue)
+ delete scriptValue;
+
if (ownMemory)
delete this;
- else
- this->~QDeclarativeDeclarativeData();
}
void QDeclarativeDeclarativeData::parentChanged(QObject *, QObject *parent)
{
- if (!parent && scriptValue.isValid()) scriptValue = QScriptValue();
+ if (!parent && scriptValue) { delete scriptValue; scriptValue = 0; }
}
bool QDeclarativeDeclarativeData::hasBindingBit(int bit) const
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index 3cf4d2b..1f8b8af 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -60,6 +60,8 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
break;
case QDeclarativeInstruction::CreateObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t\t\t" << types.at(instr->create.type).className;
+ case QDeclarativeInstruction::CreateSimpleObject:
+ qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize;
break;
case QDeclarativeInstruction::SetId:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value);
diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index 877179d..1f3c964 100644
--- a/src/declarative/qml/qdeclarativeinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -74,6 +74,7 @@ public:
// top of the stack.
Init, /* init */
CreateObject, /* create */
+ CreateSimpleObject, /* createSimple */
SetId, /* setId */
SetDefault,
CreateComponent, /* createComponent */
@@ -175,6 +176,11 @@ public:
int bindingBits;
ushort column;
};
+ struct CreateSimpleInstruction {
+ void (*create)(void *);
+ int typeSize;
+ ushort column;
+ };
struct StoreMetaInstruction {
int data;
int aliasData;
@@ -305,6 +311,7 @@ public:
union {
InitInstruction init;
CreateInstruction create;
+ CreateSimpleInstruction createSimple;
StoreMetaInstruction storeMeta;
SetIdInstruction setId;
AssignValueSourceInstruction assignValueSource;
diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
index af21765..56cc219 100644
--- a/src/declarative/qml/qdeclarativemetatype.cpp
+++ b/src/declarative/qml/qdeclarativemetatype.cpp
@@ -313,6 +313,16 @@ QDeclarativeCustomParser *QDeclarativeType::customParser() const
return d->m_customParser;
}
+QDeclarativeType::CreateFunc QDeclarativeType::createFunction() const
+{
+ return d->m_newFunc;
+}
+
+int QDeclarativeType::createSize() const
+{
+ return d->m_allocationSize;
+}
+
bool QDeclarativeType::isCreatable() const
{
return d->m_newFunc != 0;
diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h
index b3ec5e3..96e3c74 100644
--- a/src/declarative/qml/qdeclarativemetatype_p.h
+++ b/src/declarative/qml/qdeclarativemetatype_p.h
@@ -115,6 +115,10 @@ public:
QObject *create() const;
void create(QObject **, void **, size_t) const;
+ typedef void (*CreateFunc)(void *);
+ CreateFunc createFunction() const;
+ int createSize() const;
+
QDeclarativeCustomParser *customParser() const;
bool isCreatable() const;
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index d3ee67b..759a506 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -109,11 +109,11 @@ QScriptValue QDeclarativeObjectScriptClass::newQObject(QObject *object, int type
return scriptEngine->undefinedValue();
} else if (!ddata->indestructible && !object->parent()) {
return newObject(scriptEngine, this, new ObjectData(object, type));
- } else if (!ddata->scriptValue.isValid()) {
- ddata->scriptValue = newObject(scriptEngine, this, new ObjectData(object, type));
- return ddata->scriptValue;
- } else if (ddata->scriptValue.engine() == QDeclarativeEnginePrivate::getScriptEngine(engine)) {
- return ddata->scriptValue;
+ } else if (!ddata->scriptValue) {
+ ddata->scriptValue = new QScriptValue(newObject(scriptEngine, this, new ObjectData(object, type)));
+ return *ddata->scriptValue;
+ } else if (ddata->scriptValue->engine() == QDeclarativeEnginePrivate::getScriptEngine(engine)) {
+ return *ddata->scriptValue;
} else {
return newObject(scriptEngine, this, new ObjectData(object, type));
}
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index 5ba7f9b..0117880 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -236,13 +236,39 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
}
} else {
QDeclarative_setParent_noEvent(o, parent);
- // o->setParent(parent);
}
}
stack.push(o);
}
break;
+ case QDeclarativeInstruction::CreateSimpleObject:
+ {
+ QObject *o = (QObject *)operator new(instr.createSimple.typeSize +
+ sizeof(QDeclarativeDeclarativeData));
+ ::bzero(o, instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData));
+ instr.createSimple.create(o);
+
+ QDeclarativeDeclarativeData *ddata =
+ (QDeclarativeDeclarativeData *)(((const char *)o) + instr.createSimple.typeSize);
+ ddata->lineNumber = instr.line;
+ ddata->columnNumber = instr.createSimple.column;
+
+ QObjectPrivate::get(o)->declarativeData = ddata;
+ ddata->context = ddata->outerContext = ctxt;
+ ddata->nextContextObject = ctxt->contextObjects;
+ if (ddata->nextContextObject)
+ ddata->nextContextObject->prevContextObject = &ddata->nextContextObject;
+ ddata->prevContextObject = &ctxt->contextObjects;
+ ctxt->contextObjects = ddata;
+
+ QObject *parent = stack.top();
+ QDeclarative_setParent_noEvent(o, parent);
+
+ stack.push(o);
+ }
+ break;
+
case QDeclarativeInstruction::SetId:
{
QObject *target = stack.top();
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 2cc1fcc..410a269 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -1090,6 +1090,9 @@ bool QDeclarativeAnchorChanges::changesBindings()
void QDeclarativeAnchorChanges::saveOriginals()
{
Q_D(QDeclarativeAnchorChanges);
+ if (!d->target)
+ return;
+
d->origLeft = d->target->anchors()->left();
d->origRight = d->target->anchors()->right();
d->origHCenter = d->target->anchors()->horizontalCenter();
@@ -1146,6 +1149,9 @@ void QDeclarativeAnchorChanges::copyOriginals(QDeclarativeActionEvent *other)
void QDeclarativeAnchorChanges::clearBindings()
{
Q_D(QDeclarativeAnchorChanges);
+ if (!d->target)
+ return;
+
d->fromX = d->target->x();
d->fromY = d->target->y();
d->fromWidth = d->target->width();
@@ -1242,6 +1248,9 @@ void QDeclarativeAnchorChanges::rewind()
void QDeclarativeAnchorChanges::saveCurrentValues()
{
Q_D(QDeclarativeAnchorChanges);
+ if (!d->target)
+ return;
+
d->rewindLeft = d->target->anchors()->left();
d->rewindRight = d->target->anchors()->right();
d->rewindHCenter = d->target->anchors()->horizontalCenter();
@@ -1259,6 +1268,9 @@ void QDeclarativeAnchorChanges::saveCurrentValues()
void QDeclarativeAnchorChanges::saveTargetValues()
{
Q_D(QDeclarativeAnchorChanges);
+ if (!d->target)
+ return;
+
d->toX = d->target->x();
d->toY = d->target->y();
d->toWidth = d->target->width();
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index b33af06..11c7305 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -878,21 +878,22 @@ void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult &
}
}
if (!hasKeys) {
- if (!(origCount == 0 && d->size == 0)) {
- emit itemsRemoved(0, origCount);
- emit itemsInserted(0, d->size);
- emit countChanged();
- }
+ if (!(origCount == 0 && d->size == 0))
+ emit modelReset();
} else {
+ if (result.removed.count() == 1 && result.removed[0].first == 0
+ && result.removed[0].second == origCount) {
+ emit modelReset();
+ } else {
+ for (int i=0; i<result.removed.count(); i++)
+ emit itemsRemoved(result.removed[i].first, result.removed[i].second);
+ for (int i=0; i<result.inserted.count(); i++)
+ emit itemsInserted(result.inserted[i].first, result.inserted[i].second);
- for (int i=0; i<result.removed.count(); i++)
- emit itemsRemoved(result.removed[i].first, result.removed[i].second);
- for (int i=0; i<result.inserted.count(); i++)
- emit itemsInserted(result.inserted[i].first, result.inserted[i].second);
-
- if (sizeChanged)
- emit countChanged();
+ if (sizeChanged)
+ emit countChanged();
+ }
}
emit statusChanged(d->status);
diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h
index 7b85476..fd410a7 100644
--- a/src/declarative/util/qdeclarativexmllistmodel_p.h
+++ b/src/declarative/util/qdeclarativexmllistmodel_p.h
@@ -124,6 +124,7 @@ Q_SIGNALS:
void xmlChanged();
void queryChanged();
void namespaceDeclarationsChanged();
+ void modelReset();
public Q_SLOTS:
// ### need to use/expose Expiry to guess when to call this?
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index d6daf4d..150343e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7615,11 +7615,26 @@ void QGraphicsObject::updateMicroFocus()
QGraphicsItem::updateMicroFocus();
}
-void QGraphicsItemPrivate::append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
+void QGraphicsItemPrivate::children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
{
QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast<QGraphicsObject *>(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0);
}
+int QGraphicsItemPrivate::children_count(QDeclarativeListProperty<QGraphicsObject> *list)
+{
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
+ return d->children.count();
+}
+
+QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGraphicsObject> *list, int index)
+{
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
+ if (index >= 0 && index < d->children.count())
+ return d->children.at(index)->toGraphicsObject();
+ else
+ return 0;
+}
+
/*!
Returns a list of this item's children.
@@ -7632,7 +7647,8 @@ QDeclarativeListProperty<QGraphicsObject> QGraphicsItemPrivate::childrenList()
Q_Q(QGraphicsItem);
if (isObject) {
QGraphicsObject *that = static_cast<QGraphicsObject *>(q);
- return QDeclarativeListProperty<QGraphicsObject>(that, &children, QGraphicsItemPrivate::append);
+ return QDeclarativeListProperty<QGraphicsObject>(that, &children, children_append,
+ children_count, children_at);
} else {
//QGraphicsItem is not supported for this property
return QDeclarativeListProperty<QGraphicsObject>();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 73b8f04..922581d 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -480,9 +480,12 @@ public:
void resetFocusProxy();
virtual void subFocusItemChange();
+ static void children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item);
+ static int children_count(QDeclarativeListProperty<QGraphicsObject> *list);
+ static QGraphicsObject *children_at(QDeclarativeListProperty<QGraphicsObject> *list, int);
+
inline QTransform transformToParent() const;
inline void ensureSortedChildren();
- static void append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item);
static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b);
void ensureSequentialSiblingIndex();
inline void sendScenePosChange();
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index e88026c..9353d10 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1478,7 +1478,7 @@ QWidget::~QWidget()
QObjectPrivate::clearGuards(this);
if (d->declarativeData) {
- d->declarativeData->destroyed(this);
+ QDeclarativeData::destroyed(d->declarativeData, this);
d->declarativeData = 0; // don't activate again in ~QObject
}
diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml
new file mode 100644
index 0000000..dcd4061
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml
@@ -0,0 +1,14 @@
+import Qt 4.6
+
+Item {
+ id: root
+
+ property bool test1: root.children.length == 3
+ property bool test2: root.children[0] == item1
+ property bool test3: root.children[1] == item2
+ property bool test4: root.children[2] == item3
+ property bool test5: root.children[3] == null
+
+ children: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+}
+
diff --git a/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml b/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml
new file mode 100644
index 0000000..fa299be
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml
@@ -0,0 +1,21 @@
+import Qt 4.6
+
+Item {
+ id: root
+
+ property bool test1
+ property bool test2
+ property bool test3
+ property bool test4
+ property bool test5
+
+ Component.onCompleted: {
+ test1 = (root.resources.length >= 3)
+ test2 = root.resources[0] == item1
+ test3 = root.resources[1] == item2
+ test4 = root.resources[2] == item3
+ test5 = root.resources[10] == null
+ }
+
+ resources: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+}
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 46f3517..a6171ae 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -64,6 +64,9 @@ private slots:
void transforms();
void transforms_data();
+ void childrenProperty();
+ void resourcesProperty();
+
private:
template<typename T>
T *findItem(QGraphicsObject *parent, const QString &objectName);
@@ -429,6 +432,36 @@ void tst_QDeclarativeItem::transforms()
QCOMPARE(item->sceneMatrix(), matrix);
}
+void tst_QDeclarativeItem::childrenProperty()
+{
+ QDeclarativeComponent component(&engine, SRCDIR "/data/childrenProperty.qml");
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ delete o;
+}
+
+void tst_QDeclarativeItem::resourcesProperty()
+{
+ QDeclarativeComponent component(&engine, SRCDIR "/data/resourcesProperty.qml");
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ QCOMPARE(o->property("test3").toBool(), true);
+ QCOMPARE(o->property("test4").toBool(), true);
+ QCOMPARE(o->property("test5").toBool(), true);
+ delete o;
+}
+
void tst_QDeclarativeItem::propertyChanges()
{
QDeclarativeView *canvas = new QDeclarativeView(0);
diff --git a/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml b/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml
new file mode 100644
index 0000000..4bfb9c3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml
@@ -0,0 +1,28 @@
+import Qt 4.6
+Rectangle {
+ id: whiteRect
+ width: 200
+ height: 200
+ color: "white"
+ Rectangle {
+ id: blackRect
+ objectName: "blackrect"
+ color: "black"
+ y: 50
+ x: 50
+ width: 100
+ height: 100
+ opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200
+ Text { text: blackRect.opacity}
+ MouseArea {
+ objectName: "mouseregion"
+ anchors.fill: parent
+ drag.target: haveTarget ? blackRect : undefined
+ drag.axis: Drag.XandYAxis
+ drag.minimumX: 0
+ drag.maximumX: whiteRect.width-blackRect.width
+ drag.minimumY: 0
+ drag.maximumY: whiteRect.height-blackRect.height
+ }
+ }
+ }
diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
index 9b664e5..dfe46e4 100644
--- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
+++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
@@ -44,20 +44,23 @@
#include <private/qdeclarativemousearea_p.h>
#include <private/qdeclarativerectangle_p.h>
#include <QtDeclarative/qdeclarativeview.h>
+#include <QtDeclarative/qdeclarativecontext.h>
class tst_QDeclarativeMouseArea: public QObject
{
Q_OBJECT
private slots:
void dragProperties();
+ void resetDrag();
void updateMouseAreaPosOnClick();
private:
- QDeclarativeView *createView(const QString &filename);
+ QDeclarativeView *createView();
};
void tst_QDeclarativeMouseArea::dragProperties()
{
- QDeclarativeView *canvas = createView(SRCDIR "/data/dragproperties.qml");
+ QDeclarativeView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragproperties.qml"));
canvas->show();
canvas->setFocus();
QVERIFY(canvas->rootObject() != 0);
@@ -127,19 +130,49 @@ void tst_QDeclarativeMouseArea::dragProperties()
delete canvas;
}
-QDeclarativeView *tst_QDeclarativeMouseArea::createView(const QString &filename)
+void tst_QDeclarativeMouseArea::resetDrag()
+{
+ QDeclarativeView *canvas = createView();
+
+ canvas->rootContext()->setContextProperty("haveTarget", QVariant(true));
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragreset.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QVERIFY(canvas->rootObject() != 0);
+
+ QDeclarativeMouseArea *mouseRegion = canvas->rootObject()->findChild<QDeclarativeMouseArea*>("mouseregion");
+ QDeclarativeDrag *drag = mouseRegion->drag();
+ QVERIFY(mouseRegion != 0);
+ QVERIFY(drag != 0);
+
+ // target
+ QDeclarativeItem *blackRect = canvas->rootObject()->findChild<QDeclarativeItem*>("blackrect");
+ QVERIFY(blackRect != 0);
+ QVERIFY(blackRect == drag->target());
+ QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject());
+ QVERIFY(rootItem != 0);
+ QSignalSpy targetSpy(drag, SIGNAL(targetChanged()));
+ QVERIFY(drag->target() != 0);
+ canvas->rootContext()->setContextProperty("haveTarget", QVariant(false));
+ QCOMPARE(targetSpy.count(),1);
+ QVERIFY(drag->target() == 0);
+
+ delete canvas;
+}
+
+
+QDeclarativeView *tst_QDeclarativeMouseArea::createView()
{
QDeclarativeView *canvas = new QDeclarativeView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(filename));
-
return canvas;
}
void tst_QDeclarativeMouseArea::updateMouseAreaPosOnClick()
{
- QDeclarativeView *canvas = createView(SRCDIR "/data/updateMousePosOnClick.qml");
+ QDeclarativeView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/updateMousePosOnClick.qml"));
canvas->show();
canvas->setFocus();
QVERIFY(canvas->rootObject() != 0);
diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml
new file mode 100644
index 0000000..861ef8f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+Rectangle {
+ id: container
+ width: 400
+ height: 400
+
+ states: State {
+ name: "reanchored"
+ AnchorChanges {
+ anchors.top: container.top
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 2ab21a4..e7c595a 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -94,6 +94,7 @@ private slots:
void anchorChanges3();
void anchorChanges4();
void anchorChanges5();
+ void anchorChangesCrash();
void script();
void restoreEntryValues();
void explicitChanges();
@@ -716,6 +717,20 @@ void tst_qdeclarativestates::anchorChanges5()
delete rect;
}
+//QTBUG-9609
+void tst_qdeclarativestates::anchorChangesCrash()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChangesCrash.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create());
+ QVERIFY(rect != 0);
+
+ rect->setState("reanchored");
+
+ delete rect;
+}
+
void tst_qdeclarativestates::script()
{
QDeclarativeEngine engine;
diff --git a/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp b/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp
index 7b1293e..e475d42 100644
--- a/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp
+++ b/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp
@@ -71,11 +71,16 @@ void tst_qdeclarativestyledtext::textOutput_data()
QTest::newRow("missing </b>") << "<b>text" << "text";
QTest::newRow("bad nest") << "<b>text <i>italic</b></i>" << "text italic";
QTest::newRow("font color") << "<font color=\"red\">red text</font>" << "red text";
+ QTest::newRow("font color: single quote") << "<font color='red'>red text</font>" << "red text";
QTest::newRow("font size") << "<font size=\"1\">text</font>" << "text";
QTest::newRow("font empty") << "<font>text</font>" << "text";
QTest::newRow("font bad 1") << "<font ezis=\"blah\">text</font>" << "text";
QTest::newRow("font bad 2") << "<font size=\"1>text</font>" << "";
QTest::newRow("extra close") << "<b>text</b></b>" << "text";
+ QTest::newRow("extra space") << "<b >text</b>" << "text";
+ QTest::newRow("entities") << "&lt;b&gt;this &amp; that&lt;/b&gt;" << "<b>this & that</b>";
+ QTest::newRow("newline") << "text<br>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") ;
+ QTest::newRow("self-closing newline") << "text<br/>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") ;
QTest::newRow("empty") << "" << "";
}
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index 74da79e..ba0f9a7 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -378,17 +378,16 @@ void tst_qdeclarativexmllistmodel::reload()
QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int)));
QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int)));
QSignalSpy spyCount(model, SIGNAL(countChanged()));
+ QSignalSpy spyReset(model, SIGNAL(modelReset()));
model->reload();
- QTRY_COMPARE(spyCount.count(), 1);
- QTRY_COMPARE(spyInsert.count(), 1);
- QTRY_COMPARE(spyRemove.count(), 1);
-
- QCOMPARE(spyInsert[0][0].toInt(), 0);
- QCOMPARE(spyInsert[0][1].toInt(), 9);
+ QTRY_COMPARE(spyReset.count(), 1);
+ QCOMPARE(spyCount.count(), 0);
+ QCOMPARE(spyInsert.count(), 0);
+ QCOMPARE(spyRemove.count(), 0);
- QCOMPARE(spyRemove[0][0].toInt(), 0);
- QCOMPARE(spyRemove[0][1].toInt(), 9);
+ QCOMPARE(model->data(0, model->roles().first()).toString(), QString("Polly"));
+ QCOMPARE(model->data(model->count()-1, model->roles().first()).toString(), QString("Tiny"));
delete model;
}
@@ -416,15 +415,15 @@ void tst_qdeclarativexmllistmodel::useKeys()
QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int)));
QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int)));
QSignalSpy spyCount(model, SIGNAL(countChanged()));
+ QSignalSpy spyReset(model, SIGNAL(modelReset()));
model->setXml(newXml);
- if (oldCount != newData.count()) {
- QTRY_COMPARE(model->count(), newData.count());
- QCOMPARE(spyCount.count(), 1);
+ if (insertRanges.isEmpty() && removeRanges.isEmpty()) {
+ QTRY_COMPARE(spyReset.count(), 1);
} else {
QTRY_VERIFY(spyInsert.count() > 0 || spyRemove.count() > 0);
- QCOMPARE(spyCount.count(), 0);
+ QCOMPARE(spyCount.count() == 0, oldCount == newData.count());
}
QList<int> roles = model->roles();
@@ -513,21 +512,14 @@ void tst_qdeclarativexmllistmodel::useKeys_data()
<< makeItemXmlAndData("", &modelData)
<< modelData
<< QList<QDeclarativeXmlListRange>()
- << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 3));
+ << QList<QDeclarativeXmlListRange>();
QTest::newRow("replace item")
<< makeItemXmlAndData("name=A,age=25,sport=Football") << 1
<< makeItemXmlAndData("name=ZZZ,age=25,sport=Football", &modelData)
<< modelData
- << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1))
- << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1));
-
- QTest::newRow("add and remove simultaneously, in different spots")
- << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4
- << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData)
- << modelData
- << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 1))
- << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1) << qMakePair(2,2));
+ << QList<QDeclarativeXmlListRange>()
+ << QList<QDeclarativeXmlListRange>();
QTest::newRow("insert at start, remove at end i.e. rss feed")
<< makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 3
@@ -547,8 +539,8 @@ void tst_qdeclarativexmllistmodel::useKeys_data()
<< makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35") << 2
<< makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData)
<< modelData
- << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 2))
- << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 2));
+ << QList<QDeclarativeXmlListRange>()
+ << QList<QDeclarativeXmlListRange>();
}
void tst_qdeclarativexmllistmodel::noKeysValueChanges()
@@ -608,20 +600,14 @@ void tst_qdeclarativexmllistmodel::keysChanged()
QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int)));
QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int)));
QSignalSpy spyCount(model, SIGNAL(countChanged()));
+ QSignalSpy spyReset(model, SIGNAL(modelReset()));
QVERIFY(QMetaObject::invokeMethod(model, "disableNameKey"));
model->setXml(xml);
- QTRY_VERIFY(spyInsert.count() > 0 && spyRemove.count() > 0);
-
- QCOMPARE(spyInsert.count(), 1);
- QCOMPARE(spyInsert[0][0].toInt(), 0);
- QCOMPARE(spyInsert[0][1].toInt(), 2);
-
- QCOMPARE(spyRemove.count(), 1);
- QCOMPARE(spyRemove[0][0].toInt(), 0);
- QCOMPARE(spyRemove[0][1].toInt(), 2);
-
+ QTRY_COMPARE(spyReset.count(), 1);
+ QCOMPARE(spyInsert.count(), 0);
+ QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyCount.count(), 0);
delete model;