Commit 36a6585f authored by hjk's avatar hjk

Debugger: Introduce enum for columns in breakpoint view

Change-Id: I771c7fceed31739cfe504ba660796d48fb518a5e
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent b0011229
......@@ -602,13 +602,13 @@ QVariant BreakpointItem::data(int column, int role) const
}
switch (column) {
case 0:
case BreakpointNumberColumn:
if (role == Qt::DisplayRole)
return m_id.toString();
if (role == Qt::DecorationRole)
return icon();
break;
case 1:
case BreakpointFunctionColumn:
if (role == Qt::DisplayRole) {
if (!m_response.functionName.isEmpty())
return simplifyType(m_response.functionName);
......@@ -634,7 +634,7 @@ QVariant BreakpointItem::data(int column, int role) const
return empty;
}
break;
case 2:
case BreakpointFileColumn:
if (role == Qt::DisplayRole) {
QString str;
if (!m_response.fileName.isEmpty())
......@@ -654,7 +654,7 @@ QVariant BreakpointItem::data(int column, int role) const
return empty;
}
break;
case 3:
case BreakpointLineColumn:
if (role == Qt::DisplayRole) {
if (m_response.lineNumber > 0)
return m_response.lineNumber;
......@@ -665,7 +665,7 @@ QVariant BreakpointItem::data(int column, int role) const
if (role == Qt::UserRole + 1)
return m_params.lineNumber;
break;
case 4:
case BreakpointAddressColumn:
if (role == Qt::DisplayRole) {
const quint64 address = orig ? m_params.address : m_response.address;
if (address)
......@@ -673,7 +673,7 @@ QVariant BreakpointItem::data(int column, int role) const
return QVariant();
}
break;
case 5:
case BreakpointConditionColumn:
if (role == Qt::DisplayRole)
return orig ? m_params.condition : m_response.condition;
if (role == Qt::ToolTipRole)
......@@ -681,7 +681,7 @@ QVariant BreakpointItem::data(int column, int role) const
if (role == Qt::UserRole + 1)
return m_params.condition;
break;
case 6:
case BreakpointIgnoreColumn:
if (role == Qt::DisplayRole) {
const int ignoreCount =
orig ? m_params.ignoreCount : m_response.ignoreCount;
......@@ -692,7 +692,7 @@ QVariant BreakpointItem::data(int column, int role) const
if (role == Qt::UserRole + 1)
return m_params.ignoreCount;
break;
case 7:
case BreakpointThreadsColumn:
if (role == Qt::DisplayRole)
return BreakHandler::displayFromThreadSpec(orig ? m_params.threadSpec : m_response.threadSpec);
if (role == Qt::ToolTipRole)
......
......@@ -129,6 +129,18 @@ enum BreakpointPathUsage
BreakpointUseShortPath //!< Use filename only, in case source files are relocated.
};
enum BreakpointColumns
{
BreakpointNumberColumn,
BreakpointFunctionColumn,
BreakpointFileColumn,
BreakpointLineColumn,
BreakpointAddressColumn,
BreakpointConditionColumn,
BreakpointIgnoreColumn,
BreakpointThreadsColumn
};
enum BreakpointParts
{
NoParts = 0,
......
......@@ -695,14 +695,14 @@ BreakTreeView::BreakTreeView()
{
setWindowIcon(Icons::BREAKPOINTS.icon());
setSelectionMode(QAbstractItemView::ExtendedSelection);
setItemDelegateForColumn(2, new LeftElideDelegate(this));
setItemDelegateForColumn(BreakpointFileColumn, new LeftElideDelegate(this));
connect(action(UseAddressInBreakpointsView), &QAction::toggled,
this, &BreakTreeView::showAddressColumn);
}
void BreakTreeView::showAddressColumn(bool on)
{
setColumnHidden(7, !on);
setColumnHidden(BreakpointAddressColumn, !on);
}
void BreakTreeView::keyPressEvent(QKeyEvent *ev)
......@@ -736,7 +736,7 @@ void BreakTreeView::mouseDoubleClickEvent(QMouseEvent *ev)
{
QModelIndex indexUnderMouse = indexAt(ev->pos());
if (indexUnderMouse.isValid()) {
if (indexUnderMouse.column() >= 4) {
if (indexUnderMouse.column() >= BreakpointAddressColumn) {
Breakpoint b = breakHandler()->findBreakpointByIndex(indexUnderMouse);
QTC_ASSERT(b, return);
editBreakpoints(Breakpoints() << b);
......@@ -771,7 +771,8 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev)
QAction *deleteByFileAction = 0;
Breakpoints breakpointsInFile;
if (indexUnderMouse.isValid()) {
const QModelIndex index = indexUnderMouse.sibling(indexUnderMouse.row(), 2);
const QModelIndex index = indexUnderMouse.sibling(indexUnderMouse.row(),
BreakpointFileColumn);
const QString file = index.data().toString();
if (!file.isEmpty()) {
for (int i = 0; i != rowCount; ++i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment