1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#include "treewalker.h"
5#include "ui4.h"
6
7QT_BEGIN_NAMESPACE
8
9void TreeWalker::acceptUI(DomUI *ui)
10{
11 acceptWidget(widget: ui->elementWidget());
12 if (const DomButtonGroups *domButtonGroups = ui->elementButtonGroups())
13 acceptButtonGroups(buttonGroups: domButtonGroups);
14
15 acceptTabStops(tabStops: ui->elementTabStops());
16}
17
18void TreeWalker::acceptLayoutDefault(DomLayoutDefault *layoutDefault)
19{
20 Q_UNUSED(layoutDefault);
21}
22
23void TreeWalker::acceptLayoutFunction(DomLayoutFunction *layoutFunction)
24{
25 Q_UNUSED(layoutFunction);
26}
27
28void TreeWalker::acceptTabStops(DomTabStops *tabStops)
29{
30 Q_UNUSED(tabStops);
31}
32
33void TreeWalker::acceptLayout(DomLayout *layout)
34{
35 for (int i=0; i<layout->elementProperty().size(); ++i)
36 acceptProperty(property: layout->elementProperty().at(i));
37
38 for (int i=0; i<layout->elementItem().size(); ++i)
39 acceptLayoutItem(layoutItem: layout->elementItem().at(i));
40}
41
42void TreeWalker::acceptLayoutItem(DomLayoutItem *layoutItem)
43{
44 switch (layoutItem->kind()) {
45 case DomLayoutItem::Widget:
46 acceptWidget(widget: layoutItem->elementWidget());
47 return;
48 case DomLayoutItem::Layout:
49 acceptLayout(layout: layoutItem->elementLayout());
50 return;
51 case DomLayoutItem::Spacer:
52 acceptSpacer(spacer: layoutItem->elementSpacer());
53 return;
54 case DomLayoutItem::Unknown:
55 break;
56 }
57
58 Q_ASSERT( 0 );
59}
60
61void TreeWalker::acceptWidget(DomWidget *widget)
62{
63 for (int i=0; i<widget->elementAction().size(); ++i)
64 acceptAction(action: widget->elementAction().at(i));
65
66 for (int i=0; i<widget->elementActionGroup().size(); ++i)
67 acceptActionGroup(actionGroup: widget->elementActionGroup().at(i));
68
69 for (int i=0; i<widget->elementAddAction().size(); ++i)
70 acceptActionRef(actionRef: widget->elementAddAction().at(i));
71
72 for (int i=0; i<widget->elementProperty().size(); ++i)
73 acceptProperty(property: widget->elementProperty().at(i));
74
75
76
77 // recurse down
78 DomWidgets childWidgets;
79 for (int i=0; i<widget->elementWidget().size(); ++i) {
80 DomWidget *child = widget->elementWidget().at(i);
81 childWidgets += child;
82 acceptWidget(widget: child);
83 }
84
85 if (!widget->elementLayout().isEmpty())
86 acceptLayout(layout: widget->elementLayout().at(i: 0));
87}
88
89void TreeWalker::acceptSpacer(DomSpacer *spacer)
90{
91 for (int i=0; i<spacer->elementProperty().size(); ++i)
92 acceptProperty(property: spacer->elementProperty().at(i));
93}
94
95void TreeWalker::acceptColor(DomColor *color)
96{
97 Q_UNUSED(color);
98}
99
100void TreeWalker::acceptColorGroup(DomColorGroup *colorGroup)
101{
102 Q_UNUSED(colorGroup);
103}
104
105void TreeWalker::acceptPalette(DomPalette *palette)
106{
107 acceptColorGroup(colorGroup: palette->elementActive());
108 acceptColorGroup(colorGroup: palette->elementInactive());
109 acceptColorGroup(colorGroup: palette->elementDisabled());
110}
111
112void TreeWalker::acceptFont(DomFont *font)
113{
114 Q_UNUSED(font);
115}
116
117void TreeWalker::acceptPoint(DomPoint *point)
118{
119 Q_UNUSED(point);
120}
121
122void TreeWalker::acceptRect(DomRect *rect)
123{
124 Q_UNUSED(rect);
125}
126
127void TreeWalker::acceptSizePolicy(DomSizePolicy *sizePolicy)
128{
129 Q_UNUSED(sizePolicy);
130}
131
132void TreeWalker::acceptSize(DomSize *size)
133{
134 Q_UNUSED(size);
135}
136
137void TreeWalker::acceptDate(DomDate *date)
138{
139 Q_UNUSED(date);
140}
141
142void TreeWalker::acceptTime(DomTime *time)
143{
144 Q_UNUSED(time);
145}
146
147void TreeWalker::acceptDateTime(DomDateTime *dateTime)
148{
149 Q_UNUSED(dateTime);
150}
151
152void TreeWalker::acceptProperty(DomProperty *property)
153{
154 switch (property->kind()) {
155 case DomProperty::Bool:
156 case DomProperty::Color:
157 case DomProperty::Cstring:
158 case DomProperty::Cursor:
159 case DomProperty::CursorShape:
160 case DomProperty::Enum:
161 case DomProperty::Font:
162 case DomProperty::Pixmap:
163 case DomProperty::IconSet:
164 case DomProperty::Palette:
165 case DomProperty::Point:
166 case DomProperty::PointF:
167 case DomProperty::Rect:
168 case DomProperty::RectF:
169 case DomProperty::Set:
170 case DomProperty::Locale:
171 case DomProperty::SizePolicy:
172 case DomProperty::Size:
173 case DomProperty::SizeF:
174 case DomProperty::String:
175 case DomProperty::Number:
176 case DomProperty::LongLong:
177 case DomProperty::Char:
178 case DomProperty::Date:
179 case DomProperty::Time:
180 case DomProperty::DateTime:
181 case DomProperty::Url:
182 case DomProperty::Unknown:
183 case DomProperty::StringList:
184 case DomProperty::Float:
185 case DomProperty::Double:
186 case DomProperty::UInt:
187 case DomProperty::ULongLong:
188 case DomProperty::Brush:
189 break;
190 }
191}
192
193void TreeWalker::acceptCustomWidgets(DomCustomWidgets *customWidgets)
194{
195 for (int i=0; i<customWidgets->elementCustomWidget().size(); ++i)
196 acceptCustomWidget(customWidget: customWidgets->elementCustomWidget().at(i));
197}
198
199void TreeWalker::acceptCustomWidget(DomCustomWidget *customWidget)
200{
201 Q_UNUSED(customWidget);
202}
203
204void TreeWalker::acceptAction(DomAction *action)
205{
206 Q_UNUSED(action);
207}
208
209void TreeWalker::acceptActionGroup(DomActionGroup *actionGroup)
210{
211 for (int i=0; i<actionGroup->elementAction().size(); ++i)
212 acceptAction(action: actionGroup->elementAction().at(i));
213
214 for (int i=0; i<actionGroup->elementActionGroup().size(); ++i)
215 acceptActionGroup(actionGroup: actionGroup->elementActionGroup().at(i));
216}
217
218void TreeWalker::acceptActionRef(DomActionRef *actionRef)
219{
220 Q_UNUSED(actionRef);
221}
222
223void TreeWalker::acceptIncludes(DomIncludes *includes)
224{
225 for (int i=0; i<includes->elementInclude().size(); ++i)
226 acceptInclude(incl: includes->elementInclude().at(i));
227}
228
229void TreeWalker::acceptInclude(DomInclude *incl)
230{
231 Q_UNUSED(incl);
232}
233
234void TreeWalker::acceptConnections(DomConnections *connections)
235{
236 for (int i=0; i<connections->elementConnection().size(); ++i)
237 acceptConnection(connection: connections->elementConnection().at(i));
238}
239
240void TreeWalker::acceptConnection(DomConnection *connection)
241{
242 acceptConnectionHints(connectionHints: connection->elementHints());
243}
244
245void TreeWalker::acceptConnectionHints(DomConnectionHints *connectionHints)
246{
247 for (int i=0; i<connectionHints->elementHint().size(); ++i)
248 acceptConnectionHint(connectionHint: connectionHints->elementHint().at(i));
249}
250
251void TreeWalker::acceptConnectionHint(DomConnectionHint *connectionHint)
252{
253 Q_UNUSED(connectionHint);
254}
255
256void TreeWalker::acceptButtonGroups(const DomButtonGroups *domButtonGroups)
257{
258 const auto &domGroups = domButtonGroups->elementButtonGroup();
259 for (const DomButtonGroup *g : domGroups)
260 acceptButtonGroup(buttonGroup: g);
261}
262
263void TreeWalker::acceptButtonGroup(const DomButtonGroup *)
264{
265}
266
267QT_END_NAMESPACE
268

source code of qtbase/src/tools/uic/treewalker.cpp