1 #include "colorsamplemodel.h"
5 ColorSampleModel::ColorSampleModel(QObject *parent) :
6 QAbstractTableModel(parent)
10 void ColorSampleModel::setFont(const QFont &font)
15 int ColorSampleModel::rowCount(const QModelIndex &parent) const
21 int ColorSampleModel::columnCount(const QModelIndex &parent) const
27 QVariant ColorSampleModel::data(const QModelIndex &index, int role) const
29 if (!index.isValid()) {
33 const QString strText[3][2] = {
34 { tr("通常"), tr("システム") },
35 { tr("マーク"), tr("隠し属性") },
36 { tr(""), tr("読取専用") }
41 return strText[index.row()][index.column()];
47 case Qt::BackgroundRole:
48 switch (index.column()) {
50 switch (index.row()) {
51 case 0: return QBrush(m_colorMap->value("clrBgNormal"));
52 case 1: return QBrush(m_colorMap->value("clrBgMark"));
57 switch (index.row()) {
61 return QBrush(m_colorMap->value("clrBgNormal"));
67 case Qt::ForegroundRole:
68 switch (index.column()) {
70 switch (index.row()) {
71 case 0: return QBrush(m_colorMap->value("clrFgNormal"));
72 case 1: return QBrush(m_colorMap->value("clrFgMark"));
77 switch (index.row()) {
78 case 0: return QBrush(m_colorMap->value("clrFgSystem"));
79 case 1: return QBrush(m_colorMap->value("clrFgHidden"));
80 case 2: return QBrush(m_colorMap->value("clrFgReadonly"));