aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/templates
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-02-07 16:58:37 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2020-02-27 13:28:23 +0000
commitbcc2b5e08d44f3b8a601a48f5c6d7e8a9f5e6c79 (patch)
tree5a2f61c49b9f6fd4669af451c29816a3377dd601 /share/qtcreator/templates
parent0585ad0f64e26700f3436802c19ff3c0f663396e (diff)
"New Class" wizard: Try to find a base class header
If the project has a header file whose name suggests that it might declare the base class, then add an include statement for it. While we cannot guarantee that the include statement is resolvable as- is, it's at least a basis for the user to adapt accordingly, while without any include statement the class will definitely not compile. Fixes: QTCREATORBUG-3855 Change-Id: I55ec43d58a9a13b9b59a5bbe6415a457b974b654 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'share/qtcreator/templates')
-rw-r--r--share/qtcreator/templates/wizards/classes/cpp/file.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.h b/share/qtcreator/templates/wizards/classes/cpp/file.h
index aa2fa7faaf..67e4dfd4d1 100644
--- a/share/qtcreator/templates/wizards/classes/cpp/file.h
+++ b/share/qtcreator/templates/wizards/classes/cpp/file.h
@@ -6,6 +6,7 @@
#define %{GUARD}
@endif
+%{JS: Cpp.includeStatement('%{Base}', Util.preferredSuffix('text/x-c++hdr'), ['QObject', 'QWidget', 'QMainWindow', 'QQuickItem', 'QSharedData'], '%{TargetPath}')}\
%{JS: QtSupport.qtIncludes([ ( '%{IncludeQObject}' ) ? 'QtCore/%{IncludeQObject}' : '',
( '%{IncludeQWidget}' ) ? 'QtGui/%{IncludeQWidget}' : '',
( '%{IncludeQMainWindow}' ) ? 'QtGui/%{IncludeQMainWindow}' : '',