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>
This commit is contained in:
hjk
2015-04-15 18:48:32 +02:00
parent 6936d46bb9
commit bb02fba9c9
3 changed files with 19 additions and 17 deletions

View File

@@ -219,7 +219,7 @@ ToolTipWatchItem::ToolTipWatchItem(WatchItem *item)
value = item->displayValue(); value = item->displayValue();
type = item->displayType(); type = item->displayType();
iname = item->iname; iname = item->iname;
valueColor = item->valueColor(); valueColor = item->valueColor(1);
expandable = item->hasChildren(); expandable = item->hasChildren();
expression = item->expression(); expression = item->expression();
foreach (TreeItem *child, item->children()) foreach (TreeItem *child, item->children())

View File

@@ -776,21 +776,24 @@ QString WatchItem::displayType() const
return result; return result;
} }
QColor WatchItem::valueColor() const QColor WatchItem::valueColor(int column) const
{ {
using Utils::Theme; Theme::Color color = Theme::Debugger_WatchItem_ValueNormal;
Theme *theme = Utils::creatorTheme(); if (const WatchModel *model = watchModel()) {
if (watchModel()) { if (!model->m_contentsValid && !isInspect()) {
if (!valueEnabled) color = Theme::Debugger_WatchItem_ValueInvalid;
return theme->color(Theme::Debugger_WatchItem_ValueInvalid); } else if (column == 1) {
if (!watchModel()->m_contentsValid && !isInspect()) if (!valueEnabled)
return theme->color(Theme::Debugger_WatchItem_ValueInvalid); color = Theme::Debugger_WatchItem_ValueInvalid;
if (value.isEmpty()) // This might still show 0x... else if (!model->m_contentsValid && !isInspect())
return theme->color(Theme::Debugger_WatchItem_ValueInvalid); color = Theme::Debugger_WatchItem_ValueInvalid;
if (value != watchModel()->m_valueCache.value(iname)) else if (column == 1 && value.isEmpty()) // This might still show 0x...
return theme->color(Theme::Debugger_WatchItem_ValueChanged); 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 QVariant WatchItem::data(int column, int role) const
@@ -837,8 +840,7 @@ QVariant WatchItem::data(int column, int role) const
? toToolTip() : QVariant(); ? toToolTip() : QVariant();
case Qt::ForegroundRole: case Qt::ForegroundRole:
if (column == 1) return valueColor(column);
return valueColor();
case LocalsExpressionRole: case LocalsExpressionRole:
return expression(); return expression();

View File

@@ -107,7 +107,7 @@ public:
QVariant editValue() const; QVariant editValue() const;
int editType() const; int editType() const;
QColor valueColor() const; QColor valueColor(int column) const;
int requestedFormat() const; int requestedFormat() const;
WatchItem *findItem(const QByteArray &iname); WatchItem *findItem(const QByteArray &iname);