diff options
Diffstat (limited to 'share/qtcreator/templates/wizards/classes/python/file.py')
-rw-r--r-- | share/qtcreator/templates/wizards/classes/python/file.py | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/share/qtcreator/templates/wizards/classes/python/file.py b/share/qtcreator/templates/wizards/classes/python/file.py index 5698022dd8..6b16b9d952 100644 --- a/share/qtcreator/templates/wizards/classes/python/file.py +++ b/share/qtcreator/templates/wizards/classes/python/file.py @@ -1,38 +1,24 @@ # This Python file uses the following encoding: utf-8 -@if '%{Module}' === 'PySide2' - @if '%{ImportQtCore}' -from PySide2 import QtCore +@if '%{Module}' !== '<None>' + @if '%{ImportQtCore}' !== '' +from %{Module} import QtCore @endif - @if '%{ImportQtWidgets}' -from PySide2 import QtWidgets + @if '%{ImportQtWidgets}' !== '' +from %{Module} import QtWidgets @endif - @if '%{ImportQtQuick}' -from PySide2 import QtQuick - @endif -@else - @if '%{ImportQtCore}' -from PyQt5 import QtCore - @endif - @if '%{ImportQtWidgets}' -from PyQt5 import QtWidgets - @endif - @if '%{ImportQtQuick}' -from PyQt5 import QtQuick + @if '%{ImportQtQuick}' !== '' +from %{Module} import QtQuick @endif @endif @if '%{Base}' -class %{Class}(%{Base}): +class %{Class}(%{FullBase}): @else class %{Class}: @endif def __init__(self): -@if '%{Base}' === 'QWidget' - QtWidgets.QWidget.__init__(self) -@elif '%{Base}' === 'QMainWindow' - QtWidgets.QMainWindow.__init__(self) -@elif '%{Base}' === 'QQuickItem' - QtQuick.QQuickItem.__init__(self) +@if %{JS: [ "QObject", "QWidget", "QMainWindow", "QQuickItem" ].indexOf("%Base")} >= 0 + %{FullBase}.__init__(self) @endif pass |