~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/tools/uic3/domtool.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the tools applications of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#include "domtool.h"
 
30
 
 
31
#include <qsizepolicy.h>
 
32
#include <qcolor.h>
 
33
#include <qcursor.h>
 
34
#include <qdatetime.h>
 
35
#include <qrect.h>
 
36
#include <qsize.h>
 
37
#include <qfont.h>
 
38
#include <qdom.h>
 
39
#include <qbytearray.h>
 
40
#include <qdebug.h>
 
41
 
 
42
/*
 
43
  \class DomTool domtool.h
 
44
  \brief The DomTool class provides static functions for Qt Designer
 
45
  and uic.
 
46
 
 
47
  A collection of static functions used by Resource (part of the
 
48
  designer) and Uic.
 
49
 
 
50
*/
 
51
 
 
52
/*
 
53
  Returns the contents of property \a name of object \a e as
 
54
  a variant or the variant passed as \a defValue if the property does
 
55
  not exist. The \a comment is passed on to the elementToVariant()
 
56
  function.
 
57
 
 
58
  \sa hasProperty()
 
59
*/
 
60
QVariant DomTool::readProperty(const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment)
 
61
{
 
62
    QDomElement n;
 
63
    for (n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement()) {
 
64
        if (n.tagName() == QLatin1String("property")) {
 
65
            if (n.attribute(QLatin1String("name")) != name)
 
66
                continue;
 
67
            return elementToVariant(n.firstChild().toElement(), defValue, comment);
 
68
        }
 
69
    }
 
70
    return defValue;
 
71
}
 
72
 
 
73
 
 
74
/*
 
75
  \overload
 
76
 */
 
77
QVariant DomTool::readProperty(const QDomElement& e, const QString& name, const QVariant& defValue)
 
78
{
 
79
    QString comment;
 
80
    return readProperty(e, name, defValue, comment);
 
81
}
 
82
 
 
83
/*
 
84
  Returns wheter object \a e defines property \a name or not.
 
85
 
 
86
  \sa readProperty()
 
87
 */
 
88
bool DomTool::hasProperty(const QDomElement& e, const QString& name)
 
89
{
 
90
    QDomElement n;
 
91
    for (n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement()) {
 
92
        if (n.tagName() == QLatin1String("property")) {
 
93
            if (n.attribute(QLatin1String("name")) != name)
 
94
                continue;
 
95
            return true;
 
96
        }
 
97
    }
 
98
    return false;
 
99
}
 
100
 
 
101
/*
 
102
    Returns a list of the names of the properties of the given \a type
 
103
    found in the element \a e.
 
104
*/
 
105
QStringList DomTool::propertiesOfType(const QDomElement& e, const QString& type)
 
106
{
 
107
    QStringList result;
 
108
    QDomElement n;
 
109
    for (n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement()) {
 
110
        if (n.tagName() == QLatin1String("property")) {
 
111
            QDomElement n2 = n.firstChild().toElement();
 
112
            if (n2.tagName() == type)
 
113
                result += n.attribute(QLatin1String("name"));
 
114
        }
 
115
    }
 
116
    return result;
 
117
}
 
118
 
 
119
 
 
120
/*
 
121
    \overload
 
122
*/
 
123
QVariant DomTool::elementToVariant(const QDomElement& e, const QVariant& defValue)
 
124
{
 
125
    QString dummy;
 
126
    return elementToVariant(e, defValue, dummy);
 
127
}
 
128
 
 
129
/*
 
130
  Interprets element \a e as a variant and returns the result of the
 
131
  interpretation, extracting the data as a text element is the \a
 
132
  comment matches the tag name. If the interpretation fails the \a
 
133
  defValue is returned instead.
 
134
 */
 
135
QVariant DomTool::elementToVariant(const QDomElement& e, const QVariant& defValue, QString &comment)
 
