source: trunk/src/tools/uic/treewalker.cpp@ 651

Last change on this file since 651 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

File size: 9.1 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the tools applications of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "treewalker.h"
43#include "ui4.h"
44
45QT_BEGIN_NAMESPACE
46
47void TreeWalker::acceptUI(DomUI *ui)
48{
49 acceptWidget(ui->elementWidget());
50 if (const DomButtonGroups *domButtonGroups = ui->elementButtonGroups())
51 acceptButtonGroups(domButtonGroups);
52
53 acceptTabStops(ui->elementTabStops());
54
55 if (ui->elementImages())
56 acceptImages(ui->elementImages());
57}
58
59void TreeWalker::acceptLayoutDefault(DomLayoutDefault *layoutDefault)
60{
61 Q_UNUSED(layoutDefault);
62}
63
64void TreeWalker::acceptLayoutFunction(DomLayoutFunction *layoutFunction)
65{
66 Q_UNUSED(layoutFunction);
67}
68
69void TreeWalker::acceptTabStops(DomTabStops *tabStops)
70{
71 Q_UNUSED(tabStops);
72}
73
74void TreeWalker::acceptLayout(DomLayout *layout)
75{
76 for (int i=0; i<layout->elementProperty().size(); ++i)
77 acceptProperty(layout->elementProperty().at(i));
78
79 for (int i=0; i<layout->elementItem().size(); ++i)
80 acceptLayoutItem(layout->elementItem().at(i));
81}
82
83void TreeWalker::acceptLayoutItem(DomLayoutItem *layoutItem)
84{
85 switch (layoutItem->kind()) {
86 case DomLayoutItem::Widget:
87 acceptWidget(layoutItem->elementWidget());
88 return;
89 case DomLayoutItem::Layout:
90 acceptLayout(layoutItem->elementLayout());
91 return;
92 case DomLayoutItem::Spacer:
93 acceptSpacer(layoutItem->elementSpacer());
94 return;
95 case DomLayoutItem::Unknown:
96 break;
97 }
98
99 Q_ASSERT( 0 );
100}
101
102void TreeWalker::acceptWidget(DomWidget *widget)
103{
104 for (int i=0; i<widget->elementAction().size(); ++i)
105 acceptAction(widget->elementAction().at(i));
106
107 for (int i=0; i<widget->elementActionGroup().size(); ++i)
108 acceptActionGroup(widget->elementActionGroup().at(i));
109
110 for (int i=0; i<widget->elementAddAction().size(); ++i)
111 acceptActionRef(widget->elementAddAction().at(i));
112
113 for (int i=0; i<widget->elementProperty().size(); ++i)
114 acceptProperty(widget->elementProperty().at(i));
115
116
117
118 // recurse down
119 DomWidgets childWidgets;
120 for (int i=0; i<widget->elementWidget().size(); ++i) {
121 DomWidget *child = widget->elementWidget().at(i);
122 childWidgets += child;
123 acceptWidget(child);
124 }
125
126 if (!widget->elementLayout().isEmpty())
127 acceptLayout(widget->elementLayout().at(0));
128
129 const DomScripts scripts(widget->elementScript());
130 acceptWidgetScripts(scripts, widget, childWidgets);
131}
132
133void TreeWalker::acceptSpacer(DomSpacer *spacer)
134{
135 for (int i=0; i<spacer->elementProperty().size(); ++i)
136 acceptProperty(spacer->elementProperty().at(i));
137}
138
139void TreeWalker::acceptColor(DomColor *color)
140{
141 Q_UNUSED(color);
142}
143
144void TreeWalker::acceptColorGroup(DomColorGroup *colorGroup)
145{
146 Q_UNUSED(colorGroup);
147}
148
149void TreeWalker::acceptPalette(DomPalette *palette)
150{
151 acceptColorGroup(palette->elementActive());
152 acceptColorGroup(palette->elementInactive());
153 acceptColorGroup(palette->elementDisabled());
154}
155
156void TreeWalker::acceptFont(DomFont *font)
157{
158 Q_UNUSED(font);
159}
160
161void TreeWalker::acceptPoint(DomPoint *point)
162{
163 Q_UNUSED(point);
164}
165
166void TreeWalker::acceptRect(DomRect *rect)
167{
168 Q_UNUSED(rect);
169}
170
171void TreeWalker::acceptSizePolicy(DomSizePolicy *sizePolicy)
172{
173 Q_UNUSED(sizePolicy);
174}
175
176void TreeWalker::acceptSize(DomSize *size)
177{
178 Q_UNUSED(size);
179}
180
181void TreeWalker::acceptDate(DomDate *date)
182{
183 Q_UNUSED(date);
184}
185
186void TreeWalker::acceptTime(DomTime *time)
187{
188 Q_UNUSED(time);
189}
190
191void TreeWalker::acceptDateTime(DomDateTime *dateTime)
192{
193 Q_UNUSED(dateTime);
194}
195
196void TreeWalker::acceptProperty(DomProperty *property)
197{
198 switch (property->kind()) {
199 case DomProperty::Bool:
200 case DomProperty::Color:
201 case DomProperty::Cstring:
202 case DomProperty::Cursor:
203 case DomProperty::CursorShape:
204 case DomProperty::Enum:
205 case DomProperty::Font:
206 case DomProperty::Pixmap:
207 case DomProperty::IconSet:
208 case DomProperty::Palette:
209 case DomProperty::Point:
210 case DomProperty::PointF:
211 case DomProperty::Rect:
212 case DomProperty::RectF:
213 case DomProperty::Set:
214 case DomProperty::Locale:
215 case DomProperty::SizePolicy:
216 case DomProperty::Size:
217 case DomProperty::SizeF:
218 case DomProperty::String:
219 case DomProperty::Number:
220 case DomProperty::LongLong:
221 case DomProperty::Char:
222 case DomProperty::Date:
223 case DomProperty::Time:
224 case DomProperty::DateTime:
225 case DomProperty::Url:
226 case DomProperty::Unknown:
227 case DomProperty::StringList:
228 case DomProperty::Float:
229 case DomProperty::Double:
230 case DomProperty::UInt:
231 case DomProperty::ULongLong:
232 case DomProperty::Brush:
233 break;
234 }
235}
236
237void TreeWalker::acceptCustomWidgets(DomCustomWidgets *customWidgets)
238{
239 for (int i=0; i<customWidgets->elementCustomWidget().size(); ++i)
240 acceptCustomWidget(customWidgets->elementCustomWidget().at(i));
241}
242
243void TreeWalker::acceptCustomWidget(DomCustomWidget *customWidget)
244{
245 Q_UNUSED(customWidget);
246}
247
248void TreeWalker::acceptAction(DomAction *action)
249{
250 Q_UNUSED(action);
251}
252
253void TreeWalker::acceptActionGroup(DomActionGroup *actionGroup)
254{
255 for (int i=0; i<actionGroup->elementAction().size(); ++i)
256 acceptAction(actionGroup->elementAction().at(i));
257
258 for (int i=0; i<actionGroup->elementActionGroup().size(); ++i)
259 acceptActionGroup(actionGroup->elementActionGroup().at(i));
260}
261
262void TreeWalker::acceptActionRef(DomActionRef *actionRef)
263{
264 Q_UNUSED(actionRef);
265}
266
267void TreeWalker::acceptImages(DomImages *images)
268{
269 for (int i=0; i<images->elementImage().size(); ++i)
270 acceptImage(images->elementImage().at(i));
271}
272
273void TreeWalker::acceptImage(DomImage *image)
274{
275 Q_UNUSED(image);
276}
277
278void TreeWalker::acceptIncludes(DomIncludes *includes)
279{
280 for (int i=0; i<includes->elementInclude().size(); ++i)
281 acceptInclude(includes->elementInclude().at(i));
282}
283
284void TreeWalker::acceptInclude(DomInclude *incl)
285{
286 Q_UNUSED(incl);
287}
288
289void TreeWalker::acceptConnections(DomConnections *connections)
290{
291 for (int i=0; i<connections->elementConnection().size(); ++i)
292 acceptConnection(connections->elementConnection().at(i));
293}
294
295void TreeWalker::acceptConnection(DomConnection *connection)
296{
297 acceptConnectionHints(connection->elementHints());
298}
299
300void TreeWalker::acceptConnectionHints(DomConnectionHints *connectionHints)
301{
302 for (int i=0; i<connectionHints->elementHint().size(); ++i)
303 acceptConnectionHint(connectionHints->elementHint().at(i));
304}
305
306void TreeWalker::acceptConnectionHint(DomConnectionHint *connectionHint)
307{
308 Q_UNUSED(connectionHint);
309}
310
311void TreeWalker::acceptWidgetScripts(const DomScripts &, DomWidget *, const DomWidgets &)
312{
313}
314
315void TreeWalker::acceptButtonGroups(const DomButtonGroups *domButtonGroups)
316{
317 typedef QList<DomButtonGroup*> DomButtonGroupList;
318 const DomButtonGroupList domGroups = domButtonGroups->elementButtonGroup();
319 const DomButtonGroupList::const_iterator cend = domGroups.constEnd();
320 for (DomButtonGroupList::const_iterator it = domGroups.constBegin(); it != cend; ++it)
321 acceptButtonGroup(*it);
322}
323
324void TreeWalker::acceptButtonGroup(const DomButtonGroup *)
325{
326}
327
328QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.