From 3cc286de3d732e11cf804793290ca75df7c598e2 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 1 Jul 2019 12:59:52 +0200 Subject: [PATCH] ToolTipWatchItem: Fix column mapping Commit e95fd876 ("Debugger: Make the time stamp recording option work for single items") introduced an enum, and the old (off-by-one from column 1 on) plain integers were used here, leading to the problem that the second column would always show "0" and the actual value would go to the third column instead of the second one when hovering over a variable with the mouse in debug mode. Use the enum values to make it work as expected. Change-Id: I3a66596281e27a3bcc953ee6ea461755d5e64d5c Reviewed-by: hjk --- src/plugins/debugger/debuggertooltipmanager.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 2ad12ff6827..611e714abdc 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -259,13 +259,13 @@ ToolTipWatchItem::ToolTipWatchItem(TreeItem *item) { const QAbstractItemModel *model = item->model(); QModelIndex idx = item->index(); - name = model->data(idx.sibling(idx.row(), 0), Qt::DisplayRole).toString(); - value = model->data(idx.sibling(idx.row(), 1), Qt::DisplayRole).toString(); - type = model->data(idx.sibling(idx.row(), 2), Qt::DisplayRole).toString(); - iname = model->data(idx.sibling(idx.row(), 0), LocalsINameRole).toString(); - valueColor = model->data(idx.sibling(idx.row(), 1), Qt::ForegroundRole).value(); + name = model->data(idx.sibling(idx.row(), WatchModelBase::NameColumn), Qt::DisplayRole).toString(); + value = model->data(idx.sibling(idx.row(), WatchModelBase::ValueColumn), Qt::DisplayRole).toString(); + type = model->data(idx.sibling(idx.row(), WatchModelBase::TypeColumn), Qt::DisplayRole).toString(); + iname = model->data(idx.sibling(idx.row(), WatchModelBase::NameColumn), LocalsINameRole).toString(); + valueColor = model->data(idx.sibling(idx.row(), WatchModelBase::ValueColumn), Qt::ForegroundRole).value(); expandable = model->hasChildren(idx); - expression = model->data(idx.sibling(idx.row(), 0), Qt::EditRole).toString(); + expression = model->data(idx.sibling(idx.row(), WatchModelBase::NameColumn), Qt::EditRole).toString(); for (TreeItem *child : *item) appendChild(new ToolTipWatchItem(child)); }