1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "theme.h"
#include <utils/stylehelper.h>
#include <QIcon>
namespace QmlDesigner {
class DesignerIconsPrivate;
class IconFontHelper : public Utils::StyleHelper::IconFontHelper
{
typedef Utils::StyleHelper::IconFontHelper Super;
public:
IconFontHelper(Theme::Icon themeIcon,
Theme::Color color,
const QSize &size,
QIcon::Mode mode = QIcon::Normal,
QIcon::State state = QIcon::Off);
IconFontHelper();
static IconFontHelper fromJson(const QJsonObject &jsonObject);
QJsonObject toJson() const;
Theme::Icon themeIcon() const;
Theme::Color themeColor() const;
private:
Theme::Icon mThemeIcon;
Theme::Color mThemeColor;
};
class DesignerIcons
{
Q_GADGET
friend DesignerIconsPrivate;
public:
enum IconId {
AddMouseAreaIcon,
AlignBottomIcon,
AlignCameraToViewIcon,
AlignLeftIcon,
AlignRightIcon,
AlignTopIcon,
AlignViewToCameraIcon,
AnchorsIcon,
AnnotationIcon,
ArrangeIcon,
CameraIcon,
CameraOrthographicIcon,
CameraPerspectiveIcon,
ConnectionsIcon,
CopyIcon,
CreateIcon,
DeleteIcon,
DuplicateIcon,
EditComponentIcon,
EditIcon,
EnterComponentIcon,
EventListIcon,
FitSelectedIcon,
GroupSelectionIcon,
ImportedModelsIcon,
LayoutsIcon,
LightIcon,
LightDirectionalIcon,
LightPointIcon,
LightSpotIcon,
MakeComponentIcon,
MaterialIcon,
MergeWithTemplateIcon,
MinimalDownArrowIcon,
ModelConeIcon,
ModelCubeIcon,
ModelCylinderIcon,
ModelPlaneIcon,
ModelSphereIcon,
ParentIcon,
PasteIcon,
PositionsersIcon,
PrimitivesIcon,
ResetViewIcon,
SelecionIcon,
ShowBoundsIcon,
SimpleCheckIcon,
SnappingIcon,
TimelineIcon,
ToggleGroupIcon,
VisibilityIcon
};
Q_ENUM(IconId)
enum Area {
TopToolbarArea,
ContextMenuArea
};
Q_ENUM(Area)
enum Mode {
Normal = QIcon::Normal,
Disabled = QIcon::Disabled,
Hovered = QIcon::Active,
Selected = QIcon::Selected
};
Q_ENUM(Mode)
enum State {
Off = QIcon::Off,
On = QIcon::On
};
Q_ENUM(State)
typedef QMap<Mode, IconFontHelper> ModeMap;
typedef QMap<State, ModeMap> IconMap;
typedef QMap<Area, IconMap> AreaMap;
typedef QMap<IconId, AreaMap> IconsMap;
explicit DesignerIcons(const QString &fontName,
const QString &iconDatabase = QString());
~DesignerIcons();
QIcon icon(IconId icon, Area area) const;
void loadIconSettings(const QString &fileName);
void exportSettings(const QString &fileName) const;
void clearAll();
void addIcon(const IconId &iconId,
const Area &area,
const IconFontHelper &fontHelper);
void addIcon(IconId iconId,
Area area,
QIcon::Mode mode,
QIcon::State state,
Theme::Icon themeIcon,
Theme::Color color,
const QSize &size);
void addIcon(IconId iconId,
Area area,
Theme::Icon themeIcon,
Theme::Color color,
const QSize &size);
static QIcon rotateIcon(const QIcon &icon, const double °rees);
private:
QList<Utils::StyleHelper::IconFontHelper> helperList(const IconId &iconId,
const Area &area) const;
DesignerIconsPrivate *d = nullptr;
};
}
|