diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-11-02 15:20:43 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-01-10 09:13:36 +0000 |
| commit | 8c47c2a08ec69fe45a14f6c2334befcb2e074790 (patch) | |
| tree | c1f35c262c9c88f5c113ccdafb48ff41e8a89e1a /src/tools/uic/cpp/cppwriteincludes.cpp | |
| parent | f370410097f8cb8d8fdf6174b799497fe7fe0adf (diff) | |
uic: Refactor CustomWidgetsInfo::extends()
Add a extendsOneOf() helper that takes a QStringList to be searched
and simplify the code accordingly.
In WriteInitialization::acceptWidget(), move the variable
CustomWidgetsInfo *cwi up and reuse everywhere to shorten code.
Task-number: PYSIDE-797
Change-Id: I331e135b6aa58dbbd413ca151eb67b3eb92f09c6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteincludes.cpp')
| -rw-r--r-- | src/tools/uic/cpp/cppwriteincludes.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index 74546bb01d3..0ba49627c0f 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -214,14 +214,14 @@ void WriteIncludes::add(const QString &className, bool determineHeader, const QS m_knownClasses.insert(className); const CustomWidgetsInfo *cwi = m_uic->customWidgetsInfo(); - if (cwi->extends(className, QLatin1String("QTreeView")) - || cwi->extends(className, QLatin1String("QTreeWidget")) - || cwi->extends(className, QLatin1String("QTableView")) - || cwi->extends(className, QLatin1String("QTableWidget"))) { + static const QStringList treeViewsWithHeaders = { + QLatin1String("QTreeView"), QLatin1String("QTreeWidget"), + QLatin1String("QTableView"), QLatin1String("QTableWidget") + }; + if (cwi->extendsOneOf(className, treeViewsWithHeaders)) add(QLatin1String("QHeaderView")); - } - if (!m_laidOut && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox"))) + if (!m_laidOut && cwi->extends(className, QLatin1String("QToolBox"))) add(QLatin1String("QLayout")); // spacing property of QToolBox) if (className == QLatin1String("Line")) { // ### hmm, deprecate me! |
