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>
This commit is contained in:
Andy Shaw
2020-02-17 20:13:35 +01:00
parent cde9f31068
commit e22eea1cf3
3 changed files with 5 additions and 6 deletions

View File

@@ -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

View File

@@ -46,7 +46,7 @@
"data":
{
"items": [ { "trKey": "<Custom>", "value": "" },
"QObject", "QWidget", "QMainWindow", "QDeclarativeItem" ]
"QObject", "QWidget", "QMainWindow", "QDeclarativeItem", "QQuickItem" ]
}
},
{

View File

@@ -1,4 +1,4 @@
# This Python file uses the following encoding: utf-8
# if__name__ == "__main__":
# if __name__ == "__main__":
# pass