summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-02-17 20:13:35 +0100
committerAndy Shaw <andy.shaw@qt.io>2020-02-18 16:13:20 +0000
commite22eea1cf3c9f884d872d4f4c32cd5f320a27786 (patch)
treec39f2d78c90d2f8028c1abc0835c08606d2756c9
parentcde9f31068bed64bc06fd75fc3fc95418bee9f3d (diff)
downloadqt-creator-e22eea1cf3c9f884d872d4f4c32cd5f320a27786.tar.gz
Fix the Python templates
This fixes the templates so that they do not produce any warnings and also includes QQuickItem in the choice of base classes Change-Id: I58bbd462052f5d2a64bb8c4bea5bbdcd15e66700 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--share/qtcreator/templates/wizards/classes/python/file.py7
-rw-r--r--share/qtcreator/templates/wizards/classes/python/wizard.json2
-rw-r--r--share/qtcreator/templates/wizards/files/python/file.py2
3 files changed, 5 insertions, 6 deletions
diff --git a/share/qtcreator/templates/wizards/classes/python/file.py b/share/qtcreator/templates/wizards/classes/python/file.py
index adcbc1ed2d..5698022dd8 100644
--- a/share/qtcreator/templates/wizards/classes/python/file.py
+++ b/share/qtcreator/templates/wizards/classes/python/file.py
@@ -21,6 +21,7 @@ from PyQt5 import QtQuick
@endif
@endif
+
@if '%{Base}'
class %{Class}(%{Base}):
@else
@@ -29,11 +30,9 @@ class %{Class}:
def __init__(self):
@if '%{Base}' === 'QWidget'
QtWidgets.QWidget.__init__(self)
-@endif
-@if '%{Base}' === 'QMainWindow'
+@elif '%{Base}' === 'QMainWindow'
QtWidgets.QMainWindow.__init__(self)
-@if '%{Base}' === 'QQuickItem'
+@elif '%{Base}' === 'QQuickItem'
QtQuick.QQuickItem.__init__(self)
@endif
pass
-
diff --git a/share/qtcreator/templates/wizards/classes/python/wizard.json b/share/qtcreator/templates/wizards/classes/python/wizard.json
index 552c3f15a0..aeebd1f2a3 100644
--- a/share/qtcreator/templates/wizards/classes/python/wizard.json
+++ b/share/qtcreator/templates/wizards/classes/python/wizard.json
@@ -46,7 +46,7 @@
"data":
{
"items": [ { "trKey": "<Custom>", "value": "" },
- "QObject", "QWidget", "QMainWindow", "QDeclarativeItem" ]
+ "QObject", "QWidget", "QMainWindow", "QDeclarativeItem", "QQuickItem" ]
}
},
{
diff --git a/share/qtcreator/templates/wizards/files/python/file.py b/share/qtcreator/templates/wizards/files/python/file.py
index 003f841497..fcb605f9f7 100644
--- a/share/qtcreator/templates/wizards/files/python/file.py
+++ b/share/qtcreator/templates/wizards/files/python/file.py
@@ -1,4 +1,4 @@
# This Python file uses the following encoding: utf-8
-# if__name__ == "__main__":
+# if __name__ == "__main__":
# pass