summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/debugger/qdeclarativedebugserver.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp28
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp15
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp17
-rw-r--r--src/declarative/qml/qdeclarativecomponent_p.h1
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp16
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp67
8 files changed, 120 insertions, 64 deletions
diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp
index e43b90d..75e9a09 100644
--- a/src/declarative/debugger/qdeclarativedebugserver.cpp
+++ b/src/declarative/debugger/qdeclarativedebugserver.cpp
@@ -91,7 +91,7 @@ public:
QStringList clientPlugins;
bool gotHello;
- static QDeclarativeDebugServerConnection *loadConnectionPlugin();
+ static QDeclarativeDebugServerConnection *loadConnectionPlugin(const QString &pluginName);
};
QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() :
@@ -113,7 +113,8 @@ void QDeclarativeDebugServerPrivate::advertisePlugins()
connection->send(message);
}
-QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin()
+QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin(
+ const QString &pluginName)
{
QStringList pluginCandidates;
const QStringList paths = QCoreApplication::libraryPaths();
@@ -122,7 +123,8 @@ QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectio
if (dir.exists()) {
QStringList plugins(dir.entryList(QDir::Files));
foreach (const QString &pluginPath, plugins) {
- pluginCandidates << dir.absoluteFilePath(pluginPath);
+ if (QFileInfo(pluginPath).fileName().contains(pluginName))
+ pluginCandidates << dir.absoluteFilePath(pluginPath);
}
}
}
@@ -166,7 +168,7 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
bool block = false;
bool ok = false;
- // format: qmljsdebugger=port:3768[,block]
+ // format: qmljsdebugger=port:3768[,block] OR qmljsdebugger=ost[,block]
if (!appD->qmljsDebugArgumentsString().isEmpty()) {
if (!QDeclarativeEnginePrivate::qml_debugging_enabled) {
const QString message =
@@ -177,17 +179,23 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
return 0;
}
+ QString pluginName;
if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) {
int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(','));
port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok);
+ pluginName = QLatin1String("qmldbg_tcp");
+ } else if (appD->qmljsDebugArgumentsString().contains("ost")) {
+ pluginName = QLatin1String("qmldbg_ost");
+ ok = true;
}
+
block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block"));
if (ok) {
server = new QDeclarativeDebugServer();
QDeclarativeDebugServerConnection *connection
- = QDeclarativeDebugServerPrivate::loadConnectionPlugin();
+ = QDeclarativeDebugServerPrivate::loadConnectionPlugin(pluginName);
if (connection) {
server->d_func()->connection = connection;
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 174114f..f30831d 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -584,6 +584,26 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
--i;
modelIndex = visibleItems.at(i)->index + 1;
}
+
+ if (visibleItems.count() && (fillFrom > rowPos + rowSize()*2
+ || fillTo < rowPosAt(visibleIndex) - rowSize())) {
+ // We've jumped more than a page. Estimate which items are now
+ // visible and fill from there.
+ int count = (fillFrom - (rowPos + rowSize())) / (rowSize()) * columns;
+ for (int i = 0; i < visibleItems.count(); ++i)
+ releaseItem(visibleItems.at(i));
+ visibleItems.clear();
+ modelIndex += count;
+ if (modelIndex >= model->count())
+ modelIndex = model->count() - 1;
+ else if (modelIndex < 0)
+ modelIndex = 0;
+ modelIndex = modelIndex / columns * columns;
+ visibleIndex = modelIndex;
+ colPos = colPosAt(visibleIndex);
+ rowPos = rowPosAt(visibleIndex);
+ }
+
int colNum = colPos / colSize();
FxGridItem *item = 0;
@@ -2230,7 +2250,7 @@ qreal QDeclarativeGridView::maxXExtent() const
qreal extent;
qreal highlightStart;
qreal highlightEnd;
- qreal lastItemPosition;
+ qreal lastItemPosition = 0;
if (d->isRightToLeftTopToBottom()){
highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size();
highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size();
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 9dbbb74..c5fad9d 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -744,6 +744,28 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
if (visibleItems.at(i)->index != -1)
modelIndex = visibleItems.at(i)->index + 1;
}
+
+ if (visibleItems.count() && (fillFrom > itemEnd+averageSize+spacing
+ || fillTo < visiblePos - averageSize - spacing)) {
+ // We've jumped more than a page. Estimate which items are now
+ // visible and fill from there.
+ int count = (fillFrom - itemEnd) / (averageSize + spacing);
+ for (int i = 0; i < visibleItems.count(); ++i)
+ releaseItem(visibleItems.at(i));
+ visibleItems.clear();
+ modelIndex += count;
+ if (modelIndex >= model->count()) {
+ count -= modelIndex - model->count() + 1;
+ modelIndex = model->count() - 1;
+ } else if (modelIndex < 0) {
+ count -= modelIndex;
+ modelIndex = 0;
+ }
+ visibleIndex = modelIndex;
+ visiblePos = itemEnd + count * (averageSize + spacing) + 1;
+ itemEnd = visiblePos-1;
+ }
+
bool changed = false;
FxListItem *item = 0;
qreal pos = itemEnd + 1;
@@ -2119,9 +2141,11 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie
if (d->orient == QDeclarativeListView::Vertical) {
setContentWidth(-1);
setFlickableDirection(VerticalFlick);
+ setContentX(0);
} else {
setContentHeight(-1);
setFlickableDirection(HorizontalFlick);
+ setContentY(0);
}
d->regenerate();
emit orientationChanged();
@@ -2768,7 +2792,7 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event)
return;
if (d->model && d->model->count() && d->interactive) {
- if ((!d->isRightToLeft() && event->key() == Qt::Key_Left)
+ if ((d->orient == QDeclarativeListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Left)
|| (d->orient == QDeclarativeListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Right)
|| (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Up)) {
if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) {
@@ -2779,7 +2803,7 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event)
event->accept();
return;
}
- } else if ((!d->isRightToLeft() && event->key() == Qt::Key_Right)
+ } else if ((d->orient == QDeclarativeListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Right)
|| (d->orient == QDeclarativeListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Left)
|| (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Down)) {
if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) {
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 2cb1c94..af2c8f3 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -582,6 +582,7 @@ void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment)
d->vAlign = alignment;
d->updateDefaultTextOption();
updateSize();
+ moveCursorDelegate();
emit verticalAlignmentChanged(d->vAlign);
}
@@ -870,8 +871,6 @@ void QDeclarativeTextEdit::setCursorDelegate(QDeclarativeComponent* c)
Q_D(QDeclarativeTextEdit);
if(d->cursorComponent){
if(d->cursor){
- disconnect(d->control, SIGNAL(cursorPositionChanged()),
- this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(-1);
dirtyCache(cursorRectangle());
delete d->cursor;
@@ -897,8 +896,6 @@ void QDeclarativeTextEdit::loadCursorDelegate()
return;
d->cursor = qobject_cast<QDeclarativeItem*>(d->cursorComponent->create(qmlContext(this)));
if(d->cursor){
- connect(d->control, SIGNAL(cursorPositionChanged()),
- this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(0);
dirtyCache(cursorRectangle());
QDeclarative_setParent_noEvent(d->cursor, this);
@@ -1173,7 +1170,7 @@ Qt::TextInteractionFlags QDeclarativeTextEdit::textInteractionFlags() const
QRect QDeclarativeTextEdit::cursorRectangle() const
{
Q_D(const QDeclarativeTextEdit);
- return d->control->cursorRect().toRect().translated(0,-d->yoff);
+ return d->control->cursorRect().toRect().translated(0,d->yoff);
}
@@ -1558,7 +1555,7 @@ void QDeclarativeTextEditPrivate::init()
QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
- QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged()));
+ QObject::connect(control, SIGNAL(microFocusChanged()), q, SLOT(moveCursorDelegate()));
QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString)));
#ifndef QT_NO_CLIPBOARD
QObject::connect(q, SIGNAL(readOnlyChanged(bool)), q, SLOT(q_canPasteChanged()));
@@ -1583,16 +1580,17 @@ void QDeclarativeTextEdit::q_textChanged()
d->updateDefaultTextOption();
updateSize();
updateTotalLines();
- updateMicroFocus();
emit textChanged(d->text);
}
void QDeclarativeTextEdit::moveCursorDelegate()
{
Q_D(QDeclarativeTextEdit);
+ updateMicroFocus();
+ emit cursorRectangleChanged();
if(!d->cursor)
return;
- QRectF cursorRect = d->control->cursorRect();
+ QRectF cursorRect = cursorRectangle();
d->cursor->setX(cursorRect.x());
d->cursor->setY(cursorRect.y());
}
@@ -1625,7 +1623,6 @@ void QDeclarativeTextEdit::updateSelectionMarkers()
d->lastSelectionEnd = d->control->textCursor().selectionEnd();
emit selectionEndChanged();
}
- updateMicroFocus();
}
QRectF QDeclarativeTextEdit::boundingRect() const
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 276f790..8238252 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -880,6 +880,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon
state->bindValues = enginePriv->bindValues;
state->parserStatus = enginePriv->parserStatus;
+ state->finalizedParserStatus = enginePriv->finalizedParserStatus;
state->componentAttached = enginePriv->componentAttached;
if (state->componentAttached)
state->componentAttached->prev = &state->componentAttached;
@@ -887,6 +888,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon
enginePriv->componentAttached = 0;
enginePriv->bindValues.clear();
enginePriv->parserStatus.clear();
+ enginePriv->finalizedParserStatus.clear();
state->completePending = true;
enginePriv->inProgressCreations++;
}
@@ -917,6 +919,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi
state->bindValues = enginePriv->bindValues;
state->parserStatus = enginePriv->parserStatus;
+ state->finalizedParserStatus = enginePriv->finalizedParserStatus;
state->componentAttached = enginePriv->componentAttached;
if (state->componentAttached)
state->componentAttached->prev = &state->componentAttached;
@@ -924,6 +927,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi
enginePriv->componentAttached = 0;
enginePriv->bindValues.clear();
enginePriv->parserStatus.clear();
+ enginePriv->finalizedParserStatus.clear();
state->completePending = true;
enginePriv->inProgressCreations++;
}
@@ -961,6 +965,18 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
QDeclarativeEnginePrivate::clear(ps);
}
+ for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) {
+ QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii);
+ QObject *obj = status.first;
+ if (obj) {
+ void *args[] = { 0 };
+ QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod,
+ status.second, args);
+ }
+ }
+
+ //componentComplete() can register additional finalization objects
+ //that are then never handled. Handle them manually here.
if (1 == enginePriv->inProgressCreations) {
for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) {
QPair<QDeclarativeGuard<QObject>, int> status = enginePriv->finalizedParserStatus.at(ii);
@@ -986,6 +1002,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
state->bindValues.clear();
state->parserStatus.clear();
+ state->finalizedParserStatus.clear();
state->completePending = false;
enginePriv->inProgressCreations--;
diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h
index 020c5e0..f8bec2b 100644
--- a/src/declarative/qml/qdeclarativecomponent_p.h
+++ b/src/declarative/qml/qdeclarativecomponent_p.h
@@ -101,6 +101,7 @@ public:
ConstructionState() : componentAttached(0), completePending(false) {}
QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> > bindValues;
QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> > parserStatus;
+ QList<QPair<QDeclarativeGuard<QObject>, int> > finalizedParserStatus;
QDeclarativeComponentAttached *componentAttached;
QList<QDeclarativeError> errors;
bool completePending;
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index bb4ece4..3abd787 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -227,6 +227,7 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte
if (data) {
lastData = data;
lastContext = bindContext;
+ lastScopeObject = scopeObject;
return QScriptClass::HandlesReadAccess;
}
}
@@ -268,17 +269,12 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name)
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
- if (lastScopeObject) {
-
- return ep->objectClass->property(lastScopeObject, name);
-
- } else if (lastData) {
+ if (lastData) {
if (lastData->type) {
- return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject, lastData->type));
+ return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->type));
} else if (lastData->typeNamespace) {
- return Value(scriptEngine, ep->typeNameClass->newObject(bindContext->contextObject,
- lastData->typeNamespace));
+ return Value(scriptEngine, ep->typeNameClass->newObject(lastScopeObject, lastData->typeNamespace));
} else {
int index = lastData->importedScriptIndex;
if (index < bindContext->importedScripts.count()) {
@@ -288,6 +284,10 @@ QDeclarativeContextScriptClass::property(Object *object, const Identifier &name)
}
}
+ } else if (lastScopeObject) {
+
+ return ep->objectClass->property(lastScopeObject, name);
+
} else if (lastPropertyIndex != -1) {
QScriptValue rv;
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 4424490..0a39ca8 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -144,6 +144,7 @@ struct XmlQueryJob
QList<void*> roleQueryErrorId; // the ptr to send back if there is an error
QStringList keyRoleQueries;
QStringList keyRoleResultsCache;
+ QString prefix;
};
class QDeclarativeXmlQuery : public QObject
@@ -172,6 +173,12 @@ public:
}
int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
+ {
+ QMutexLocker m1(&m_mutex);
+ m_queryIds.ref();
+ if (m_queryIds <= 0)
+ m_queryIds = 1;
+ }
XmlQueryJob job;
job.queryId = m_queryIds;
@@ -194,9 +201,6 @@ public:
{
QMutexLocker ml(&m_mutex);
m_jobs.insert(m_queryIds, job);
- m_queryIds++;
- if (m_queryIds <= 0)
- m_queryIds = 1;
}
QMetaObject::invokeMethod(this, "processQuery", Qt::QueuedConnection, Q_ARG(int, job.queryId));
@@ -214,20 +218,15 @@ private slots:
job = m_jobs.value(queryId);
}
- QDeclarativeXmlQueryResult r;
- doQueryJob(&job);
- doSubQueryJob(&job);
- r.queryId = job.queryId;
- r.size = m_size;
- r.data = m_modelData;
- r.inserted = m_insertedItemRanges;
- r.removed = m_removedItemRanges;
- r.keyRoleResultsCache = job.keyRoleResultsCache;
+ QDeclarativeXmlQueryResult result;
+ result.queryId = job.queryId;
+ doQueryJob(&job, &result);
+ doSubQueryJob(&job, &result);
{
QMutexLocker ml(&m_mutex);
if (m_jobs.contains(queryId)) {
- emit queryCompleted(r);
+ emit queryCompleted(result);
m_jobs.remove(queryId);
}
}
@@ -241,8 +240,8 @@ protected:
private:
- void doQueryJob(XmlQueryJob* job);
- void doSubQueryJob(XmlQueryJob* job);
+ void doQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
+ void doSubQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
void getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const;
void addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const;
@@ -250,17 +249,12 @@ private:
QMutex m_mutex;
QThread m_thread;
QMap<int, XmlQueryJob> m_jobs;
- int m_queryIds;
- QString m_prefix;
- int m_size;
- QList<QList<QVariant> > m_modelData;
- QList<QDeclarativeXmlListRange> m_insertedItemRanges;
- QList<QDeclarativeXmlListRange> m_removedItemRanges;
+ QAtomicInt m_queryIds;
};
Q_GLOBAL_STATIC(QDeclarativeXmlQuery, globalXmlQuery)
-void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob* currentJob)
+void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -295,10 +289,8 @@ void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob* currentJob)
}
currentJob->data = xml;
- m_prefix = namespaces + prefix + QLatin1Char('/');
- m_size = 0;
- if (count > 0)
- m_size = count;
+ currentJob->prefix = namespaces + prefix + QLatin1Char('/');
+ currentResult->size = (count > 0 ? count : 0);
}
void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
@@ -306,9 +298,9 @@ void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QS
const QStringList &keysQueries = currentJob.keyRoleQueries;
QString keysQuery;
if (keysQueries.count() == 1)
- keysQuery = m_prefix + keysQueries[0];
+ keysQuery = currentJob.prefix + keysQueries[0];
else if (keysQueries.count() > 1)
- keysQuery = m_prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")");
+ keysQuery = currentJob.prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")");
if (!keysQuery.isEmpty()) {
query->setQuery(keysQuery);
@@ -331,10 +323,9 @@ void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> *
ranges->append(qMakePair(index, 1));
}
-void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
+void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
- m_modelData.clear();
QBuffer b(&currentJob->data);
b.open(QIODevice::ReadOnly);
@@ -347,16 +338,14 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
// See if any values of key roles have been inserted or removed.
- m_insertedItemRanges.clear();
- m_removedItemRanges.clear();
if (currentJob->keyRoleResultsCache.isEmpty()) {
- m_insertedItemRanges << qMakePair(0, m_size);
+ currentResult->inserted << qMakePair(0, currentResult->size);
} else {
if (keyRoleResults != currentJob->keyRoleResultsCache) {
QStringList temp;
for (int i=0; i<currentJob->keyRoleResultsCache.count(); i++) {
if (!keyRoleResults.contains(currentJob->keyRoleResultsCache[i]))
- addIndexToRangeList(&m_removedItemRanges, i);
+ addIndexToRangeList(&currentResult->removed, i);
else
temp << currentJob->keyRoleResultsCache[i];
}
@@ -364,12 +353,12 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
for (int i=0; i<keyRoleResults.count(); i++) {
if (temp.count() == i || keyRoleResults[i] != temp[i]) {
temp.insert(i, keyRoleResults[i]);
- addIndexToRangeList(&m_insertedItemRanges, i);
+ addIndexToRangeList(&currentResult->inserted, i);
}
}
}
}
- currentJob->keyRoleResultsCache = keyRoleResults;
+ currentResult->keyRoleResultsCache = keyRoleResults;
// Get the new values for each role.
//### we might be able to condense even further (query for everything in one go)
@@ -377,7 +366,7 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
for (int i = 0; i < queries.size(); ++i) {
QList<QVariant> resultList;
if (!queries[i].isEmpty()) {
- subquery.setQuery(m_prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")"));
+ subquery.setQuery(currentJob->prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")"));
if (subquery.isValid()) {
QXmlResultItems resultItems;
subquery.evaluateTo(&resultItems);
@@ -391,9 +380,9 @@ void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob* currentJob)
}
}
//### should warn here if things have gone wrong.
- while (resultList.count() < m_size)
+ while (resultList.count() < currentResult->size)
resultList << QVariant();
- m_modelData << resultList;
+ currentResult->data << resultList;
b.seek(0);
}