From 748836dae80a7d11901f3f0630168829076d11a8 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 9 Jan 2018 16:29:55 +0100 Subject: Don't generate QAction include unconditionally Generate it only when the form contains some actions. Change-Id: Ic1d64003ccff6102174771c04999cf7c90ac2ae8 Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cppwriteincludes.cpp | 19 ++++++++++++++++++- src/tools/uic/cpp/cppwriteincludes.h | 7 +++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src/tools/uic/cpp') diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index 853a306721..0ba9d28642 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -106,7 +106,6 @@ void WriteIncludes::acceptUI(DomUI *node) add(QLatin1String("QApplication")); add(QLatin1String("QVariant")); - add(QLatin1String("QAction")); if (node->elementButtonGroups()) add(QLatin1String("QButtonGroup")); @@ -252,6 +251,24 @@ void WriteIncludes::acceptCustomWidget(DomCustomWidget *node) } } +void WriteIncludes::acceptActionGroup(DomActionGroup *node) +{ + add(QLatin1String("QAction")); + TreeWalker::acceptActionGroup(node); +} + +void WriteIncludes::acceptAction(DomAction *node) +{ + add(QLatin1String("QAction")); + TreeWalker::acceptAction(node); +} + +void WriteIncludes::acceptActionRef(DomActionRef *node) +{ + add(QLatin1String("QAction")); + TreeWalker::acceptActionRef(node); +} + void WriteIncludes::acceptCustomWidgets(DomCustomWidgets *node) { Q_UNUSED(node); diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h index f91e1cf8ff..7f03849798 100644 --- a/src/tools/uic/cpp/cppwriteincludes.h +++ b/src/tools/uic/cpp/cppwriteincludes.h @@ -55,6 +55,13 @@ struct WriteIncludes : public TreeWalker void acceptSpacer(DomSpacer *node) override; void acceptProperty(DomProperty *node) override; +// +// actions +// + void acceptActionGroup(DomActionGroup *node) Q_DECL_OVERRIDE; + void acceptAction(DomAction *node) Q_DECL_OVERRIDE; + void acceptActionRef(DomActionRef *node) Q_DECL_OVERRIDE; + // // custom widgets // -- cgit v1.2.3