Show Active Position errors in X/26 triplet list

Attempts to move the Active Position upwards to a lesser numbered row,
or leftwards within the same row to a lesser numbered column, are now
highlighted red within the triplet list so the user can see which
triplets are being ignored due to these errors.

Detection for other triplet errors such as reserved bits/values or
object related errors will be added later on.

This is a part of moving the Active Position logic from the renderer
to the triplet list, so a renderer won't be needed if the ability to
editing (G)POP pages is added in the future.
This commit is contained in:
G.K.MacGregor
2021-06-28 22:07:41 +01:00
parent e1a1bcf070
commit e7f6a54d8d
4 changed files with 216 additions and 69 deletions

View File

@@ -64,6 +64,16 @@ QVariant X26Model::data(const QModelIndex &index, int role) const
return QVariant();
}
// Error colours from KDE Plasma Breeze (light) theme
if (role == Qt::ForegroundRole && triplet.error() != X26Triplet::NoError && index.column() == m_tripletErrors[triplet.error()].columnHighlight)
return QColor(252, 252, 252);
if (role == Qt::BackgroundRole && triplet.error() != X26Triplet::NoError && index.column() == m_tripletErrors[triplet.error()].columnHighlight)
return QColor(218, 68, 63);
if (role == Qt::ToolTipRole && triplet.error() != X26Triplet::NoError)
return m_tripletErrors[triplet.error()].message;
if (role == Qt::DisplayRole || role == Qt::EditRole)
switch (index.column()) {
case 0:
@@ -94,7 +104,7 @@ QVariant X26Model::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) {
if (index.column() == 2)
return (modeTripletName[triplet.modeExt()]);
return (m_modeTripletName[triplet.modeExt()]);
// Column 3 - describe effects of data/address triplet parameters in plain English
switch (triplet.modeExt()) {
case 0x01: // Full row colour