1#ifndef WIDGETS_PALETTEEDITOR_H
2#define WIDGETS_PALETTEEDITOR_H
7#include <QItemDelegate>
11QT_FORWARD_DECLARE_CLASS(QListView)
12QT_FORWARD_DECLARE_CLASS(QLabel)
31 Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
36 static QPalette getPalette(QWidget *parent,
const QPalette &init = QPalette(),
const QPalette &parentPal = QPalette(),
int *result =
nullptr);
38 QPalette palette()
const;
39 void setPalette(
const QPalette &palette);
40 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
44 void paletteChanged(
const QPalette &palette);
45 void handleComputeRadioClicked();
46 void handleDetailsRadioClicked();
51 void updateStyledButton();
53 QPalette::ColorGroup currentColorGroup()
const
55 return m_currentColorGroup;
58 std::unique_ptr<Ui::PaletteEditor> m_ui;
59 QPalette m_editPalette;
60 QPalette m_parentPalette;
61 QPalette::ColorGroup m_currentColorGroup;
64 bool m_paletteUpdated;
73 Q_PROPERTY(QPalette::ColorRole colorRole READ colorRole)
77 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
78 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
79 QVariant data(
const QModelIndex &index,
int role)
const override;
80 bool setData(
const QModelIndex &index,
const QVariant &value,
int role)
override;
81 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
82 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
84 QPalette getPalette()
const;
85 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
89 return QPalette::NoRole;
100 QPalette::ColorGroup columnToGroup(
int index)
const;
101 int groupToColumn(QPalette::ColorGroup group)
const;
104 QPalette m_parentPalette;
105 QMap<QPalette::ColorRole, QString> m_roleNames;
118 void setBrush(
const QBrush &brush);
119 QBrush brush()
const;
120 bool changed()
const;
139 explicit RoleEditor(QWidget *parent =
nullptr);
141 void setLabel(
const QString &label);
142 void setEdited(
bool on);
149 void emitResetProperty();
165 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
167 void setEditorData(QWidget *ed,
const QModelIndex &index)
const override;
168 void setModelData(QWidget *ed, QAbstractItemModel *model,
const QModelIndex &index)
const override;
170 void updateEditorGeometry(QWidget *ed,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
172 void paint(QPainter *painter,
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const override;
173 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.