136
{
 
137
    Q_UNUSED(defValue);
 
138
 
 
139
    QVariant v;
 
140
    Variant var;
 
141
 
 
142
    if (e.tagName() == QLatin1String("rect")) {
 
143
        QDomElement n3 = e.firstChild().toElement();
 
144
        int x = 0, y = 0, w = 0, h = 0;
 
145
        while (!n3.isNull()) {
 
146
            if (n3.tagName() == QLatin1String("x"))
 
147
                x = n3.firstChild().toText().data().toInt();
 
148
            else if (n3.tagName() == QLatin1String("y"))
 
149
                y = n3.firstChild().toText().data().toInt();
 
150
            else if (n3.tagName() == QLatin1String("width"))
 
151
                w = n3.firstChild().toText().data().toInt();
 
152
            else if (n3.tagName() == QLatin1String("height"))
 
153
                h = n3.firstChild().toText().data().toInt();
 
154
            n3 = n3.nextSibling().toElement();
 
155
        }
 
156
        var.createRect(x, y, w, h);
 
157
        qVariantSetValue(v, var);
 
158
    } else if (e.tagName() == QLatin1String("point")) {
 
159
        QDomElement n3 = e.firstChild().toElement();
 
160
        int x = 0, y = 0;
 
161
        while (!n3.isNull()) {
 
162
            if (n3.tagName() == QLatin1String("x"))
 
163
                x = n3.firstChild().toText().data().toInt();
 
164
            else if (n3.tagName() == QLatin1String("y"))
 
165
                y = n3.firstChild().toText().data().toInt();
 
166
            n3 = n3.nextSibling().toElement();
 
167
        }
 
168
        var.createPoint(x,y);
 
169
        qVariantSetValue(v, var);
 
170
    } else if (e.tagName() == QLatin1String("size")) {
 
171
        QDomElement n3 = e.firstChild().toElement();
 
172
        int w = 0, h = 0;
 
173
        while (!n3.isNull()) {
 
174
            if (n3.tagName() == QLatin1String("width"))
 
175
                w = n3.firstChild().toText().data().toInt();
 
176
            else if (n3.tagName() == QLatin1String("height"))
 
177
                h = n3.firstChild().toText().data().toInt();
 
178
            n3 = n3.nextSibling().toElement();
 
179
        }
 
180
        var.createSize(w, h);
 
181
        qVariantSetValue(v, var);
 
182
    } else if (e.tagName() == QLatin1String("color")) {
 
183
        var.color = readColor(e);
 
184
        qVariantSetValue(v, var);
 
185
    } else if (e.tagName() == QLatin1String("font")) {
 
186
        QDomElement n3 = e.firstChild().toElement();
 
187
        Font f;
 
188
        f.init();
 
189
        while (!n3.isNull()) {
 
190
            if (n3.tagName() == QLatin1String("family"))
 
191
                f.family = qstrdup(n3.firstChild().toText().data());
 
192
            else if (n3.tagName() == QLatin1String("pointsize"))
 
193
                f.pointsize = n3.firstChild().toText().data().toInt();
 
194
            else if (n3.tagName() == QLatin1String("bold"))
 
195
                f.bold = n3.firstChild().toText().data().toInt();
 
196
            else if (n3.tagName() == QLatin1String("italic"))
 
197
                f.italic = n3.firstChild().toText().data().toInt();
 
198
            else if (n3.tagName() == QLatin1String("underline"))
 
199
                f.underline = n3.firstChild().toText().data().toInt();
 
200
            else if (n3.tagName() == QLatin1String("strikeout"))
 
201
                f.strikeout = n3.firstChild().toText().data().toInt();
 
202
            n3 = n3.nextSibling().toElement();
 
203
        }
 
204
        var.font = f;
 
205
        qVariantSetValue(v, var);
 
206
    } else if (e.tagName() == QLatin1String("string")) {
 
207
        v = QVariant(e.firstChild().toText().data());
 
208
        QDomElement n = e;
 
209
        n = n.nextSibling().toElement();
 
210
        if (n.tagName() == QLatin1String("comment"))
 
211
            comment = n.firstChild().toText().data();
 
212
    } else if (e.tagName() == QLatin1String("cstring")) {
 
213
        v = QVariant(e.firstChild().toText().data().toAscii());
 
214
    } else if (e.tagName() == QLatin1String("number")) {
 
215
        bool ok = true;
 
216
        v = QVariant(e.firstChild().toText().data().toInt(&ok));
 
217
        if (!ok)
 
218
            v = QVariant(e.firstChild().toText().data().toDouble());
 
219
    } else if (e.tagName() == QLatin1String("bool")) {
 
220
        QString t = e.firstChild().toText().data();
 
221
        v = QVariant(t == QLatin1String("true") || t == QLatin1String("1"));
 
222
    } else if (e.tagName() == QLatin1String("pixmap")) {
 
223
        v = QVariant(e.firstChild().toText().data());
 
224
    } else if (e.tagName() == QLatin1String("iconset")) {
 
225
        v = QVariant(e.firstChild().toText().data());
 
226
    } else if (e.tagName() == QLatin1String("image")) {
 
227
        v = QVariant(e.firstChild().toText().data());
 
228
    } else if (e.tagName() == QLatin1String("enum")) {
 
229
        v = QVariant(e.firstChild().toText().data());
 
230
    } else if (e.tagName() == QLatin1String("set")) {
 
231
        v = QVariant(e.firstChild().toText().data());
 
232
    } else if (e.tagName() == QLatin1String("sizepolicy")) {
 
233
        QDomElement n3 = e.firstChild().toElement();
 
234
        var.createSizePolicy();
 
235
        while (!n3.isNull()) {
 
236
            if (n3.tagName() == QLatin1String("hsizetype"))
 
237
                var.sizePolicy.hsizetype = n3.firstChild().toText().data().toInt();
 
238
            else if (n3.tagName() == QLatin1String("vsizetype"))
 
239
                var.sizePolicy.vsizetype = n3.firstChild().toText().data().toInt();
 
240
            else if (n3.tagName() == QLatin1String("horstretch"))
 
241
                var.sizePolicy.horstretch = n3.firstChild().toText().data().toInt();
 
242
            else if (n3.tagName() == QLatin1String("verstretch"))
 
243
                var.sizePolicy.verstretch = n3.firstChild().toText().data().toInt();
 
244
            n3 = n3.nextSibling().toElement();
 
245
        }
 
246
        qVariantSetValue(v, var);
 
247
    } else if (e.tagName() == QLatin1String("cursor")) {
 
248
        var.createCursor(e.firstChild().toText().data().toInt());
 
249
        qVariantSetValue(v, var);
 
250
    } else if (e.tagName() == QLatin1String("stringlist")) {
 
251
        QStringList lst;
 
252
        QDomElement n;
 
253
        for (n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement())
 
254
            lst << n.firstChild().toText().data();
 
255
        v = QVariant(lst);
 
256
    } else if (e.tagName() == QLatin1String("date")) {
 
257
        QDomElement n3 = e.firstChild().toElement();
 
258
        int y, m, d;
 
259
        y = m = d = 0;
 
260
        while (!n3.isNull()) {
 
261
            if (n3.tagName() == QLatin1String("year"))
 
262
                y = n3.firstChild().toText().data().toInt();
 
263
            else if (n3.tagName() == QLatin1String("month"))
 
264
                m = n3.firstChild().toText().data().toInt();
 
265
            else if (n3.tagName() == QLatin1String("day"))
 
266
                d = n3.firstChild().toText().data().toInt();
 
267
            n3 = n3.nextSibling().toElement();
 
268
        }
 
269
        v = QVariant(QDate(y, m, d));
 
270
    } else if (e.tagName() == QLatin1String("time")) {
 
271
        QDomElement n3 = e.firstChild().toElement();
 
272
        int h, m, s;
 
273
        h = m = s = 0;
 
274
        while (!n3.isNull()) {
 
275
            if (n3.tagName() == QLatin1String("hour"))
 
276
                h = n3.firstChild().toText().data().toInt();
 
277
            else if (n3.tagName() == QLatin1String("minute"))
 
278
                m = n3.firstChild().toText().data().toInt();
 
279
            else if (n3.tagName() == QLatin1String("second"))
 
280
                s = n3.firstChild().toText().data().toInt();
 
281
            n3 = n3.nextSibling().toElement();
 
282
        }
 
283
        v = QVariant(QTime(h, m, s));
 
284
    } else if (e.tagName() == QLatin1String("datetime")) {
 
285
        QDomElement n3 = e.firstChild().toElement();
 
286
        int h, mi, s, y, mo, d ;
 
287
        h = mi = s = y = mo = d = 0;
 
288
        while (!n3.isNull()) {
 
289
            if (n3.tagName() == QLatin1String("hour"))
 
290
                h = n3.firstChild().toText().data().toInt();
 
291
            else if (n3.tagName() == QLatin1String("minute"))
 
292
                mi = n3.firstChild().toText().data().toInt();
 
293
            else if (n3.tagName() == QLatin1String("second"))
 
294
                s = n3.firstChild().toText().data().toInt();
 
295
            else if (n3.tagName() == QLatin1String("year"))
 
296
                y = n3.firstChild().toText().data().toInt();
 
297
            else if (n3.tagName() == QLatin1String("month"))
 
298
                mo = n3.firstChild().toText().data().toInt();
 
299
            else if (n3.tagName() == QLatin1String("day"))
 
300
                d = n3.firstChild().toText().data().toInt();
 
301
            n3 = n3.nextSibling().toElement();
 
302
        }
 
303
        v = QVariant(QDateTime(QDate(y, mo, d), QTime(h, mi, s)));
 
304
    }
 
305
 
 
306
    return v;
 
307
}
 
