diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-10-04 06:30:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-04 06:30:15 -0400 |
| commit | 2fe50f2ff366ea850eb70a85c6ea7d6c936bf08a (patch) | |
| tree | 77041dd84568817e0e359381e7fb78f6a1f2dd2a /src/colortable.h | |
| parent | e6a47bf8b70be2c480f77c68c08480a33e71dce3 (diff) | |
| parent | 239cfbe6854f727b5dd3e6922cacc17587361cf5 (diff) | |
Merge pull request #842 from isanae/dialog-settings
Dialog settings
Diffstat (limited to 'src/colortable.h')
| -rw-r--r-- | src/colortable.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/colortable.h b/src/colortable.h new file mode 100644 index 00000000..039b6024 --- /dev/null +++ b/src/colortable.h @@ -0,0 +1,39 @@ +#ifndef COLORTABLE_H +#define COLORTABLE_H + +#include <QTableWidget> + +class Settings; + +// a QTableWidget to view and modify color settings +// +class ColorTable : public QTableWidget +{ +public: + ColorTable(QWidget* parent=nullptr); + + // adds colors to the table from the settings + // + void load(Settings& s); + + // resets the colors to their default values; commitColors() must be called + // to save them + // + void resetColors(); + + // commits any changes + // + void commitColors(); + +private: + Settings* m_settings; + + void addColor( + const QString& text, const QColor& defaultColor, + std::function<QColor ()> get, + std::function<void (const QColor&)> commit); + + void onColorActivated(); +}; + +#endif // COLORTABLE_H |
