Wizards: Refresh the Canvas3D Application wizard

...and move it under qtquickqpplication

Change-Id: I7e402424075583fe895aaa1cb6e877351098015b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
Alessandro Portale
2017-08-01 15:58:31 +02:00
parent 774bf8d8af
commit f752fbb5cc
14 changed files with 142 additions and 134 deletions

View File

@@ -1,13 +0,0 @@
cmake_minimum_required(VERSION 2.8.12)
project(%{ProjectName} LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt5 COMPONENTS Core Quick REQUIRED)
add_executable(${PROJECT_NAME} "%{MainCppFileName}" "qml.qrc")
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick)

View File

@@ -1,25 +0,0 @@
QT += quick
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += %{MainCppFileName}
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

View File

@@ -1,38 +0,0 @@
import qbs
Project {
minimumQbsVersion: "1.7.1"
CppApplication {
Depends { name: "Qt.core" }
Depends { name: "Qt.quick" }
// Additional import path used to resolve QML modules in Qt Creator's code model
property pathList qmlImportPaths: []
cpp.cxxLanguageVersion: "c++11"
cpp.defines: [
// The following define makes your compiler emit warnings if you use
// any feature of Qt which as been marked deprecated (the exact warnings
// depend on your compiler). Please consult the documentation of the
// deprecated API in order to know how to port your code away from it.
"QT_DEPRECATED_WARNINGS",
// You can also make your code fail to compile if you use deprecated APIs.
// In order to do so, uncomment the following line.
// You can also select to disable deprecated APIs only up to a certain version of Qt.
//"QT_DISABLE_DEPRECATED_BEFORE=0x060000" // disables all the APIs deprecated before Qt 6.0.0
]
files: [
"%{MainCppFileName}",
"qml.qrc",
]
Group { // Properties for the produced executable
fileTagsFilter: product.type
qbs.install: true
}
}
}

View File

@@ -1,13 +0,0 @@
%{Cpp:LicenseTemplate}\
%{JS: QtSupport.qtIncludes([], ["QtGui/QGuiApplication", "QtQml/QQmlApplicationEngine"])}
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}

View File

@@ -1,30 +0,0 @@
import QtQuick 2.4
import QtCanvas3D 1.1
import QtQuick.Window 2.2
import "glcode.js" as GLCode
Window {
title: qsTr("%{ProjectName}")
width: 1280
height: 768
visible: true
Canvas3D {
id: canvas3d
anchors.fill: parent
focus: true
onInitializeGL: {
GLCode.initializeGL(canvas3d);
}
onPaintGL: {
GLCode.paintGL(canvas3d);
}
onResizeGL: {
GLCode.resizeGL(canvas3d);
}
}
}

View File

@@ -0,0 +1,67 @@
import QtQuick 2.4
import QtCanvas3D 1.1
import QtQuick.Window 2.2
@if %{UseVirtualKeyboard}
import %{QtQuickVirtualKeyboardImport}
@endif
import "glcode.js" as GLCode
Window {
@if %{UseVirtualKeyboard}
id: window
@endif
title: qsTr("%{ProjectName}")
width: 640
height: 360
visible: true
Canvas3D {
id: canvas3d
anchors.fill: parent
focus: true
onInitializeGL: {
GLCode.initializeGL(canvas3d);
}
onPaintGL: {
GLCode.paintGL(canvas3d);
}
onResizeGL: {
GLCode.resizeGL(canvas3d);
}
}
@if %{UseVirtualKeyboard}
InputPanel {
id: inputPanel
z: 99
x: 0
y: window.height
width: window.width
states: State {
name: "visible"
when: inputPanel.active
PropertyChanges {
target: inputPanel
y: window.height - inputPanel.height
}
}
transitions: Transition {
from: ""
to: "visible"
reversible: true
ParallelAnimation {
NumberAnimation {
properties: "y"
duration: 250
easing.type: Easing.InOutQuad
}
}
}
}
@endif
}

View File

