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#ifndef UTILS_H
5#define UTILS_H
6
7#include "ui4.h"
8#include <qstring.h>
9#include <qlist.h>
10#include <qhash.h>
11
12QT_BEGIN_NAMESPACE
13
14inline bool toBool(const QString &str)
15{ return QString::compare(s1: str, s2: QLatin1StringView("true"), cs: Qt::CaseInsensitive) == 0; }
16
17inline QString toString(const DomString *str)
18{ return str ? str->text() : QString(); }
19
20inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties)
21{
22 QHash<QString, DomProperty *> map;
23 for (DomProperty *p : properties)
24 map.insert(key: p->attributeName(), value: p);
25 return map;
26}
27
28QT_END_NAMESPACE
29
30#endif // UTILS_H
31

source code of qtbase/src/tools/uic/utils.h