summaryrefslogtreecommitdiff
path: root/models/DecodeHighlightingModel.cpp
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2019-03-11 14:19:23 +0100
committerChristoph Berg <christoph.berg@credativ.de>2019-03-11 14:19:23 +0100
commit200de07a95209a55d6019ba87f0abc78d302bf4c (patch)
tree3b2922eb5d89b01ad214cae492e871c3bfb5df18 /models/DecodeHighlightingModel.cpp
parente0737c56c1e384e05064a0c6e1ac46979371041b (diff)
New upstream version 2.0.1+repackupstream/2.0.1+repack
Diffstat (limited to 'models/DecodeHighlightingModel.cpp')
-rw-r--r--models/DecodeHighlightingModel.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/models/DecodeHighlightingModel.cpp b/models/DecodeHighlightingModel.cpp
index 6425a1a5..4a1205eb 100644
--- a/models/DecodeHighlightingModel.cpp
+++ b/models/DecodeHighlightingModel.cpp
@@ -155,25 +155,30 @@ QVariant DecodeHighlightingModel::data (const QModelIndex& index, int role) cons
if (index.isValid () && index.row () < rowCount ())
{
auto const& item = m_->data_[index.row ()];
+ auto fg_unset = Qt::NoBrush == item.foreground_.style ();
+ auto bg_unset = Qt::NoBrush == item.background_.style ();
switch (role)
{
case Qt::CheckStateRole:
result = item.enabled_ ? Qt::Checked : Qt::Unchecked;
break;
case Qt::DisplayRole:
- return QString {"%1 [f/g:%2, b/g:%3]"}
+ return QString {"%1%2%3%4%4%5%6"}
.arg (highlight_name (item.type_))
- .arg (item.foreground_.style () != Qt::NoBrush ? QString {"#%1"}.arg (item.foreground_.color ().rgb () & 0xffffff, 6, 16, QChar {'0'}) : QString {"unset"})
- .arg (item.background_.style () != Qt::NoBrush ? QString {"#%1"}.arg (item.background_.color ().rgb () & 0xffffff, 6, 16, QChar {'0'}) : QString {"unset"});
+ .arg (fg_unset || bg_unset ? QString {" ["} : QString {})
+ .arg (fg_unset ? QString {"f/g unset"} : QString {})
+ .arg (fg_unset && bg_unset ? QString {" "} : QString {})
+ .arg (bg_unset ? QString {"b/g unset"} : QString {})
+ .arg (fg_unset || bg_unset ? QString {"]"} : QString {});
break;
case Qt::ForegroundRole:
- if (Qt::NoBrush != item.foreground_.style ())
+ if (!fg_unset)
{
result = item.foreground_;
}
break;
case Qt::BackgroundRole:
- if (Qt::NoBrush != item.background_.style ())
+ if (!bg_unset)
{
result = item.background_;
}