Qml JS Inspector: Show "no context" element in crumble path when empty

This commit is contained in:
Lasse Holmstedt
2010-08-02 18:03:27 +02:00
parent 034798c0ef
commit f464de1cd5
3 changed files with 10 additions and 5 deletions

View File

@@ -7,9 +7,10 @@ namespace QmlJSInspector {
namespace Internal { namespace Internal {
ContextCrumblePath::ContextCrumblePath(QWidget *parent) ContextCrumblePath::ContextCrumblePath(QWidget *parent)
: CrumblePath(parent) : CrumblePath(parent), m_isEmpty(true)
{ {
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
updateContextPath(QStringList());
} }
ContextCrumblePath::~ContextCrumblePath() ContextCrumblePath::~ContextCrumblePath()
@@ -23,6 +24,11 @@ void ContextCrumblePath::updateContextPath(const QStringList &path)
foreach(const QString &pathPart, path) { foreach(const QString &pathPart, path) {
pushElement(pathPart); pushElement(pathPart);
} }
m_isEmpty = path.isEmpty();
if (m_isEmpty) {
pushElement(tr("[no context]"));
}
} }
} // namespace Internal } // namespace Internal

View File

@@ -16,7 +16,8 @@ public:
public slots: public slots:
void updateContextPath(const QStringList &path); void updateContextPath(const QStringList &path);
private:
bool m_isEmpty;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -164,7 +164,6 @@ void Inspector::disconnected()
{ {
resetViews(); resetViews();
updateMenuActions(); updateMenuActions();
applyChangesToQmlObserverHelper(false); applyChangesToQmlObserverHelper(false);
} }
@@ -324,7 +323,7 @@ void Inspector::startQmlProjectDebugger()
void Inspector::resetViews() void Inspector::resetViews()
{ {
m_crumblePath->clear(); m_crumblePath->updateContextPath(QStringList());
} }
void Inspector::simultaneouslyDebugQmlCppApplication() void Inspector::simultaneouslyDebugQmlCppApplication()
@@ -572,7 +571,6 @@ void Inspector::setSimpleDockWidgetArrangement()
mainWindow->removeDockWidget(m_crumblePathDock); mainWindow->removeDockWidget(m_crumblePathDock);
mainWindow->addDockWidget(Qt::BottomDockWidgetArea, m_crumblePathDock); mainWindow->addDockWidget(Qt::BottomDockWidgetArea, m_crumblePathDock);
mainWindow->splitDockWidget(mainWindow->toolBarDockWidget(), m_crumblePathDock, Qt::Vertical); mainWindow->splitDockWidget(mainWindow->toolBarDockWidget(), m_crumblePathDock, Qt::Vertical);
//m_crumblePathDock->setVisible(true);
mainWindow->setTrackingEnabled(true); mainWindow->setTrackingEnabled(true);
} }