From b21e3989d47578218cd9d506911975c239334ad2 Mon Sep 17 00:00:00 2001 From: "linger@posteo.net" Date: Sun, 28 Feb 2021 15:58:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Add=20build=20type=20debug/profile/release?= =?UTF-8?q?=20support=20=EF=BC=88=E6=94=AF=E6=8C=81=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E9=80=89=E6=8B=A9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Qml/main.qml | 14 +++++++++++++- VersionModel.cpp | 25 ++++++++++++++++++++++++- VersionModel.h | 7 +++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Qml/main.qml b/Qml/main.qml index ed262d9..a340309 100644 --- a/Qml/main.qml +++ b/Qml/main.qml @@ -20,7 +20,7 @@ Window { | Qt.CustomizeWindowHint | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowStaysOnTopHint width: 640 - height: 480 + height: 540 title: qsTr("Qt程序打包工具v1.0.1") DropArea { @@ -89,6 +89,18 @@ Window { } } + ContentBar { + z: 1 + width: parent.width + height: 40 + text: "选择构建方式" + + MyComboBox { + model: versionMode.buildTypeList + onCurrentTextChanged: versionMode.buildType = currentText + } + } + Item { width: parent.width height: 240 diff --git a/VersionModel.cpp b/VersionModel.cpp index 4a74b23..98dfb3c 100644 --- a/VersionModel.cpp +++ b/VersionModel.cpp @@ -46,6 +46,7 @@ bool VersionModel::create() qDebug()<<"[Info] "<<"Exe File: "< Date: Mon, 1 Mar 2021 23:37:29 +0800 Subject: [PATCH 2/2] Add select qmldir --- Qml/main.qml | 62 ++++++++++++++++++++++++++++++++++++++++++++++-- VersionModel.cpp | 24 +++++++++++++++++-- VersionModel.h | 9 +++++-- 3 files changed, 89 insertions(+), 6 deletions(-) diff --git a/Qml/main.qml b/Qml/main.qml index a340309..1cb61eb 100644 --- a/Qml/main.qml +++ b/Qml/main.qml @@ -7,6 +7,9 @@ LICENSE: MIT **********************************************************/ import QtQuick 2.0 import QtQuick.Window 2.2 +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.0 +import Qt.labs.platform 1.0 import VersionMode 1.0 import "./Common" @@ -20,7 +23,7 @@ Window { | Qt.CustomizeWindowHint | Qt.WindowSystemMenuHint | Qt.WindowMinimizeButtonHint | Qt.WindowStaysOnTopHint width: 640 - height: 540 + height: 560 title: qsTr("Qt程序打包工具v1.0.1") DropArea { @@ -63,7 +66,7 @@ Window { Column { anchors.verticalCenter: parent.verticalCenter width: parent.width - spacing: 15 + spacing: 10 ContentBar { z: 2 @@ -101,6 +104,61 @@ Window { } } + ContentBar { + width: parent.width + height: 40 + text: "选择Qt类型" + + Row { + height: 40 + RadioButton { + id: widgetButton + checked: true + text: "widget" + width: 90 + onCheckedChanged: { + if(checked) { + versionMode.qmlDir = "" + } + } + } + + RadioButton { + id: qmlButton + text: "qml" + width: 70 + } + + TextField { + width: parent.width - qmlButton.width - widgetButton.width - qmlFileDialogButton.width + height: 40 + visible: qmlButton.checked + text: qmlFolderDialog.folder + placeholderText: "qml 文件路径" + selectByMouse: true + onTextChanged: { + versionMode.qmlDir = text + } + } + + MyButton { + visible: qmlButton.checked + id: qmlFileDialogButton + text: "..." + height: 40 + width: 30 + onClicked: { + qmlFolderDialog.open() + } + } + + FolderDialog { + id: qmlFolderDialog + } + } + + } + Item { width: parent.width height: 240 diff --git a/VersionModel.cpp b/VersionModel.cpp index 98dfb3c..9909a38 100644 --- a/VersionModel.cpp +++ b/VersionModel.cpp @@ -59,11 +59,19 @@ bool VersionModel::create() QDir qtDir = sourceFile.dir(); qtDir.cdUp(); QString qtPath = qtDir.path(); + QString qmlPath; + if(m_qmlDir.isLocalFile()) { + qmlPath = m_qmlDir.toLocalFile(); + } qDebug()<<"[Info] "<<"Qt Path"< #include +#include class VersionModel : public QObject { @@ -21,7 +22,7 @@ class VersionModel : public QObject Q_PROPERTY(QString buildType READ buildType WRITE setBuildType NOTIFY statusChanged) Q_PROPERTY(QString compilerVersion READ compilerVersion WRITE setCompilerVersion NOTIFY statusChanged) Q_PROPERTY(QString exeFile READ exeFile WRITE setExeFile NOTIFY statusChanged) - + Q_PROPERTY(QUrl qmlDir READ qmlDir WRITE setQmlDir NOTIFY statusChanged) public: VersionModel(); @@ -32,7 +33,6 @@ class VersionModel : public QObject QStringList compilerVersionList(); QStringList buildTypeList(); - QString buildType(); void setBuildType(const QString &buildType); @@ -45,6 +45,10 @@ class VersionModel : public QObject QString exeFile(); void setExeFile(const QString &file); + + QUrl qmlDir(); + void setQmlDir(const QUrl &dir); + signals: void listChanged(); void statusChanged(); @@ -57,6 +61,7 @@ class VersionModel : public QObject QString m_compilerVersion; QString m_buildType; QString m_exeFile; + QUrl m_qmlDir; QString m_sourceEnvPath; QProcess m_testProcess; };