Files
qt-creator/share/qtcreator/templates/wizards/classes/python/file.py
Cristian Maureira-Fredes f7e1354ae5 Add Qt for Python templates and better support
QtCreator:
* Add new icons
* Add support for `.pyproject` files,
* Set `.pyproject` as default, but keep compatibility with `.pyqtc`
    * `.pyproject` is a JSON file, while `.pyqtc` is a plain-text.

Python class:
* Add option to ask if use PySide2 or PyQt5
* Remove the old import try-except structure
* Remove iconText and add icon option
* Remove shebang
* Add utf-8 support

Python file:
* Remove code
* Remove iconText and add icon option
* Remove shebang
* Add utf-8 support

Qt for Python - Empty
* Add file with basic statements to execute a QApplication

Qt for Python - Window
* Add file with basic statements to execute a QApplication,
  which contains a QMainWindow

Task-number: QTCREATORBUG-21824
Change-Id: I4adb3ab6b179f084c7b674a6d4f643445fe24929
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-02-04 09:32:30 +00:00

40 lines
831 B
Python

# This Python file uses the following encoding: utf-8
@if '%{Module}' === 'PySide2'
@if '%{ImportQtCore}'
from PySide2 import QtCore
@endif
@if '%{ImportQtWidgets}'
from PySide2 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
@endif
@endif
@if '%{Base}'
class %{Class}(%{Base}):
@else
class %{Class}:
@endif
def __init__(self):
@if '%{Base}' === 'QWidget'
QtWidgets.QWidget.__init__(self)
@endif
@if '%{Base}' === 'QMainWindow'
QtWidgets.QMainWindow.__init__(self)
@if '%{Base}' === 'QQuickItem'
QtQuick.QQuickItem.__init__(self)
@endif
pass