diff options
author | Aurindam Jana <aurindam.jana@nokia.com> | 2012-01-16 12:38:33 +0100 |
---|---|---|
committer | Aurindam Jana <aurindam.jana@nokia.com> | 2012-01-18 14:57:41 +0100 |
commit | 70bcccd646d2aeac3aabf9bc6c81ed42c563aeb2 (patch) | |
tree | c8a95c7269bb84843bbb69315713efb770ad5f6a /src/plugins/debugger/stackhandler.cpp | |
parent | 8e7a11392cd3c52a6d7038d16b949bf0927b9285 (diff) | |
download | qt-creator-70bcccd646d2aeac3aabf9bc6c81ed42c563aeb2.tar.gz |
ScriptConsole: Show current context
Show the current context in the script console. The expression
in the script console is evaluated within this context.
Change-Id: Ieb4cfc3e0892b150301f4ad79220cd878dee3ce3
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src/plugins/debugger/stackhandler.cpp')
-rw-r--r-- | src/plugins/debugger/stackhandler.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index 37eb25d16a..d88acc41c1 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -62,7 +62,7 @@ StackHandler::StackHandler() { m_resetLocationScheduled = false; m_contentsValid = false; - m_currentIndex = 0; + m_currentIndex = -1; m_canExpand = false; connect(debuggerCore()->action(OperateByInstruction), SIGNAL(triggered()), this, SLOT(resetModel())); @@ -160,6 +160,8 @@ Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const StackFrame StackHandler::currentFrame() const { + if (m_currentIndex == -1) + return StackFrame(); QTC_ASSERT(m_currentIndex >= 0, return StackFrame()); QTC_ASSERT(m_currentIndex < m_stackFrames.size(), return StackFrame()); return m_stackFrames.at(m_currentIndex); @@ -167,7 +169,7 @@ StackFrame StackHandler::currentFrame() const void StackHandler::setCurrentIndex(int level) { - if (level == m_currentIndex) + if (level == -1 || level == m_currentIndex) return; // Emit changed for previous frame @@ -175,6 +177,7 @@ void StackHandler::setCurrentIndex(int level) emit dataChanged(i, i); m_currentIndex = level; + emit currentIndexChanged(); // Emit changed for new frame i = index(m_currentIndex, 0); @@ -184,7 +187,7 @@ void StackHandler::setCurrentIndex(int level) void StackHandler::removeAll() { m_stackFrames.clear(); - m_currentIndex = 0; + setCurrentIndex(-1); reset(); } @@ -195,7 +198,7 @@ void StackHandler::setFrames(const StackFrames &frames, bool canExpand) m_canExpand = canExpand; m_stackFrames = frames; if (m_currentIndex >= m_stackFrames.size()) - m_currentIndex = m_stackFrames.size() - 1; + setCurrentIndex(m_stackFrames.size() - 1); reset(); emit stackChanged(); } |