Files
qt-creator/share/qtcreator/templates/wizards/classes/python/file.py
Christian Stenger 5b4b09481a Wizards: Improve python class wizard
Some minor fixes, simplifications and improvements.
In detail:
 * create valid Python code
 * allow creating a Python class also without a Qt package
 * hint about the need for a Qt package depending on the
   base class
 * remove QDeclarativeItem as base class as this is not
   present in recent Qt packages

Change-Id: I7198f315b3a9eec9a04f52d7438d05ccce40c3f7
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-07-02 06:58:51 +00:00

25 lines
557 B
Python

# This Python file uses the following encoding: utf-8
@if '%{Module}' !== '<None>'
@if '%{ImportQtCore}' !== ''
from %{Module} import QtCore
@endif
@if '%{ImportQtWidgets}' !== ''
from %{Module} import QtWidgets
@endif
@if '%{ImportQtQuick}' !== ''
from %{Module} import QtQuick
@endif
@endif
@if '%{Base}'
class %{Class}(%{FullBase}):
@else
class %{Class}:
@endif
def __init__(self):
@if %{JS: [ "QObject", "QWidget", "QMainWindow", "QQuickItem" ].indexOf("%Base")} >= 0
%{FullBase}.__init__(self)
@endif
pass