@@ -1,13 +1,13 @@
{
"version": 1,
"supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
"id": "W.QtCanvas3dApplication",
"id": "W.QtQuickApplicationCanvas3D",
"category": "F.Application",
"trDescription": "Creates a Qt Canvas 3D QML project. Optionally including three.js.",
"trDisplayName": "Qt Canvas 3D Application",
"trDescription": "Creates a Qt Canvas 3D QML project, optionally including three.js.",
"trDisplayName": "Qt Quick Application - Canvas 3D",
"trDisplayCategory": "Application",
"icon": "3dapplication.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQtCanvas3d1.1" ],
"icon": "icon.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.7" ],
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}",
"options":
@@ -17,8 +17,13 @@
{ "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
{ "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
{ "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.qtQuickVersion}" },
{ "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.qtQuickWindowVersion}" }
{ "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" },
{ "key": "QtQuick3DVersion", "value": "%{JS: %{QtVersion}.QtQuick3DVersion}" },
{ "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.QtQuickWindowVersion}" },
{ "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" },
{ "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" },
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" },
{ "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" }
],
"pages":
@@ -70,6 +75,48 @@
"typeId": "Fields",
"data":
[
{
"name": "QtVersion",
"trDisplayName": "Minimal required Qt version:",
"type": "ComboBox",
"data":
{
"index": 0,
"items":
[
{
"trKey": "Qt 5.9",
"value":
"{
'QtQuickVersion': '2.9',
'QtQuick3DVersion': '1.1',
'QtQuickWindowVersion': '2.2',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1'
}"
},
{
"trKey": "Qt 5.8",
"value":
"{
'QtQuickVersion': '2.8',
'QtQuick3DVersion': '1.1',
'QtQuickWindowVersion': '2.2',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1'
}"
},
{
"trKey": "Qt 5.7",
"value":
"{
'QtQuickVersion': '2.7',
'QtQuick3DVersion': '1.1',
'QtQuickWindowVersion': '2.2',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1'
}"
}
]
}
},
{
"name": "ThreeJs",
"trDisplayName": "Create a three.js based application.",
@@ -78,6 +125,15 @@
{
"checked": false
}
},
{
"name": "UseVirtualKeyboard",
"trDisplayName": "Use Qt Virtual Keyboard.",
"type": "CheckBox",
"data":
{
"checked": "%{JS: %{UseVirtualKeyboardByDefault}}"
}
}
]
},
@@ -86,7 +142,10 @@
"trShortTitle": "Kits",
"typeId": "Kits",
"enabled": "%{JS: ! %{IsSubproject}}",
"data": { "projectFilePath": "%{ProjectFile}" }
"data": {
"projectFilePath": "%{ProjectFile}",
"requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ]
}
},
{
"trDisplayName": "Project Management",
@@ -101,24 +160,25 @@
"data":
[
{
"source": "app.pro",
"source": "../app.pro",
"target": "%{ProFile}",
"openAsProject": true,
"condition": "%{JS: '%{BuildSystem}' === 'qmake'}"
},
{
"source": "CMakeLists.txt",
"source": "../CMakeLists.txt",
"target": "CMakeLists.txt",
"openAsProject": true,
"condition": "%{JS: '%{BuildSystem}' === 'cmake'}"
},
{
"source": "file.qbs",
"source": "../app.qbs",
"target": "%{QbsFile}",
"openAsProject": true,
"condition": "%{JS: '%{BuildSystem}' === 'qbs'}"
},
{
"source": "main.cpp",
"source": "../main.cpp",
"target": "%{MainCppFileName}"
},
{
@@ -129,12 +189,12 @@
{
"source": "threejs/3rdparty/three.js",
"condition": "%{ThreeJs}",
"target": "%{ProjectDirectory}/three.js",
"target": "three.js",
"isBinary": true
},
{
"source": "%{JS: (%{ThreeJs} ? 'threejs' : 'plaincanvas3d') + '/glcode.js'}",
"target": "%{ProjectDirectory}/glcode.js"
"target": "glcode.js"
},
{
"source": "qml.qrc"

View File

@@ -2501,7 +2501,7 @@
height="100%" />
</g>
<g
id="share/qtcreator/templates/wizards/projects/qtcanvas3dapplication/3dapplication"
id="share/qtcreator/templates/wizards/projects/qtquickapplication/canvas3d/icon"
transform="translate(-159,-83)">
<use
style="display:inline"

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB