summaryrefslogtreecommitdiff
path: root/src/plugins/qmljsinspector
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@nokia.com>2011-02-10 13:58:59 +0100
committerChristiaan Janssen <christiaan.janssen@nokia.com>2011-02-10 14:33:20 +0100
commit49fa40cf9e4b3ed5d26b38b2e7e8d884ae229ea9 (patch)
tree6bd09679c6070ead9429ded44020efb19e5e7cf3 /src/plugins/qmljsinspector
parent37686e6a15993406c6e87553524501d61c2b556b (diff)
downloadqt-creator-49fa40cf9e4b3ed5d26b38b2e7e8d884ae229ea9.tar.gz
QmlInspector: changed crumblepath appearance
Reviewed-by: Kai Koehne
Diffstat (limited to 'src/plugins/qmljsinspector')
-rw-r--r--src/plugins/qmljsinspector/qmljscontextcrumblepath.cpp15
-rw-r--r--src/plugins/qmljsinspector/qmljscontextcrumblepath.h3
-rw-r--r--src/plugins/qmljsinspector/qmljsinspector.cpp14
3 files changed, 19 insertions, 13 deletions
diff --git a/src/plugins/qmljsinspector/qmljscontextcrumblepath.cpp b/src/plugins/qmljsinspector/qmljscontextcrumblepath.cpp
index 6ebefda882..1089b59837 100644
--- a/src/plugins/qmljsinspector/qmljscontextcrumblepath.cpp
+++ b/src/plugins/qmljsinspector/qmljscontextcrumblepath.cpp
@@ -56,19 +56,22 @@ void ContextCrumblePath::updateContextPath(const QStringList &path, const QList<
clear();
- for (int i=0; i<path.count(); i++) {
- pushElement(path[i],QVariant(debugIds[i]));
- }
-
m_isEmpty = path.isEmpty();
if (m_isEmpty) {
pushElement(tr("[no context]"));
+ } else {
+ for (int i=0; i<path.count(); i++) {
+ pushElement(path[i],QVariant(debugIds[i]));
+ }
}
}
-void ContextCrumblePath::selectIndex(int index)
+void ContextCrumblePath::addChildren(const QStringList &childrenNames, const QList<int> &childrenDebugIds)
{
- CrumblePath::selectIndex(index);
+ Q_ASSERT(childrenNames.count() == childrenDebugIds.count());
+ for (int i=0; i<childrenNames.count(); i++) {
+ addChild(childrenNames[i],QVariant(childrenDebugIds[i]));
+ }
}
bool ContextCrumblePath::isEmpty() const
diff --git a/src/plugins/qmljsinspector/qmljscontextcrumblepath.h b/src/plugins/qmljsinspector/qmljscontextcrumblepath.h
index dee2bb2347..9b20b8d2e4 100644
--- a/src/plugins/qmljsinspector/qmljscontextcrumblepath.h
+++ b/src/plugins/qmljsinspector/qmljscontextcrumblepath.h
@@ -50,7 +50,8 @@ public:
public slots:
void updateContextPath(const QStringList &path, const QList<int> &debugIds);
- void selectIndex(int index);
+ void addChildren(const QStringList &childrenNames, const QList<int> &childrenDebugIds);
+
private:
bool m_isEmpty;
};
diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp
index 6ac4b92302..0a1f92ea9f 100644
--- a/src/plugins/qmljsinspector/qmljsinspector.cpp
+++ b/src/plugins/qmljsinspector/qmljsinspector.cpp
@@ -576,7 +576,9 @@ void InspectorUi::populateCrumblePath(const QDeclarativeDebugObjectReference &ob
crumbleStrings.push_front( displayName(ref) );
}
- int itemIndex = crumbleData.length()-1;
+ m_crumblePath->updateContextPath(crumbleStrings, crumbleData);
+ crumbleStrings.clear();
+ crumbleData.clear();
// now append the children
foreach (const QDeclarativeDebugObjectReference &child, objRef.children()) {
@@ -584,8 +586,7 @@ void InspectorUi::populateCrumblePath(const QDeclarativeDebugObjectReference &ob
crumbleStrings.push_back( displayName(child) );
}
- m_crumblePath->updateContextPath(crumbleStrings, crumbleData);
- m_crumblePath->selectIndex(itemIndex);
+ m_crumblePath->addChildren(crumbleStrings, crumbleData);
}
void InspectorUi::selectItems(const QList<int> &objectIds)
@@ -710,8 +711,9 @@ void InspectorUi::setupDockWidgets()
wlay->setSpacing(0);
observerWidget->setLayout(wlay);
wlay->addWidget(m_toolBar->widget());
- wlay->addWidget(m_propertyInspector);
wlay->addWidget(m_crumblePath);
+ wlay->addWidget(m_propertyInspector);
+
Debugger::DebuggerMainWindow *mw = Debugger::DebuggerPlugin::mainWindow();
QDockWidget *dock = mw->createDockWidget(Debugger::QmlLanguage, observerWidget);
@@ -719,10 +721,10 @@ void InspectorUi::setupDockWidgets()
dock->setTitleBarWidget(new QWidget(dock));
}
-void InspectorUi::crumblePathElementClicked(int pathIndex)
+void InspectorUi::crumblePathElementClicked(int debugId)
{
QList <int> l;
- l << m_crumblePath->debugIdForIndex(pathIndex);
+ l << debugId;
selectItems(l);
}