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);
43 bool event(QEvent *event)
override;
47 void paletteChanged(
const QPalette &palette);
48 void handleComputeRadioClicked();
49 void handleDetailsRadioClicked();
54 void updateStyledButton();
56 QPalette::ColorGroup currentColorGroup()
const
58 return m_currentColorGroup;
61 std::unique_ptr<Ui::PaletteEditor> m_ui;
62 QPalette m_editPalette;
63 QPalette m_parentPalette;
64 QPalette::ColorGroup m_currentColorGroup;
67 bool m_paletteUpdated;
76 Q_PROPERTY(QPalette::ColorRole colorRole READ colorRole)
80 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
81 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
82 QVariant data(
const QModelIndex &index,
int role)
const override;
83 bool setData(
const QModelIndex &index,
const QVariant &value,
int role)
override;
84 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
85 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
87 QPalette getPalette()
const;
88 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
92 return QPalette::NoRole;
103 QPalette::ColorGroup columnToGroup(
int index)
const;
104 int groupToColumn(QPalette::ColorGroup group)
const;
107 QPalette m_parentPalette;
108 QMap<QPalette::ColorRole, QString> m_roleNames;
121 void setBrush(
const QBrush &brush);
122 QBrush brush()
const;
123 bool changed()
const;
142 explicit RoleEditor(QWidget *parent =
nullptr);
144 void setLabel(
const QString &label);
145 void setEdited(
bool on);
152 void emitResetProperty();
168 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
170 void setEditorData(QWidget *ed,
const QModelIndex &index)
const override;
171 void setModelData(QWidget *ed, QAbstractItemModel *model,
const QModelIndex &index)
const override;
173 void updateEditorGeometry(QWidget *ed,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
175 void paint(QPainter *painter,
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const override;
176 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.