diff options
author | hjk <hjk121@nokiamail.com> | 2014-12-18 13:25:54 +0100 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-12-18 15:51:33 +0100 |
commit | c3650bf269fa77b4ec647bbe803e0309c0427b6f (patch) | |
tree | 2a033c46d364445cc1f6e03816f9a15596149bbb /src/plugins/debugger/stackhandler.cpp | |
parent | 242b3f4110ebbe3882e28b7df75c26768c5f9ecc (diff) |
Debugger: Use an enum for column numbers in stack view
Easier to read.
Change-Id: I85abf6e8c881b4d521f7791625cff37bbd2fffdc
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger/stackhandler.cpp')
-rw-r--r-- | src/plugins/debugger/stackhandler.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index 6ba5ecd542..eeb3ad948c 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -84,7 +84,7 @@ int StackHandler::rowCount(const QModelIndex &parent) const int StackHandler::columnCount(const QModelIndex &parent) const { - return parent.isValid() ? 0 : 5; + return parent.isValid() ? 0 : StackColumnCount; } QVariant StackHandler::data(const QModelIndex &index, int role) const @@ -93,11 +93,11 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const return QVariant(); if (index.row() == m_stackFrames.size()) { - if (role == Qt::DisplayRole && index.column() == 0) + if (role == Qt::DisplayRole && index.column() == StackLevelColumn) return tr("..."); - if (role == Qt::DisplayRole && index.column() == 1) + if (role == Qt::DisplayRole && index.column() == StackFunctionNameColumn) return tr("<More>"); - if (role == Qt::DecorationRole && index.column() == 0) + if (role == Qt::DecorationRole && index.column() == StackLevelColumn) return m_emptyIcon; return QVariant(); } @@ -106,15 +106,15 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole) { switch (index.column()) { - case 0: // Stack frame level + case StackLevelColumn: return QString::number(frame.level); - case 1: // Function name + case StackFunctionNameColumn: return simplifyType(frame.function); - case 2: // File name + case StackFileNameColumn: return frame.file.isEmpty() ? frame.from : QFileInfo(frame.file).fileName(); - case 3: // Line number + case StackLineNumberColumn: return frame.line > 0 ? QVariant(frame.line) : QVariant(); - case 4: // Address + case StackAddressColumn: if (frame.address) return QString::fromLatin1("0x%1").arg(frame.address, 0, 16); return QString(); @@ -122,7 +122,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const return QVariant(); } - if (role == Qt::DecorationRole && index.column() == 0) { + if (role == Qt::DecorationRole && index.column() == StackLevelColumn) { // Return icon that indicates whether this is the active stack frame return (m_contentsValid && index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon; |