├── .gitignore ├── LICENSE ├── QmlBusyIndicator ├── QmlBusyIndicator.pro ├── QmlBusyIndicator.qml ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlCalendar ├── QmlCalendar.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlCanvasText ├── QmlCanvasText.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.jpg ├── QmlCheckBox ├── QmlCheckBox.pro ├── images │ ├── checked.png │ └── unchecked.png ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlCircular ├── QmlCircular.pro ├── main.cpp ├── main.qml ├── qml.qrc ├── qt.png └── show.jpg ├── QmlCircularProgress ├── QmlCircularProgress.pro ├── QmlCircularProgress.qml ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlCircularProgressButton ├── QmlCircularProgress.qml ├── QmlCircularProgressButton.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlDragDrop ├── Face.png ├── QmlDragDrop.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlFace ├── QmlFace.pro ├── emoji │ ├── Face_(0).png │ ├── Face_(1).png │ ├── Face_(10).png │ ├── Face_(11).png │ ├── Face_(12).png │ ├── Face_(13).png │ ├── Face_(14).png │ ├── Face_(15).png │ ├── Face_(16).png │ ├── Face_(17).png │ ├── Face_(18).png │ ├── Face_(19).png │ ├── Face_(2).png │ ├── Face_(20).png │ ├── Face_(21).png │ ├── Face_(22).png │ ├── Face_(23).png │ ├── Face_(24).png │ ├── Face_(25).png │ ├── Face_(26).png │ ├── Face_(27).png │ ├── Face_(28).png │ ├── Face_(29).png │ ├── Face_(3).png │ ├── Face_(30).png │ ├── Face_(31).png │ ├── Face_(32).png │ ├── Face_(33).png │ ├── Face_(34).png │ ├── Face_(35).png │ ├── Face_(36).png │ ├── Face_(37).png │ ├── Face_(38).png │ ├── Face_(39).png │ ├── Face_(4).png │ ├── Face_(40).png │ ├── Face_(41).png │ ├── Face_(42).png │ ├── Face_(43).png │ ├── Face_(44).png │ ├── Face_(45).png │ ├── Face_(46).png │ ├── Face_(47).png │ ├── Face_(48).png │ ├── Face_(49).png │ ├── Face_(5).png │ ├── Face_(50).png │ ├── Face_(51).png │ ├── Face_(52).png │ ├── Face_(53).png │ ├── Face_(54).png │ ├── Face_(55).png │ ├── Face_(56).png │ ├── Face_(6).png │ ├── Face_(7).png │ ├── Face_(8).png │ └── Face_(9).png ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlFlipImage ├── QmlFlipImage.pro ├── images │ ├── 1.jpg │ └── 2.jpg ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlFontAwesome ├── Font │ ├── font-awesome.css │ └── fontawesome-webfont.ttf ├── QmlFontAwesome.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.jpg ├── QmlFontList ├── QmlFontList.pro ├── QmlFontList.qml ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlGrayImage ├── 1.png ├── QmlGrayImage.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.jpg ├── QmlHyperlink ├── QmlHyperlink.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlImageProvider ├── Face.png ├── QmlImageProvider.h ├── QmlImageProvider.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.jpg ├── QmlInvertedImage ├── 1.png ├── QmlInvertedImage.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.jpg ├── QmlKey ├── QmlKey.cpp ├── QmlKey.h ├── QmlKey.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlLanguage ├── QmlLanguage.cpp ├── QmlLanguage.h ├── QmlLanguage.pro ├── en_US.qm ├── en_US.ts ├── main.cpp ├── main.qml ├── qml.qrc ├── show.gif ├── zh_CN.qm └── zh_CN.ts ├── QmlListSlidDelete ├── QmlListSlidDelete.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlLoader ├── Page1.qml ├── Page2.qml ├── QmlLoader.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlLog4Qml ├── QmlLog4Qml.cpp ├── QmlLog4Qml.h ├── QmlLog4Qml.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.jpg ├── QmlPageNavigation ├── QmlPageNavigation.pro ├── QmlPageNavigation.qml ├── arrow.png ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlPlugin ├── QmlPlugin │ ├── QmlPlugin.cpp │ ├── QmlPlugin.h │ ├── QmlPlugin.pro │ ├── QmlPlugin.qml │ └── QmlPlugin.qrc └── QmlPluginTest │ ├── QmlPluginTest.cpp │ ├── QmlPluginTest.h │ ├── QmlPluginTest.pro │ ├── main.cpp │ ├── main.qml │ ├── qml.qrc │ └── show.gif ├── QmlPopMenu ├── QmlPopMenu.pro ├── images │ ├── away.png │ ├── busy.png │ ├── hide.png │ └── online.png ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlProgress ├── QmlProgress.pro ├── QmlProgress.qml ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlRotationAnimation ├── QmlRotationAnimation.pro ├── image.png ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlShowSideWindow ├── Face.png ├── QmlShowSideWindow.pro ├── QmlShowSideWindow.qml ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlSign ├── QmlSign.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlSlidingMenu ├── QmlSlidingMenu.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlStackView ├── Page1.qml ├── Page2.qml ├── Page3.qml ├── QmlStackView.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlTabBar ├── Chat_FriendManager.svg ├── Chat_FriendManagerG.svg ├── Chat_MsgRecord.svg ├── Chat_MsgRecordG.svg ├── Main_P2PChat.svg ├── Main_P2PChatG.svg ├── Mobile_Find.svg ├── Mobile_FindG.svg ├── QmlTabBar.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlTableView ├── Face.png ├── QmlTableView.cpp ├── QmlTableView.h ├── QmlTableView.pro ├── QmlTableView.qml ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlTextEditDrop ├── QmlTextEditDrop.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlTextEditScrollBar ├── QmlTextEditScrollBar.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlToggleButton ├── QmlToggleButton.pro ├── QmlToggleButton.qml ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlUpDownRefresh ├── QmlBusyIndicator.qml ├── QmlUpDownRefresh.pro ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QmlWinExtras ├── Chat_FriendManagerG.svg ├── Chat_MsgRecordG.svg ├── Main_P2PChatG.svg ├── Mobile_FindG.svg ├── QmlWinExtras.pro ├── QmlWinExtras.qrc ├── QmlWinExtras.rc ├── logo.ico ├── main.cpp ├── main.qml ├── qml.qrc └── show.gif ├── QtQuickExamples.jpg ├── QtQuickExamples.pro └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | *.user 4 | 5 | # Compiled Object files 6 | *.slo 7 | *.lo 8 | *.o 9 | *.obj 10 | 11 | # Precompiled Headers 12 | *.gch 13 | *.pch 14 | 15 | # Compiled Dynamic libraries 16 | 17 | # Fortran module files 18 | *.mod 19 | *.smod 20 | 21 | # Compiled Static libraries 22 | *.lai 23 | *.la 24 | *.a 25 | 26 | # Executables 27 | *.exe 28 | *.out 29 | *.app 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 zhengtianzuo 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 | -------------------------------------------------------------------------------- /QmlBusyIndicator/QmlBusyIndicator.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlBusyIndicator/QmlBusyIndicator.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlBusyIndicator.qml 3 | *@brief Qml自定义等待指示器 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtGraphicalEffects 1.0 10 | 11 | Item { 12 | 13 | Rectangle { 14 | id: rect 15 | width: parent.width 16 | height: parent.height 17 | color: Qt.rgba(0, 0, 0, 0) 18 | radius: width / 2 19 | border.width: width / 6 20 | visible: false 21 | } 22 | 23 | ConicalGradient { 24 | width: rect.width 25 | height: rect.height 26 | gradient: Gradient { 27 | GradientStop { position: 0.0; color: "#80c342" } 28 | GradientStop { position: 1.0; color: "#006325" } 29 | } 30 | source: rect 31 | 32 | Rectangle { 33 | anchors.top: parent.top 34 | anchors.horizontalCenter: parent.horizontalCenter 35 | width: rect.border.width 36 | height: width 37 | radius: width / 2 38 | color: "#006325" 39 | } 40 | 41 | RotationAnimation on rotation { 42 | from: 0 43 | to: 360 44 | duration: 800 45 | loops: Animation.Infinite 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /QmlBusyIndicator/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlBusyIndicator/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("Qml自定义等待指示器") 17 | 18 | BusyIndicator { 19 | id: busyIndicator 20 | anchors.centerIn: parent 21 | implicitWidth: 96 22 | implicitHeight: 96 23 | opacity: running ? 0.0 : 1.0 24 | contentItem: QmlBusyIndicator{} 25 | } 26 | 27 | MouseArea{ 28 | anchors.fill: parent 29 | onClicked: busyIndicator.running = !busyIndicator.running 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /QmlBusyIndicator/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlBusyIndicator.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlBusyIndicator/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlBusyIndicator/show.gif -------------------------------------------------------------------------------- /QmlCalendar/QmlCalendar.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlCalendar/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlCalendar/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 1.4 10 | import QtQuick.Controls.Styles 1.4 11 | import QtQuick.Layouts 1.3 12 | 13 | ApplicationWindow { 14 | visible: true 15 | width: 400 16 | height: 300 17 | title: qsTr("Qml日历") 18 | 19 | function dayValid(date){ 20 | var myArray = new Array(); 21 | myArray[0]="13"; 22 | myArray[1]="17"; 23 | myArray[2]="26"; 24 | 25 | for(var i = 0; i < myArray.length;i++) 26 | { 27 | if (myArray[i] === date) 28 | { 29 | return(false); 30 | } 31 | } 32 | return(true); 33 | } 34 | 35 | Calendar { 36 | anchors.centerIn: parent 37 | 38 | style: CalendarStyle { 39 | gridVisible: false 40 | dayDelegate: Rectangle { 41 | property bool dayIsValid: dayValid(styleData.date.getDate().toString()) 42 | 43 | gradient: Gradient { 44 | GradientStop { 45 | position: 0.00 46 | color: styleData.selected && dayIsValid ? "#148014" : (styleData.visibleMonth && styleData.valid ? (dayIsValid ? "#CCCCCC" : "#FFFFFF") : "#FFFFFF"); 47 | } 48 | } 49 | 50 | Label { 51 | text: styleData.date.getDate() 52 | anchors.centerIn: parent 53 | } 54 | 55 | Rectangle { 56 | width: parent.width 57 | height: 1 58 | color: "#EEEEEE" 59 | anchors.bottom: parent.bottom 60 | } 61 | 62 | Rectangle { 63 | width: 1 64 | height: parent.height 65 | color: "#EEEEEE" 66 | anchors.right: parent.right 67 | } 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /QmlCalendar/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlCalendar/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCalendar/show.gif -------------------------------------------------------------------------------- /QmlCanvasText/QmlCanvasText.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlCanvasText/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlCanvasText/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("QmlCanvas文字") 17 | 18 | Canvas{ 19 | id: canvas 20 | width: 300 21 | height: 100 22 | onPaint: { 23 | var ctx = getContext("2d"); 24 | ctx.fillStyle = "red"; 25 | ctx.font = fontMetrics.getFontToContext2D(); 26 | 27 | ctx.beginPath(); 28 | ctx.text(qsTr("Canvas 这是一段文字"), 20, 40); 29 | ctx.fill(); 30 | } 31 | } 32 | 33 | Text{ 34 | id: text 35 | anchors.left: parent.left 36 | anchors.leftMargin: 20 37 | anchors.top: parent.top 38 | anchors.topMargin: 60 39 | font: fontMetrics.font 40 | color: "red" 41 | text: qsTr("Text 这是一段文字") 42 | } 43 | 44 | FontMetrics { 45 | id: fontMetrics 46 | font.family: "Arial" 47 | font.pixelSize: 16 48 | font.italic: false 49 | font.bold: false 50 | 51 | function getFontToContext2D() { 52 | var cssFontString = ""; 53 | if(fontMetrics.font.italic) { 54 | cssFontString += "italic "; 55 | } else { 56 | cssFontString += "normal "; 57 | } 58 | 59 | if(fontMetrics.font.bold) { 60 | cssFontString += "bold "; 61 | } else { 62 | cssFontString += "normal "; 63 | } 64 | 65 | cssFontString += (fontMetrics.font.pixelSize+"px "); 66 | cssFontString += fontMetrics.font.family; 67 | return cssFontString; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /QmlCanvasText/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlCanvasText/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCanvasText/show.jpg -------------------------------------------------------------------------------- /QmlCheckBox/QmlCheckBox.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlCheckBox/images/checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCheckBox/images/checked.png -------------------------------------------------------------------------------- /QmlCheckBox/images/unchecked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCheckBox/images/unchecked.png -------------------------------------------------------------------------------- /QmlCheckBox/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlCheckBox/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Qml自定义复选框") 16 | 17 | CheckBox { 18 | id: checkBox 19 | text: qsTr("复选框") 20 | checked: true 21 | anchors.centerIn: parent 22 | spacing: 0 23 | enabled: true 24 | 25 | indicator: 26 | Image { 27 | id: image 28 | height: 16 29 | width: 16 30 | anchors.verticalCenter: parent.verticalCenter 31 | source: checkBox.checked ? "qrc:/images/checked.png" : "qrc:/images/unchecked.png" 32 | } 33 | 34 | contentItem: Text { 35 | id: text 36 | text: checkBox.text 37 | font: checkBox.font 38 | opacity: enabled ? 1.0 : 0.3 39 | color: checkBox.down ? "#AA0000" : "#148014" 40 | horizontalAlignment: Text.AlignHCenter 41 | verticalAlignment: Text.AlignVCenter 42 | leftPadding: checkBox.indicator.width + checkBox.spacing 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /QmlCheckBox/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | images/checked.png 5 | images/unchecked.png 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlCheckBox/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCheckBox/show.gif -------------------------------------------------------------------------------- /QmlCircular/QmlCircular.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlCircular/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlCircular/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtGraphicalEffects 1.0 11 | 12 | ApplicationWindow { 13 | id:mainWidnow 14 | title: qsTr("Qml圆形图片") 15 | width: 400 16 | height: 300 17 | visible: true 18 | 19 | Item { 20 | width: 96 21 | height: 96 22 | anchors.centerIn: parent 23 | Image { 24 | id: sourceimage 25 | source: "qrc:/qt.png" 26 | sourceSize: Qt.size(parent.width, parent.height) 27 | smooth: true 28 | visible: false 29 | } 30 | 31 | Rectangle { 32 | id: mask 33 | width: parent.width 34 | height: parent.height 35 | radius: height/2 36 | color:"red" 37 | visible: false 38 | 39 | } 40 | 41 | OpacityMask { 42 | anchors.fill: sourceimage 43 | source: sourceimage 44 | maskSource: mask 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /QmlCircular/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | qt.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlCircular/qt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCircular/qt.png -------------------------------------------------------------------------------- /QmlCircular/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCircular/show.jpg -------------------------------------------------------------------------------- /QmlCircularProgress/QmlCircularProgress.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlCircularProgress/QmlCircularProgress.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlCircularProgress.qml 3 | *@brief Qml圆形进度条 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.4 9 | 10 | Canvas { 11 | property color arcColor: "#148014" 12 | property color arcBackgroundColor: "#AAAAAA" 13 | property int arcWidth: 2 14 | property real progress: 0 15 | property real radius: 100 16 | property bool anticlockwise: false 17 | property alias interval: timer.interval 18 | 19 | id: canvas 20 | width: 2*radius + arcWidth 21 | height: 2*radius + arcWidth 22 | 23 | Text{ 24 | anchors.centerIn: parent 25 | font.pointSize: 15 26 | text: Math.floor((parent.progress / 360) * 100 )+ "%" 27 | } 28 | 29 | Timer{ 30 | id: timer 31 | running: false 32 | repeat: true 33 | interval: 5 34 | onTriggered:{ 35 | parent.progress++; 36 | if (parent.progress > 360){ 37 | onStop(); 38 | return; 39 | } 40 | parent.requestPaint(); 41 | } 42 | } 43 | 44 | function isRunning(){ 45 | return(timer.running) 46 | } 47 | 48 | function onStart(){ 49 | progress = 0; 50 | var ctx = getContext("2d"); 51 | ctx.clearRect(0,0,width,height); 52 | timer.running = true; 53 | } 54 | 55 | function onStop(){ 56 | timer.running = false; 57 | } 58 | 59 | onPaint: { 60 | var ctx = getContext("2d") 61 | ctx.clearRect(0,0,width,height) 62 | ctx.beginPath() 63 | ctx.strokeStyle = arcBackgroundColor 64 | ctx.lineWidth = arcWidth 65 | ctx.arc(width/2,height/2,radius,0,Math.PI*2,anticlockwise) 66 | ctx.stroke() 67 | 68 | var r = progress*Math.PI/180 69 | ctx.beginPath() 70 | ctx.strokeStyle = arcColor 71 | ctx.lineWidth = arcWidth 72 | 73 | ctx.arc(width/2,height/2,radius,0-90*Math.PI/180,r-90*Math.PI/180,anticlockwise) 74 | ctx.stroke() 75 | } 76 | } 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /QmlCircularProgress/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | if (engine.rootObjects().isEmpty()) 19 | return -1; 20 | 21 | return app.exec(); 22 | } 23 | -------------------------------------------------------------------------------- /QmlCircularProgress/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.3 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("Qml圆形进度条") 17 | 18 | QmlCircularProgress{ 19 | id: cProgress 20 | anchors.centerIn: parent 21 | arcWidth: 3 22 | radius: 100 23 | interval: 1 24 | arcColor: "#148014" 25 | } 26 | 27 | Button{ 28 | id: btnStart 29 | anchors.horizontalCenter: cProgress.horizontalCenter 30 | anchors.top: cProgress.bottom 31 | anchors.topMargin: 6 32 | text: cProgress.isRunning() ? qsTr("结束") : qsTr("开始") 33 | onClicked: { 34 | if (cProgress.isRunning()){ 35 | cProgress.onStop(); 36 | }else{ 37 | cProgress.onStart(); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /QmlCircularProgress/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlCircularProgress.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlCircularProgress/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCircularProgress/show.gif -------------------------------------------------------------------------------- /QmlCircularProgressButton/QmlCircularProgress.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlCircularProgress.qml 3 | *@brief Qml圆形进度条 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.4 9 | 10 | Canvas { 11 | property color arcColor: "#148014" 12 | property color arcBackgroundColor: "#EEEEEE" 13 | property int arcWidth: 2 14 | property real progress: 0 15 | property real radius: 100 16 | property bool anticlockwise: false 17 | property alias interval: timer.interval 18 | 19 | signal sStart() 20 | signal sStop() 21 | 22 | id: canvas 23 | width: 2*radius + arcWidth 24 | height: 2*radius + arcWidth 25 | 26 | Text{ 27 | anchors.centerIn: parent 28 | font.pointSize: 15 29 | text: Math.floor((parent.progress / 360) * 100 )+ "%" 30 | } 31 | 32 | Timer{ 33 | id: timer 34 | running: false 35 | repeat: true 36 | interval: 5 37 | onTriggered:{ 38 | parent.progress++; 39 | if (parent.progress > 360){ 40 | onStop(); 41 | return; 42 | } 43 | parent.requestPaint(); 44 | } 45 | } 46 | 47 | function isRunning(){ 48 | return(timer.running) 49 | } 50 | 51 | function onStart(){ 52 | progress = 0; 53 | var ctx = getContext("2d"); 54 | ctx.clearRect(0,0,width,height); 55 | timer.running = true; 56 | emit: sStart() 57 | } 58 | 59 | function onStop(){ 60 | timer.running = false; 61 | emit: sStop() 62 | } 63 | 64 | onPaint: { 65 | var ctx = getContext("2d") 66 | ctx.clearRect(0,0,width,height) 67 | ctx.beginPath() 68 | ctx.strokeStyle = arcBackgroundColor 69 | ctx.lineWidth = arcWidth 70 | ctx.arc(width/2,height/2,radius,0,Math.PI*2,anticlockwise) 71 | ctx.stroke() 72 | 73 | var r = progress*Math.PI/180 74 | ctx.beginPath() 75 | ctx.strokeStyle = arcColor 76 | ctx.lineWidth = arcWidth 77 | 78 | ctx.arc(width/2,height/2,radius,0-90*Math.PI/180,r-90*Math.PI/180,anticlockwise) 79 | ctx.stroke() 80 | } 81 | } 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /QmlCircularProgressButton/QmlCircularProgressButton.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlCircularProgressButton/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlCircularProgressButton/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Qml圆形进度按钮") 16 | 17 | Rectangle{ 18 | property int btnHeight: 48 19 | property int btnWidth: 120 20 | 21 | id: cProBtn 22 | height: btnHeight 23 | width: btnWidth 24 | anchors.centerIn: parent 25 | border.color: "#148014" 26 | border.width: 2 27 | radius: 0 28 | Text{ 29 | id: cText 30 | anchors.centerIn: parent 31 | font.family: "microsoft yahei" 32 | font.pixelSize: 14 33 | text: qsTr("开始") 34 | } 35 | MouseArea{ 36 | anchors.fill: parent 37 | onClicked: { 38 | if (rAniStart.running || rAniStop.running) return 39 | cText.visible = false; 40 | rAniStart.start(); 41 | widthAniStart.start(); 42 | } 43 | } 44 | PropertyAnimation{ 45 | id: rAniStart 46 | target: cProBtn 47 | property: "radius" 48 | duration: 300 49 | from: 0 50 | to: cProBtn.btnHeight/2 51 | onStopped: { 52 | cProgress.onStart(); 53 | cProgress.visible = true; 54 | } 55 | } 56 | PropertyAnimation{ 57 | id: widthAniStart 58 | target: cProBtn 59 | property: "width" 60 | duration: 300 61 | from: cProBtn.btnWidth 62 | to: cProBtn.btnHeight 63 | } 64 | QmlCircularProgress{ 65 | id: cProgress 66 | anchors.centerIn: parent 67 | visible: false 68 | arcWidth: 2 69 | radius: cProBtn.btnHeight/2 70 | interval: 2 71 | arcColor: "#148014" 72 | onSStop: { 73 | visible = false; 74 | rAniStop.start(); 75 | widthAniStop.start(); 76 | } 77 | } 78 | PropertyAnimation{ 79 | id: rAniStop 80 | target: cProBtn 81 | property: "radius" 82 | duration: 300 83 | from: cProBtn.btnHeight/2 84 | to: 0 85 | onStopped: { 86 | cText.text = qsTr("完成"); 87 | cText.visible = true; 88 | } 89 | } 90 | PropertyAnimation{ 91 | id: widthAniStop 92 | target: cProBtn 93 | property: "width" 94 | duration: 300 95 | from: cProBtn.btnHeight 96 | to: cProBtn.btnWidth 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /QmlCircularProgressButton/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlCircularProgress.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlCircularProgressButton/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlCircularProgressButton/show.gif -------------------------------------------------------------------------------- /QmlDragDrop/Face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlDragDrop/Face.png -------------------------------------------------------------------------------- /QmlDragDrop/QmlDragDrop.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlDragDrop/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlDragDrop/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("Qml拖放") 17 | 18 | Text{ 19 | id: sourceLabel 20 | anchors.left: parent.left 21 | anchors.leftMargin: 120 22 | anchors.verticalCenter: parent.verticalCenter 23 | text: qsTr("这是一段文字") 24 | 25 | Drag.active: dragArea.drag.active; 26 | Drag.supportedActions: Qt.CopyAction; 27 | Drag.dragType: Drag.Automatic; 28 | Drag.mimeData: {"text": text}; 29 | 30 | MouseArea { 31 | id: dragArea; 32 | anchors.fill: parent; 33 | drag.target: parent; 34 | } 35 | } 36 | 37 | Rectangle{ 38 | anchors.left: sourceLabel.left 39 | anchors.top: sourceLabel.bottom 40 | anchors.topMargin: 20 41 | border.color: "#AAAAAA" 42 | border.width: 1 43 | height: 25 44 | width: 100 45 | 46 | TextEdit{ 47 | id: targetEdit 48 | height: parent.height-2 49 | width: parent.width-2 50 | anchors.centerIn: parent 51 | text: qsTr("") 52 | 53 | DropArea { 54 | id: dropContainer 55 | anchors.fill: parent; 56 | onDropped: { 57 | if (drop.supportedActions == Qt.CopyAction){ 58 | targetEdit.text = drop.getDataAsString("text") 59 | } 60 | } 61 | } 62 | } 63 | } 64 | 65 | Image{ 66 | id: sourceImage 67 | height: 36 68 | width: 36 69 | anchors.right: parent.right 70 | anchors.rightMargin: 120 71 | anchors.verticalCenter: parent.verticalCenter 72 | source: "qrc:/Face.png" 73 | 74 | Drag.active: dragArea1.drag.active; 75 | Drag.supportedActions: Qt.CopyAction; 76 | Drag.dragType: Drag.Automatic; 77 | Drag.mimeData: {"pic": source}; 78 | 79 | MouseArea { 80 | id: dragArea1; 81 | anchors.fill: parent; 82 | drag.target: parent; 83 | } 84 | } 85 | 86 | Rectangle{ 87 | anchors.left: sourceImage.left 88 | anchors.top: sourceLabel.bottom 89 | anchors.topMargin: 20 90 | border.color: "#AAAAAA" 91 | border.width: 1 92 | height: 36 93 | width: 36 94 | 95 | Image{ 96 | id: targetImage 97 | height: parent.height-2 98 | width: parent.width-2 99 | anchors.centerIn: parent 100 | 101 | DropArea { 102 | id: dropContainer1 103 | anchors.fill: parent; 104 | onDropped: { 105 | if (drop.supportedActions == Qt.CopyAction){ 106 | targetImage.source = drop.getDataAsString("pic") 107 | } 108 | } 109 | } 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /QmlDragDrop/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Face.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlDragDrop/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlDragDrop/show.gif -------------------------------------------------------------------------------- /QmlFace/QmlFace.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(0).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(0).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(1).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(10).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(10).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(11).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(11).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(12).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(12).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(13).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(13).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(14).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(14).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(15).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(15).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(16).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(16).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(17).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(17).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(18).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(18).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(19).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(19).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(2).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(20).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(20).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(21).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(21).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(22).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(22).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(23).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(23).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(24).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(24).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(25).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(25).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(26).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(26).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(27).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(27).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(28).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(28).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(29).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(29).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(3).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(3).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(30).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(30).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(31).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(31).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(32).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(32).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(33).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(33).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(34).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(34).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(35).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(35).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(36).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(36).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(37).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(37).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(38).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(38).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(39).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(39).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(4).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(4).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(40).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(40).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(41).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(41).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(42).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(42).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(43).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(43).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(44).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(44).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(45).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(45).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(46).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(46).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(47).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(47).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(48).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(48).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(49).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(49).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(5).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(5).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(50).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(50).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(51).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(51).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(52).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(52).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(53).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(53).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(54).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(54).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(55).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(55).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(56).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(56).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(6).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(6).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(7).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(7).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(8).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(8).png -------------------------------------------------------------------------------- /QmlFace/emoji/Face_(9).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/emoji/Face_(9).png -------------------------------------------------------------------------------- /QmlFace/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlFace/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | emoji/Face_(0).png 5 | emoji/Face_(1).png 6 | emoji/Face_(2).png 7 | emoji/Face_(3).png 8 | emoji/Face_(4).png 9 | emoji/Face_(5).png 10 | emoji/Face_(6).png 11 | emoji/Face_(7).png 12 | emoji/Face_(8).png 13 | emoji/Face_(9).png 14 | emoji/Face_(10).png 15 | emoji/Face_(11).png 16 | emoji/Face_(12).png 17 | emoji/Face_(13).png 18 | emoji/Face_(14).png 19 | emoji/Face_(15).png 20 | emoji/Face_(16).png 21 | emoji/Face_(17).png 22 | emoji/Face_(18).png 23 | emoji/Face_(19).png 24 | emoji/Face_(20).png 25 | emoji/Face_(21).png 26 | emoji/Face_(22).png 27 | emoji/Face_(23).png 28 | emoji/Face_(24).png 29 | emoji/Face_(25).png 30 | emoji/Face_(26).png 31 | emoji/Face_(27).png 32 | emoji/Face_(28).png 33 | emoji/Face_(29).png 34 | emoji/Face_(30).png 35 | emoji/Face_(31).png 36 | emoji/Face_(32).png 37 | emoji/Face_(33).png 38 | emoji/Face_(34).png 39 | emoji/Face_(35).png 40 | emoji/Face_(36).png 41 | emoji/Face_(37).png 42 | emoji/Face_(38).png 43 | emoji/Face_(39).png 44 | emoji/Face_(40).png 45 | emoji/Face_(41).png 46 | emoji/Face_(42).png 47 | emoji/Face_(43).png 48 | emoji/Face_(44).png 49 | emoji/Face_(45).png 50 | emoji/Face_(46).png 51 | emoji/Face_(47).png 52 | emoji/Face_(48).png 53 | emoji/Face_(49).png 54 | emoji/Face_(50).png 55 | emoji/Face_(51).png 56 | emoji/Face_(52).png 57 | emoji/Face_(53).png 58 | emoji/Face_(54).png 59 | emoji/Face_(55).png 60 | emoji/Face_(56).png 61 | 62 | 63 | -------------------------------------------------------------------------------- /QmlFace/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFace/show.gif -------------------------------------------------------------------------------- /QmlFlipImage/QmlFlipImage.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlFlipImage/images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFlipImage/images/1.jpg -------------------------------------------------------------------------------- /QmlFlipImage/images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFlipImage/images/2.jpg -------------------------------------------------------------------------------- /QmlFlipImage/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | if (engine.rootObjects().isEmpty()) 19 | return -1; 20 | 21 | return app.exec(); 22 | } 23 | -------------------------------------------------------------------------------- /QmlFlipImage/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | id: root 13 | visible: true 14 | width: 400 15 | height: 400 16 | title: qsTr("Qml翻转效果") 17 | 18 | Flipable{ 19 | id: flip 20 | width: 300 21 | height: 300 22 | anchors.centerIn: parent 23 | 24 | property bool flipped: false 25 | 26 | front:Image{ 27 | anchors.fill: parent 28 | source: "qrc:/images/1.jpg" 29 | } 30 | 31 | back:Image{ 32 | anchors.fill: parent 33 | source: "qrc:/images/2.jpg" 34 | } 35 | 36 | transform: Rotation{ 37 | id: rotation 38 | origin.x: flip.width / 2 39 | origin.y: flip.height / 2 40 | axis.x: rx.checked 41 | axis.y: ry.checked 42 | axis.z: rz.checked 43 | angle: 0 44 | } 45 | 46 | states:State{ 47 | PropertyChanges { 48 | target: rotation 49 | angle:180 50 | } 51 | when:flip.flipped 52 | } 53 | 54 | transitions: Transition{ 55 | NumberAnimation{ 56 | target:rotation 57 | properties: "angle" 58 | duration:1000 59 | } 60 | } 61 | } 62 | 63 | Row{ 64 | anchors.horizontalCenter: parent.horizontalCenter 65 | anchors.bottom: parent.bottom 66 | anchors.bottomMargin: 6 67 | 68 | RadioButton{ 69 | id: rx 70 | height: 24 71 | text: qsTr("X轴") 72 | checked: true 73 | } 74 | 75 | RadioButton{ 76 | id: ry 77 | height: 24 78 | text: qsTr("Y轴") 79 | } 80 | 81 | RadioButton{ 82 | id: rz 83 | height: 24 84 | text: qsTr("Z轴") 85 | } 86 | Button{ 87 | height: 24 88 | text: qsTr("翻转") 89 | onClicked: flip.flipped = !flip.flipped 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /QmlFlipImage/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | images/1.jpg 5 | images/2.jpg 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlFlipImage/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFlipImage/show.gif -------------------------------------------------------------------------------- /QmlFontAwesome/Font/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFontAwesome/Font/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /QmlFontAwesome/QmlFontAwesome.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlFontAwesome/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 16 | QGuiApplication app(argc, argv); 17 | 18 | // 添加字体文件 19 | int fontId = QFontDatabase::addApplicationFont(":/Font/fontawesome-webfont.ttf"); 20 | QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId); 21 | qDebug() << "fontFamilies.size() " << fontFamilies.size(); 22 | 23 | QQmlApplicationEngine engine; 24 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 25 | 26 | return app.exec(); 27 | } 28 | -------------------------------------------------------------------------------- /QmlFontAwesome/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Qml使用FontAwesome") 16 | 17 | Row{ 18 | anchors.centerIn: parent 19 | spacing: 20 20 | 21 | Text{ 22 | color: Qt.rgba(0, 160, 230, 1.0) 23 | font.family: "FontAwesome" 24 | font.pixelSize: 20 25 | text: "\uf00e" 26 | } 27 | Text{ 28 | color: "green" 29 | font.family: "FontAwesome" 30 | font.pixelSize: 30 31 | text: "\uf004" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /QmlFontAwesome/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Font/fontawesome-webfont.ttf 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlFontAwesome/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFontAwesome/show.jpg -------------------------------------------------------------------------------- /QmlFontList/QmlFontList.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlFontList/QmlFontList.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlFontList.qml 3 | *@brief Qml获取字体列表 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Window 2.0 11 | 12 | Window{ 13 | id: fontList 14 | visible: false 15 | flags: Qt.Window | Qt.FramelessWindowHint 16 | 17 | signal sClick(string sFontName); 18 | 19 | ListView{ 20 | id: comb 21 | anchors.fill: parent 22 | model: Qt.fontFamilies() 23 | delegate: Item { 24 | height: 32 25 | width: parent.width 26 | 27 | Rectangle{ 28 | id: fontSelect 29 | height: 24 30 | width: parent.width 31 | 32 | Text { 33 | id: txtShow 34 | anchors.left: parent.left 35 | anchors.leftMargin: 6 36 | verticalAlignment: Text.AlignVCenter 37 | text: qsTr("Select Font 选择字体") 38 | font.family: modelData 39 | font.pixelSize: 14 40 | } 41 | 42 | Text { 43 | id: txtFont 44 | anchors.left: txtShow.right 45 | anchors.leftMargin: 6 46 | anchors.verticalCenter: txtShow.verticalCenter 47 | verticalAlignment: Text.AlignVCenter 48 | text: modelData 49 | font.pixelSize: 14 50 | } 51 | } 52 | 53 | Rectangle { 54 | height: 2 55 | width: parent.width 56 | anchors.top: fontSelect.bottom 57 | color: "#148014" 58 | } 59 | 60 | MouseArea{ 61 | anchors.fill: parent 62 | onClicked: { 63 | emit: sClick(modelData); 64 | fontList.visible = false; 65 | } 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /QmlFontList/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlFontList/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Window 2.0 11 | 12 | ApplicationWindow { 13 | id: root 14 | visible: true 15 | width: 600 16 | height: 600 17 | title: qsTr("Qml获取字体列表") 18 | 19 | property string fontName: "Microsoft Yahei" 20 | 21 | QmlFontList{ 22 | id: fontList 23 | height: 400 24 | width: 400 25 | visible: false 26 | onSClick: { 27 | fontName = sFontName; 28 | } 29 | } 30 | 31 | Rectangle{ 32 | id: fontSelect 33 | height: 24 34 | width: txtShow.width + txtShow.anchors.leftMargin + txtFont.width + txtFont.anchors.leftMargin + 2 35 | anchors.bottom: parent.bottom 36 | anchors.bottomMargin: 50 37 | anchors.horizontalCenter: parent.horizontalCenter 38 | border.color: "#AAAAAA" 39 | border.width: 1 40 | 41 | Text { 42 | id: txtShow 43 | anchors.left: parent.left 44 | anchors.leftMargin: 6 45 | anchors.verticalCenter: parent.verticalCenter 46 | verticalAlignment: Text.AlignVCenter 47 | text: qsTr("Select Font 选择字体") 48 | font.family: fontName 49 | font.pixelSize: 14 50 | } 51 | 52 | Text { 53 | id: txtFont 54 | anchors.left: txtShow.right 55 | anchors.leftMargin: 6 56 | anchors.verticalCenter: parent.verticalCenter 57 | verticalAlignment: Text.AlignVCenter 58 | text: fontName 59 | font.pixelSize: 14 60 | } 61 | 62 | MouseArea{ 63 | anchors.fill: parent 64 | onClicked: { 65 | fontList.visible = !fontList.visible; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /QmlFontList/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlFontList.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlFontList/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlFontList/show.gif -------------------------------------------------------------------------------- /QmlGrayImage/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlGrayImage/1.png -------------------------------------------------------------------------------- /QmlGrayImage/QmlGrayImage.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlGrayImage/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlGrayImage/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtGraphicalEffects 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("Qml图片转灰度") 17 | 18 | Row{ 19 | anchors.centerIn: parent 20 | 21 | Image { 22 | id: source 23 | source: "qrc:/1.png" 24 | smooth: true 25 | } 26 | 27 | Image { 28 | id: target 29 | source: "qrc:/1.png" 30 | smooth: true 31 | Desaturate { 32 | anchors.fill: parent 33 | source: parent 34 | desaturation: 1.0 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /QmlGrayImage/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 1.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlGrayImage/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlGrayImage/show.jpg -------------------------------------------------------------------------------- /QmlHyperlink/QmlHyperlink.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlHyperlink/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlHyperlink/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 400 16 | title: qsTr("Qml超链接") 17 | 18 | Rectangle { 19 | width: 200 20 | height: 200 21 | anchors.centerIn: parent 22 | color: "lightblue" 23 | 24 | Text { 25 | anchors.centerIn: parent 26 | text: '点击' 27 | MouseArea { 28 | anchors.fill: parent; 29 | hoverEnabled: true; 30 | cursorShape: 31 | (containsMouse? Qt.PointingHandCursor: Qt.ArrowCursor); 32 | onClicked: Qt.openUrlExternally("http://www.baidu.com") 33 | } 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /QmlHyperlink/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlHyperlink/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlHyperlink/show.gif -------------------------------------------------------------------------------- /QmlImageProvider/Face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlImageProvider/Face.png -------------------------------------------------------------------------------- /QmlImageProvider/QmlImageProvider.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlImageProvider.h 3 | *@brief QmlImageProvider 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #pragma once 9 | #include 10 | #include 11 | 12 | class ImageProvider : public QQuickImageProvider 13 | { 14 | public: 15 | ImageProvider::ImageProvider(ImageType type, Flags flags = Flags()) : 16 | QQuickImageProvider(type, flags) 17 | { 18 | } 19 | ~ImageProvider(){} 20 | QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) 21 | { 22 | QString strFileName = QCoreApplication::applicationDirPath() + "/" + id; 23 | qDebug() << strFileName; 24 | QPixmap pixmap(strFileName); 25 | return pixmap; 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /QmlImageProvider/QmlImageProvider.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlImageProvider/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include "QmlImageProvider.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 16 | QGuiApplication app(argc, argv); 17 | QQmlApplicationEngine engine; 18 | engine.addImageProvider(QLatin1String("imageProvider"), new ImageProvider(QQmlImageProviderBase::Pixmap)); 19 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 20 | return app.exec(); 21 | } 22 | -------------------------------------------------------------------------------- /QmlImageProvider/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("ImageProvider") 17 | 18 | Image { 19 | anchors.centerIn: parent 20 | source: "image://imageProvider/Face.png" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QmlImageProvider/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlImageProvider/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlImageProvider/show.jpg -------------------------------------------------------------------------------- /QmlInvertedImage/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlInvertedImage/1.png -------------------------------------------------------------------------------- /QmlInvertedImage/QmlInvertedImage.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlInvertedImage/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlInvertedImage/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtGraphicalEffects 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 320 16 | title: qsTr("Qml倒影") 17 | color: "#AAAAAA" 18 | 19 | Image { 20 | id: img 21 | width: 128 22 | height: 128 23 | anchors.top: parent.top 24 | anchors.topMargin: 16 25 | anchors.horizontalCenter: parent.horizontalCenter 26 | source: "qrc:/1.png" 27 | 28 | ShaderEffect { 29 | height: parent.height 30 | width: parent.width 31 | anchors.top: parent.bottom 32 | anchors.left: parent.left 33 | 34 | property variant source: img 35 | property size sourceSize: Qt.size(0.5 / img.width, 0.5 / img.height) 36 | 37 | fragmentShader: " 38 | varying highp vec2 qt_TexCoord0; 39 | uniform lowp sampler2D source; 40 | uniform lowp vec2 sourceSize; 41 | uniform lowp float qt_Opacity; 42 | void main() { 43 | lowp vec2 tc = qt_TexCoord0 * vec2(1, -1) + vec2(0, 1); 44 | lowp vec4 col = 0.25 * (texture2D(source, tc + sourceSize) 45 | + texture2D(source, tc- sourceSize) 46 | + texture2D(source, tc + sourceSize * vec2(1, -1)) 47 | + texture2D(source, tc + sourceSize * vec2(-1, 1)) 48 | ); 49 | gl_FragColor = col * qt_Opacity * (1.0 - qt_TexCoord0.y) * 0.5; 50 | }" 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /QmlInvertedImage/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 1.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlInvertedImage/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlInvertedImage/show.jpg -------------------------------------------------------------------------------- /QmlKey/QmlKey.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlKey.cpp 3 | *@brief Qml全局按键 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include "QmlKey.h" 9 | 10 | QmlKey::QmlKey() 11 | { 12 | 13 | } 14 | 15 | bool QmlKey::eventFilter(QObject *watched, QEvent *event) 16 | { 17 | if (event->type() == QEvent::KeyPress) 18 | { 19 | QKeyEvent *keyEvent = static_cast(event); 20 | if (keyEvent->key() == Qt::Key_Backspace) 21 | { 22 | emit sKeyBackPress(); 23 | return(true); 24 | } 25 | } 26 | if (event->type() == QEvent::KeyRelease) 27 | { 28 | QKeyEvent *keyEvent = static_cast(event); 29 | if (keyEvent->key() == Qt::Key_Backspace) 30 | { 31 | emit sKeyBackRelease(); 32 | return(true); 33 | } 34 | } 35 | 36 | return QObject::eventFilter(watched, event); 37 | } 38 | -------------------------------------------------------------------------------- /QmlKey/QmlKey.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlKey.h 3 | *@brief Qml全局按键 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #pragma once 9 | #include 10 | #include 11 | #include 12 | 13 | class QmlKey : public QObject 14 | { 15 | Q_OBJECT 16 | public: 17 | QmlKey(); 18 | 19 | protected: 20 | virtual bool eventFilter(QObject *watched, QEvent *event); 21 | 22 | signals: 23 | void sKeyBackPress(); 24 | void sKeyBackRelease(); 25 | }; 26 | -------------------------------------------------------------------------------- /QmlKey/QmlKey.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp \ 12 | QmlKey.cpp 13 | 14 | HEADERS += \ 15 | QmlKey.h 16 | 17 | RESOURCES += qml.qrc 18 | -------------------------------------------------------------------------------- /QmlKey/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "QmlKey.h" 13 | 14 | int main(int argc, char *argv[]) 15 | { 16 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 17 | QGuiApplication app(argc, argv); 18 | QmlKey qmlKey; 19 | QQmlApplicationEngine engine; 20 | engine.rootContext()->setContextProperty("qmlKey", &qmlKey); 21 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 22 | QObject *root = engine.rootObjects()[0]; 23 | root->installEventFilter(&qmlKey); 24 | QObject::connect(&qmlKey, SIGNAL(sKeyBackPress()), root, SLOT(onSKeyBackPress())); 25 | QObject::connect(&qmlKey, SIGNAL(sKeyBackRelease()), root, SLOT(onSKeyBackRelease())); 26 | return app.exec(); 27 | } 28 | -------------------------------------------------------------------------------- /QmlKey/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | import QtQuick.Window 2.2 12 | 13 | Window { 14 | id: frmWindow 15 | visible: true 16 | width: 400 17 | height: 300 18 | title: qsTr("Qml全局按键") 19 | 20 | Label{ 21 | id: label 22 | text: qsTr("文本") 23 | height: 48 24 | width: 120 25 | anchors.centerIn: parent 26 | } 27 | 28 | function onSKeyBackPress(){ 29 | label.text = qsTr("按下了Backspace") 30 | } 31 | 32 | function onSKeyBackRelease(){ 33 | label.text = qsTr("松开了Backspace") 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /QmlKey/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlKey/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlKey/show.gif -------------------------------------------------------------------------------- /QmlLanguage/QmlLanguage.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlLanguage.cpp 3 | *@brief 语言切换 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include "QmlLanguage.h" 9 | 10 | QmlLanguage::QmlLanguage(QGuiApplication &app, QQmlApplicationEngine& engine) 11 | { 12 | m_app = &app; 13 | m_engine = &engine; 14 | } 15 | 16 | void QmlLanguage::setLanguage(int nLanguage) 17 | { 18 | QTranslator translator; 19 | if (nLanguage == 0) 20 | { 21 | translator.load(":/en_US.qm"); 22 | }else{ 23 | translator.load(":/zh_CN.qm"); 24 | } 25 | m_app->installTranslator(&translator); 26 | m_engine->retranslate(); 27 | } 28 | -------------------------------------------------------------------------------- /QmlLanguage/QmlLanguage.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlLanguage.h 3 | *@brief 语言切换 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #pragma once 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | class QmlLanguage : public QObject 15 | { 16 | Q_OBJECT 17 | public: 18 | QmlLanguage(QGuiApplication& app, QQmlApplicationEngine &engine); 19 | 20 | Q_INVOKABLE void setLanguage(int nLanguage); 21 | 22 | private: 23 | QGuiApplication *m_app; 24 | QQmlApplicationEngine *m_engine; 25 | }; 26 | -------------------------------------------------------------------------------- /QmlLanguage/QmlLanguage.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp \ 12 | QmlLanguage.cpp 13 | 14 | RESOURCES += qml.qrc 15 | 16 | TRANSLATIONS = zh_CN.ts en_US.ts 17 | 18 | HEADERS += \ 19 | QmlLanguage.h 20 | -------------------------------------------------------------------------------- /QmlLanguage/en_US.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlLanguage/en_US.qm -------------------------------------------------------------------------------- /QmlLanguage/en_US.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | main 6 | 7 | 8 | Dialog 9 | Dialog 10 | 11 | 12 | 13 | TextLabel 14 | TextLabel 15 | 16 | 17 | 18 | PushButton 19 | PushButton 20 | 21 | 22 | 23 | English 24 | 25 | 26 | 27 | 28 | 简体中文 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /QmlLanguage/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include "QmlLanguage.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 16 | QGuiApplication app(argc, argv); 17 | 18 | QQmlApplicationEngine engine; 19 | QmlLanguage qmlLanguage(app, engine); 20 | engine.rootContext()->setContextProperty("qmlLanguage", &qmlLanguage); 21 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 22 | 23 | return app.exec(); 24 | } 25 | -------------------------------------------------------------------------------- /QmlLanguage/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Dialog") 16 | 17 | Column{ 18 | width: parent.width 19 | anchors.horizontalCenter: parent.horizontalCenter 20 | anchors.verticalCenter: parent.verticalCenter 21 | anchors.verticalCenterOffset: 20 22 | 23 | Text { 24 | id: textLabel 25 | height: 24 26 | width: 120 27 | anchors.horizontalCenter: parent.horizontalCenter 28 | horizontalAlignment: Text.AlignHCenter 29 | text: qsTr("TextLabel") 30 | } 31 | Button{ 32 | id: pushButton 33 | height: 24 34 | width: 120 35 | anchors.horizontalCenter: parent.horizontalCenter 36 | text: qsTr("PushButton") 37 | } 38 | 39 | Column{ 40 | anchors.right: parent.right 41 | anchors.rightMargin: 20 42 | 43 | RadioButton{ 44 | id: enChk 45 | text: qsTr("English") 46 | checked: true 47 | onClicked: { 48 | qmlLanguage.setLanguage(0); 49 | } 50 | } 51 | RadioButton{ 52 | id: cnCHK 53 | text: qsTr("简体中文") 54 | onClicked: { 55 | qmlLanguage.setLanguage(1); 56 | } 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /QmlLanguage/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | zh_CN.qm 5 | en_US.qm 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlLanguage/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlLanguage/show.gif -------------------------------------------------------------------------------- /QmlLanguage/zh_CN.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlLanguage/zh_CN.qm -------------------------------------------------------------------------------- /QmlLanguage/zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | main 6 | 7 | 8 | Dialog 9 | 对话框 10 | 11 | 12 | 13 | TextLabel 14 | 文本 15 | 16 | 17 | 18 | PushButton 19 | 按钮 20 | 21 | 22 | 23 | English 24 | 25 | 26 | 27 | 28 | 简体中文 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /QmlListSlidDelete/QmlListSlidDelete.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlListSlidDelete/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | if (engine.rootObjects().isEmpty()) 19 | return -1; 20 | 21 | return app.exec(); 22 | } 23 | -------------------------------------------------------------------------------- /QmlListSlidDelete/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Qml滑动删除") 16 | 17 | ListModel { 18 | id: listModel 19 | 20 | ListElement { 21 | text: qsTr("111222333随便的一些内容") 22 | } 23 | ListElement { 24 | text: qsTr("AAABBBCCC随便的一些内容") 25 | } 26 | ListElement { 27 | text: qsTr("DDDEEEFFF随便的一些内容") 28 | } 29 | ListElement { 30 | text: qsTr("GGGHHHIII随便的一些内容") 31 | } 32 | ListElement { 33 | text: qsTr("JJJKKKLLL随便的一些内容") 34 | } 35 | } 36 | 37 | ListView{ 38 | id: listview 39 | width: parent.width 40 | height: parent.height 41 | anchors.fill: parent 42 | model: listModel 43 | delegate: listDelegate 44 | } 45 | 46 | Component{ 47 | id: listDelegate 48 | Rectangle{ 49 | id: listItem 50 | width: parent.width 51 | height: 30 52 | 53 | Text { 54 | id: text 55 | font.family: "microsoft yahei" 56 | font.pointSize: 12 57 | height: parent.height 58 | width: parent.width - delBtn.width 59 | text: model.text 60 | color: "green" 61 | verticalAlignment: Text.AlignVCenter 62 | MouseArea{ 63 | property point clickPos: "0,0" 64 | 65 | anchors.fill: parent 66 | onPressed: { 67 | clickPos = Qt.point(mouse.x,mouse.y); 68 | } 69 | onReleased: { 70 | var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y) 71 | console.debug("delta.x: " + delta.x); 72 | if ((delta.x < 0) && (aBtnShow.running === false) && (delBtn.width == 0)){ 73 | aBtnShow.start(); 74 | }else if (aBtnHide.running === false && (delBtn.width > 0)){ 75 | aBtnHide.start(); 76 | } 77 | } 78 | } 79 | } 80 | Rectangle{ 81 | color: "#AAAAAA" 82 | height: 1 83 | width: parent.width 84 | anchors.bottom: parent.bottom 85 | } 86 | Rectangle{ 87 | id: delBtn 88 | height: parent.height 89 | width: 0 90 | color: "#EE4040" 91 | anchors.right: parent.right 92 | Text { 93 | font.family: "microsoft yahei" 94 | font.pointSize: 12 95 | anchors.centerIn: parent 96 | text: qsTr("删除") 97 | color: "#ffffff" 98 | } 99 | MouseArea{ 100 | anchors.fill: parent 101 | onClicked: { 102 | listview.model.remove(index); 103 | } 104 | } 105 | } 106 | PropertyAnimation{ 107 | id: aBtnShow 108 | target: delBtn 109 | property: "width" 110 | duration: 100 111 | from: 0 112 | to: 60 113 | } 114 | PropertyAnimation{ 115 | id: aBtnHide 116 | target: delBtn 117 | property: "width" 118 | duration: 100 119 | from: 60 120 | to: 0 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /QmlListSlidDelete/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlListSlidDelete/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlListSlidDelete/show.gif -------------------------------------------------------------------------------- /QmlLoader/Page1.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.7 2 | import QtQuick.Window 2.0 3 | import QtQuick.Controls 2.0 4 | 5 | Window{ 6 | width: 400 7 | height: 300 8 | visible: true 9 | flags: Qt.Window | Qt.WindowStaysOnTopHint 10 | 11 | Text{ 12 | anchors.top: parent.top 13 | anchors.topMargin: 4 14 | anchors.horizontalCenter: parent.horizontalCenter 15 | text: qsTr("主页一") 16 | } 17 | 18 | Button{ 19 | height: 32 20 | width: 60 21 | anchors.centerIn: parent 22 | text: qsTr("下一页") 23 | onClicked: changePage(); 24 | } 25 | 26 | Button{ 27 | height: 32 28 | width: 32 29 | text: "X" 30 | anchors.right: parent.right 31 | anchors.rightMargin: 4 32 | anchors.top: parent.top 33 | anchors.topMargin: 4 34 | onClicked: { 35 | Qt.quit() 36 | } 37 | } 38 | 39 | Loader{ 40 | id: pageLoader 41 | } 42 | 43 | function changePage(){ 44 | pageLoader.source = "Page2.qml" 45 | close(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /QmlLoader/Page2.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.7 2 | import QtQuick.Window 2.0 3 | import QtQuick.Controls 2.0 4 | 5 | Window{ 6 | width: 400 7 | height: 300 8 | visible: true 9 | flags: Qt.Window | Qt.WindowStaysOnTopHint 10 | 11 | Text{ 12 | anchors.top: parent.top 13 | anchors.topMargin: 4 14 | anchors.horizontalCenter: parent.horizontalCenter 15 | text: qsTr("主页二") 16 | } 17 | 18 | Button{ 19 | height: 32 20 | width: 60 21 | anchors.centerIn: parent 22 | text: qsTr("下一页") 23 | onClicked: changePage(); 24 | } 25 | 26 | Button{ 27 | height: 32 28 | width: 32 29 | text: "X" 30 | anchors.right: parent.right 31 | anchors.rightMargin: 4 32 | anchors.top: parent.top 33 | anchors.topMargin: 4 34 | onClicked: { 35 | Qt.quit() 36 | } 37 | } 38 | 39 | Loader{ 40 | id: pageLoader 41 | } 42 | 43 | function changePage(){ 44 | pageLoader.source = "main.qml" 45 | close(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /QmlLoader/QmlLoader.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlLoader/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlLoader/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Window 2.0 10 | import QtQuick.Controls 2.0 11 | 12 | Window{ 13 | width: 400 14 | height: 300 15 | visible: true 16 | flags: Qt.Window | Qt.WindowStaysOnTopHint 17 | title: qsTr("QmlLoader") 18 | 19 | Text{ 20 | anchors.top: parent.top 21 | anchors.topMargin: 4 22 | anchors.horizontalCenter: parent.horizontalCenter 23 | text: qsTr("主页面") 24 | } 25 | 26 | Button{ 27 | height: 32 28 | width: 60 29 | anchors.centerIn: parent 30 | text: qsTr("下一页") 31 | onClicked: changePage(); 32 | } 33 | 34 | Button{ 35 | height: 32 36 | width: 32 37 | text: "X" 38 | anchors.right: parent.right 39 | anchors.rightMargin: 4 40 | anchors.top: parent.top 41 | anchors.topMargin: 4 42 | onClicked: { 43 | Qt.quit() 44 | } 45 | } 46 | 47 | Loader{ 48 | id: pageLoader 49 | } 50 | 51 | function changePage(){ 52 | pageLoader.source = "Page1.qml" 53 | close(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /QmlLoader/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Page1.qml 5 | Page2.qml 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlLoader/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlLoader/show.gif -------------------------------------------------------------------------------- /QmlLog4Qml/QmlLog4Qml.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlLog4Qml.cpp 3 | *@brief Qml写日志 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include "QmlLog4Qml.h" 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg) 15 | { 16 | static QMutex mutex; 17 | mutex.lock(); 18 | 19 | QString text; 20 | switch(type) 21 | { 22 | case QtDebugMsg: 23 | text = QString("Debug:"); 24 | break; 25 | 26 | case QtWarningMsg: 27 | text = QString("Warning:"); 28 | break; 29 | 30 | case QtCriticalMsg: 31 | text = QString("Critical:"); 32 | break; 33 | 34 | case QtFatalMsg: 35 | text = QString("Fatal:"); 36 | } 37 | 38 | QString message = ""; 39 | if (context.file != nullptr) 40 | { 41 | QString context_info = QString("File:(%1) Line:(%2)").arg(QString(context.file)).arg(context.line); 42 | QString current_date_time = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ddd"); 43 | QString current_date = QString("(%1)").arg(current_date_time); 44 | message = QString("%1 %2 %3 %4").arg(text).arg(context_info).arg(msg).arg(current_date); 45 | } 46 | else 47 | { 48 | message = msg; 49 | } 50 | 51 | QFile file("log.txt"); 52 | file.open(QIODevice::WriteOnly | QIODevice::Append); 53 | QTextStream text_stream(&file); 54 | text_stream << message << "\r\n"; 55 | file.flush(); 56 | file.close(); 57 | 58 | mutex.unlock(); 59 | } 60 | 61 | QmlLog4Qml::QmlLog4Qml() 62 | { 63 | qInstallMessageHandler(outputMessage); 64 | } 65 | 66 | void QmlLog4Qml::qDebug_Info(int type, QString strInfo) 67 | { 68 | QMessageLogContext context; 69 | context.file = nullptr; 70 | outputMessage((QtMsgType)type, context, strInfo); 71 | } 72 | -------------------------------------------------------------------------------- /QmlLog4Qml/QmlLog4Qml.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlLog4Qml.h 3 | *@brief Qml写日志 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | 10 | class QmlLog4Qml : public QObject 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QmlLog4Qml(); 16 | Q_INVOKABLE void qDebug_Info(int type, QString strInfo); 17 | }; 18 | -------------------------------------------------------------------------------- /QmlLog4Qml/QmlLog4Qml.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp \ 12 | QmlLog4Qml.cpp 13 | 14 | HEADERS += \ 15 | QmlLog4Qml.h 16 | 17 | RESOURCES += qml.qrc 18 | -------------------------------------------------------------------------------- /QmlLog4Qml/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include "QmlLog4Qml.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 16 | QGuiApplication app(argc, argv); 17 | 18 | QmlLog4Qml log4Qml; 19 | 20 | QQmlApplicationEngine engine; 21 | engine.rootContext()->setContextProperty("log4Qml", &log4Qml); 22 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 23 | 24 | return app.exec(); 25 | } 26 | -------------------------------------------------------------------------------- /QmlLog4Qml/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("Qml写日志") 17 | 18 | Component.onCompleted: { 19 | log4Qml.qDebug_Info(0, "Qml写日志"); 20 | console.debug("Qml写日志"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QmlLog4Qml/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlLog4Qml/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlLog4Qml/show.jpg -------------------------------------------------------------------------------- /QmlPageNavigation/QmlPageNavigation.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlPageNavigation/QmlPageNavigation.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlPageNavigation.qml 3 | *@brief Qml分页显示 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | Row{ 12 | id: pageNavigation 13 | property int nCout: 1 14 | property int nCurPage: 1 15 | property int nPageSize: 1 16 | 17 | signal sCurPage(int curPage); 18 | 19 | Rectangle{ 20 | id: prevPage 21 | height: 24 22 | width: 60 23 | color: "#EEEEEE" 24 | border.color: "#AAAAAA" 25 | border.width: 1 26 | Row{ 27 | anchors.centerIn: parent 28 | Image{ 29 | height: 16 30 | width: 16 31 | anchors.verticalCenter: parent.verticalCenter 32 | source: "qrc:/arrow.png" 33 | rotation: -180 34 | } 35 | Text { 36 | font.family: "microsoft yahei" 37 | font.pixelSize: 12 38 | anchors.verticalCenter: parent.verticalCenter 39 | text: qsTr("上一页") 40 | } 41 | } 42 | MouseArea{ 43 | anchors.fill: parent 44 | onClicked: { 45 | if (pageNavigation.nCurPage > 1) pageNavigation.nCurPage--; 46 | } 47 | } 48 | } 49 | 50 | Repeater{ 51 | id: repeater 52 | model: pageNavigation.nPageSize 53 | delegate: Rectangle{ 54 | property int nCurIndex: (pageNavigation.nCurPage-1)*pageNavigation.nPageSize + index + 1 55 | property bool hasPage: nCurIndex <= pageNavigation.nCout 56 | 57 | height: 24 58 | width: 24 59 | color: hasPage ? "#EEEEEE" : "transparent" 60 | border.color: "#AAAAAA" 61 | border.width: hasPage ? 1 : 0 62 | Text { 63 | font.family: "microsoft yahei" 64 | font.pixelSize: 12 65 | anchors.centerIn: parent 66 | text: nCurIndex 67 | visible: hasPage ? true : false 68 | } 69 | MouseArea{ 70 | anchors.fill: parent 71 | hoverEnabled: hasPage 72 | onEntered: { 73 | parent.color = "#148014" 74 | } 75 | onExited: { 76 | parent.color = "#EEEEEE" 77 | } 78 | onPressed: { 79 | emit: sCurPage(nCurIndex); 80 | } 81 | } 82 | } 83 | } 84 | 85 | Rectangle{ 86 | id: nextPage 87 | height: 24 88 | width: 60 89 | color: "#EEEEEE" 90 | border.color: "#AAAAAA" 91 | border.width: 1 92 | Row{ 93 | anchors.centerIn: parent 94 | Text { 95 | font.family: "microsoft yahei" 96 | font.pixelSize: 12 97 | anchors.verticalCenter: parent.verticalCenter 98 | text: qsTr("下一页") 99 | } 100 | Image{ 101 | height: 16 102 | width: 16 103 | anchors.verticalCenter: parent.verticalCenter 104 | source: "qrc:/arrow.png" 105 | } 106 | } 107 | MouseArea{ 108 | anchors.fill: parent 109 | onClicked: { 110 | if (pageNavigation.nCurPage*pageNavigation.nPageSize <= pageNavigation.nCout) pageNavigation.nCurPage++; 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /QmlPageNavigation/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPageNavigation/arrow.png -------------------------------------------------------------------------------- /QmlPageNavigation/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlPageNavigation/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Qml分页显示") 16 | 17 | Text { 18 | id: txtPage 19 | anchors.centerIn: parent 20 | font.family: "microsoft yahei" 21 | font.pixelSize: 20 22 | text: qsTr("第1页") 23 | } 24 | 25 | QmlPageNavigation{ 26 | id: pageNavigation 27 | anchors.left: parent.left 28 | anchors.leftMargin: 6 29 | anchors.bottom: parent.bottom 30 | anchors.bottomMargin: 6 31 | nCout: 23 32 | nCurPage: 1 33 | nPageSize: 5 34 | onSCurPage: { 35 | txtPage.text = qsTr("第") + curPage + qsTr("页"); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /QmlPageNavigation/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | arrow.png 5 | QmlPageNavigation.qml 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlPageNavigation/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPageNavigation/show.gif -------------------------------------------------------------------------------- /QmlPlugin/QmlPlugin/QmlPlugin.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlPlugin.cpp 3 | *@brief Qml插件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include "QmlPlugin.h" 9 | 10 | void QmlPlugin::ShowWindow() 11 | { 12 | engine.load(QUrl(QLatin1String("qrc:/QmlPlugin.qml"))); 13 | } 14 | 15 | void ShowWindowApp() 16 | { 17 | QmlPlugin *pp = new QmlPlugin; 18 | pp->ShowWindow(); 19 | } 20 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPlugin/QmlPlugin.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlPlugin.h 3 | *@brief Qml插件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #pragma once 9 | 10 | #include 11 | #include 12 | 13 | #if defined(QTDLL_LIBRARY) 14 | # define QTDLLSHARED_EXPORT Q_DECL_EXPORT 15 | #else 16 | # define QTDLLSHARED_EXPORT Q_DECL_IMPORT 17 | #endif 18 | 19 | class QTDLLSHARED_EXPORT QmlPlugin 20 | { 21 | public: 22 | void ShowWindow(); 23 | 24 | private: 25 | QQmlApplicationEngine engine; 26 | }; 27 | 28 | extern "C" QTDLLSHARED_EXPORT void ShowWindowApp(); 29 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPlugin/QmlPlugin.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | TEMPLATE = lib 12 | 13 | DEFINES += QTDLL_LIBRARY 14 | 15 | SOURCES += \ 16 | QmlPlugin.cpp 17 | 18 | HEADERS += \ 19 | QmlPlugin.h 20 | 21 | RESOURCES += \ 22 | QmlPlugin.qrc 23 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPlugin/QmlPlugin.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | id:applicationWindow 13 | visible: true 14 | width: 320 15 | height: 240 16 | title: qsTr("这是插件") 17 | 18 | Button{ 19 | id:button 20 | text: qsTr("插件中的按钮") 21 | height:48 22 | width:120 23 | anchors.centerIn: parent 24 | MouseArea{ 25 | id:mouseArea 26 | anchors.fill: parent 27 | onPressed: { 28 | console.debug(qsTr("点击了插件中的按钮")); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPlugin/QmlPlugin.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | QmlPlugin.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPluginTest/QmlPluginTest.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlPluginTest.cpp 3 | *@brief Qml调用插件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include "QmlPluginTest.h" 9 | #include 10 | #include 11 | #include 12 | 13 | QmlPluginTest::QmlPluginTest() 14 | { 15 | 16 | } 17 | 18 | void QmlPluginTest::showWindow() 19 | { 20 | typedef void(*FUN1)(); 21 | QLibrary lib(QCoreApplication::applicationDirPath() + "/plugins/QmlPlugin/QmlPlugin.dll"); 22 | if (lib.load()) 23 | { 24 | FUN1 pShow = (FUN1)lib.resolve("ShowWindowApp"); 25 | if (pShow) 26 | { 27 | pShow(); 28 | } 29 | else 30 | { 31 | qDebug() << "fun error"; 32 | } 33 | } 34 | else 35 | { 36 | qDebug() << "load error"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPluginTest/QmlPluginTest.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlPluginTest.h 3 | *@brief Qml调用插件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #pragma once 9 | #include 10 | 11 | class QmlPluginTest : public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | QmlPluginTest(); 16 | 17 | Q_INVOKABLE void showWindow(); 18 | }; 19 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPluginTest/QmlPluginTest.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp \ 12 | QmlPluginTest.cpp 13 | 14 | HEADERS += \ 15 | QmlPluginTest.h 16 | 17 | RESOURCES += qml.qrc 18 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPluginTest/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include "QmlPluginTest.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 16 | QGuiApplication app(argc, argv); 17 | 18 | QQmlApplicationEngine engine; 19 | QmlPluginTest qmlPluginTest; 20 | engine.rootContext()->setContextProperty("qmlPluginTest", &qmlPluginTest); 21 | 22 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 23 | 24 | return app.exec(); 25 | } 26 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPluginTest/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | 11 | ApplicationWindow { 12 | id:applicationWindow 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("主窗体") 17 | 18 | Button{ 19 | id:button 20 | text: qsTr("显示插件") 21 | height:48 22 | width:120 23 | anchors.centerIn: parent 24 | MouseArea{ 25 | id:mouseArea 26 | anchors.fill: parent 27 | onPressed: { 28 | qmlPluginTest.showWindow(); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPluginTest/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlPlugin/QmlPluginTest/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPlugin/QmlPluginTest/show.gif -------------------------------------------------------------------------------- /QmlPopMenu/QmlPopMenu.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlPopMenu/images/away.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPopMenu/images/away.png -------------------------------------------------------------------------------- /QmlPopMenu/images/busy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPopMenu/images/busy.png -------------------------------------------------------------------------------- /QmlPopMenu/images/hide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPopMenu/images/hide.png -------------------------------------------------------------------------------- /QmlPopMenu/images/online.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPopMenu/images/online.png -------------------------------------------------------------------------------- /QmlPopMenu/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlPopMenu/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | images/away.png 5 | images/busy.png 6 | images/hide.png 7 | images/online.png 8 | 9 | 10 | -------------------------------------------------------------------------------- /QmlPopMenu/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlPopMenu/show.gif -------------------------------------------------------------------------------- /QmlProgress/QmlProgress.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlProgress/QmlProgress.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlProgress.qml 3 | *@brief Qml进度条 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.2 10 | 11 | ProgressBar { 12 | property color proColor: "#148014" 13 | property color proBackgroundColor: "#AAAAAA" 14 | property int proWidth: 2 15 | property real progress: 0 16 | property real proRadius: 3 17 | property alias interval: timer.interval 18 | 19 | function isRunning(){ 20 | return(timer.running) 21 | } 22 | 23 | function onStart(){ 24 | cProgress.progress = 0; 25 | timer.running = true; 26 | } 27 | 28 | function onStop(){ 29 | timer.running = false; 30 | } 31 | 32 | id: cProgress 33 | anchors.centerIn: parent 34 | value: (progress/100) 35 | padding: 2 36 | 37 | background: Rectangle { 38 | implicitWidth: 200 39 | implicitHeight: 16 40 | color: cProgress.proBackgroundColor 41 | radius: cProgress.proRadius 42 | } 43 | 44 | contentItem: Item { 45 | implicitWidth: 200 46 | implicitHeight: 10 47 | 48 | Rectangle { 49 | width: cProgress.visualPosition * parent.width 50 | height: parent.height 51 | radius: 2 52 | color: cProgress.proColor 53 | } 54 | } 55 | 56 | Timer{ 57 | id: timer 58 | running: false 59 | repeat: true 60 | interval: 50 61 | onTriggered:{ 62 | cProgress.progress++; 63 | if (cProgress.progress > 100){ 64 | cProgress.onStop(); 65 | return; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /QmlProgress/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlProgress/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.2 10 | 11 | ApplicationWindow { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Qml进度条") 16 | 17 | QmlProgress { 18 | id: cProgress 19 | anchors.centerIn: parent 20 | } 21 | 22 | Button{ 23 | id: btnStart 24 | anchors.horizontalCenter: cProgress.horizontalCenter 25 | anchors.top: cProgress.bottom 26 | anchors.topMargin: 6 27 | text: cProgress.isRunning() ? qsTr("结束") : qsTr("开始") 28 | onClicked: { 29 | if (cProgress.isRunning()){ 30 | cProgress.onStop(); 31 | }else{ 32 | cProgress.onStart(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /QmlProgress/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlProgress.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlProgress/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlProgress/show.gif -------------------------------------------------------------------------------- /QmlRotationAnimation/QmlRotationAnimation.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlRotationAnimation/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlRotationAnimation/image.png -------------------------------------------------------------------------------- /QmlRotationAnimation/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlRotationAnimation/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Window 2.0 10 | 11 | Window { 12 | visible: true 13 | width: 400 14 | height: 300 15 | title: qsTr("Qml旋转箭头") 16 | 17 | property bool isDown : false 18 | 19 | Image { 20 | id: image 21 | height: 24 22 | width: 24 23 | anchors.centerIn: parent 24 | source: "qrc:/image.png" 25 | 26 | MouseArea{ 27 | anchors.fill: parent 28 | onClicked:{ 29 | if (rotationAnimation.running === true) return; 30 | rotationAnimation.start(); 31 | } 32 | } 33 | } 34 | RotationAnimation{ 35 | id: rotationAnimation 36 | target: image 37 | from: 0 38 | to: 90 39 | duration: 100 40 | onStopped: { 41 | if (isDown === true) 42 | { 43 | rotationAnimation.from = 0; 44 | rotationAnimation.to = 90; 45 | } 46 | else 47 | { 48 | rotationAnimation.from = 90; 49 | rotationAnimation.to = 0; 50 | } 51 | isDown = !isDown; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /QmlRotationAnimation/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | image.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlRotationAnimation/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlRotationAnimation/show.gif -------------------------------------------------------------------------------- /QmlShowSideWindow/Face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlShowSideWindow/Face.png -------------------------------------------------------------------------------- /QmlShowSideWindow/QmlShowSideWindow.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlShowSideWindow/QmlShowSideWindow.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlShowSideWindow.qml 3 | *@brief Qml弹出右侧信息弹窗 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Window 2.0 11 | 12 | Window { 13 | flags: Qt.FramelessWindowHint 14 | color: "#AAAAAA" 15 | 16 | Text { 17 | id: info 18 | text: qsTr("显示信息") 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /QmlShowSideWindow/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlShowSideWindow/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | id: root 14 | visible: true 15 | width: 400 16 | height: 300 17 | title: qsTr("Qml弹出右侧信息弹窗") 18 | 19 | Image { 20 | id: image 21 | anchors.left: parent.left 22 | anchors.leftMargin: 12 23 | anchors.top: parent.top 24 | anchors.topMargin: 12 25 | height: 36 26 | width: 36 27 | source: "qrc:/Face.png" 28 | MouseArea{ 29 | anchors.fill: parent 30 | hoverEnabled: true 31 | onEntered: { 32 | overTimer.stop(); 33 | if (subWindow.visible === true) return; 34 | subWindow.opacity = 0.0; 35 | subWindow.visible = true; 36 | downAnimation.start(); 37 | showAnimation.start(); 38 | } 39 | onExited: { 40 | overTimer.start(); 41 | } 42 | } 43 | } 44 | 45 | Button{ 46 | text: qsTr("X") 47 | anchors.top: parent.top 48 | anchors.right: parent.right 49 | height: 32 50 | width: 32 51 | MouseArea{ 52 | anchors.fill: parent 53 | onClicked: {Qt.quit()} 54 | } 55 | } 56 | 57 | Timer{ 58 | id: overTimer 59 | interval: 1000 60 | repeat: false 61 | onTriggered: { 62 | upAnimation.start(); 63 | hideAnimation.start(); 64 | } 65 | } 66 | 67 | PropertyAnimation{ 68 | id: showAnimation 69 | target: subWindow 70 | properties:"opacity" 71 | from: 0.0 72 | to: 1.0 73 | duration: 500 74 | } 75 | 76 | PropertyAnimation{ 77 | id: hideAnimation 78 | target: subWindow 79 | properties:"opacity" 80 | from: 1.0 81 | to: 0.0 82 | duration: 300 83 | onStopped: { 84 | subWindow.visible = false; 85 | } 86 | } 87 | 88 | PropertyAnimation{ 89 | id: downAnimation 90 | target: subWindow 91 | properties:"y" 92 | from: root.y 93 | to: root.y + 24 94 | duration: 300 95 | } 96 | 97 | PropertyAnimation{ 98 | id: upAnimation 99 | target: subWindow 100 | properties:"y" 101 | from: root.y + 24 102 | to: root.y 103 | duration: 300 104 | } 105 | 106 | QmlShowSideWindow{ 107 | id: subWindow 108 | visible: false 109 | x: root.x + root.width + 12 110 | y: root.y + 24 111 | height: 200 112 | width: 200 113 | MouseArea{ 114 | anchors.fill: parent 115 | hoverEnabled: true 116 | onEntered: { 117 | overTimer.stop(); 118 | } 119 | onExited: { 120 | overTimer.start(); 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /QmlShowSideWindow/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Face.png 5 | QmlShowSideWindow.qml 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlShowSideWindow/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlShowSideWindow/show.gif -------------------------------------------------------------------------------- /QmlSign/QmlSign.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlSign/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlSign/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | import QtGraphicalEffects 1.0 12 | 13 | ApplicationWindow { 14 | visible: true 15 | width: 400 16 | height: 300 17 | title: qsTr("Qml签名修改") 18 | 19 | function subEditingFinished() 20 | { 21 | if (textFieldback.visible !== true) return; 22 | textFieldback.visible = false 23 | textField.focus = false 24 | textMetrics.text = textField.text 25 | textField.text = textMetrics.elidedText 26 | console.debug("textMetrics.elidedText: ", textMetrics.elidedText); 27 | console.debug("textMetrics.text: ", textMetrics.text); 28 | console.debug("textField.text: ", textField.text); 29 | } 30 | 31 | MouseArea{ 32 | anchors.fill: parent 33 | onClicked: { 34 | subEditingFinished(); 35 | } 36 | } 37 | 38 | TextMetrics { 39 | id: textMetrics 40 | elide: Text.ElideRight 41 | elideWidth: textField.width - 12 42 | text: qsTr("123这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字这是一段文字") 43 | } 44 | 45 | TextField{ 46 | id: textField 47 | text: textMetrics.elidedText 48 | height: 32 49 | width: 120 50 | anchors.centerIn: parent 51 | verticalAlignment: Text.AlignVCenter 52 | horizontalAlignment:Text.AlignLeft 53 | selectByMouse: true 54 | 55 | background: Rectangle { 56 | id: textFieldback 57 | implicitWidth: 120 58 | implicitHeight: 32 59 | border.color: "#CCCCCC" 60 | visible: false 61 | } 62 | 63 | onPressed:{ 64 | textFieldback.visible = true 65 | textField.text = textMetrics.text 66 | console.debug("textMetrics.text: ", textMetrics.text); 67 | } 68 | 69 | onEditingFinished :{ 70 | subEditingFinished(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /QmlSign/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlSign/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlSign/show.gif -------------------------------------------------------------------------------- /QmlSlidingMenu/QmlSlidingMenu.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlSlidingMenu/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QGuiApplication app(argc, argv); 14 | 15 | QQmlApplicationEngine engine; 16 | engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); 17 | 18 | return app.exec(); 19 | } 20 | -------------------------------------------------------------------------------- /QmlSlidingMenu/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Window 2.2 10 | import QtQuick.Controls 2.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("Qml侧边滑动菜单") 17 | property bool bMenuShown: false 18 | 19 | Rectangle { 20 | anchors.fill: parent 21 | color: "#AAAAAA"; 22 | opacity: bMenuShown ? 1 : 0 23 | Behavior on opacity { 24 | NumberAnimation { 25 | duration: 300 26 | } 27 | } 28 | } 29 | 30 | Rectangle { 31 | anchors.fill: parent 32 | color: "#FFFFFF" 33 | opacity: bMenuShown ? 0.5 : 1 34 | Behavior on opacity { 35 | NumberAnimation { 36 | duration: 300 37 | } 38 | } 39 | 40 | Button { 41 | width: 48 42 | height: 48 43 | text: qsTr("菜单") 44 | onClicked: onMenu(); 45 | } 46 | 47 | transform: Translate { 48 | id: menuTranslate 49 | x: 0 50 | Behavior on x { 51 | NumberAnimation { 52 | duration: 400; 53 | easing.type: Easing.OutQuad 54 | } 55 | } 56 | } 57 | MouseArea { 58 | anchors.fill: parent 59 | enabled: bMenuShown 60 | onClicked: onMenu(); 61 | } 62 | } 63 | 64 | function onMenu() 65 | { 66 | menuTranslate.x = bMenuShown ? 0 : width * 0.8 67 | bMenuShown = !bMenuShown; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /QmlSlidingMenu/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlSlidingMenu/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlSlidingMenu/show.gif -------------------------------------------------------------------------------- /QmlStackView/Page1.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file Page1.qml 3 | *@brief Page1 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.8 9 | import QtQuick.Controls 2.1 10 | 11 | Page { 12 | id: frmWindow 13 | title: qsTr("设置") 14 | visible: true 15 | 16 | property StackView stack: null 17 | 18 | Button { 19 | height: 32 20 | width: 120 21 | text: "<-" 22 | anchors.left: parent.left 23 | anchors.top: parent.top 24 | onClicked: stack.pop() 25 | } 26 | 27 | Label{ 28 | id: label 29 | text: qsTr("设置") 30 | height: 80 31 | width: 240 32 | anchors.centerIn: parent 33 | font.pixelSize: 20 34 | } 35 | 36 | Button { 37 | height: 32 38 | width: 120 39 | text: qsTr("个人设置") 40 | anchors.right: parent.right 41 | anchors.bottom: parent.bottom 42 | onClicked: { 43 | page2.visible = true; 44 | page2.stack = stack; 45 | stack.push(page2); 46 | } 47 | } 48 | 49 | Page2 { 50 | id: page2 51 | visible: false 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /QmlStackView/Page2.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file Page2.qml 3 | *@brief Page2 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.8 9 | import QtQuick.Controls 2.1 10 | 11 | Page { 12 | id: frmWindow 13 | title: qsTr("个人设置") 14 | visible: true 15 | 16 | property StackView stack: null 17 | 18 | Button { 19 | height: 32 20 | width: 120 21 | text: "<-" 22 | anchors.left: parent.left 23 | anchors.top: parent.top 24 | onClicked: stack.pop() 25 | } 26 | 27 | Label{ 28 | id: label 29 | text: qsTr("个人设置") 30 | height: 80 31 | width: 240 32 | anchors.centerIn: parent 33 | font.pixelSize: 20 34 | } 35 | 36 | Button { 37 | height: 32 38 | width: 120 39 | text: qsTr("帐号") 40 | anchors.right: parent.right 41 | anchors.bottom: parent.bottom 42 | onClicked: { 43 | page3.visible = true; 44 | page3.stack = stack; 45 | stack.push(page3); 46 | } 47 | } 48 | 49 | Page3 { 50 | id: page3 51 | visible: false 52 | stack: stack 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /QmlStackView/Page3.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file Page3.qml 3 | *@brief Page3 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.8 9 | import QtQuick.Controls 2.1 10 | 11 | Page { 12 | id: frmWindow 13 | title: qsTr("帐号") 14 | visible: true 15 | 16 | property StackView stack: null 17 | 18 | Button { 19 | height: 32 20 | width: 120 21 | text: "<-" 22 | anchors.left: parent.left 23 | anchors.top: parent.top 24 | onClicked: stack.pop() 25 | } 26 | 27 | Label{ 28 | id: label 29 | text: qsTr("帐号") 30 | height: 80 31 | width: 240 32 | anchors.centerIn: parent 33 | font.pixelSize: 20 34 | } 35 | 36 | Label{ 37 | anchors.top: label.bottom 38 | anchors.horizontalCenter: parent.horizontalCenter 39 | text: qsTr("帐号信息") 40 | height: 80 41 | width: 240 42 | font.pixelSize: 20 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /QmlStackView/QmlStackView.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlStackView/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlStackView/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.8 9 | import QtQuick.Controls 2.1 10 | 11 | ApplicationWindow { 12 | id: frmWindow 13 | title: qsTr("Qml堆栈窗体") 14 | width: 400 15 | height: 300 16 | visible: true 17 | 18 | StackView { 19 | id: stack 20 | initialItem: mainView 21 | anchors.fill: parent 22 | } 23 | 24 | Page { 25 | id: mainView 26 | 27 | Label{ 28 | text: qsTr("主页") 29 | height: 80 30 | width: 240 31 | anchors.centerIn: parent 32 | font.pixelSize: 20 33 | } 34 | Button { 35 | height: 32 36 | width: 120 37 | text: qsTr("设置") 38 | anchors.right: parent.right 39 | anchors.bottom: parent.bottom 40 | onClicked: { 41 | page1.visible = true; 42 | page1.stack = stack; 43 | stack.push(page1) 44 | } 45 | } 46 | } 47 | 48 | Page1 { 49 | id: page1 50 | visible: false 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /QmlStackView/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Page1.qml 5 | Page2.qml 6 | Page3.qml 7 | 8 | 9 | -------------------------------------------------------------------------------- /QmlStackView/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlStackView/show.gif -------------------------------------------------------------------------------- /QmlTabBar/Chat_FriendManager.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/Chat_FriendManagerG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/Chat_MsgRecord.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/Chat_MsgRecordG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/Main_P2PChat.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/Main_P2PChatG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/Mobile_Find.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/Mobile_FindG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlTabBar/QmlTabBar.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlTabBar/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlTabBar/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | import QtQuick.Window 2.2 12 | 13 | ApplicationWindow { 14 | id: frmWindow 15 | visible: true 16 | width: 300 17 | height: 400 18 | title: qsTr("Qml底部导航") 19 | 20 | footer: TabBar { 21 | id: bar 22 | height: 48 23 | width: parent.width 24 | currentIndex: 0 25 | 26 | ListModel { 27 | id: myModel 28 | ListElement { modelText: "消息"; modelSrc: "qrc:/Chat_MsgRecord.svg"; modelSrcG: "qrc:/Chat_MsgRecordG.svg";} 29 | ListElement { modelText: "联系人"; modelSrc: "qrc:/Chat_FriendManager.svg"; modelSrcG: "qrc:/Chat_FriendManagerG.svg";} 30 | ListElement { modelText: "发现"; modelSrc: "qrc:/Mobile_Find.svg"; modelSrcG: "qrc:/Mobile_FindG.svg";} 31 | ListElement { modelText: "我"; modelSrc: "qrc:/Main_P2PChat.svg"; modelSrcG: "qrc:/Main_P2PChatG.svg";} 32 | } 33 | 34 | Repeater { 35 | model: myModel 36 | 37 | TabButton { 38 | height: bar.height 39 | contentItem:Text{ 40 | text: modelText 41 | horizontalAlignment: Text.AlignHCenter 42 | verticalAlignment: Text.AlignBottom 43 | color: (model.index === bar.currentIndex) ? "#148014" : "#000000" 44 | } 45 | background:Image{ 46 | width: 24 47 | height: 24 48 | anchors.horizontalCenter: parent.horizontalCenter 49 | source: (model.index === bar.currentIndex) ? modelSrcG : modelSrc 50 | } 51 | } 52 | } 53 | } 54 | 55 | SwipeView { 56 | id: view 57 | height: frmWindow.height - bar.height 58 | width: parent.width 59 | currentIndex: bar.currentIndex 60 | 61 | Rectangle{ 62 | Text { 63 | text: qsTr("消息") 64 | anchors.centerIn: parent 65 | } 66 | } 67 | Rectangle{ 68 | Text { 69 | text: qsTr("联系人") 70 | anchors.centerIn: parent 71 | } 72 | } 73 | Rectangle{ 74 | Text { 75 | text: qsTr("发现") 76 | anchors.centerIn: parent 77 | } 78 | } 79 | Rectangle{ 80 | Text { 81 | text: qsTr("我") 82 | anchors.centerIn: parent 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /QmlTabBar/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Chat_FriendManager.svg 5 | Chat_MsgRecord.svg 6 | Main_P2PChat.svg 7 | Mobile_Find.svg 8 | Chat_FriendManagerG.svg 9 | Chat_MsgRecordG.svg 10 | Main_P2PChatG.svg 11 | Mobile_FindG.svg 12 | 13 | 14 | -------------------------------------------------------------------------------- /QmlTabBar/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlTabBar/show.gif -------------------------------------------------------------------------------- /QmlTableView/Face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlTableView/Face.png -------------------------------------------------------------------------------- /QmlTableView/QmlTableView.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlTableView.h 3 | *@brief QmlTableView 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include "QmlTableView.h" 9 | #include 10 | 11 | QmlTableViewModel::QmlTableViewModel() : QAbstractTableModel(0) 12 | { 13 | } 14 | 15 | int QmlTableViewModel::rowCount(const QModelIndex &parent) const 16 | { 17 | Q_UNUSED(parent) 18 | return m_aryData.size(); 19 | } 20 | 21 | int QmlTableViewModel::columnCount(const QModelIndex &parent) const 22 | { 23 | Q_UNUSED(parent) 24 | return 3; 25 | } 26 | 27 | QVariant QmlTableViewModel::data(const QModelIndex &index, int role) const 28 | { 29 | return m_aryData[index.row()][role]; 30 | } 31 | 32 | QHash QmlTableViewModel::roleNames() const 33 | { 34 | QHash roles; 35 | roles[OneRole] = "1"; 36 | roles[TwoRole] = "2"; 37 | roles[ThreeRole] = "3"; 38 | return roles; 39 | } 40 | 41 | void QmlTableViewModel::Add(QString one, QString two, QString three) 42 | { 43 | beginInsertRows(QModelIndex(), m_aryData.size(), m_aryData.size()); 44 | QVector list; 45 | list.push_back(one); 46 | list.push_back(two); 47 | list.push_back(three); 48 | m_aryData.push_back(list); 49 | endInsertRows(); 50 | } 51 | 52 | void QmlTableViewModel::Set(int row, int column, QString text) 53 | { 54 | if (row == -1){return;} 55 | if (column == -1){return;} 56 | beginResetModel(); 57 | m_aryData[row][column] = text; 58 | endResetModel(); 59 | } 60 | 61 | void QmlTableViewModel::Del() 62 | { 63 | if (m_aryData.size() <= 0) return; 64 | beginRemoveRows(QModelIndex(), m_aryData.size() - 1, m_aryData.size() - 1); 65 | m_aryData.removeLast(); 66 | endRemoveRows(); 67 | } 68 | 69 | void QmlTableViewModel::Refresh() 70 | { 71 | beginResetModel(); 72 | endResetModel(); 73 | } 74 | -------------------------------------------------------------------------------- /QmlTableView/QmlTableView.h: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlTableView.h 3 | *@brief QmlTableView 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #pragma once 9 | #include 10 | #include 11 | 12 | enum Role { 13 | OneRole, 14 | TwoRole, 15 | ThreeRole 16 | }; 17 | 18 | class QmlTableViewModel : public QAbstractTableModel 19 | { 20 | Q_OBJECT 21 | public: 22 | explicit QmlTableViewModel(); 23 | int rowCount(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE; 24 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 25 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 26 | QHash roleNames() const Q_DECL_OVERRIDE; 27 | 28 | Q_INVOKABLE void Add(QString one, QString two, QString three); 29 | Q_INVOKABLE void Set(int row, int column, QString text); 30 | Q_INVOKABLE void Del(); 31 | Q_INVOKABLE void Refresh(); 32 | private: 33 | QVector> m_aryData; 34 | }; 35 | -------------------------------------------------------------------------------- /QmlTableView/QmlTableView.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp \ 12 | qmlTableView.cpp 13 | 14 | HEADERS += \ 15 | qmlTableView.h 16 | 17 | RESOURCES += qml.qrc 18 | -------------------------------------------------------------------------------- /QmlTableView/QmlTableView.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlTableView.qml 3 | *@brief QmlTableView 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.8 9 | import QtQuick.Controls 1.4 10 | 11 | TableView { 12 | property alias tableView: tableView 13 | 14 | id: tableView 15 | TableViewColumn {title: "1"; role: "1"; width: 120} 16 | TableViewColumn {title: "2"; role: "2"; width: 120} 17 | TableViewColumn {title: "3"; role: "3"; width: 120} 18 | model: theModel 19 | alternatingRowColors: false 20 | backgroundVisible: false 21 | } 22 | -------------------------------------------------------------------------------- /QmlTableView/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include "QmlTableView.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 16 | QGuiApplication app(argc, argv); 17 | QQmlApplicationEngine engine; 18 | QmlTableViewModel model; 19 | model.Add(QStringLiteral("初始化"), QStringLiteral("999"), QStringLiteral("888")); 20 | engine.rootContext()->setContextProperty("theModel", &model); 21 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 22 | 23 | return app.exec(); 24 | } 25 | -------------------------------------------------------------------------------- /QmlTableView/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.8 9 | import QtQuick.Controls 2.1 10 | 11 | ApplicationWindow { 12 | id: frmWindow 13 | title: qsTr("QmlTableView") 14 | width: 400 15 | height: 300 16 | visible: true 17 | onClosing: {qmlTableView.enabled = false;} 18 | 19 | QmlTableView{ 20 | id: qmlTableView 21 | height: frmWindow.height - 40 22 | width: parent.width 23 | tableView.itemDelegate:Rectangle { 24 | TextField{ 25 | id: textField 26 | height: 25 27 | text: styleData.value 28 | selectByMouse: true 29 | onEditingFinished: { 30 | theModel.Set(styleData.row, styleData.column, textField.text); 31 | } 32 | visible: (styleData.column !== 0) 33 | } 34 | Image{ 35 | id: image 36 | height: 25 37 | width: 25 38 | source: "qrc:/Face.png" 39 | visible: (styleData.column === 0) 40 | } 41 | } 42 | tableView.rowDelegate: Rectangle { 43 | height: 25 44 | } 45 | } 46 | 47 | Row{ 48 | anchors.bottom: parent.bottom 49 | height: 40 50 | width: parent.width 51 | Button{ 52 | text: qsTr("Add") 53 | onClicked: { 54 | theModel.Add("111",222,3.33); 55 | } 56 | } 57 | Button{ 58 | text: qsTr("Del") 59 | onClicked: { 60 | theModel.Del(); 61 | } 62 | } 63 | Button{ 64 | text: qsTr("Refresh") 65 | onClicked: { 66 | theModel.Refresh(); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /QmlTableView/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlTableView.qml 5 | Face.png 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlTableView/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlTableView/show.gif -------------------------------------------------------------------------------- /QmlTextEditDrop/QmlTextEditDrop.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlTextEditDrop/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlTextEditDrop/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("QmlTextEdit接受拖放") 17 | 18 | TextEdit{ 19 | id: textEdit 20 | height: parent.height 21 | width: parent.width 22 | DropArea{ 23 | anchors.fill: parent 24 | onDropped: { 25 | if (drop.hasUrls){ 26 | console.debug("拖放了文件: " + drop.urls.length); 27 | for(var i = 0; i < drop.urls.length; i++){ 28 | console.debug("文件: " + drop.urls[i]); 29 | textEdit.append("文件: " + drop.urls[i]) 30 | } 31 | } 32 | else if (drop.hasText){ 33 | console.debug("拖放了本文: " + drop.text.length); 34 | console.debug("文本: " + drop.text); 35 | textEdit.append("文本: " + drop.text) 36 | } 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /QmlTextEditDrop/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlTextEditDrop/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlTextEditDrop/show.gif -------------------------------------------------------------------------------- /QmlTextEditScrollBar/QmlTextEditScrollBar.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlTextEditScrollBar/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlTextEditScrollBar/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("QmlTextEdit带滚动条") 17 | 18 | Rectangle { 19 | id: frame 20 | clip: true 21 | width: parent.width 22 | height: parent.height 23 | border.color: "black" 24 | anchors.centerIn: parent 25 | anchors.top: parent.bottom 26 | anchors.left: parent.left 27 | focus: true 28 | 29 | Keys.onUpPressed: vbar.decrease() 30 | Keys.onDownPressed: vbar.increase() 31 | 32 | TextEdit { 33 | id: textEdit 34 | text: "ABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKLABCDEFGHIJKL" 35 | font.pointSize: 14 36 | height: contentHeight 37 | width: frame.width - vbar.width 38 | y: -vbar.position * textEdit.height 39 | wrapMode: TextEdit.Wrap 40 | selectByKeyboard: true 41 | selectByMouse: true 42 | 43 | MouseArea{ 44 | anchors.fill: parent 45 | onWheel: { 46 | if (wheel.angleDelta.y > 0) { 47 | vbar.decrease(); 48 | } 49 | else { 50 | vbar.increase(); 51 | } 52 | } 53 | onClicked: { 54 | textEdit.forceActiveFocus(); 55 | } 56 | } 57 | } 58 | 59 | ScrollBar { 60 | id: vbar 61 | hoverEnabled: true 62 | active: hovered || pressed 63 | orientation: Qt.Vertical 64 | size: frame.height / textEdit.height 65 | width: 10 66 | anchors.top: parent.top 67 | anchors.right: parent.right 68 | anchors.bottom: parent.bottom 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /QmlTextEditScrollBar/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /QmlTextEditScrollBar/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlTextEditScrollBar/show.gif -------------------------------------------------------------------------------- /QmlToggleButton/QmlToggleButton.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlToggleButton/QmlToggleButton.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlToggleButton.qml 3 | *@brief Qml选择开关 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.0 9 | 10 | Rectangle { 11 | id: root 12 | width: 80 13 | height: 26 14 | color: "#EAEAEA" 15 | radius: 12 16 | 17 | property string leftString 18 | property string rightString 19 | signal toggleLeft 20 | signal toggleRight 21 | 22 | Rectangle { 23 | id: rect 24 | width: parent.width * 0.6 25 | radius: parent.radius 26 | color: rect.state == "left"? "#4040FF" : "#CCCCCC" 27 | state: "left" 28 | anchors { 29 | top: parent.top 30 | bottom: parent.bottom 31 | } 32 | 33 | states: [ 34 | State { 35 | name: "right" 36 | PropertyChanges { 37 | target: rect 38 | x: root.width - rect.width 39 | } 40 | } 41 | 42 | ] 43 | 44 | transitions: [ 45 | Transition { 46 | from: "*" 47 | to: "*" 48 | NumberAnimation { property: "x"; duration: 200 } 49 | } 50 | ] 51 | 52 | Text { 53 | id: label 54 | anchors.centerIn: parent 55 | text: rect.state == "left"? root.leftString : root.rightString 56 | color: "white" 57 | font.pointSize: 10 58 | } 59 | } 60 | 61 | MouseArea { 62 | anchors.fill: parent 63 | onPressed: { 64 | if(rect.state == "left"){ 65 | rect.state = "right"; 66 | root.toggleRight(); 67 | }else { 68 | rect.state = "left"; 69 | root.toggleLeft(); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /QmlToggleButton/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlToggleButton/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtQuick.Layouts 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("Qml选择开关") 17 | 18 | Label{ 19 | id: label 20 | anchors.bottom: qmlToggleButton.top 21 | anchors.horizontalCenter: parent.horizontalCenter 22 | height: 24 23 | width: contentWidth 24 | } 25 | 26 | QmlToggleButton{ 27 | id: qmlToggleButton 28 | anchors.centerIn: parent 29 | height: 26 30 | width: 80 31 | leftString: qsTr("打开") 32 | rightString: qsTr("关闭") 33 | onToggleLeft: label.text = qmlToggleButton.leftString 34 | onToggleRight: label.text = qmlToggleButton.rightString 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /QmlToggleButton/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlToggleButton.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlToggleButton/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlToggleButton/show.gif -------------------------------------------------------------------------------- /QmlUpDownRefresh/QmlBusyIndicator.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file QmlBusyIndicator.qml 3 | *@brief Qml自定义等待指示器 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtGraphicalEffects 1.0 10 | 11 | Item { 12 | 13 | Rectangle { 14 | id: rect 15 | width: parent.width 16 | height: parent.height 17 | color: Qt.rgba(0, 0, 0, 0) 18 | radius: width / 2 19 | border.width: width / 6 20 | visible: false 21 | } 22 | 23 | ConicalGradient { 24 | width: rect.width 25 | height: rect.height 26 | gradient: Gradient { 27 | GradientStop { position: 0.0; color: "#80c342" } 28 | GradientStop { position: 1.0; color: "#006325" } 29 | } 30 | source: rect 31 | 32 | Rectangle { 33 | anchors.top: parent.top 34 | anchors.horizontalCenter: parent.horizontalCenter 35 | width: rect.border.width 36 | height: width 37 | radius: width / 2 38 | color: "#006325" 39 | } 40 | 41 | RotationAnimation on rotation { 42 | from: 0 43 | to: 360 44 | duration: 800 45 | loops: Animation.Infinite 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /QmlUpDownRefresh/QmlUpDownRefresh.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | -------------------------------------------------------------------------------- /QmlUpDownRefresh/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 14 | QGuiApplication app(argc, argv); 15 | 16 | QQmlApplicationEngine engine; 17 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 18 | 19 | return app.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /QmlUpDownRefresh/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | QmlBusyIndicator.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /QmlUpDownRefresh/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlUpDownRefresh/show.gif -------------------------------------------------------------------------------- /QmlWinExtras/Chat_FriendManagerG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlWinExtras/Chat_MsgRecordG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlWinExtras/Main_P2PChatG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlWinExtras/Mobile_FindG.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /QmlWinExtras/QmlWinExtras.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick winextras 8 | 9 | CONFIG += c++11 10 | 11 | SOURCES += main.cpp 12 | 13 | RESOURCES += qml.qrc 14 | 15 | win32{ 16 | RESOURCES += QmlWinExtras.qrc 17 | RC_FILE = QmlWinExtras.rc 18 | } -------------------------------------------------------------------------------- /QmlWinExtras/QmlWinExtras.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | logo.ico 4 | QmlWinExtras.rc 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /QmlWinExtras/QmlWinExtras.rc: -------------------------------------------------------------------------------- 1 | #include "winver.h" 2 | 3 | IDI_ICON1 ICON DISCARDABLE "logo.ico" 4 | 5 | VS_VERSION_INFO VERSIONINFO 6 | FILEVERSION 1,0,0,0 7 | PRODUCTVERSION 1,0,0,0 8 | FILEFLAGS 0x0L 9 | FILEFLAGSMASK 0x3fL 10 | FILEOS 0x00040004L 11 | FILETYPE 0x1L 12 | FILESUBTYPE 0x0L 13 | BEGIN 14 | BLOCK "StringFileInfo" 15 | BEGIN 16 | BLOCK "080404b0" 17 | BEGIN 18 | VALUE "CompanyName", "zhengtianzuo" 19 | VALUE "FileDescription", "QmlWinExtras" 20 | VALUE "FileVersion", "1.0.0.0" 21 | VALUE "InternalName", "QmlWinExtras.exe" 22 | VALUE "LegalCopyright", "Copyright (C) 2003-2103 CamelSoft Corporation" 23 | VALUE "OriginalFilename","QmlWinExtras.exe" 24 | VALUE "ProductName", "QmlWinExtras" 25 | VALUE "ProductVersion", "1.0.0.0" 26 | END 27 | END 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0804, 1200 31 | END 32 | END 33 | -------------------------------------------------------------------------------- /QmlWinExtras/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlWinExtras/logo.ico -------------------------------------------------------------------------------- /QmlWinExtras/main.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.cpp 3 | *@brief 程序主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | #include 9 | #include 10 | #include 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 15 | QGuiApplication app(argc, argv); 16 | 17 | QQmlApplicationEngine engine; 18 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 19 | 20 | return app.exec(); 21 | } 22 | -------------------------------------------------------------------------------- /QmlWinExtras/main.qml: -------------------------------------------------------------------------------- 1 | /*! 2 | *@file main.qml 3 | *@brief 主文件 4 | *@version 1.0 5 | *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation 6 | *@author zhengtianzuo 7 | */ 8 | import QtQuick 2.7 9 | import QtQuick.Controls 2.0 10 | import QtWinExtras 1.0 11 | 12 | ApplicationWindow { 13 | visible: true 14 | width: 400 15 | height: 300 16 | title: qsTr("QmlWinExtras") 17 | 18 | TaskbarButton { 19 | property real proValue: 0 20 | property alias interval: timer.interval 21 | 22 | function isRunning(){ 23 | return(timer.running) 24 | } 25 | 26 | function onStart(){ 27 | taskbar.proValue = 0; 28 | timer.running = true; 29 | } 30 | 31 | function onStop(){ 32 | timer.running = false; 33 | } 34 | 35 | id: taskbar 36 | overlay.iconSource: "qrc:/logo.ico" 37 | overlay.accessibleDescription: qsTr("加载中...") 38 | progress.visible: (progress.value != 0) 39 | progress.value: taskbar.proValue 40 | 41 | Timer{ 42 | id: timer 43 | running: false 44 | repeat: true 45 | interval: 20 46 | onTriggered:{ 47 | taskbar.proValue++; 48 | if (taskbar.proValue > 100){ 49 | taskbar.onStop(); 50 | return; 51 | } 52 | } 53 | } 54 | } 55 | 56 | Button{ 57 | id: btnTaskbar 58 | height: 24 59 | width: 120 60 | anchors.centerIn: parent 61 | text: taskbar.isRunning() ? qsTr("结束") : qsTr("开始") 62 | onClicked: { 63 | if (taskbar.isRunning()){ 64 | taskbar.onStop(); 65 | }else{ 66 | taskbar.onStart(); 67 | } 68 | } 69 | } 70 | 71 | ThumbnailToolBar { 72 | ThumbnailToolButton { 73 | iconSource: "qrc:/Chat_MsgRecordG.svg" 74 | tooltip: qsTr("消息") 75 | } 76 | ThumbnailToolButton { 77 | iconSource: "qrc:/Chat_FriendManagerG.svg" 78 | tooltip: qsTr("联系人") 79 | } 80 | ThumbnailToolButton { 81 | iconSource: "qrc:/Mobile_FindG.svg" 82 | tooltip: qsTr("发现") 83 | } 84 | ThumbnailToolButton { 85 | iconSource: "qrc:/Main_P2PChatG.svg" 86 | tooltip: qsTr("我") 87 | onClicked: { 88 | Qt.quit() 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /QmlWinExtras/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | Chat_FriendManagerG.svg 5 | Chat_MsgRecordG.svg 6 | Main_P2PChatG.svg 7 | Mobile_FindG.svg 8 | 9 | 10 | -------------------------------------------------------------------------------- /QmlWinExtras/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QmlWinExtras/show.gif -------------------------------------------------------------------------------- /QtQuickExamples.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsgxeva/QtQuickExamples/646e1566a1ef122d4a58aa2e01da301c723087df/QtQuickExamples.jpg -------------------------------------------------------------------------------- /QtQuickExamples.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Copyright (C) 2003-2103 CamelSoft Corporation 4 | # 5 | #------------------------------------------------- 6 | 7 | TEMPLATE = subdirs 8 | SUBDIRS += QmlBusyIndicator 9 | SUBDIRS += QmlCheckBox 10 | SUBDIRS += QmlDragDrop 11 | SUBDIRS += QmlFace 12 | SUBDIRS += QmlHyperlink 13 | SUBDIRS += QmlImageProvider 14 | SUBDIRS += QmlLog4Qml 15 | SUBDIRS += QmlPlugin\QmlPlugin 16 | SUBDIRS += QmlPlugin\QmlPluginTest 17 | SUBDIRS += QmlPopMenu 18 | SUBDIRS += QmlCircular 19 | SUBDIRS += QmlRotationAnimation 20 | SUBDIRS += QmlShowSideWindow 21 | SUBDIRS += QmlSign 22 | SUBDIRS += QmlSlidingMenu 23 | SUBDIRS += QmlStackView 24 | SUBDIRS += QmlTabBar 25 | SUBDIRS += QmlTableView 26 | SUBDIRS += QmlTextEditDrop 27 | SUBDIRS += QmlTextEditScrollBar 28 | SUBDIRS += QmlToggleButton 29 | SUBDIRS += QmlCircularProgress 30 | SUBDIRS += QmlFontList 31 | SUBDIRS += QmlFlipImage 32 | SUBDIRS += QmlGrayImage 33 | SUBDIRS += QmlProgress 34 | SUBDIRS += QmlWinExtras 35 | SUBDIRS += QmlCalendar 36 | SUBDIRS += QmlCanvasText 37 | SUBDIRS += QmlKey 38 | SUBDIRS += QmlLoader 39 | SUBDIRS += QmlInvertedImage 40 | SUBDIRS += QmlFontAwesome 41 | SUBDIRS += QmlListSlidDelete 42 | SUBDIRS += QmlCircularProgressButton 43 | SUBDIRS += QmlPageNavigation 44 | SUBDIRS += QmlUpDownRefresh 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QtQuickExamples.jpg?raw=true) 3 | 4 | # QtQuickExamples 5 | QtQuick相关的技术分享 6 | 7 | 访问博客[CSDN博客](http://blog.csdn.net/zhengtianzuo06) 8 | 9 | ![](https://img.shields.io/badge/%E7%89%88%E6%9D%83%E8%AE%B8%E5%8F%AF-MIT-orange.svg) 10 | ![](https://img.shields.io/badge/Qt-5.9-blue.svg) 11 | ![](https://img.shields.io/badge/VS-2015-blue.svg) 12 | ![](https://img.shields.io/badge/QtQuick-2.0-blue.svg) 13 | ![](https://img.shields.io/badge/%E7%89%88%E6%9C%AC-1.0.0.0-blue.svg) 14 | ![](https://img.shields.io/badge/%E7%BC%96%E8%AF%91-%E6%88%90%E5%8A%9F-brightgreen.svg) 15 | 16 | QmlBusyIndicator: Qml自定义等待指示器 17 | 18 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlBusyIndicator/show.gif?raw=true) 19 | 20 | 21 | QmlCheckBox: Qml自定义复选框 22 | 23 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlCheckBox/show.gif?raw=true) 24 | 25 | 26 | QmlDragDrop: Qml拖放 27 | 28 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlDragDrop/show.gif?raw=true) 29 | 30 | 31 | QmlFace: Qml表情选择框 32 | 33 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlFace/show.gif?raw=true) 34 | 35 | 36 | QmlHyperlink: Qml超链接 37 | 38 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlHyperlink/show.gif?raw=true) 39 | 40 | 41 | QmlImageProvider: QmlImageProvider 42 | 43 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlImageProvider/show.jpg?raw=true) 44 | 45 | 46 | QmlLog4Qml: Qml写日志 47 | 48 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlLog4Qml/show.jpg?raw=true) 49 | 50 | 51 | QmlPlugin: Qml调用插件 52 | 53 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlPlugin/QmlPluginTest/show.gif?raw=true) 54 | 55 | 56 | QmlPopMenu: Qml弹出菜单 57 | 58 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlPopMenu/show.gif?raw=true) 59 | 60 | 61 | QmlCircular: Qml圆形图片 62 | 63 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlCircular/show.jpg?raw=true) 64 | 65 | 66 | QmlRotationAnimation: Qml旋转箭头 67 | 68 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlRotationAnimation/show.gif?raw=true) 69 | 70 | 71 | QmlShowSideWindow: Qml弹出右侧信息弹窗 72 | 73 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlShowSideWindow/show.gif?raw=true) 74 | 75 | 76 | QmlSign: Qml签名修改 77 | 78 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlSign/show.gif?raw=true) 79 | 80 | 81 | QmlSlidingMenu: Qml侧边滑动菜单 82 | 83 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlSlidingMenu/show.gif?raw=true) 84 | 85 | 86 | QmlStackView: Qml堆栈窗体 87 | 88 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlStackView/show.gif?raw=true) 89 | 90 | 91 | QmlTabBar: Qml底部导航 92 | 93 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlTabBar/show.gif?raw=true) 94 | 95 | 96 | QmlTableView: QmlTableView 97 | 98 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlTableView/show.gif?raw=true) 99 | 100 | 101 | QmlTextEditDrop: QmlTextEdit接受拖放 102 | 103 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlTextEditDrop/show.gif?raw=true) 104 | 105 | 106 | QmlTextEditScrollBar: QmlTextEdit带滚动条 107 | 108 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlTextEditScrollBar/show.gif?raw=true) 109 | 110 | 111 | QmlToggleButton: Qml选择开关 112 | 113 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlToggleButton/show.gif?raw=true) 114 | 115 | 116 | QmlCircularProgress: Qml圆形进度条 117 | 118 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlCircularProgress/show.gif?raw=true) 119 | 120 | 121 | QmlFontList: Qml获取字体列表 122 | 123 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlFontList/show.gif?raw=true) 124 | 125 | 126 | QmlFlipImage: Qml翻转效果 127 | 128 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlFlipImage/show.gif?raw=true) 129 | 130 | 131 | QmlGrayImage: Qml图片转灰度 132 | 133 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlGrayImage/show.jpg?raw=true) 134 | 135 | 136 | QmlProgress: Qml进度条 137 | 138 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlProgress/show.gif?raw=true) 139 | 140 | 141 | QmlWinExtras: QmlWinExtras 142 | 143 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlWinExtras/show.gif?raw=true) 144 | 145 | 146 | QmlCalendar:Qml日历 147 | 148 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlCalendar/show.gif?raw=true) 149 | 150 | 151 | QmlCanvasText: QmlCanvas文字 152 | 153 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlCanvasText/show.jpg?raw=true) 154 | 155 | 156 | QmlKey: Qml全局按键 157 | 158 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlKey/show.gif?raw=true) 159 | 160 | 161 | QmlLoader: QmlLoader 162 | 163 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlLoader/show.gif?raw=true) 164 | 165 | 166 | QmlInvertedImage: Qml倒影 167 | 168 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlInvertedImage/show.jpg?raw=true) 169 | 170 | 171 | QmlFontAwesome: Qml使用FontAwesome 172 | 173 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlFontAwesome/show.jpg?raw=true) 174 | 175 | 176 | QmlListSlidDelete: Qml滑动删除 177 | 178 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlListSlidDelete/show.gif?raw=true) 179 | 180 | 181 | QmlCircularProgressButton: Qml圆形进度按钮 182 | 183 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlCircularProgressButton/show.gif?raw=true) 184 | 185 | 186 | QmlPageNavigation: Qml分页显示 187 | 188 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlPageNavigation/show.gif?raw=true) 189 | 190 | 191 | QmlLanguage: Qml动态语言切换 192 | 193 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlLanguage/show.gif?raw=true) 194 | 195 | 196 | QmlUpDownRefresh: Qml上拉下拉刷新 197 | 198 | ![](https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlUpDownRefresh/show.gif?raw=true) 199 | --------------------------------------------------------------------------------