diff options
Diffstat (limited to 'src/declarative')
11 files changed, 116 insertions, 35 deletions
diff --git a/src/declarative/debugger/qdeclarativeinspectorservice.cpp b/src/declarative/debugger/qdeclarativeinspectorservice.cpp index 9fec006..15dbf58 100644 --- a/src/declarative/debugger/qdeclarativeinspectorservice.cpp +++ b/src/declarative/debugger/qdeclarativeinspectorservice.cpp @@ -67,11 +67,13 @@ QDeclarativeInspectorService *QDeclarativeInspectorService::instance() void QDeclarativeInspectorService::addView(QDeclarativeView *view) { m_views.append(view); + updateStatus(); } void QDeclarativeInspectorService::removeView(QDeclarativeView *view) { m_views.removeAll(view); + updateStatus(); } void QDeclarativeInspectorService::sendMessage(const QByteArray &message) @@ -84,10 +86,18 @@ void QDeclarativeInspectorService::sendMessage(const QByteArray &message) void QDeclarativeInspectorService::statusChanged(Status status) { - if (m_views.isEmpty()) + updateStatus(); +} + +void QDeclarativeInspectorService::updateStatus() +{ + if (m_views.isEmpty()) { + if (m_inspectorPlugin) + m_inspectorPlugin->deactivate(); return; + } - if (status == Enabled) { + if (status() == Enabled) { if (!m_inspectorPlugin) m_inspectorPlugin = loadInspectorPlugin(); diff --git a/src/declarative/debugger/qdeclarativeinspectorservice_p.h b/src/declarative/debugger/qdeclarativeinspectorservice_p.h index 9fe0d601f..9a14155 100644 --- a/src/declarative/debugger/qdeclarativeinspectorservice_p.h +++ b/src/declarative/debugger/qdeclarativeinspectorservice_p.h @@ -78,6 +78,8 @@ protected: virtual void messageReceived(const QByteArray &); private: + void updateStatus(); + static QDeclarativeInspectorInterface *loadInspectorPlugin(); QList<QDeclarativeView*> m_views; diff --git a/src/declarative/debugger/qjsdebuggeragent_p.h b/src/declarative/debugger/qjsdebuggeragent_p.h index 309588e..4b27fc8 100644 --- a/src/declarative/debugger/qjsdebuggeragent_p.h +++ b/src/declarative/debugger/qjsdebuggeragent_p.h @@ -94,6 +94,12 @@ inline QDataStream &operator<<(QDataStream &s, const JSAgentWatchData &data) << data.type << data.hasChildren << data.objectId; } +inline QDataStream &operator>>(QDataStream &s, JSAgentWatchData &data) +{ + return s >> data.exp >> data.name >> data.value + >> data.type >> data.hasChildren >> data.objectId; +} + struct JSAgentStackData { QByteArray functionName; @@ -106,6 +112,11 @@ inline QDataStream &operator<<(QDataStream &s, const JSAgentStackData &data) return s << data.functionName << data.fileUrl << data.lineNumber; } +inline QDataStream &operator>>(QDataStream &s, JSAgentStackData &data) +{ + return s >> data.functionName >> data.fileUrl >> data.lineNumber; +} + struct JSAgentBreakpointData { QByteArray functionName; diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 9caaa79..f53d2a3 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -164,12 +164,16 @@ public Q_SLOTS: void readyToRead() { + bool gotPackets = false; while (true) { - // Need to get trailing data + // Get size header (if not in progress) if (-1 == inProgressSize) { // We need a size header of sizeof(qint32) - if (sizeof(qint32) > (uint)dev->bytesAvailable()) - return; + if (sizeof(qint32) > (uint)dev->bytesAvailable()) { + if (gotPackets) + emit readyRead(); + return; // no more data available + } // Read size header int read = dev->read((char *)&inProgressSize, sizeof(qint32)); @@ -200,9 +204,12 @@ public Q_SLOTS: inProgress.clear(); waitingForPacket = false; - emit readyRead(); - } else - return; + gotPackets = true; + } else { + if (gotPackets) + emit readyRead(); + return; // packet in progress is not yet complete + } } } } diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 836ad49..9c274e9 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -240,22 +240,20 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() BorderImage can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. - It can also handle .sci files, which are a QML-specific format. A .sci - file uses a simple text-based format that specifies the borders, the - image file and the tile rules. + This property can also be used to refer to .sci files, which are + written in a QML-specific, text-based format that specifies the + borders, the image file and the tile rules for a given border image. The following .sci file sets the borders to 10 on each side for the image \c picture.png: - \qml - BorderImage { - border.left: 10 - border.top: 10 - border.bottom: 10 - border.right: 10 - source: "picture.png" - } - \endqml + \code + border.left: 10 + border.top: 10 + border.bottom: 10 + border.right: 10 + source: "picture.png" + \endcode The URL may be absolute, or relative to the URL of the component. diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index fc5cd8b..a0264f7 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1800,7 +1800,7 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode) \o Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is dependent on the \l GridView::flow property. \o Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent - on the \l GridView:flow property. + on the \l GridView::flow property. \endlist When using the attached property \l {LayoutMirroring::enabled} for locale layouts, diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index ccf0de0..805ca4d 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2604,6 +2604,17 @@ void QDeclarativeItem::setKeepMouseGrab(bool keep) If \a item is a \c null value, this maps the point from the coordinate system of the root QML view. */ + +/*! + Maps the point (\a x, \a y), which is in \a item's coordinate system, to + this item's coordinate system, and returns a script value with \c x and \c y + properties matching the mapped cooordinate. + + If \a item is a \c null value, this maps the point from the coordinate + system of the root QML view. + + \sa Item::mapFromItem() +*/ QScriptValue QDeclarativeItem::mapFromItem(const QScriptValue &item, qreal x, qreal y) const { QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject(); @@ -2630,6 +2641,17 @@ QScriptValue QDeclarativeItem::mapFromItem(const QScriptValue &item, qreal x, qr If \a item is a \c null value, this maps \a x and \a y to the coordinate system of the root QML view. */ + +/*! + Maps the point (\a x, \a y), which is in this item's coordinate system, to + \a item's coordinate system, and returns a script value with \c x and \c y + properties matching the mapped cooordinate. + + If \a item is a \c null value, this maps \a x and \a y to the coordinate + system of the root QML view. + + \sa Item::mapToItem() +*/ QScriptValue QDeclarativeItem::mapToItem(const QScriptValue &item, qreal x, qreal y) const { QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject(); @@ -2649,8 +2671,17 @@ QScriptValue QDeclarativeItem::mapToItem(const QScriptValue &item, qreal x, qrea /*! \qmlmethod Item::forceActiveFocus() - Force active focus on the item. - This method sets focus on the item and makes sure that all the focus scopes higher in the object hierarchy are also given focus. + Forces active focus on the item. + + This method sets focus on the item and makes sure that all the focus scopes + higher in the object hierarchy are also given the focus. +*/ + +/*! + Forces active focus on the item. + + This method sets focus on the item and makes sure that all the focus scopes + higher in the object hierarchy are also given the focus. */ void QDeclarativeItem::forceActiveFocus() { @@ -2669,7 +2700,12 @@ void QDeclarativeItem::forceActiveFocus() Returns the visible child item at point (\a x, \a y), which is in this item's coordinate system, or \c null if there is no such item. - */ +*/ + +/*! + Returns the visible child item at point (\a x, \a y), which is in this + item's coordinate system, or 0 if there is no such item. +*/ QDeclarativeItem *QDeclarativeItem::childAt(qreal x, qreal y) const { const QList<QGraphicsItem *> children = childItems(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index bc9b6fd..d2897eb 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1941,12 +1941,12 @@ void QDeclarativeTextInput::selectionChanged() void QDeclarativeTextInput::q_textChanged() { Q_D(QDeclarativeTextInput); + emit textChanged(); + emit displayTextChanged(); updateSize(); d->determineHorizontalAlignment(); d->updateHorizontalScroll(); updateMicroFocus(); - emit textChanged(); - emit displayTextChanged(); if(hasAcceptableInput() != d->oldValidity){ d->oldValidity = hasAcceptableInput(); emit acceptableInputChanged(); diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index ca3bc37..689cd00 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -243,12 +243,13 @@ QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeCont if (id < 0) return 0; + Q_ASSERT(ctxt); QDeclarativeContextData *ctxtdata = QDeclarativeContextData::get(ctxt); - QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(qmlEngine(obj)); + QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(ctxtdata->engine); QDeclarativeCompiledData *cdata = 0; QDeclarativeTypeData *typeData = 0; - if (engine && ctxtdata && !ctxtdata->url.isEmpty()) { + if (!ctxtdata->url.isEmpty()) { typeData = engine->typeLoader.get(ctxtdata->url); cdata = typeData->compiledData(); } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index e642a67..abde4ad 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -622,6 +622,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, out->dumpInstructions(); if (compilerStatDump()) dumpStats(); + Q_ASSERT(out->rootPropertyCache); } else { reset(out); } @@ -1218,6 +1219,11 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj) id.setId.index = obj->idIndex; output->bytecode << id; } + + if (obj == unitRoot) { + output->rootPropertyCache = output->types[obj->type].createPropertyCache(engine); + output->rootPropertyCache->addref(); + } } bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj, diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index 77587a4..168c151 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -434,7 +434,7 @@ void QDeclarativeDataBlob::notifyComplete(QDeclarativeDataBlob *blob) /*! \class QDeclarativeDataLoader -\brief The QDeclarativeDataLoader class abstracts loading files and their dependecies over the network. +\brief The QDeclarativeDataLoader class abstracts loading files and their dependencies over the network. \internal The QDeclarativeDataLoader class is provided for the exclusive use of the QDeclarativeTypeLoader class. @@ -453,9 +453,11 @@ are required before processing can fully complete. To complete processing, the QDeclarativeDataBlob::done() callback is invoked. done() is called when one of these three preconditions are met. -1. The QDeclarativeDataBlob has no dependencies. -2. The QDeclarativeDataBlob has an error set. -3. All the QDeclarativeDataBlob's dependencies are themselves "done()". +\list 1 +\o The QDeclarativeDataBlob has no dependencies. +\o The QDeclarativeDataBlob has an error set. +\o All the QDeclarativeDataBlob's dependencies are themselves "done()". +\endlist Thus QDeclarativeDataBlob::done() will always eventually be called, even if the blob has an error set. */ @@ -616,13 +618,17 @@ void QDeclarativeDataLoader::setData(QDeclarativeDataBlob *blob, const QByteArra } /*! -\class QDeclarativeTypeLoader +Constructs a new type loader that uses the given \a engine. */ QDeclarativeTypeLoader::QDeclarativeTypeLoader(QDeclarativeEngine *engine) : QDeclarativeDataLoader(engine) { } +/*! +Destroys the type loader, first clearing the cache of any information about +loaded files. +*/ QDeclarativeTypeLoader::~QDeclarativeTypeLoader() { clearCache(); @@ -674,7 +680,7 @@ QDeclarativeTypeData *QDeclarativeTypeLoader::get(const QByteArray &data, const } /*! -Return a QDeclarativeScriptData for \a url. The QDeclarativeScriptData may be cached. +Returns a QDeclarativeScriptData for \a url. The QDeclarativeScriptData may be cached. */ QDeclarativeScriptData *QDeclarativeTypeLoader::getScript(const QUrl &url) { @@ -695,7 +701,7 @@ QDeclarativeScriptData *QDeclarativeTypeLoader::getScript(const QUrl &url) } /*! -Return a QDeclarativeQmldirData for \a url. The QDeclarativeQmldirData may be cached. +Returns a QDeclarativeQmldirData for \a url. The QDeclarativeQmldirData may be cached. */ QDeclarativeQmldirData *QDeclarativeTypeLoader::getQmldir(const QUrl &url) { @@ -715,6 +721,10 @@ QDeclarativeQmldirData *QDeclarativeTypeLoader::getQmldir(const QUrl &url) return qmldirData; } +/*! +Clears cached information about loaded files, including any type data, scripts +and qmldir information. +*/ void QDeclarativeTypeLoader::clearCache() { for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter) |