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

take color setting out of set model

parent 719464f1
No related branches found
No related tags found
1 merge request!2636minor
Pipeline #149111 passed
......@@ -15,8 +15,8 @@
#ifndef BORNAGAIN_GUI_MODEL_TYPE_MODELFORSET_H
#define BORNAGAIN_GUI_MODEL_TYPE_MODELFORSET_H
#include "GUI/Model/Type/PredefinedColors.h"
#include <QAbstractListModel>
#include <QWidget>
template <class T> class SetWithModel;
......@@ -45,8 +45,7 @@ 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 GUI::Colors::listBackground(row == m_set->currentIndex());
default:
return {};
}
......
......@@ -13,6 +13,7 @@
// ************************************************************************************************
#include "GUI/Model/Type/PredefinedColors.h"
#include <QWidget>
const QVector<QColor>& GUI::Colors::layerDefaults()
{
......@@ -22,3 +23,10 @@ const QVector<QColor>& GUI::Colors::layerDefaults()
return colors;
}
const QColor& GUI::Colors::listBackground(bool isCurrent)
{
static QVector<QColor> values = {QWidget().palette().color(QPalette::Button),
QWidget().palette().color(QPalette::Dark)};
return values.at(isCurrent);
}
......@@ -23,6 +23,8 @@ namespace GUI::Colors {
const QVector<QColor>& layerDefaults();
const QColor& listBackground(bool isCurrent);
} // namespace GUI::Colors
#endif // BORNAGAIN_GUI_MODEL_TYPE_PREDEFINEDCOLORS_H
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