308
 
 
309
 
 
310
/*  Returns the color which is returned in the dom element \a e.
 
311
 */
 
312
 
 
313
Color DomTool::readColor(const QDomElement &e)
 
314
{
 
315
    QDomElement n = e.firstChild().toElement();
 
316
    int r= 0, g = 0, b = 0;
 
317
    while (!n.isNull()) {
 
318
        if (n.tagName() == QLatin1String("red"))
 
319
            r = n.firstChild().toText().data().toInt();
 
320
        else if (n.tagName() == QLatin1String("green"))
 
321
            g = n.firstChild().toText().data().toInt();
 
322
        else if (n.tagName() == QLatin1String("blue"))
 
323
            b = n.firstChild().toText().data().toInt();
 
324
        n = n.nextSibling().toElement();
 
325
    }
 
326
 
 
327
    Color c;
 
328
    c.init(r, g, b);
 
329
    return c;
 
330
}
 
331
 
 
332
/*
 
333
  Returns the contents of attribute \a name of object \a e as
 
334
  a variant or the variant passed as \a defValue if the attribute does
 
335
  not exist. The \a comment is passed to the elementToVariant()
 
336
  function.
 
337
 
 
338
  \sa hasAttribute()
 
339
 */
 
340
QVariant DomTool::readAttribute(const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment)
 
