1 #ifndef WIDGETS_PALETTEEDITOR_H 2 #define WIDGETS_PALETTEEDITOR_H 6 #include <c++utilities/conversion/types.h> 8 #include <QItemDelegate> 13 QT_FORWARD_DECLARE_CLASS(QListView)
14 QT_FORWARD_DECLARE_CLASS(QLabel)
39 static QPalette getPalette(QWidget *parent,
const QPalette &
init = QPalette(),
40 const QPalette &parentPal = QPalette(),
int *result =
nullptr);
42 QPalette palette()
const;
43 void setPalette(
const QPalette &palette);
44 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
47 void on_buildButton_colorChanged(
const QColor &);
48 void on_activeRadio_clicked();
49 void on_inactiveRadio_clicked();
50 void on_disabledRadio_clicked();
51 void on_computeRadio_clicked();
52 void on_detailsRadio_clicked();
54 void paletteChanged(
const QPalette &palette);
59 void updatePreviewPalette();
60 void updateStyledButton();
62 QPalette::ColorGroup currentColorGroup()
const 64 return m_currentColorGroup;
67 std::unique_ptr<Ui::PaletteEditor> m_ui;
68 QPalette m_editPalette;
69 QPalette m_parentPalette;
70 QPalette::ColorGroup m_currentColorGroup;
73 bool m_paletteUpdated;
83 Q_PROPERTY(QPalette::ColorRole colorRole READ colorRole)
87 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
88 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
89 QVariant data(
const QModelIndex &index,
int role)
const;
90 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
91 Qt::ItemFlags flags(
const QModelIndex &index)
const;
92 QVariant headerData(
int section, Qt::Orientation orientation,
93 int role = Qt::DisplayRole)
const;
95 QPalette getPalette()
const;
96 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
98 QPalette::ColorRole
colorRole()
const {
return QPalette::NoRole; }
102 void paletteChanged(
const QPalette &palette);
106 QPalette::ColorGroup columnToGroup(
int index)
const;
107 int groupToColumn(QPalette::ColorGroup group)
const;
110 QPalette m_parentPalette;
111 QMap<QPalette::ColorRole, QString> m_roleNames;
125 void setBrush(
const QBrush &brush);
126 QBrush brush()
const;
127 bool changed()
const;
130 void changed(QWidget *widget);
147 explicit RoleEditor(QWidget *parent =
nullptr);
149 void setLabel(
const QString &label);
150 void setEdited(
bool on);
154 void changed(QWidget *widget);
157 void emitResetProperty();
174 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
176 void setEditorData(QWidget *ed,
const QModelIndex &index)
const;
177 void setModelData(QWidget *ed, QAbstractItemModel *model,
const QModelIndex &index)
const;
179 void updateEditorGeometry(QWidget *ed,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
181 void paint(QPainter *painter,
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const;
182 QSize sizeHint(
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const;
187 #endif // WIDGETS_PALETTEEDITOR_H The BrushEditor class is used by PaletteEditor.
The ColorDelegate class is used by PaletteEditor.
The PaletteEditor class provides a dialog to customize a QPalette.
QT_UTILITIES_EXPORT void init()
Initiates the resources used and provided by this library.
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Provides common dialogs such as AboutDialog, EnterPasswordDialog and SettingsDialog.
The RoleEditor class is used by PaletteEditor.
QPalette::ColorRole colorRole() const
The PaletteModel class is used by PaletteEditor.