From bb02fba9c9a348ddc3cdae7bf41f0e200d095bd3 Mon Sep 17 00:00:00 2001 From: hjk <hjk@theqtcompany.com> Date: Wed, 15 Apr 2015 18:48:32 +0200 Subject: [PATCH] Debugger: Fix WatchItem color display Name and type columns were not properly grayed out. Change-Id: I4120329e6d8f4e6fa33859056cafd07f69b642bd Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> --- .../debugger/debuggertooltipmanager.cpp | 2 +- src/plugins/debugger/watchhandler.cpp | 34 ++++++++++--------- src/plugins/debugger/watchhandler.h | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index b3c64958a72..9b7556d5547 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -219,7 +219,7 @@ ToolTipWatchItem::ToolTipWatchItem(WatchItem *item) value = item->displayValue(); type = item->displayType(); iname = item->iname; - valueColor = item->valueColor(); + valueColor = item->valueColor(1); expandable = item->hasChildren(); expression = item->expression(); foreach (TreeItem *child, item->children()) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index cc27ae30c1d..a77b2d57387 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -776,21 +776,24 @@ QString WatchItem::displayType() const return result; } -QColor WatchItem::valueColor() const -{ - using Utils::Theme; - Theme *theme = Utils::creatorTheme(); - if (watchModel()) { - if (!valueEnabled) - return theme->color(Theme::Debugger_WatchItem_ValueInvalid); - if (!watchModel()->m_contentsValid && !isInspect()) - return theme->color(Theme::Debugger_WatchItem_ValueInvalid); - if (value.isEmpty()) // This might still show 0x... - return theme->color(Theme::Debugger_WatchItem_ValueInvalid); - if (value != watchModel()->m_valueCache.value(iname)) - return theme->color(Theme::Debugger_WatchItem_ValueChanged); +QColor WatchItem::valueColor(int column) const +{ + Theme::Color color = Theme::Debugger_WatchItem_ValueNormal; + if (const WatchModel *model = watchModel()) { + if (!model->m_contentsValid && !isInspect()) { + color = Theme::Debugger_WatchItem_ValueInvalid; + } else if (column == 1) { + if (!valueEnabled) + color = Theme::Debugger_WatchItem_ValueInvalid; + else if (!model->m_contentsValid && !isInspect()) + color = Theme::Debugger_WatchItem_ValueInvalid; + else if (column == 1 && value.isEmpty()) // This might still show 0x... + color = Theme::Debugger_WatchItem_ValueInvalid; + else if (column == 1 && value != model->m_valueCache.value(iname)) + color = Theme::Debugger_WatchItem_ValueChanged; + } } - return theme->color(Theme::Debugger_WatchItem_ValueNormal); + return creatorTheme()->color(color); } QVariant WatchItem::data(int column, int role) const @@ -837,8 +840,7 @@ QVariant WatchItem::data(int column, int role) const ? toToolTip() : QVariant(); case Qt::ForegroundRole: - if (column == 1) - return valueColor(); + return valueColor(column); case LocalsExpressionRole: return expression(); diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 0d9f53abec3..b01a3110c47 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -107,7 +107,7 @@ public: QVariant editValue() const; int editType() const; - QColor valueColor() const; + QColor valueColor(int column) const; int requestedFormat() const; WatchItem *findItem(const QByteArray &iname); -- GitLab