341
{
 
342
    QDomElement n;
 
343
    for (n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement()) {
 
344
        if (n.tagName() == QLatin1String("attribute")) {
 
345
            if (n.attribute(QLatin1String("name")) != name)
 
346
                continue;
 
347
            return elementToVariant(n.firstChild().toElement(), defValue, comment);
 
348
        }
 
349
    }
 
350
    return defValue;
 
351
}
 
352
 
 
353
/*
 
354
  \overload
 
355
*/
 
356
QVariant DomTool::readAttribute(const QDomElement& e, const QString& name, const QVariant& defValue)
 
357
{
 
358
    QString comment;
 
359
    return readAttribute(e, name, defValue, comment);
 
360
}
 
361
 
 
362
/*
 
363
  Returns wheter object \a e defines attribute \a name or not.
 
364
 
 
365
  \sa readAttribute()
 
366
 */
 
367
bool DomTool::hasAttribute(const QDomElement& e, const QString& name)
 
368
{
 
369
    QDomElement n;
 
370
    for (n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement()) {
 
371
        if (n.tagName() == QLatin1String("attribute")) {
 
372
            if (n.attribute(QLatin1String("name")) != name)
 
373
                continue;
 
374
            return true;
 
375
        }
 
376
    }
 
377
    return false;
 
378
}
 
