diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json
index 87cc5c0979c..33fe0b0abb9 100644
--- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json
@@ -1,14 +1,13 @@
{
"version": 1,
"supportedProjectTypes": [ "PythonProject" ],
- "id": "U.QtForPythonApplicationEmpty",
+ "id": "F.QtForPythonApplicationEmpty",
"category": "F.Application",
"trDescription": "Creates a Qt for Python application that contains only the main code for a QApplication.",
"trDisplayName": "Qt for Python - Empty",
"trDisplayCategory": "Application",
"icon": "icon.png",
"enabled": "%{JS: value('Plugins').indexOf('Python') >= 0}",
- "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ],
"options":
[
@@ -44,6 +43,11 @@
"source": "../main_empty.py",
"target": "%{SrcFileName}",
"openInEditor": true
+ },
+ {
+ "source": "../../git.ignore",
+ "target": ".gitignore",
+ "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
}
]
}
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/icon.png b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/icons/icon.png
similarity index 100%
rename from share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/icon.png
rename to share/qtcreator/templates/wizards/projects/qtforpythonapplication/icons/icon.png
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/icon@2x.png b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/icons/icon@2x.png
similarity index 100%
rename from share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/icon@2x.png
rename to share/qtcreator/templates/wizards/projects/qtforpythonapplication/icons/icon@2x.png
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_qtquick.py b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_qtquick.py
new file mode 100644
index 00000000000..cba746860b1
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_qtquick.py
@@ -0,0 +1,16 @@
+# This Python file uses the following encoding: utf-8
+import sys
+import os
+
+from PySide2.QtGui import QGuiApplication
+from PySide2.QtQml import QQmlApplicationEngine
+
+
+if __name__ == "__main__":
+ app = QGuiApplication(sys.argv)
+ engine = QQmlApplicationEngine()
+ engine.load(os.path.join(os.path.dirname(__file__), "main.qml"))
+
+ if not engine.rootObjects():
+ sys.exit(-1)
+ sys.exit(app.exec_())
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_widget.py b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_widget.py
new file mode 100644
index 00000000000..1f63b14acb7
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_widget.py
@@ -0,0 +1,40 @@
+# This Python file uses the following encoding: utf-8
+import sys
+import os
+
+
+@if '%{BaseCB}' === 'QWidget'
+from PySide2.QtWidgets import QApplication, QWidget
+@endif
+@if '%{BaseCB}' === 'QMainWindow'
+from PySide2.QtWidgets import QApplication, QMainWindow
+@endif
+@if '%{BaseCB}' === 'QDialog'
+from PySide2.QtWidgets import QApplication, QDialog
+@endif
+from PySide2.QtCore import QFile
+from PySide2.QtUiTools import QUiLoader
+
+
+@if '%{BaseCB}'
+class %{Class}(%{BaseCB}):
+@else
+class %{Class}:
+@endif
+ def __init__(self):
+ super(%{Class}, self).__init__()
+ self.load_ui()
+
+ def load_ui(self):
+ loader = QUiLoader()
+ path = os.path.join(os.path.dirname(__file__), "form.ui")
+ ui_file = QFile(path)
+ ui_file.open(QFile.ReadOnly)
+ loader.load(ui_file, self)
+ ui_file.close()
+
+if __name__ == "__main__":
+ app = QApplication([])
+ widget = %{Class}()
+ widget.show()
+ sys.exit(app.exec_())
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_widget.ui b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_widget.ui
new file mode 100644
index 00000000000..47fadf2b6e9
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_widget.ui
@@ -0,0 +1,24 @@
+
+
+ %{Class}
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ %{Class}
+
+@if '%{BaseCB}' === 'QMainWindow'
+
+
+
+@endif
+
+
+
+
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json
index 0e562b124c0..cdbe2bf53f3 100644
--- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json
@@ -1,14 +1,13 @@
{
"version": 1,
"supportedProjectTypes": [ "PythonProject" ],
- "id": "U.QtForPythonApplicationWindow",
+ "id": "F.QtForPythonApplicationWindow",
"category": "F.Application",
"trDescription": "Creates a Qt for Python application that contains an empty window.",
"trDisplayName": "Qt for Python - Window",
"trDisplayCategory": "Application",
- "icon": "icon.png",
+ "icon": "../icons/icon.png",
"enabled": "%{JS: value('Plugins').indexOf('Python') >= 0}",
- "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ],
"options":
[
@@ -43,8 +42,8 @@
"type": "ComboBox",
"data":
{
- "items": [ { "trKey": "", "value": "" },
- "QWidget", "QMainWindow"]
+ "items": [ "QWidget", "QMainWindow",
+ { "trKey": "", "value": "" } ]
}
},
{
@@ -84,6 +83,11 @@
"source": "../main_mainwindow.py",
"target": "%{MainPyFileName}",
"openInEditor": true
+ },
+ {
+ "source": "../../git.ignore",
+ "target": ".gitignore",
+ "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
}
]
}
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/main.pyproject b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/main.pyproject
new file mode 100644
index 00000000000..b7922c9fab9
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/main.pyproject
@@ -0,0 +1,3 @@
+{
+ "files": ["%{SrcFileName}", "%{QmlFileName}"]
+}
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/main.qml.tpl b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/main.qml.tpl
new file mode 100644
index 00000000000..6f9e90d5177
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/main.qml.tpl
@@ -0,0 +1,9 @@
+import QtQuick %{QtQuickVersion}
+import QtQuick.Window %{QtQuickWindowVersion}
+
+Window {
+ title: qsTr("Hello World")
+ width: 640
+ height: 480
+ visible: true
+}
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/wizard.json
new file mode 100644
index 00000000000..a0e7fcef02d
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/qtquickapplication/wizard.json
@@ -0,0 +1,98 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ "PythonProject" ],
+ "id": "F.QtQuickQtForPythonApplicationEmpty",
+ "category": "F.Application",
+ "trDescription": "Creates a Qt Quick application that contains an empty window.",
+ "trDisplayName": "Qt for Python - Qt Quick Application - Empty",
+ "trDisplayCategory": "Application",
+ "icon": "../icons/icon.png",
+ "enabled": "%{JS: value('Plugins').indexOf('Python') >= 0}",
+
+ "options":
+ [
+ { "key": "SrcFileName", "value": "main.py" },
+ { "key": "QmlFileName", "value": "main.qml" },
+ { "key": "PyProjectFile", "value": "main.pyproject" },
+ { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" },
+ { "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Project Location",
+ "trShortTitle": "Location",
+ "typeId": "Project"
+ },
+ {
+ "trDisplayName": "Define Project Details",
+ "trShortTitle": "Details",
+ "typeId": "Fields",
+ "data":
+ [
+ {
+ "name": "QtVersion",
+ "trDisplayName": "PySide version:",
+ "type": "ComboBox",
+ "data":
+ {
+ "index": 1,
+ "items":
+ [
+ {
+ "trKey": "PySide 5.13",
+ "value":
+ {
+ "QtQuickVersion": "2.13",
+ "QtQuickWindowVersion": "2.13"
+ }
+ },
+ {
+ "trKey": "PySide 5.12",
+ "value":
+ {
+ "QtQuickVersion": "2.12",
+ "QtQuickWindowVersion": "2.12"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+ "generators":
+ [
+ {
+ "typeId": "File",
+ "data":
+ [
+ {
+ "source": "../main_qtquick.py",
+ "target": "main.py"
+ },
+ {
+ "source": "main.pyproject",
+ "target": "main.pyproject",
+ "openAsProject": true
+ },
+ {
+ "source": "main.qml.tpl",
+ "target": "main.qml",
+ "openInEditor": true
+ },
+ {
+ "source": "../../git.ignore",
+ "target": ".gitignore",
+ "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
+ }
+ ]
+ }
+ ]
+}
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/widget/main.pyproject b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/widget/main.pyproject
new file mode 100644
index 00000000000..64c2987a8fb
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/widget/main.pyproject
@@ -0,0 +1,3 @@
+{
+ "files": ["%{SrcFileName}", "form.ui"]
+}
diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/widget/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/widget/wizard.json
new file mode 100644
index 00000000000..3bdfa8459aa
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/widget/wizard.json
@@ -0,0 +1,98 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ "PythonProject" ],
+ "id": "F.QtForPythonApplicationWindowWidget",
+ "category": "F.Application",
+ "trDescription": "Creates a Qt for Python application that includes a Qt Designer-based widget (ui file)",
+ "trDisplayName": "Qt for Python - Window (UI file)",
+ "trDisplayCategory": "Application",
+ "icon": "../icons/icon.png",
+ "enabled": "%{JS: value('Plugins').indexOf('Python') >= 0}",
+
+ "options":
+ [
+ { "key": "SrcFileName", "value": "main.py" },
+ { "key": "PyProjectFile", "value": "main.pyproject" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Project Location",
+ "trShortTitle": "Location",
+ "typeId": "Project",
+ "name": "ProjectPath"
+ },
+ {
+ "trDisplayName": "Define Class",
+ "trShortTitle": "Details",
+ "typeId": "Fields",
+ "data" :
+ [
+ {
+ "name": "Class",
+ "trDisplayName": "Class name:",
+ "mandatory": true,
+ "type": "LineEdit",
+ "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)" }
+ },
+ {
+ "name": "BaseCB",
+ "trDisplayName": "Base class:",
+ "type": "ComboBox",
+ "data":
+ {
+ "items": [ "QWidget", "QDialog", "QMainWindow" ]
+ }
+ },
+ {
+ "name": "SrcFileName",
+ "type": "LineEdit",
+ "trDisplayName": "Source file:",
+ "mandatory": true,
+ "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-python'))}" }
+ },
+ {
+ "name": "ProjectFileName",
+ "type": "LineEdit",
+ "trDisplayName": "Project file:",
+ "mandatory": true,
+ "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), 'pyproject')}" }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+ "generators":
+ [
+ {
+ "typeId": "File",
+ "data":
+ [
+ {
+ "source": "main.pyproject",
+ "target": "%{PyProjectFile}",
+ "openAsProject": true
+ },
+ {
+ "source": "../main_widget.py",
+ "target": "%{SrcFileName}",
+ "openInEditor": true
+ },
+ {
+ "source": "../main_widget.ui",
+ "target": "form.ui"
+ },
+ {
+ "source": "../../git.ignore",
+ "target": ".gitignore",
+ "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
+ }
+ ]
+ }
+ ]
+}