├── app.ico
├── Resource
├── Qtbig.png
└── Qtbig_qrcode.jpg
├── Test
├── Qt程序打包工具V1.0.gif
├── Qt程序打包工具V1.0.mp4
├── Qt程序打包工具V1.0.png
└── exe_demo
│ ├── Qt_5_12_2_MSVC_2017_x86_Release_Test.exe
│ ├── Qt_5_12_2_Mingw_730_x86_Release_Test.exe
│ ├── Qt_5_12_2_MSVC_2017_x86_Release_QML_Test.exe
│ └── Qt_5_12_2_MSVC_2017_x86_Release_QML_Plugin_Test.exe
├── ChangeLogs.md
├── resources.qrc
├── qml.qrc
├── ToolsModel.cpp
├── ToolsModel.h
├── Qml
├── Common
│ ├── MyButton.qml
│ ├── ContentBar.qml
│ ├── RoundRectangle.qml
│ ├── MyComboBox.qml
│ └── ComboBox.qml
├── TipsDialog.qml
├── About
│ └── About.qml
└── main.qml
├── .gitignore
├── LICENSE
├── main.cpp
├── README.md
├── DeployQt.pro
├── VersionModel.h
└── VersionModel.cpp
/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/app.ico
--------------------------------------------------------------------------------
/Resource/Qtbig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Resource/Qtbig.png
--------------------------------------------------------------------------------
/Test/Qt程序打包工具V1.0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Test/Qt程序打包工具V1.0.gif
--------------------------------------------------------------------------------
/Test/Qt程序打包工具V1.0.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Test/Qt程序打包工具V1.0.mp4
--------------------------------------------------------------------------------
/Test/Qt程序打包工具V1.0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Test/Qt程序打包工具V1.0.png
--------------------------------------------------------------------------------
/Resource/Qtbig_qrcode.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Resource/Qtbig_qrcode.jpg
--------------------------------------------------------------------------------
/ChangeLogs.md:
--------------------------------------------------------------------------------
1 | ## v1.0.1版本
2 | * 修正在mingw编译器编译的程序可能打包不成功的问题。
3 |
4 | ## v1.0版本
5 | * 新增关于页面;
6 | * 完善错误处理;
7 | * 修正若干Bug。
8 |
9 | ## v0.9版本
10 | * 建立打包工具基础功能。
11 |
--------------------------------------------------------------------------------
/Test/exe_demo/Qt_5_12_2_MSVC_2017_x86_Release_Test.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Test/exe_demo/Qt_5_12_2_MSVC_2017_x86_Release_Test.exe
--------------------------------------------------------------------------------
/Test/exe_demo/Qt_5_12_2_Mingw_730_x86_Release_Test.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Test/exe_demo/Qt_5_12_2_Mingw_730_x86_Release_Test.exe
--------------------------------------------------------------------------------
/Test/exe_demo/Qt_5_12_2_MSVC_2017_x86_Release_QML_Test.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Test/exe_demo/Qt_5_12_2_MSVC_2017_x86_Release_QML_Test.exe
--------------------------------------------------------------------------------
/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | Resource/Qtbig.png
4 | Resource/Qtbig_qrcode.jpg
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Test/exe_demo/Qt_5_12_2_MSVC_2017_x86_Release_QML_Plugin_Test.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yasir-shahzad/Qt-DeployQt/HEAD/Test/exe_demo/Qt_5_12_2_MSVC_2017_x86_Release_QML_Plugin_Test.exe
--------------------------------------------------------------------------------
/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | Qml/main.qml
4 | Qml/Common/ComboBox.qml
5 | Qml/Common/RoundRectangle.qml
6 | Qml/Common/ContentBar.qml
7 | Qml/Common/MyComboBox.qml
8 | Qml/Common/MyButton.qml
9 | Qml/About/About.qml
10 | Qml/TipsDialog.qml
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ToolsModel.cpp:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | #include "ToolsModel.h"
9 | #include
10 | #include
11 |
12 | ToolsModel::ToolsModel(QObject *parent) : QObject(parent)
13 | {
14 |
15 | }
16 |
17 | void ToolsModel::openUrl(const QString &url)
18 | {
19 | QDesktopServices::openUrl(QUrl(url));
20 | }
21 |
--------------------------------------------------------------------------------
/ToolsModel.h:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | #ifndef TOOLS_H
9 | #define TOOLS_H
10 |
11 | #include
12 |
13 | class ToolsModel : public QObject
14 | {
15 | Q_OBJECT
16 | public:
17 | explicit ToolsModel(QObject *parent = nullptr);
18 |
19 | Q_INVOKABLE void openUrl(const QString &url);
20 |
21 | signals:
22 |
23 | public slots:
24 | };
25 |
26 | #endif // TOOLS_H
27 |
--------------------------------------------------------------------------------
/Qml/Common/MyButton.qml:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | import QtQuick 2.0
9 |
10 | RoundRectangle {
11 | id: root
12 | property alias text: content.text
13 | signal clicked()
14 |
15 | color: mouseArea.pressed ? "#4cbeff" : "white"
16 | radius: 8
17 | border.color: mouseArea.pressed ? "#00000000" : "#d5d5d5"
18 |
19 | Text {
20 | id: content
21 | anchors.centerIn: parent
22 | color: mouseArea.pressed ? "white" : "#333333"
23 | font.pixelSize: 17
24 | }
25 |
26 | MouseArea {
27 | id: mouseArea
28 | anchors.fill: parent
29 | onClicked: root.clicked()
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Qml/Common/ContentBar.qml:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | import QtQuick 2.0
9 |
10 | Item {
11 | id: root
12 | property alias text: content.text
13 | default property alias items: row.children
14 |
15 | Row {
16 | id: row
17 | Item {
18 | width: root.width*0.3
19 | height: root.height
20 |
21 | Text {
22 | id: content
23 | anchors.centerIn: parent
24 | font.pixelSize: 17
25 | }
26 | }
27 | }
28 |
29 | Component.onCompleted: {
30 | items[1].width = root.width*0.7 - 5
31 | items[1].height = root.height
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 |
38 | # qtcreator generated files
39 | *.pro.user*
40 |
41 | # xemacs temporary files
42 | *.flc
43 |
44 | # Vim temporary files
45 | .*.swp
46 |
47 | # Visual Studio generated files
48 | *.ib_pdb_index
49 | *.idb
50 | *.ilk
51 | *.pdb
52 | *.sln
53 | *.suo
54 | *.vcproj
55 | *vcproj.*.*.user
56 | *.ncb
57 | *.sdf
58 | *.opensdf
59 | *.vcxproj
60 | *vcxproj.*
61 |
62 | # MinGW generated files
63 | *.Debug
64 | *.Release
65 |
66 | # Python byte code
67 | *.pyc
68 |
69 | # Binaries
70 | # --------
71 | *.dll
72 | *.exe
73 |
74 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 aeagean
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Qml/TipsDialog.qml:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | import QtQuick 2.0
9 |
10 | Rectangle {
11 | id: root
12 | property alias text: content.text
13 |
14 | color: "#90000000"
15 | visible: false
16 |
17 | MouseArea { anchors.fill: parent }
18 |
19 | Rectangle {
20 | anchors.centerIn: parent
21 | width: root.width * 0.7;
22 | height: root.height * 0.4;
23 | radius: 8
24 |
25 | Text {
26 | id: content
27 | anchors.centerIn: parent
28 | font.pixelSize: 20
29 | }
30 | }
31 |
32 | Timer {
33 | id: delayTimer
34 | repeat: false
35 | onTriggered: hide()
36 | }
37 |
38 | function show(content) {
39 | root.text = content
40 | visible = true
41 | }
42 |
43 | function hide() {
44 | visible = false
45 | }
46 |
47 | function delayHide(msecond) {
48 | delayTimer.interval = msecond
49 | delayTimer.start()
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include "VersionModel.h"
14 | #include "ToolsModel.h"
15 |
16 | class Application : public QGuiApplication
17 | {
18 | public:
19 | Application(int &argc, char ** argv) : QGuiApplication(argc, argv) {}
20 |
21 | bool notify(QObject *receiver, QEvent *e) {
22 | return QGuiApplication::notify(receiver, e);
23 | }
24 | };
25 |
26 | int main(int argc, char *argv[])
27 | {
28 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
29 | Application app(argc, argv);
30 |
31 | qmlRegisterType("VersionMode", 1, 0, "VersionMode");
32 | qmlRegisterType("ToolsModel", 1, 0, "ToolsModel");
33 |
34 | QQmlApplicationEngine engine;
35 | engine.load(QUrl(QStringLiteral("qrc:/Qml/main.qml")));
36 | if (engine.rootObjects().isEmpty())
37 | return -1;
38 |
39 | return app.exec();
40 | }
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | | 下载地址 |
2 | | --- |
3 | | [打包工具运行文件](https://github.com/aeagean/DeployQt/releases/download/v1.0.1/QtDeploy-v1.0.1.rar) |
4 |
5 | # Qt程序打包工具(最新版本v1.0.1)
6 | > 由于Qt软件提供的windeployqt采用命令行操作,打包程序起来相对繁琐。而现有大多数的打包工具又不能针对Qt而打包,往往是一些库打包不成功,又或者操作繁琐。如果有一个可视化的傻瓜式的打包工具就好了。也就是这一原因,决定写这个基于Windows系统的可视化Qt打包程序,并开源其代码供大家一起学习进步。
7 |
8 | 
9 |
10 | ## 1. 适用范围
11 | * Window系统;
12 | * Qt5.0版本以上release版本编译的程序;
13 | * 暂时不支持debug版本打包,后续会添加。
14 |
15 | ## 2. 使用方法
16 | 1. 将需要打包的程序拖拽到打包工具中;
17 | 2. 选择该程序编译时的Qt版本和编译器版本;
18 | 3. 点击生成;
19 | 4. 最后测试。
20 |
21 | ## 3. 注意
22 | * 不能打包引入的第三方库,需要自己复制到程序运行目录下
23 |
24 | ## 4. 下载使用(最新版本v1.0.1)
25 | * [最新源代码下载地址](https://github.com/aeagean/DeployQt/archive/master.zip)
26 | * [最新执行文件下载地址](https://github.com/aeagean/DeployQt/releases/download/v1.0.1/QtDeploy-v1.0.1.rar)
27 |
28 | ## 5. 关于更新
29 | * 了解最新版本详见: [更新记录](https://github.com/aeagean/DeployQt/blob/master/ChangeLogs.md)
30 | * 获取版本列表: [版本列表](https://github.com/aeagean/DeployQt/releases)
31 |
32 | ## 6. 关于作者
33 | |Qt君公众号(每天更新)|Qt君|
34 | |---|---|
35 | |Qt君个人网站|[www.qtbig.com](http://www.qtbig.com)|
36 | |QQ交流群|732271126|
37 |
38 |
39 |
40 |
微信扫一扫关注公众号
41 |
42 |
--------------------------------------------------------------------------------
/DeployQt.pro:
--------------------------------------------------------------------------------
1 | #**********************************************************
2 | #Author: Qt君
3 | #微信公众号: Qt君
4 | #QQ群: 732271126
5 | #Email: 2088201923@qq.com
6 | #LICENSE: MIT
7 | #**********************************************************
8 | QT += quick qml core
9 | CONFIG += c++11
10 |
11 | # The following define makes your compiler emit warnings if you use
12 | # any Qt feature that has been marked deprecated (the exact warnings
13 | # depend on your compiler). Refer to the documentation for the
14 | # deprecated API to know how to port your code away from it.
15 | DEFINES += QT_DEPRECATED_WARNINGS
16 |
17 | # You can also make your code fail to compile if it uses deprecated APIs.
18 | # In order to do so, uncomment the following line.
19 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
20 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
21 |
22 | SOURCES += \
23 | main.cpp \
24 | VersionModel.cpp \
25 | ToolsModel.cpp
26 |
27 | RC_ICONS = app.ico
28 | RESOURCES += \
29 | Resources.qrc \
30 | Qml.qrc
31 |
32 | # Additional import path used to resolve QML modules in Qt Creator's code model
33 | QML_IMPORT_PATH =
34 |
35 | # Additional import path used to resolve QML modules just for Qt Quick Designer
36 | QML_DESIGNER_IMPORT_PATH =
37 |
38 | # Default rules for deployment.
39 | qnx: target.path = /tmp/$${TARGET}/bin
40 | else: unix:!android: target.path = /opt/$${TARGET}/bin
41 | !isEmpty(target.path): INSTALLS += target
42 |
43 | HEADERS += \
44 | VersionModel.h \
45 | ToolsModel.h
46 |
--------------------------------------------------------------------------------
/VersionModel.h:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | #ifndef VERSIONMODEL_H
9 | #define VERSIONMODEL_H
10 |
11 | #include
12 | #include
13 |
14 | class VersionModel : public QObject
15 | {
16 | Q_OBJECT
17 | Q_PROPERTY(QStringList qtVersionList READ qtVersionList NOTIFY listChanged)
18 | Q_PROPERTY(QStringList compilerVersionList READ compilerVersionList NOTIFY listChanged)
19 | Q_PROPERTY(QString qtVersion READ qtVersion WRITE setQtVersion NOTIFY statusChanged)
20 | Q_PROPERTY(QString compilerVersion READ compilerVersion WRITE setCompilerVersion NOTIFY statusChanged)
21 | Q_PROPERTY(QString exeFile READ exeFile WRITE setExeFile NOTIFY statusChanged)
22 |
23 | public:
24 | VersionModel();
25 |
26 | Q_INVOKABLE bool create();
27 | Q_INVOKABLE bool test();
28 |
29 | QStringList qtVersionList();
30 | QStringList compilerVersionList();
31 |
32 |
33 | QString qtVersion();
34 | void setQtVersion(const QString &version);
35 |
36 | QString compilerVersion();
37 | void setCompilerVersion(const QString &version);
38 |
39 | QString exeFile();
40 | void setExeFile(const QString &file);
41 |
42 | signals:
43 | void listChanged();
44 | void statusChanged();
45 |
46 | private:
47 | QStringList m_qtVersionList;
48 | QStringList m_compilerVersionList;
49 | QString m_qtVersion;
50 | QString m_qtVersionDirName;
51 | QString m_compilerVersion;
52 | QString m_exeFile;
53 | QString m_sourceEnvPath;
54 | QProcess m_testProcess;
55 | };
56 |
57 | #endif // VERSIONMODEL_H
58 |
--------------------------------------------------------------------------------
/Qml/Common/RoundRectangle.qml:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | import QtQuick 2.0
9 |
10 | Rectangle {
11 | id: root
12 | property int radiusCorners: Qt.AlignLeft | Qt.AlignRight | Qt.AlignTop | Qt.AlignBottom /* Default: */
13 | /*
14 | Qt.AlignLeft | Qt.AlignLeft | Qt.AlignRight | Qt.AlignLeft | Qt.AlignLeft |
15 | Qt.AlignRight | Qt.AlignTop | Qt.AlignTop | Qt.AlignRight | Qt.AlignRight |
16 | None:0 Qt.AlignTop | Qt.AlignBottom Qt.AlignBottom Qt.AlignTop Qt.AlignBottom
17 | Qt.AlignBottom
18 | ***************** ************* *************** *************** ************* *****************
19 | * * * * * * * * * * * *
20 | * * * * * * * * * * * *
21 | * * * * * * * * * * * *
22 | * * * * * * * * * * * *
23 | * * * * * * * * * * * *
24 | * * * * * * * * * * * *
25 | * * * * * * * * * * * *
26 | ***************** ************* *************** *************** ***************** *************
27 | */
28 |
29 | Repeater {
30 | model: [ {
31 | x: 0,
32 | y: 0,
33 | visible: internal.aligns(Qt.AlignLeft | Qt.AlignTop),
34 | radius: root.radius
35 | },
36 | {
37 | x: root.width - root.radius,
38 | y: 0,
39 | visible: internal.aligns(Qt.AlignRight | Qt.AlignTop),
40 | radius: root.radius
41 | },
42 | {
43 | x: 0,
44 | y: root.height - root.radius,
45 | visible: internal.aligns(Qt.AlignLeft | Qt.AlignBottom),
46 | radius: root.radius
47 | },
48 | {
49 | x: root.width - root.radius,
50 | y: root.height - root.radius,
51 | visible: internal.aligns(Qt.AlignRight | Qt.AlignBottom),
52 | radius: root.radius
53 | } ]
54 |
55 | Rectangle {
56 | x: modelData.x; y: modelData.y
57 | width: modelData.radius; height: width
58 | visible: !modelData.visible
59 | color: parent.color
60 | }
61 | }
62 |
63 | QtObject {
64 | id: internal
65 |
66 | function aligns(direction) {
67 | return (root.radiusCorners & direction) === direction
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Qml/Common/MyComboBox.qml:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | import QtQuick 2.0
9 |
10 | ComboBox {
11 | id: root
12 | model: ["One", "Two", "Three", "Four", "Five"]
13 |
14 | background: Item { }
15 |
16 | contentItem: RoundRectangle {
17 | width: root.width; height: root.height
18 | color: root.down ? "#4cbeff" : "white"
19 | radius: 8
20 | radiusCorners: root.down ? (Qt.AlignLeft | Qt.AlignRight | Qt.AlignTop) :
21 | (Qt.AlignLeading | Qt.AlignRight | Qt.AlignTop | Qt.AlignBottom)
22 |
23 | border.color: root.down ? "#00000000" : "#d5d5d5"
24 |
25 | Text {
26 | anchors.verticalCenter: parent.verticalCenter
27 | anchors.left: parent.left
28 | anchors.leftMargin: 20
29 | color: root.down ? "white" : "#333333"
30 | text: root.currentText
31 | font.bold: true
32 | font.pixelSize: 17
33 | }
34 | }
35 |
36 | indicator: Item {
37 | width: root.width; height: root.height
38 |
39 | Item {
40 | anchors.verticalCenter: parent.verticalCenter
41 | anchors.right: parent.right
42 | anchors.rightMargin: 20
43 | width: Math.sqrt(_triangle.width*_triangle.width*2); height: width/2
44 | clip: true
45 |
46 | Rectangle {
47 | id: _triangle
48 | anchors.horizontalCenter: parent.horizontalCenter
49 | anchors.bottom: parent.bottom
50 | anchors.bottomMargin: parent.height/4
51 | width: 12; height: width
52 | color: root.down ? "white" : "#4cbeff"
53 | rotation: 45
54 | }
55 | }
56 | }
57 |
58 | delegate: Item {
59 | width: root.width; height: root.height
60 |
61 | Text {
62 | anchors.verticalCenter: parent.verticalCenter
63 | anchors.left: parent.left
64 | anchors.leftMargin: 20
65 | color: delegateMouseArea.isEnter ? "#4cbeff" : "black"
66 | text: modelData
67 | font.bold: true
68 | font.pixelSize: 17
69 | }
70 |
71 | Rectangle {
72 | id: line
73 | anchors.horizontalCenter: parent.horizontalCenter
74 | anchors.bottom: parent.bottom
75 | width: parent.width - 40
76 | height: 1
77 | color: "#e6e8ea"
78 | visible: index !== root.count - 1
79 | }
80 |
81 | MouseArea {
82 | id: delegateMouseArea
83 | property bool isEnter: false
84 | anchors.fill: parent
85 | hoverEnabled: true
86 | onEntered: isEnter = true
87 | onExited: isEnter = false
88 | onClicked: {
89 | root.down = false
90 | root.currentIndex = index
91 | }
92 | }
93 | }
94 |
95 | popup: Rectangle {
96 | width: root.width; height: root.count < 3 ? root.count * root.height : root.height * 3
97 | border.color: "#d5d5d5"
98 | border.width: 1
99 | }
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/VersionModel.cpp:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | Author: Qt君
3 | 微信公众号: Qt君(首发)
4 | QQ群: 732271126
5 | Email: 2088201923@qq.com
6 | LICENSE: MIT
7 | **********************************************************/
8 | #include "VersionModel.h"
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | static const QString PROGRAMS_PATH = QDir::homePath() + "/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/";
15 |
16 | static QString qtEnvPath(const QString &envPath)
17 | {
18 | QString result;
19 | QFile file(envPath + "/qtenv2.bat");
20 | if (!file.open(QIODevice::ReadOnly)) {
21 | qDebug()<<"[Info] "<<"Qt Env Path: "<