20 #include <QAbstractItemModel>
22 #include <QModelIndex>
24 #include <QTextStream>
29 class mgx_EXPORT
Colors :
public QAbstractItemModel
68 StartMesh1 = Mesh1Color,
69 StartMesh2 = Mesh2Color,
70 StartOthers = BackgroundColor
74 static const QString colorNames[NbColors];
75 static const QString categoryNames[3];
76 static const int categoryShift[3];
77 static const int categorySize[3];
82 void readParms(
Parms& parms, QString section);
83 void writeParms(QTextStream& pout, QString section);
85 bool hasChildren(
const QModelIndex& parent = QModelIndex())
const;
87 QColor
color(
const QModelIndex& index)
const
89 return data(index, Qt::DecorationRole).value<QColor>();
91 void setColor(
const QModelIndex& index, QColor col)
93 setData(index, col, Qt::DecorationRole);
99 int rowCount(
const QModelIndex& parent = QModelIndex())
const;
100 int columnCount(
const QModelIndex& parent = QModelIndex())
const;
102 Qt::ItemFlags flags(
const QModelIndex& index)
const;
104 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const;
105 bool setData(
const QModelIndex& index,
const QVariant& value,
int role = Qt::EditRole);
106 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
108 QModelIndex index(
int row,
int column,
const QModelIndex& parent = QModelIndex())
const;
109 QModelIndex parent(
const QModelIndex& index)
const;
119 return instance()->qcolor(type);
123 return instance()->color(type);
127 void colorsChanged();
131 void restoreColors();