379
 
 
380
static bool toBool(const QString& s)
 
381
{
 
382
    return s == QLatin1String("true") || s.toInt() != 0;
 
383
}
 
384
 
 
385
/*
 
386
    \internal
 
387
 
 
388
    Convert Qt 2.x format to Qt 3.x format if necessary.
 
389
*/
 
390
void DomTool::fixDocument(QDomDocument& doc)
 
391
{
 
392
    QDomElement e;
 
393
    QDomNode n;
 
394
    QDomNodeList nl;
 
395
    int i = 0;
 
396
 
 
397
    e = doc.firstChild().toElement();
 
398
    if (e.tagName() != QLatin1String("UI"))
 
399
        return;
 
400
 
 
401
    // rename classes and properties
 
402
    double version = e.hasAttribute(QLatin1String("version")) 
 
403
        ? e.attribute(QLatin1String("version")).toDouble() : 0.0;
 
404
        
 
405
    nl = e.childNodes();
 
406
    fixAttributes(nl, version);
 
407
 
 
408
    // 3.x don't do anything more
 
409
    if (e.hasAttribute(QLatin1String("version")) 
 
410
            && e.attribute(QLatin1String("version")).toDouble() >= 3.0)
 
411
        return;
 
412
 
 
413
    // in versions smaller than 3.0 we need to change more
 
414
 
 
415
    e.setAttribute(QLatin1String("version"), 3.0);
 
416
    e.setAttribute(QLatin1String("stdsetdef"), 1);
 
417
    nl = e.elementsByTagName(QLatin1String("property"));
 
418
    for (i = 0; i <  (int) nl.length(); i++) {
 
419
        e = nl.item(i).toElement();
 
420
        QString name;
 
421
        QDomElement n2 = e.firstChild().toElement();
 
422
        if (n2.tagName() == QLatin1String("name")) {
 
423
            name = n2.firstChild().toText().data();
 
424
            if (name == QLatin1String("resizeable"))
 
425
                e.setAttribute(QLatin1String("name"), QLatin1String("resizable"));
 
426
            else
 
427
                e.setAttribute(QLatin1String("name"), name);
 
428
            e.removeChild(n2);
 
429
        }
 
430
        bool stdset = toBool(e.attribute(QLatin1String("stdset")));
 
431
        if (stdset || name == QLatin1String("toolTip") || name == QLatin1String("whatsThis") ||
 
432
             name == QLatin1String("buddy") ||
 
433
             e.parentNode().toElement().tagName() == QLatin1String("item") ||
 
434
             e.parentNode().toElement().tagName() == QLatin1String("spacer") ||
 
435
             e.parentNode().toElement().tagName() == QLatin1String("column")
 
436
            )
 
437
            e.removeAttribute(QLatin1String("stdset"));
 
438
        else
 
439
            e.setAttribute(QLatin1String("stdset"), 0);
 
440
    }
 
441
 
 
442
    nl = doc.elementsByTagName(QLatin1String("attribute"));
 
443
    for (i = 0; i <  (int) nl.length(); i++) {
 
444
        e = nl.item(i).toElement();
 
445
        QString name;
 
446
        QDomElement n2 = e.firstChild().toElement();
 
447
        if (n2.tagName() == QLatin1String("name")) {
 
448
            name = n2.firstChild().toText().data();
 
449
            e.setAttribute(QLatin1String("name"), name);
 
450
            e.removeChild(n2);
 
451
        }
 
452
    }
 
453
 
 
454
    nl = doc.elementsByTagName(QLatin1String("image"));
 
455
    for (i = 0; i <  (int) nl.length(); i++) {
 
456
        e = nl.item(i).toElement();
 
457
        QString name;
 
458
        QDomElement n2 = e.firstChild().toElement();
 
459
        if (n2.tagName() == QLatin1String("name")) {
 
460
            name = n2.firstChild().toText().data();
 
461
            e.setAttribute(QLatin1String("name"), name);
 
462
            e.removeChild(n2);
 
463
        }
 
464
    }
 
465
 
 
466
    nl = doc.elementsByTagName(QLatin1String("widget"));
 
467
    for (i = 0; i <  (int) nl.length(); i++) {
 
468
        e = nl.item(i).toElement();
 
469
        QString name;
 
470
        QDomElement n2 = e.firstChild().toElement();
 
471
        if (n2.tagName() == QLatin1String("class")) {
 
472
            name = n2.firstChild().toText().data();
 
473
            e.setAttribute(QLatin1String("class"), name);
 
474
            e.removeChild(n2);
 
475
        }
 
476
    }
 
477
 
 
478
}
 
