1 #ifndef WIDGETS_PALETTEEDITOR_H
2 #define WIDGETS_PALETTEEDITOR_H
7 #include <QItemDelegate>
11 QT_FORWARD_DECLARE_CLASS(QListView)
12 QT_FORWARD_DECLARE_CLASS(QLabel)
35 static QPalette getPalette(QWidget *parent,
const QPalette &
init = QPalette(),
const QPalette &parentPal = QPalette(),
int *result =
nullptr);
37 QPalette palette()
const;
38 void setPalette(
const QPalette &palette);
39 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
42 void handleBuildButtonColorChanged(
const QColor &);
43 void handleActiveRadioClicked();
44 void handleInactiveRadioClicked();
45 void handleDisabledRadioClicked();
46 void handleComputeRadioClicked();
47 void handleDetailsRadioClicked();
49 void paletteChanged(
const QPalette &palette);
54 void updatePreviewPalette();
55 void updateStyledButton();
57 QPalette::ColorGroup currentColorGroup()
const
59 return m_currentColorGroup;
62 std::unique_ptr<Ui::PaletteEditor> m_ui;
63 QPalette m_editPalette;
64 QPalette m_parentPalette;
65 QPalette::ColorGroup m_currentColorGroup;
68 bool m_paletteUpdated;
77 Q_PROPERTY(QPalette::ColorRole colorRole READ colorRole)
81 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
82 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
83 QVariant data(
const QModelIndex &index,
int role)
const override;
84 bool setData(
const QModelIndex &index,
const QVariant &value,
int role)
override;
85 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
86 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
88 QPalette getPalette()
const;
89 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
93 return QPalette::NoRole;
104 QPalette::ColorGroup columnToGroup(
int index)
const;
105 int groupToColumn(QPalette::ColorGroup group)
const;
108 QPalette m_parentPalette;
109 QMap<QPalette::ColorRole, QString> m_roleNames;
122 void setBrush(
const QBrush &brush);
123 QBrush brush()
const;
124 bool changed()
const;
143 explicit RoleEditor(QWidget *parent =
nullptr);
145 void setLabel(
const QString &label);
146 void setEdited(
bool on);
153 void emitResetProperty();
169 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
171 void setEditorData(QWidget *ed,
const QModelIndex &index)
const override;
172 void setModelData(QWidget *ed, QAbstractItemModel *model,
const QModelIndex &index)
const override;
174 void updateEditorGeometry(QWidget *ed,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
176 void paint(QPainter *painter,
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const override;
177 QSize sizeHint(
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const override;
The BrushEditor class is used by PaletteEditor.
void changed(QWidget *widget)
The ColorDelegate class is used by PaletteEditor.
The PaletteEditor class provides a dialog to customize a QPalette.
The PaletteModel class is used by PaletteEditor.
QPalette::ColorRole colorRole() const
void paletteChanged(const QPalette &palette)
The RoleEditor class is used by PaletteEditor.
void changed(QWidget *widget)
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
QT_UTILITIES_EXPORT void init()
Initiates the resources used and provided by this library.