DtkGui 5.5.23
DTK Gui module
ddciiconpalette.h
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DDCIICONPALETTE_H
6#define DDCIICONPALETTE_H
7
8#include <dtkgui_global.h>
9#include <qobjectdefs.h>
10
11#include <QColor>
12#include <QVector>
13
14DGUI_BEGIN_NAMESPACE
15
17{
18 Q_GADGET
19 Q_PROPERTY(QColor foreground READ foreground WRITE setForeground FINAL)
20 Q_PROPERTY(QColor background READ background WRITE setBackground FINAL)
21 Q_PROPERTY(QColor highlight READ highlight WRITE setHighlight FINAL)
22 Q_PROPERTY(QColor highlightForeground READ highlightForeground WRITE setHighlightForeground FINAL)
23
24public:
25 enum PaletteRole {
26 NoPalette = -1,
27 Foreground = 0,
28 Background = 1,
29 HighlightForeground = 2,
30 Highlight = 3,
31 PaletteCount
32 };
33
34 DDciIconPalette(QColor foreground = QColor::Invalid, QColor background = QColor::Invalid,
35 QColor highlight = QColor::Invalid, QColor highlightForeground = QColor::Invalid);
36 bool operator==(const DDciIconPalette &other) const;
37 bool operator!=(const DDciIconPalette &other) const;
38
39 QColor foreground() const;
40 void setForeground(const QColor &foreground);
41
42 QColor background() const;
43 void setBackground(const QColor &background);
44
45 QColor highlightForeground() const;
46 void setHighlightForeground(const QColor &highlightForeground);
47
48 QColor highlight() const;
49 void setHighlight(const QColor &highlight);
50
51 static QString convertToString(const DDciIconPalette &palette);
52 static DDciIconPalette convertFromString(const QString &data);
53private:
54 QVector<QColor> colors;
55};
56
57DGUI_END_NAMESPACE
58
59QT_BEGIN_NAMESPACE
60#ifndef QT_NO_DEBUG_STREAM
61Q_GUI_EXPORT QDebug operator<<(QDebug, const DTK_GUI_NAMESPACE::DDciIconPalette &);
62#endif
63QT_END_NAMESPACE
64#endif // DDCIICONPALETTE_H
Definition: ddciiconpalette.h:17