Skip to content
Snippets Groups Projects
Commit 357a320c authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

format

parent a01c3165
No related branches found
No related tags found
1 merge request!2455express stylesheet colors through default palette; selected item background cyan -> gray; restore masks list view; rm MAsksQModel
Pipeline #134723 passed
......@@ -45,8 +45,8 @@ public:
case Qt::ToolTipRole:
return t->description();
case Qt::BackgroundRole:
return row == m_set->currentIndex() ?
QWidget().palette().color(QPalette::Dark) : QWidget().palette().color(QPalette::Button);
return row == m_set->currentIndex() ? QWidget().palette().color(QPalette::Dark)
: QWidget().palette().color(QPalette::Button);
default:
return {};
}
......
......@@ -24,8 +24,8 @@ QStringList splitName(const QString& s)
QRegularExpression pattern("(.*)_(\\d+)$");
QRegularExpressionMatch match = pattern.match(s);
if (match.hasMatch()) {
ASSERT(match.lastCapturedIndex() == 2);
return { match.captured(1), match.captured(2) };
ASSERT(match.lastCapturedIndex() == 2);
return {match.captured(1), match.captured(2)};
}
return {}; // s does not contain '_\d+'
}
......
......@@ -30,14 +30,14 @@ void SetView::setSet(AbstractSetModel* set)
{
disconnect(this, &QListView::clicked, nullptr, nullptr);
if (set) {
setModel(set->model());
connect(this, &QListView::clicked, [this, set](const QModelIndex& qi) {
set->setCurrentIndex(qi.row());
this->setCurrentIndex({}); // keep "current" invalid, hence invisible
});
setModel(set->model());
connect(this, &QListView::clicked, [this, set](const QModelIndex& qi) {
set->setCurrentIndex(qi.row());
this->setCurrentIndex({}); // keep "current" invalid, hence invisible
});
} else {
// It seems to be a stable though undocumented feature of QAbstractItemView::setModel
// that the nullptr argument is supported: https://stackoverflow.com/a/46630417/1017348.
setModel(nullptr);
// It seems to be a stable though undocumented feature of QAbstractItemView::setModel
// that the nullptr argument is supported: https://stackoverflow.com/a/46630417/1017348.
setModel(nullptr);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment