forked from qt-creator/qt-creator
QmlJSInspector: Show property values
When using the "Select" tool, update the property inspector with the selected object's properties. Change-Id: Ie24d9ed01b871b2f8f1f408cf4b1c0661c15cc84 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -152,25 +152,42 @@ void ClientProxy::onCurrentObjectsChanged(const QList<int> &debugIds,
|
||||
bool requestIfNeeded)
|
||||
{
|
||||
QList<QmlDebugObjectReference> selectedItems;
|
||||
|
||||
m_fetchCurrentObjects.clear();
|
||||
m_fetchCurrentObjectsQueryIds.clear();
|
||||
foreach (int debugId, debugIds) {
|
||||
QmlDebugObjectReference ref = objectReferenceForId(debugId);
|
||||
if (ref.debugId() != -1) {
|
||||
if (ref.debugId() != -1 && !ref.needsMoreData()) {
|
||||
selectedItems << ref;
|
||||
} else if (requestIfNeeded) {
|
||||
// ### FIXME right now, there's no way in the protocol to
|
||||
// a) get some item and know its parent (although that's possible
|
||||
// by adding it to a separate plugin)
|
||||
// b) add children to part of an existing tree.
|
||||
// So the only choice that remains is to update the complete
|
||||
// tree when we have an unknown debug id.
|
||||
// break;
|
||||
m_fetchCurrentObjectsQueryIds << fetchContextObject(
|
||||
QmlDebugObjectReference(debugId));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
emit selectedItemsChanged(selectedItems);
|
||||
}
|
||||
|
||||
void ClientProxy::onCurrentObjectsFetched(quint32 queryId, const QVariant &result)
|
||||
{
|
||||
m_fetchCurrentObjectsQueryIds.removeOne(queryId);
|
||||
QmlDebugObjectReference obj = qvariant_cast<QmlDebugObjectReference>(result);
|
||||
m_fetchCurrentObjects.push_front(obj);
|
||||
|
||||
//If this is not a root object, check if we have the parent
|
||||
QmlDebugObjectReference parent = objectReferenceForId(obj.parentId());
|
||||
if (obj.parentId() != -1 && (parent.debugId() == -1 || parent.needsMoreData())) {
|
||||
m_fetchCurrentObjectsQueryIds << fetchContextObject(
|
||||
QmlDebugObjectReference(obj.parentId()));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (const QmlDebugObjectReference &o, m_fetchCurrentObjects)
|
||||
addObjectToTree(o);
|
||||
emit selectedItemsChanged(QList<QmlDebugObjectReference>() <<
|
||||
m_fetchCurrentObjects.last());
|
||||
}
|
||||
|
||||
void ClientProxy::setSelectedItemsByDebugId(const QList<int> &debugIds)
|
||||
{
|
||||
if (!isConnected())
|
||||
@@ -538,6 +555,8 @@ void ClientProxy::onResult(quint32 queryId, const QVariant &value, const QByteAr
|
||||
updateEngineList(value);
|
||||
else if (queryId == m_contextQueryId)
|
||||
contextChanged(value);
|
||||
else if (m_fetchCurrentObjectsQueryIds.contains(queryId))
|
||||
onCurrentObjectsFetched(queryId, value);
|
||||
else
|
||||
emit result(queryId, value);
|
||||
}
|
||||
|
@@ -150,6 +150,7 @@ private slots:
|
||||
void newObjects();
|
||||
void objectWatchTriggered(int debugId, const QByteArray &propertyName, const QVariant &propertyValue);
|
||||
void onResult(quint32 queryId, const QVariant &value, const QByteArray &type);
|
||||
void onCurrentObjectsFetched(quint32 queryId, const QVariant &result);
|
||||
|
||||
private:
|
||||
void contextChanged(const QVariant &value);
|
||||
@@ -178,8 +179,10 @@ private:
|
||||
quint32 m_engineQueryId;
|
||||
quint32 m_contextQueryId;
|
||||
QList<quint32> m_objectTreeQueryIds;
|
||||
QList<quint32> m_fetchCurrentObjectsQueryIds;
|
||||
|
||||
QList<QmlDebugObjectReference> m_rootObjects;
|
||||
QList<QmlDebugObjectReference> m_fetchCurrentObjects;
|
||||
QmlDebugEngineReferenceList m_engines;
|
||||
DebugIdHash m_debugIdHash;
|
||||
|
||||
|
Reference in New Issue
Block a user