widgets/designerplugins.cpp

Sat, 08 Apr 2023 15:08:19 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sat, 08 Apr 2023 15:08:19 +0300
changeset 346
3e3784c4cd3e
parent 281
afed72b544f0
child 347
5c655cc006de
permissions
-rw-r--r--

Change color edit coloring to use only stylesheets to colorise the line edit only

264
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
1 #include "widgets/designerplugins.h"
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
2 #include "widgets/vec3editor.h"
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
3 #include "widgets/matrixeditor.h"
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
4 #include "widgets/colorbutton.h"
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
5
269
593545977c5e Further use APPNAME macro
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
6 PluginCollection::PluginCollection(QObject* parent) :
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
7 QObject{parent}
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
8 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
9 this->interfaces.append(new Vec3EditorPlugin{this});
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
10 this->interfaces.append(new MatrixEditorPlugin{this});
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
11 this->interfaces.append(new ColorButtonPlugin{this});
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
12 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
13
269
593545977c5e Further use APPNAME macro
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
14 QList<QDesignerCustomWidgetInterface*> PluginCollection::customWidgets() const
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
15 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
16 return this->interfaces;
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
17 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
18
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
19 QString Vec3EditorPlugin::name() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
20 {
254
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 253
diff changeset
21 return "VectorInput";
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
22 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
23
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
24 QString Vec3EditorPlugin::group() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
25 {
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 269
diff changeset
26 return CMAKE_PROJECT_NAME;
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
27 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
28
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
29 QString Vec3EditorPlugin::toolTip() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
30 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
31 return "";
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
32 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
33
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
34 QString Vec3EditorPlugin::whatsThis() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
35 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
36 return "";
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
37 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
38
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
39 QString Vec3EditorPlugin::includeFile() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
40 {
264
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
41 return "widgets/vec3editor.h";
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
42 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
43
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
44 QIcon Vec3EditorPlugin::icon() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
45 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
46 return {};
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
47 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
48
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
49 bool Vec3EditorPlugin::isContainer() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
50 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
51 return false;
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
52 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
53
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
54 QWidget* Vec3EditorPlugin::createWidget(QWidget* parent)
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
55 {
254
b7b29cb82360 Rename Vec3Editor to VectorInput
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 253
diff changeset
56 return new VectorInput{{0, 0, 0}, parent};
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
57 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
58
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
59 QString MatrixEditorPlugin::name() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
60 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
61 return "MatrixEditor";
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
62 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
63
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
64 QString MatrixEditorPlugin::group() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
65 {
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 269
diff changeset
66 return CMAKE_PROJECT_NAME;
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
67 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
68
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
69 QString MatrixEditorPlugin::toolTip() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
70 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
71 return "";
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
72 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
73
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
74 QString MatrixEditorPlugin::whatsThis() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
75 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
76 return "";
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
77 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
78
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
79 QString MatrixEditorPlugin::includeFile() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
80 {
264
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
81 return "widgets/matrixeditor.h";
253
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
82 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
83
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
84 QIcon MatrixEditorPlugin::icon() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
85 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
86 return {};
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
87 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
88
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
89 bool MatrixEditorPlugin::isContainer() const
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
90 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
91 return false;
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
92 }
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
93
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
94 QWidget* MatrixEditorPlugin::createWidget(QWidget* parent)
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
95 {
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
96 return new MatrixEditor{parent};
8b994c917f69 Make LDForge widgets visible in Qt Designer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff changeset
97 }
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
98
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
99
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
100 QString ColorButtonPlugin::name() const
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
101 {
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
102 return "ColorButton";
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
103 }
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
104
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
105 QString ColorButtonPlugin::group() const
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
106 {
281
afed72b544f0 - Add CMake build type to about page and window title
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 269
diff changeset
107 return CMAKE_PROJECT_NAME;
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
108 }
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
109
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
110 QString ColorButtonPlugin::toolTip() const
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
111 {
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
112 return "";
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
113 }
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
114
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
115 QString ColorButtonPlugin::whatsThis() const
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
116 {
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
117 return "";
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
118 }
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
119
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
120 QString ColorButtonPlugin::includeFile() const
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
121 {
264
76a025db4948 Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 256
diff changeset
122 return "widgets/colorbutton.h";
256
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
123 }
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
124
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
125 QIcon ColorButtonPlugin::icon() const
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
126 {
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
127 return {};
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
128 }
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
129
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
130 bool ColorButtonPlugin::isContainer() const
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
131 {
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
132 return false;
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
133 }
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
134
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
135 QWidget* ColorButtonPlugin::createWidget(QWidget* parent)
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
136 {
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
137 return new ColorButton{parent};
c6f5de03dc0f Move color button into widgets lib
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 254
diff changeset
138 }

mercurial