479
 
 
480
struct widgetName {
 
481
    widgetName(double v, QString b, QString a)
 
482
        : version(v), before(b), after(a) {}
 
483
    double version;
 
484
    QString before;
 
485
    QString after;
 
486
};
 
487
 
 
488
struct propertyName : public widgetName {
 
489
    propertyName(double v, QString b, QString a, QString c = QString())
 
490
        : widgetName(v, b, a), clss(c) {}
 
491
    QString clss;
 
492
};
 
493
 
 
494
const int widgs = 1;
 
495
widgetName widgetTable[1] = {
 
496
    widgetName(3.3, QLatin1String("before"), QLatin1String("after")),
 
497
};
 
498
 
 
499
const int props = 1;
 
500
propertyName propertyTable[1] = {
 
501
    propertyName(3.0, QLatin1String("resizeable"), QLatin1String("resizable")), // we need to fix a spelling error in 3.0
 
502
};
 
503
 
 
504
/*
 
505
    \internal
 
506
*/
 
507
void DomTool::fixAttributes(QDomNodeList &nodes, double version)
 
508
{
 
509
    QDomNode n;
 
510
    QDomNodeList nl;
 
511
    for (int i = 0; i < (int) nodes.count(); ++i) {
 
512
        n = nodes.item(i);
 
513
        fixAttribute(n, version);
 
514
        nl = n.childNodes();
 
515
        fixAttributes(nl, version);
 
516
    }
 
517
}
 
518
 
 
519
/*
 
520
    \internal
 
521
*/
 
522
void DomTool::fixAttribute(QDomNode &node, double version)
 
523
{
 
524
    QString tagName =  node.toElement().tagName();
 
525
    if (tagName == QLatin1String("widget")) {
 
526
        QString clss = node.toElement().attribute(QLatin1String("class"));
 
527
        for (int i = 0; i < widgs; ++i)
 
528
            if ((version < widgetTable[i].version)
 
529
                 && (clss == widgetTable[i].before)) {
 
530
                node.toElement().setAttribute(QLatin1String("class"), propertyTable[i].after);
 
531
                return;
 
532
            }
 
533
        return;
 
534
    }
 
535
    if (tagName == QLatin1String("property")) {
 
536
        QDomElement e = node.parentNode().toElement();
 
537
        QString clss = e.attribute(QLatin1String("class"));
 
538
        QString name = node.toElement().attribute(QLatin1String("name"), QLatin1String(""));
 
539
        for (int i = 0; i < props; ++i)
 
540
            if ((version < propertyTable[i].version)
 
541
                 && (clss == propertyTable[i].clss)
 
542
                 && (propertyTable[i].before.isNull()
 
543
                      || name == propertyTable[i].before)) {
 
544
                node.toElement().setAttribute(QLatin1String("name"), propertyTable[i].after);
 
545
                return;
 
546
            }
 
547
    }
 
548
}