1 #ifndef WIDGETS_PALETTEEDITOR_H 2 #define WIDGETS_PALETTEEDITOR_H 6 #include <c++utilities/conversion/types.h> 9 #include <QItemDelegate> 13 QT_FORWARD_DECLARE_CLASS(QListView)
14 QT_FORWARD_DECLARE_CLASS(QLabel)
39 static QPalette getPalette(QWidget *parent,
const QPalette &
init = QPalette(),
const QPalette &parentPal = QPalette(),
int *result =
nullptr);
41 QPalette palette()
const;
42 void setPalette(
const QPalette &palette);
43 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
46 void on_buildButton_colorChanged(
const QColor &);
47 void on_activeRadio_clicked();
48 void on_inactiveRadio_clicked();
49 void on_disabledRadio_clicked();
50 void on_computeRadio_clicked();
51 void on_detailsRadio_clicked();
53 void paletteChanged(
const QPalette &palette);
58 void updatePreviewPalette();
59 void updateStyledButton();
61 QPalette::ColorGroup currentColorGroup()
const 63 return m_currentColorGroup;
66 std::unique_ptr<Ui::PaletteEditor> m_ui;
67 QPalette m_editPalette;
68 QPalette m_parentPalette;
69 QPalette::ColorGroup m_currentColorGroup;
72 bool m_paletteUpdated;
81 Q_PROPERTY(QPalette::ColorRole colorRole READ colorRole)
85 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
86 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
87 QVariant data(
const QModelIndex &index,
int role)
const;
88 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
89 Qt::ItemFlags flags(
const QModelIndex &index)
const;
90 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
92 QPalette getPalette()
const;
93 void setPalette(
const QPalette &palette,
const QPalette &parentPalette);
97 return QPalette::NoRole;
105 void paletteChanged(
const QPalette &palette);
108 QPalette::ColorGroup columnToGroup(
int index)
const;
109 int groupToColumn(QPalette::ColorGroup group)
const;
112 QPalette m_parentPalette;
113 QMap<QPalette::ColorRole, QString> m_roleNames;
126 void setBrush(
const QBrush &brush);
127 QBrush brush()
const;
128 bool changed()
const;
131 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();
173 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
175 void setEditorData(QWidget *ed,
const QModelIndex &index)
const;
176 void setModelData(QWidget *ed, QAbstractItemModel *model,
const QModelIndex &index)
const;
178 void updateEditorGeometry(QWidget *ed,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
180 void paint(QPainter *painter,
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const;
181 QSize sizeHint(
const QStyleOptionViewItem &opt,
const QModelIndex &index)
const;
185 #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.