24 const std::vector<std::pair<QString, Qt::GlobalColor>> color_queue = {
25 {
"Black", Qt::GlobalColor::black}, {
"Blue", Qt::GlobalColor::blue},
26 {
"Red", Qt::GlobalColor::darkRed}, {
"Cyan", Qt::GlobalColor::darkCyan},
27 {
"Gray", Qt::GlobalColor::darkGray}, {
"Magenta", Qt::GlobalColor::darkMagenta}};
29 struct ColorNameComparator {
30 ColorNameComparator(
const QString& value_to_comp) : m_value_to_comp(value_to_comp) {}
31 bool operator()(
const std::pair<QString, Qt::GlobalColor>& value)
const
33 return value.first == m_value_to_comp;
36 const QString m_value_to_comp;
60 if (!item_index.isValid()) {
62 os <<
"Error in DataProperties::dataItem: index produced by path";
63 os << path.toStdString() <<
" is invalid" << std::endl;
81 std::find_if(color_queue.begin(), color_queue.end(), ColorNameComparator(color_name));
82 if (iter == color_queue.end())
83 throw GUIHelpers::Error(
"Error in Data1DPresentationProperties::color: unknown color name");
84 return QColor(iter->second);
90 return color_queue.front().first;
93 std::find_if(color_queue.begin(), color_queue.end(), ColorNameComparator(current_color));
94 if (iter == color_queue.end() || *iter == color_queue.back())
95 return color_queue.front().first;
96 return (++iter)->first;
101 auto color_combo = defaultColorCombo();
102 color_combo.setValue(color_name);
110 for (
auto& color : color_queue)
111 result << color.first;
112 result.
setValue(color_queue.front().first);
Defines class ComboProperty.
Defines class DataProperties and its descendants.
Defines class GUIHelpers functions.
Defines ModelPath namespace.
Defines class SessionModel.
Custom property to define list of string values with multiple selections.
void setValue(const QString &name)
Holds data required for 1D DataItem representation.
void setColorProperty(const QString &color_name)
Returns set up color ComboProperty.
static const QString & nextColorName(Data1DProperties *properties)
Returns the name of the color, which follows the color of passes property container.
QColor color()
Creates and returns a color object from color name in Data1DPresentationProperties.
static const QString P_COLOR
Provides common functionality for IntensityDataItem and SpecularDataItem.
Implements a link to DataItem.
static const QString P_DATALINK
void setDataItem(DataItem *item)
DataProperties(const QString &model_type)
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
SessionModel * model() const
Returns model of this item.
T * item(const QString &tag) const
void setItemValue(const QString &tag, const QVariant &variant)
Directly set value of item under given tag.
SessionItem * itemForIndex(const QModelIndex &index) const
QModelIndex getIndexFromPath(const SessionModel *model, const QString &path)
QString getPathFromIndex(const QModelIndex &index)