From 058474884c2505a8a00d4c59b4922bfcd3597c2f Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 8 Jan 2018 17:39:56 +0100 Subject: Don't generate QHeaderView include unconditionally Generate it only when needed. Change-Id: I7a89b18ec0f2ee7d55fcad1b3f9701269d7616ec Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cppwriteincludes.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/tools/uic/cpp/cppwriteincludes.cpp') diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index de64b85219b..809cac6bef0 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -109,7 +109,6 @@ void WriteIncludes::acceptUI(DomUI *node) add(QLatin1String("QAction")); add(QLatin1String("QButtonGroup")); // ### only if it is really necessary - add(QLatin1String("QHeaderView")); TreeWalker::acceptUI(node); @@ -212,6 +211,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"))) { + add(QLatin1String("QHeaderView")); + } + if (!m_laidOut && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox"))) add(QLatin1String("QLayout")); // spacing property of QToolBox) -- cgit v1.2.3