├── .qmake.stash
├── AReadmeQrc
├── 1-001.gif
├── 1-002-1.gif
├── 2-001.gif
├── 2-002.gif
├── 2-003-1.gif
├── 2-003-2.gif
├── 2-003-3.gif
├── 2-003-4.gif
├── 2-003-5.gif
├── 2-003-6.gif
├── 2-004.gif
├── 2-005.gif
├── 2-006.gif
├── 3-002-1.gif
├── 5-001.gif
└── AReadme.pro
├── CanvasSector
├── CanvasSector.pro
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── canvasSector.qml
├── debug
│ ├── CanvasSector.exe
│ ├── CanvasSector.ilk
│ ├── CanvasSector.pdb
│ ├── CanvasSector.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── images
│ ├── Oil.svg
│ ├── Oil1.svg
│ └── Oil2.svg
├── main.cpp
├── main.qml
└── qml.qrc
├── Communication.zip
├── Communication
├── Communication.pro
├── Communication.qrc
├── README.md
├── app
│ ├── Customer.cpp
│ ├── Customer.h
│ ├── CustomerProtocol.cpp
│ ├── CustomerProtocol.h
│ ├── MultiCustomManager.cpp
│ └── MultiCustomManager.h
├── core
│ ├── UserApplication.cc
│ └── UserApplication.h
├── main.cpp
├── main.qml
├── qgcimages.qrc
└── src
│ ├── Backup
│ ├── TCPClient.cc
│ ├── TCPClient.h
│ ├── TCPServer.cc
│ └── TCPServer.h
│ ├── Communication
│ ├── Image
│ │ ├── Disconnect.svg
│ │ ├── Monitor.svg
│ │ ├── Send.svg
│ │ └── arrow-down.png
│ ├── LinkConfiguration.cc
│ ├── LinkConfiguration.h
│ ├── LinkInterface.cc
│ ├── LinkInterface.h
│ ├── LinkManager.cc
│ ├── LinkManager.h
│ ├── QGCSerialPortInfo.cc
│ ├── QmlFile
│ │ ├── BluetoothSettings.qml
│ │ ├── LinkSettings.qml
│ │ ├── SerialSettings.qml
│ │ ├── TcpSettings.qml
│ │ ├── UdpSettings.qml
│ │ └── qmldir
│ ├── TCPLink.cc
│ ├── TCPLink.h
│ ├── UDPLink.cc
│ ├── UDPLink.h
│ ├── UdpIODevice.cc
│ └── UdpIODevice.h
│ ├── QmlControls
│ ├── QmlButton.qml
│ ├── QmlButton1.qml
│ ├── QmlButton11.qml
│ ├── QmlButton2.qml
│ ├── QmlButton4.qml
│ ├── QmlButton5.qml
│ ├── QmlCheckBox.qml
│ ├── QmlColoredImage.qml
│ ├── QmlComboBox.qml
│ ├── QmlGradientImage.qml
│ ├── QmlHoverHoriButton.qml
│ ├── QmlHoverVertButton.qml
│ ├── QmlImageButton.qml
│ ├── QmlInnerLabel.qml
│ ├── QmlLabel.qml
│ ├── QmlMenuButton.qml
│ ├── QmlRadioButton.qml
│ ├── QmlSliderSwitch.qml
│ ├── QmlSpecialLabel.qml
│ ├── QmlTextField.qml
│ ├── QmlToolStrip.qml
│ ├── ScreenTools.qml
│ └── qmldir
│ └── QmlGeneral
│ ├── QmlObjectListModel.cc
│ ├── QmlObjectListModel.h
│ ├── QmlPalette.cc
│ ├── QmlPalette.h
│ ├── ScreenTools.qml
│ └── qmldir
├── CrazyMath.zip
├── CrazyMath
├── CrazyMath.pro
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── MathProblem.cpp
├── MathProblem.h
├── MathProblem
│ ├── MathProblem.cpp
│ └── MathProblem.h
├── Qml
│ ├── GameContentView.qml
│ ├── GameOverView.qml
│ └── GameStartView.qml
├── QmlControls
│ ├── CCButton.qml
│ ├── CCColoredImage.qml
│ ├── CCHoverHoriButton.qml
│ ├── CCHoverHorzButton.qml
│ ├── CCLabel.qml
│ ├── CCVertRect.qml
│ └── qmldir
├── SettingValues
│ ├── Values.cc
│ └── Values.h
├── Translations
│ ├── lrelease
│ ├── zh_CN.qm
│ └── zh_CN.ts
├── android-libCrazyMath.so-deployment-settings.json
├── android
│ ├── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── res
│ │ ├── drawable-hdpi
│ │ └── icon.png
│ │ ├── drawable-ldpi
│ │ └── icon.png
│ │ ├── drawable-mdpi
│ │ └── icon.png
│ │ └── values
│ │ └── libs.xml
├── debug
│ ├── CrazyMath.exe
│ ├── CrazyMath.ilk
│ ├── CrazyMath.pdb
│ ├── CrazyMath.vc.pdb
│ ├── MathProblem.obj
│ ├── Values.obj
│ ├── main.obj
│ ├── moc_MathProblem.cpp
│ ├── moc_MathProblem.obj
│ ├── moc_Values.cpp
│ ├── moc_Values.obj
│ ├── moc_predefs.h
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── images
│ ├── Clock.svg
│ ├── Correct.svg
│ ├── Error.svg
│ ├── Restart.svg
│ ├── Start.svg
│ └── equal.png
├── language.zh_CN.qm
├── language.zh_CN.ts
├── libCrazyMath.so
├── main.cpp
├── main.qml
├── qml.qrc
├── zh_CN.qm
└── zh_CN.ts
├── LICENSE
├── Makefile
├── MapFermatSpiral
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── MapFermatSpiral.pro
├── debug
│ ├── MapFermatSpiral.exe
│ ├── MapFermatSpiral.ilk
│ ├── MapFermatSpiral.pdb
│ ├── MapFermatSpiral.vc.pdb
│ ├── fermatspiralpath.obj
│ ├── main.obj
│ ├── moc_fermatspiralpath.cpp
│ ├── moc_fermatspiralpath.obj
│ ├── moc_predefs.h
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── fermatspiralpath.cpp
├── fermatspiralpath.h
├── main.cpp
├── main.qml
└── qml.qrc
├── MapGetdistance
├── Getdistance.qml
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── MapGetdistance.pro
├── debug
│ ├── MapGetdistance.exe
│ ├── MapGetdistance.ilk
│ ├── MapGetdistance.pdb
│ ├── MapGetdistance.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── main.cpp
├── main.qml
└── qml.qrc
├── MenuForButton
├── ColoredImage.qml
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── MenuForButton.pro
├── MyButton.qml
├── TestPage3.qml
├── debug
│ ├── MenuForButton.exe
│ ├── MenuForButton.ilk
│ ├── MenuForButton.pdb
│ ├── MenuForButton.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── images
│ ├── code.jpg
│ ├── dir1.png
│ ├── dir2.png
│ ├── dir3.png
│ ├── dir4.png
│ ├── dir5.png
│ ├── focus.jpg
│ ├── line.png
│ ├── menu.png
│ └── working.jpg
├── main.cpp
├── main.qml
├── qml.qrc
├── slidier
│ ├── ArtificialHorizonMain.qml.autosave
│ ├── ColorRect.qml
│ └── SlidierMain.qml
├── testPage1.qml
└── testPage2.qml
├── MenuForListview
├── ColoredImage.qml
├── ListviewMenu.qml
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── MenuForListview.pro
├── debug
│ ├── MenuForListview.exe
│ ├── MenuForListview.ilk
│ ├── MenuForListview.pdb
│ ├── MenuForListview.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── images
│ ├── code.jpg
│ ├── dir1.png
│ ├── dir2.png
│ ├── dir3.png
│ ├── dir4.png
│ ├── dir5.png
│ ├── focus.jpg
│ ├── line.png
│ ├── menu.png
│ └── working.jpg
├── main.cpp
├── main.qml
└── qml.qrc
├── MenuForRepeater
├── ColoredImage.qml
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── MenuForRepeater.pro
├── RepeaterMenu.qml
├── debug
│ ├── MenuForRepeater.exe
│ ├── MenuForRepeater.ilk
│ ├── MenuForRepeater.pdb
│ ├── MenuForRepeater.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── images
│ ├── code.jpg
│ ├── dir1.png
│ ├── dir2.png
│ ├── dir3.png
│ ├── dir4.png
│ ├── dir5.png
│ ├── focus.jpg
│ └── working.jpg
├── main.cpp
├── main.qml
├── qml.qrc
└── qml
│ └── slidier
│ ├── ColorRect.qml
│ └── SlidierMain.qml
├── MenuForTabBar
├── ColoredImage.qml
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── MenuForTabBar.pro
├── debug
│ ├── MenuForTabBar.exe
│ ├── MenuForTabBar.ilk
│ ├── MenuForTabBar.pdb
│ ├── MenuForTabBar.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── images
│ ├── code.jpg
│ ├── dir1.png
│ ├── dir2.png
│ ├── dir3.png
│ ├── dir4.png
│ ├── dir5.png
│ ├── focus.jpg
│ ├── line.png
│ ├── menu.png
│ └── working.jpg
├── main.cpp
├── main.qml
└── qml.qrc
├── NetTools
├── NetTools.pro
├── controls
│ ├── CCButton1.qml
│ ├── CCColoredImage.qml
│ ├── CCGradientImage.qml
│ ├── CCHoverHoriButton.qml
│ ├── CCLabel.qml
│ ├── CCMenuButton.qml
│ ├── CCRadioButton.qml
│ ├── CCTextField.qml
│ └── Controls
│ │ └── qmldir
├── images
│ ├── Disconnect.svg
│ ├── Monitor.svg
│ └── Send.svg
├── main.cpp
├── main.qml
├── qml.qrc
└── src
│ ├── QmlControls
│ ├── QmlObjectListModel.cc
│ └── QmlObjectListModel.h
│ ├── TCPClient.cc
│ ├── TCPClient.h
│ ├── TCPServer.cc
│ └── TCPServer.h
├── ParaProgressBar
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── ParaProgressBar.pro
├── Parallelogram.qml
├── debug
│ ├── ParaProgressBar.exe
│ ├── ParaProgressBar.ilk
│ ├── ParaProgressBar.pdb
│ ├── ParaProgressBar.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── main.cpp
├── main.qml
└── qml.qrc
├── Popup
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── Popup.pro
├── Test.qml
├── debug
│ ├── Popup.exe
│ ├── Popup.ilk
│ ├── Popup.pdb
│ ├── Popup.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── main.cpp
├── main.qml
└── qml.qrc
├── QmlLearningPro.pro
├── QmlLearningPro.pro.user
├── QmlLearningPro.pro.user.6563d66
├── QmlLearningPro.pro.user.72bd40a
├── QmlLearningPro.pro.user.7723631
├── QmlLearningPro.pro.user.c3dca0e
├── QmlLearningPro.pro.user.f38911c
├── README.md
├── TableView
├── TableView.pro
├── TargetCoordinate.cpp
├── TargetCoordinate.h
├── main.cpp
├── main.qml
└── qml.qrc
├── TranslationsDemo
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── TranslationTest.cpp
├── TranslationTest.h
├── Translations
│ ├── zh_CN.qm
│ └── zh_CN.ts
├── TranslationsDemo.pro
├── debug
│ ├── TranslationTest.obj
│ ├── TranslationsDemo.exe
│ ├── TranslationsDemo.ilk
│ ├── TranslationsDemo.pdb
│ ├── TranslationsDemo.vc.pdb
│ ├── main.obj
│ ├── moc_TranslationTest.cpp
│ ├── moc_TranslationTest.obj
│ ├── moc_predefs.h
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── main.cpp
├── main.qml
└── qml.qrc
├── VirtualJoystick
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── VirtualJoystick.pro
├── android
│ ├── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── res
│ │ ├── drawable-hdpi
│ │ └── icon.png
│ │ ├── drawable-ldpi
│ │ └── icon.png
│ │ ├── drawable-mdpi
│ │ └── icon.png
│ │ └── values
│ │ └── libs.xml
├── debug
│ ├── VirtualJoystick.exe
│ ├── VirtualJoystick.ilk
│ ├── VirtualJoystick.pdb
│ ├── VirtualJoystick.vc.pdb
│ ├── main.obj
│ ├── qrc_qml.cpp
│ └── qrc_qml.obj
├── images
│ ├── Cat.png
│ ├── Cat.svg
│ ├── Dog.png
│ ├── Dog.svg
│ ├── Down.svg
│ ├── JoystickBezelLight.png
│ ├── Left.svg
│ ├── Right.svg
│ └── Up.svg
├── main.cpp
├── main.qml
├── qml.qrc
├── qml
│ ├── JoystickThumbPad.qml
│ └── Output.qml
├── virtualJoystick.ico
├── virtualJoystick.png
└── virtualJoystick.svg
├── WordExportQml
├── .qmake.stash
├── Makefile
├── Makefile.Debug
├── Makefile.Release
├── Test.docx
├── main.cpp
├── main.qml
├── qWord.pro
├── qWord.pro.user
├── qWord.pro.user.f38911c
├── qml.qrc
└── src
│ ├── OfficeExporter.cpp
│ └── OfficeExporter.h
└── untitled
├── main.cpp
├── main.qml
├── qml.qrc
└── untitled.pro
/.qmake.stash:
--------------------------------------------------------------------------------
1 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
2 | QMAKE_CXX.QMAKE_MSC_VER = 1916
3 | QMAKE_CXX.QMAKE_MSC_FULL_VER = 191627045
4 | QMAKE_CXX.COMPILER_MACROS = \
5 | QT_COMPILER_STDCXX \
6 | QMAKE_MSC_VER \
7 | QMAKE_MSC_FULL_VER
8 | QMAKE_CXX.INCDIRS = \
9 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\ATLMFC\\include" \
10 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\include" \
11 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um" \
12 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt" \
13 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\shared" \
14 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\um" \
15 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\winrt" \
16 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt"
17 | QMAKE_CXX.LIBDIRS = \
18 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\ATLMFC\\lib\\x64" \
19 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\lib\\x64" \
20 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x64" \
21 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x64" \
22 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\um\\x64"
23 |
--------------------------------------------------------------------------------
/AReadmeQrc/1-001.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/1-001.gif
--------------------------------------------------------------------------------
/AReadmeQrc/1-002-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/1-002-1.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-001.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-001.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-002.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-002.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-003-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-003-1.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-003-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-003-2.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-003-3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-003-3.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-003-4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-003-4.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-003-5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-003-5.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-003-6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-003-6.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-004.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-004.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-005.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-005.gif
--------------------------------------------------------------------------------
/AReadmeQrc/2-006.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/2-006.gif
--------------------------------------------------------------------------------
/AReadmeQrc/3-002-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/3-002-1.gif
--------------------------------------------------------------------------------
/AReadmeQrc/5-001.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/AReadmeQrc/5-001.gif
--------------------------------------------------------------------------------
/AReadmeQrc/AReadme.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
32 | DISTFILES += \
33 | ../README.md \
34 | 1-001.gif \
35 | 1-002-1.gif \
36 | 2-001.gif \
37 | 2-002.gif \
38 | 2-003-1.gif \
39 | 2-003-2.gif \
40 | 2-003-3.gif \
41 | 2-003-4.gif \
42 | 2-003-5.gif \
43 | 2-003-6.gif \
44 | 2-004.gif \
45 | 2-005.gif \
46 | 2-006.gif \
47 | 5-001.gif
48 |
--------------------------------------------------------------------------------
/CanvasSector/CanvasSector.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
32 | DISTFILES +=
33 |
--------------------------------------------------------------------------------
/CanvasSector/debug/CanvasSector.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CanvasSector/debug/CanvasSector.exe
--------------------------------------------------------------------------------
/CanvasSector/debug/CanvasSector.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CanvasSector/debug/CanvasSector.ilk
--------------------------------------------------------------------------------
/CanvasSector/debug/CanvasSector.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CanvasSector/debug/CanvasSector.pdb
--------------------------------------------------------------------------------
/CanvasSector/debug/CanvasSector.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CanvasSector/debug/CanvasSector.vc.pdb
--------------------------------------------------------------------------------
/CanvasSector/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CanvasSector/debug/main.obj
--------------------------------------------------------------------------------
/CanvasSector/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CanvasSector/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/CanvasSector/images/Oil2.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CanvasSector/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | /////--中文测试
7 | bool ChineseTest(void) {
8 |
9 | QString str = "为什么的2df.dasf为 d啊 ";
10 | int LowerCase, UpperCase; //大写,小写
11 | int space = 0;
12 | int digit, character; //数字,字符
13 | int chinese = 0; //中文
14 | digit = character = LowerCase = UpperCase = 0;
15 | for (int i = 0; i < str.size(); )
16 | {
17 | if (str[i] >= 'a' && str[i] <= 'z')
18 | {
19 | LowerCase ++;i++;
20 | }
21 | else if (str[i] >= 'A' && str[i] <= 'Z')
22 | {
23 | UpperCase ++;i++;
24 | }
25 | else if (str[i] >= '0' && str[i] <= '9')
26 | {
27 | digit ++;i++;
28 | }
29 | ////通过utf-8字节码进行判断
30 | else if (str[i] >= 0xE0){
31 | char c[3];
32 | // strncpy(&c[0], &str[i], 3);
33 | i+=3;
34 | chinese++;
35 | }
36 | else if (str[i] == ' ')
37 | {
38 | space++;i++;
39 | }
40 | else
41 | {
42 | character++;i++;
43 | }
44 | }
45 | // qDebug() << QString("大写");
46 |
47 | qDebug() << QString("大写%1个,小写%2个,数字%3个,字符%4个,汉字%5个,空格%6个\n").arg(UpperCase).arg(LowerCase).arg(digit).arg(character).arg(chinese).arg(space);
48 | return 0;
49 | }
50 |
51 | int main(int argc, char *argv[])
52 | {
53 | ChineseTest();
54 |
55 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
56 |
57 | QGuiApplication app(argc, argv);
58 |
59 | QQmlApplicationEngine engine;
60 | const QUrl url(QStringLiteral("qrc:/main.qml"));
61 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
62 | &app, [url](QObject *obj, const QUrl &objUrl) {
63 | if (!obj && url == objUrl)
64 | QCoreApplication::exit(-1);
65 | }, Qt::QueuedConnection);
66 | engine.load(url);
67 |
68 | return app.exec();
69 | }
70 |
--------------------------------------------------------------------------------
/CanvasSector/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | canvasSector.qml
5 |
6 |
7 | images/Oil.svg
8 | images/Oil1.svg
9 | images/Oil2.svg
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Communication.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Communication.zip
--------------------------------------------------------------------------------
/Communication/Communication.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | src/Communication/QmlFile/BluetoothSettings.qml
5 | src/Communication/QmlFile/LinkSettings.qml
6 | src/Communication/QmlFile/qmldir
7 | src/Communication/QmlFile/SerialSettings.qml
8 | src/Communication/QmlFile/TcpSettings.qml
9 | src/Communication/QmlFile/UdpSettings.qml
10 | src/QmlControls/QmlButton.qml
11 | src/QmlControls/QmlButton2.qml
12 | src/QmlControls/QmlButton4.qml
13 | src/QmlControls/QmlButton5.qml
14 | src/QmlControls/QmlButton11.qml
15 | src/QmlControls/QmlCheckBox.qml
16 | src/QmlControls/qmldir
17 | src/QmlControls/QmlGradientImage.qml
18 | src/QmlControls/QmlHoverHoriButton.qml
19 | src/QmlControls/QmlHoverVertButton.qml
20 | src/QmlControls/QmlImageButton.qml
21 | src/QmlControls/QmlInnerLabel.qml
22 | src/QmlControls/QmlLabel.qml
23 | src/QmlControls/QmlMenuButton.qml
24 | src/QmlControls/QmlRadioButton.qml
25 | src/QmlControls/QmlSliderSwitch.qml
26 | src/QmlControls/QmlSpecialLabel.qml
27 | src/QmlControls/QmlTextField.qml
28 | src/QmlControls/QmlToolStrip.qml
29 | src/QmlControls/QmlComboBox.qml
30 | src/QmlControls/ScreenTools.qml
31 | src/QmlControls/QmlButton1.qml
32 | src/QmlControls/QmlColoredImage.qml
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Communication/README.md:
--------------------------------------------------------------------------------
1 |
2 | ==========================================================================
3 |
4 | 2023/04/08 [Windows]
5 |
6 | #[Communication]
7 |
8 | ##第一版功能:
9 | 1、能建立多个用户端,每个用户端独立的数据链路,每个用户端的链路暂时不进行管理;
10 | 2、每个用户端拥有最简单的协议,能进行读写功能即可;
11 | 3、暂时只支持UDP、TCP客户端,能进行简答的配置和保存;
12 |
13 | ##类的介绍:
14 | Customer:
15 | 类似 vehicle,也需要监听心跳包,才能建立连接;首先也需要用户手动连接到相应的线路中;
16 |
17 | CustomerProtocol:
18 | 类似 MavLinkProtocol,协议相关处理
19 |
20 | MultiCustomManager:
21 | 类似 MultiVehicleManager.cc,管理 Customer,后续根据心跳包新建 new Customer(link,...);
22 | 目前根据用户添加的时候,手动创建 Customer,即用户点击 "连接" 的时候创建;
23 |
24 | #[QGC]
25 | QGC中有多个无人机,每个无人机,可以有多条线路,线路中会自动择优选择:
26 | USB线路-->低延时线路-->高延时线路
27 |
28 | ==========================================================================
--------------------------------------------------------------------------------
/Communication/app/Customer.cpp:
--------------------------------------------------------------------------------
1 | #include "Customer.h"
2 |
3 | Customer::Customer()
4 | {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/Communication/app/Customer.h:
--------------------------------------------------------------------------------
1 | #ifndef CUSTOMER_H
2 | #define CUSTOMER_H
3 |
4 | #include
5 |
6 | class Customer : public QObject
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | Customer();
12 |
13 | public slots:
14 |
15 | private:
16 |
17 | };
18 |
19 | #endif // CUSTOMER_H
20 |
--------------------------------------------------------------------------------
/Communication/app/CustomerProtocol.h:
--------------------------------------------------------------------------------
1 | #ifndef CUSTOMER_PROTOCOL_H
2 | #define CUSTOMER_PROTOCOL_H
3 |
4 | #include
5 |
6 | #include "LinkInterface.h"
7 | #include "LinkManager.h"
8 |
9 |
10 | class CustomerProtocol : public QObject
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | CustomerProtocol();
16 |
17 | public slots:
18 | // void receiveBytes(LinkInterface* link, QByteArray b);
19 |
20 | private:
21 | // LinkManager* _linkMgr;
22 |
23 | };
24 |
25 | enum SANHANG_PRO_STATE{
26 | PROTOCOL_DEFAULT = 0,
27 | PROTOCOL_HEAD,
28 | PROTOCOL_LEN1,
29 | // PROTOCOL_LEN2,
30 | PROTOCOL_ID1,
31 | // PROTOCOL_ID2,
32 | PROTOCOL_CMD,
33 | PROTOCOL_DATA,
34 | PROTOCOL_CRC1,
35 | PROTOCOL_CRC2
36 | };
37 |
38 | #endif // CUSTOMER_H
39 |
--------------------------------------------------------------------------------
/Communication/app/MultiCustomManager.cpp:
--------------------------------------------------------------------------------
1 | #include "MultiCustomManager.h"
2 |
3 |
4 | MultiCustomManager::MultiCustomManager()
5 | {
6 | // _customerProtocol = new CustomerProtocol();
7 |
8 | //心跳包的确认来建立一个用户端; 目前由用户操作决定
9 | // connect(_customerProtocol, &MAVLinkProtocol::vehicleHeartbeatInfo, this, &MultiVehicleManager::_vehicleHeartbeatInfo);
10 | }
11 |
12 | MultiCustomManager::~MultiCustomManager() {
13 |
14 | }
15 |
16 |
17 | void MultiCustomManager::CreateCustomer(LinkInterface *link) {
18 | qDebug() << QString("link name is %1").arg(link->linkConfiguration()->name());
19 | }
20 |
--------------------------------------------------------------------------------
/Communication/app/MultiCustomManager.h:
--------------------------------------------------------------------------------
1 | #ifndef MultiCustomManager_H
2 | #define MultiCustomManager_H
3 |
4 | #include
5 |
6 | #include "CustomerProtocol.h"
7 | //class CustomerProtocol;
8 |
9 | class MultiCustomManager : public QObject
10 | {
11 | Q_OBJECT
12 |
13 | public:
14 | MultiCustomManager();
15 | ~MultiCustomManager();
16 |
17 | public slots:
18 |
19 | void CreateCustomer (LinkInterface* link);
20 |
21 | private:
22 | // CustomerProtocol* _customerProtocol = nullptr;
23 |
24 | };
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/Communication/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "UserApplication.h"
4 | #include
5 |
6 | int main(int argc, char *argv[])
7 | {
8 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
9 |
10 | UserApplication* app = new UserApplication(argc, argv);
11 |
12 | app->_initCommon(); //qmlRegisterType
13 |
14 | app->_initForNormalAppBoot(); // qmlEngine->addImportPath("qrc:/qml");
15 |
16 | app->exec();
17 |
18 | app->_shutdown();
19 | delete app;
20 |
21 | qDebug() << "After app delete";
22 | }
23 |
24 | //// QGuiApplication app(argc, argv);
25 | //// QQmlApplicationEngine engine;
26 | //// qmlRegisterType ("Palette", 1, 0, "Palette");
27 | // engine.addImportPath(QStringLiteral("qrc:/qml"));
28 | //// engine.addImportPath(QStringLiteral("qrc:/qml"));
29 | //// engine.addImportPath(QStringLiteral("qrc:/qml/Communication/QmlFile"));
30 | //// engine.addImportPath(QStringLiteral("qrc:/qml/src/QmlControls"));
31 |
32 | // const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
33 | // QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
34 | // &app, [url](QObject *obj, const QUrl &objUrl) {
35 | // if (!obj && url == objUrl)
36 | // QCoreApplication::exit(-1);
37 | // }, Qt::QueuedConnection);
38 | // engine.load(url);
39 |
40 | // return app.exec();
41 | //}
42 |
--------------------------------------------------------------------------------
/Communication/qgcimages.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | src/Communication/Image/arrow-down.png
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Communication/src/Backup/TCPServer.h:
--------------------------------------------------------------------------------
1 | #ifndef TCPServer_H
2 | #define TCPServer_H
3 |
4 | #include
5 |
6 | //#include //监听套接字
7 | //#include //通信套接字
8 | //#include
9 |
10 | #include
11 | #include
12 |
13 | #include
14 | #include "qloggingcategory.h"
15 |
16 |
17 | //Q_DECLARE_LOGGING_CATEGORY(CcTcpServer_H)
18 |
19 | class TCPServer : public QObject
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | /*explicit*/ TCPServer(QObject *parent = nullptr);
25 |
26 |
27 | Q_PROPERTY(quint16 serverPort READ serverPort WRITE setServerPort)
28 | Q_PROPERTY(bool isConnected READ isConnected NOTIFY isConnectedChanged)
29 | Q_PROPERTY(qreal gimbalPitch READ gimbalPitch NOTIFY gimbalPitchChanged)
30 |
31 |
32 | //READ
33 | quint16 serverPort () const { return _serverPort; }
34 | bool isConnected () const { return _isConnected; }
35 | qreal gimbalPitch () const { return _gimbalPitch; }
36 |
37 | //WRITE
38 | void setServerPort (const quint16 sp);
39 |
40 | Q_INVOKABLE void start (QString port);
41 | // Q_INVOKABLE bool start (uint16_t port, QHostAddress addr = QHostAddress::AnyIPv4);
42 | Q_INVOKABLE bool disconnect (void);
43 | Q_INVOKABLE bool sendData (const QString info);
44 |
45 | Q_INVOKABLE bool sendValue (char value);
46 | Q_INVOKABLE bool sendDataAdd (void);
47 |
48 | Q_INVOKABLE void timerStart (int dir);
49 |
50 | Q_INVOKABLE bool sendUpDown (int dir);
51 |
52 | void ReceiveParse(const QByteArray &buf);
53 |
54 |
55 | signals:
56 | void isConnectedChanged (const bool isConnect);
57 | void gimbalPitchChanged (qreal pitch);
58 |
59 | private slots:
60 | void newConnection();
61 | void readData();
62 |
63 | private:
64 | quint16 _serverPort;
65 |
66 | QTcpServer* _tcpServer = nullptr;
67 | QTcpSocket* _tcpSocket = nullptr;
68 |
69 | bool _isConnected = false;
70 | char _add = 0;
71 |
72 | QTimer _dirTimer;
73 | int _dir = 0;
74 | qreal _gimbalPitch = -90.0 ;
75 |
76 | };
77 |
78 | #endif
79 |
--------------------------------------------------------------------------------
/Communication/src/Communication/Image/Disconnect.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Communication/src/Communication/Image/Monitor.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Communication/src/Communication/Image/Send.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Communication/src/Communication/Image/arrow-down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Communication/src/Communication/Image/arrow-down.png
--------------------------------------------------------------------------------
/Communication/src/Communication/QmlFile/TcpSettings.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | *
3 | * (c) 2009-2020 QGROUNDCONTROL PROJECT
4 | *
5 | * QGroundControl is licensed according to the terms in the file
6 | * COPYING.md in the root of the source code directory.
7 | *
8 | ****************************************************************************/
9 |
10 |
11 | import QtQuick 2.3
12 | import QtQuick.Controls 1.2
13 | import QtQuick.Dialogs 1.2
14 |
15 | import QGroundControl 1.0
16 | import QGroundControl.Controls 1.0
17 | import QGroundControl.ScreenTools 1.0
18 | import QGroundControl.Palette 1.0
19 |
20 | Column {
21 | id: tcpLinkSettings
22 | spacing: ScreenTools.defaultFontPixelHeight * 0.5
23 | anchors.margins: ScreenTools.defaultFontPixelWidth
24 | function saveSettings() {
25 | if(subEditConfig) {
26 | subEditConfig.host = hostField.text
27 | subEditConfig.port = parseInt(portField.text)
28 | }
29 | }
30 | Row {
31 | spacing: ScreenTools.defaultFontPixelWidth
32 | QGCLabel {
33 | text: qsTr("Host Address:")
34 | width: _firstColumn
35 | anchors.verticalCenter: parent.verticalCenter
36 | }
37 | QGCTextField {
38 | id: hostField
39 | text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeTcp ? subEditConfig.host : ""
40 | width: _secondColumn
41 | anchors.verticalCenter: parent.verticalCenter
42 | }
43 | }
44 | Row {
45 | spacing: ScreenTools.defaultFontPixelWidth
46 | QGCLabel {
47 | text: qsTr("TCP Port:")
48 | width: _firstColumn
49 | anchors.verticalCenter: parent.verticalCenter
50 | }
51 | QGCTextField {
52 | id: portField
53 | text: subEditConfig && subEditConfig.linkType === LinkConfiguration.TypeTcp ? subEditConfig.port.toString() : ""
54 | width: _firstColumn
55 | inputMethodHints: Qt.ImhFormattedNumbersOnly
56 | anchors.verticalCenter: parent.verticalCenter
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Communication/src/Communication/QmlFile/qmldir:
--------------------------------------------------------------------------------
1 | Module Communication.QmlFile
2 |
3 | LinkSettings 1.0 LinkSettings.qml
4 | #BluetoothSettings 1.0 BluetoothSettings.qml
5 | #LinkSettings 1.0 LinkSettings.qml
6 | #SerialSettings 1.0 SerialSettings.qml
7 | #TcpSettings 1.0 TcpSettings.qml
8 | #UdpSettings 1.0 UdpSettings.qml
9 |
--------------------------------------------------------------------------------
/Communication/src/Communication/UdpIODevice.cc:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | *
3 | * (c) 2009-2020 QGROUNDCONTROL PROJECT
4 | *
5 | * QGroundControl is licensed according to the terms in the file
6 | * COPYING.md in the root of the source code directory.
7 | *
8 | ****************************************************************************/
9 |
10 | #include "UdpIODevice.h"
11 | #include
12 |
13 | UdpIODevice::UdpIODevice(QObject *parent) : QUdpSocket(parent)
14 | {
15 | // this might cause data to be available only after a second readyRead() signal
16 | connect(this, &QUdpSocket::readyRead, this, &UdpIODevice::_readAvailableData);
17 | }
18 |
19 | bool UdpIODevice::canReadLine() const
20 | {
21 | return _buffer.indexOf('\n') > -1;
22 | }
23 |
24 | qint64 UdpIODevice::readLineData(char *data, qint64 maxSize)
25 | {
26 | int length = _buffer.indexOf('\n') + 1; // add 1 to include the '\n'
27 | if (length == 0) {
28 | return 0;
29 | }
30 | length = std::min(length, static_cast(maxSize));
31 | // copy lines to output
32 | std::copy(_buffer.data(), _buffer.data() + length, data);
33 | // trim buffer to remove consumed line
34 | _buffer = _buffer.right(_buffer.size() - length);
35 | // return number of bytes read
36 | return length;
37 | }
38 |
39 | void UdpIODevice::_readAvailableData() {
40 | while (hasPendingDatagrams()) {
41 | int previousSize = _buffer.size();
42 | _buffer.resize(static_cast(_buffer.size() + pendingDatagramSize()));
43 | readDatagram((_buffer.data() + previousSize), pendingDatagramSize());
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Communication/src/Communication/UdpIODevice.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | *
3 | * (c) 2009-2020 QGROUNDCONTROL PROJECT
4 | *
5 | * QGroundControl is licensed according to the terms in the file
6 | * COPYING.md in the root of the source code directory.
7 | *
8 | ****************************************************************************/
9 | #pragma once
10 |
11 | #include
12 |
13 | /**
14 | * @brief QUdpSocket implementation of canReadLine() readLineData() in server mode.
15 | * The UdpIODevice class works almost exactly as a QUdpSocket, but
16 | * also implements canReadLine() and readLineData() while in the bound state.
17 | * Regular QUdpSocket only allows to use these QIODevice interfaces when using
18 | * connectToHost(), which means it is working as a client instead of server.
19 | *
20 | **/
21 |
22 | class UdpIODevice: public QUdpSocket
23 | {
24 | Q_OBJECT
25 | public:
26 | UdpIODevice(QObject *parent = nullptr);
27 | bool canReadLine() const;
28 | qint64 readLineData(char *data, qint64 maxSize);
29 |
30 | private slots:
31 | void _readAvailableData();
32 |
33 | private:
34 | QByteArray _buffer;
35 | };
36 |
--------------------------------------------------------------------------------
/Communication/src/QmlControls/QmlColoredImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Styles 1.4
4 | import QtGraphicalEffects 1.0
5 |
6 | Item {
7 | property color color: "white" // Image color
8 |
9 | property alias asynchronous: image.asynchronous
10 | property alias cache: image.cache
11 | property alias fillMode: image.fillMode
12 | property alias horizontalAlignment: image.horizontalAlignment
13 | property alias mirror: image.mirror
14 | property alias paintedHeight: image.paintedHeight
15 | property alias paintedWidth: image.paintedWidth
16 | property alias progress: image.progress
17 | property alias smooth: image.smooth
18 | property alias mipmap: image.mipmap
19 | property alias source: image.source
20 | property alias sourceSize: image.sourceSize
21 | property alias status: image.status
22 | property alias verticalAlignment: image.verticalAlignment
23 | property int _rotation: 0
24 |
25 | width: image.width
26 | height: image.height
27 |
28 | Image {
29 | id: image
30 | smooth: true
31 | mipmap: true
32 | antialiasing: true
33 | visible: false
34 | fillMode: Image.PreserveAspectFit
35 | anchors.fill: parent
36 | sourceSize.height: height
37 | rotation: _rotation
38 | }
39 |
40 | ColorOverlay {
41 | anchors.fill: image
42 | source: image
43 | color: parent.color
44 | rotation: _rotation
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Communication/src/QmlControls/QmlGradientImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.7
2 | import QtQuick.Controls 2.0
3 | import QtGraphicalEffects 1.12 ///--[Mark]
4 |
5 | LinearGradient
6 | {
7 | id: image
8 | width: height
9 |
10 | property alias iconSource: innerImage.source
11 |
12 | property real _startPos: 0.0
13 | property color _startColor: "white"
14 |
15 | property real _middlePos: (1-0.618)
16 | property color _middleColor: "white"
17 |
18 | property real _stopPos: 1.0
19 | property color _stopColor: qgcPal.ccTheme
20 |
21 | source: Image {
22 | id: innerImage
23 | mipmap: true
24 | antialiasing: true
25 | fillMode: Image.PreserveAspectFit
26 | }
27 |
28 | gradient: Gradient { //从上到下的
29 | GradientStop {
30 | position: _startPos
31 | color: _startColor
32 | }
33 |
34 | GradientStop {
35 | position: _middlePos
36 | color: _middleColor
37 | }
38 |
39 | GradientStop {
40 | position: _stopPos
41 | color: _stopColor
42 | }
43 | }
44 | start:Qt.point(0,0)
45 | end:Qt.point(0,height)
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/Communication/src/QmlControls/QmlLabel.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.12
3 |
4 | import QmlControls 1.0
5 |
6 | Text {
7 | property bool _min: false
8 | property bool _small: false
9 | property bool _large: false
10 | property bool _big: false
11 | property bool _huge: false
12 |
13 | color: "white"
14 | antialiasing: true
15 | font.bold: true
16 | font.pixelSize: getPixel()
17 |
18 | function getPixel() {
19 | ///从小到大的
20 | if(_min) {
21 | return ScreenTools.minText
22 | }
23 | else if(_small) {
24 | return ScreenTools.smallText
25 | }
26 | else if(_big) {
27 | return ScreenTools.bigText
28 | }
29 | else if(_large) {
30 | return ScreenTools.largeText
31 | }
32 | else if(_huge) {
33 | return ScreenTools.hugeText
34 | }
35 | else {
36 | return ScreenTools.mediumText
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Communication/src/QmlControls/QmlMenuButton.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.9
2 | import QtQuick.Controls 2.5
3 |
4 | Button {
5 | id: button
6 | checkable: false
7 |
8 | property alias labelColor: _label.color
9 | property var imageSource
10 | property color _themeColor: "#a27e7e"//"#FFDC35"//"#a27e7e"
11 | onCheckedChanged: checkable = false
12 |
13 | background: Rectangle {
14 | anchors.fill: parent
15 | color: button.checked ? "#a27e7e"/*_themeColor*/ : Qt.rgba(0,0,0,0)
16 | border.color: "black"
17 | border.width: button.checked ? 1 : 0
18 | // color: button.checked ? "#FFDC35" : Qt.rgba(0,0,0,0)
19 | }
20 |
21 | contentItem: Row {
22 | spacing: 10
23 | anchors.verticalCenter: button.verticalCenter
24 |
25 | CCColoredImage {
26 | id: innerImage
27 | width: 20
28 | height: width
29 | source: button.icon.source
30 | color: button.checked ? "#black" : "black"
31 | visible: imageSource !== ""
32 | }
33 |
34 | Text {
35 | id: _label
36 | visible: text !== ""
37 | text: button.text
38 | anchors.verticalCenter: parent.verticalCenter
39 | color: button.checked ? "white" : "black"
40 | font.bold: true
41 | font.pointSize: 15
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Communication/src/QmlControls/QmlRadioButton.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.11
2 | import QtQuick.Controls 2.4
3 | import QtQuick.Controls.Styles 1.4
4 |
5 |
6 | RadioButton {
7 | id: control
8 | font.pointSize: 12
9 |
10 | property color textColor: "red"
11 | property color subColor: "#019858"
12 | property bool _noText: text === ""
13 |
14 | indicator: Rectangle {
15 | implicitWidth: 20
16 | implicitHeight: width
17 | color: "white"
18 | border.color: "black"
19 | radius: height / 2
20 | opacity: control.enabled ? 1 : 0.5
21 | x: control.leftPadding
22 | y: parent.height / 2 - height / 2
23 | Rectangle {
24 | anchors.centerIn: parent
25 | // Width should be an odd number to be centralized by the parent properly
26 | width: 2 * Math.floor(parent.width / 4) + 1
27 | height: width
28 | antialiasing: true
29 | radius: height * 0.5
30 | color: subColor
31 | visible: control.checked
32 | }
33 | }
34 |
35 | contentItem: CCLabel {
36 | text: control.text
37 | font.family: control.font.pointSize
38 | font.pointSize: control.font.pointSize
39 | font.bold: true
40 | color: control.textColor
41 | opacity: enabled ? 1.0 : 0.3
42 | verticalAlignment: Text.AlignVCenter
43 | leftPadding: control.indicator.width + (_noText ? 0 : 4)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Communication/src/QmlControls/QmlSpecialLabel.qml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Communication/src/QmlControls/QmlSpecialLabel.qml
--------------------------------------------------------------------------------
/Communication/src/QmlControls/QmlTextField.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Styles 1.4
4 | import QtQuick.Layouts 1.2
5 |
6 | TextField {
7 | id: root
8 | textColor: "#000000"
9 | activeFocusOnPress: true
10 | antialiasing: true
11 | width: 150
12 |
13 | //点击输入框,则全选
14 | Component.onCompleted: selectAllIfActiveFocus()
15 | onActiveFocusChanged: selectAllIfActiveFocus()
16 | function selectAllIfActiveFocus() {
17 | if (activeFocus) {
18 | selectAll()
19 | }
20 | }
21 |
22 | style: TextFieldStyle {
23 | id: tfs
24 | font.pointSize: 13
25 | font.family: "Microsoft Yahei"
26 | renderType: Text.QtRendering // 渲染方式 This works around font rendering problems on windows
27 |
28 | background: Item {
29 | id: backgroundItem
30 | Rectangle {
31 | anchors.fill: parent
32 | anchors.bottomMargin: -2
33 | color: "#44ffffff" //边距的填充 可以用 green 测试
34 | }
35 |
36 | Rectangle {
37 | anchors.fill: parent
38 | border.width: 2//enabled ? 2 : 0
39 | border.color: enabled ? (root.activeFocus ? "#47b" : "#999" ) : "#E0E0E0"
40 | color: "#ffffff" //qgcPal.textField 边距的填充 可以用 red 测试
41 | radius: height *0.1
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Communication/src/QmlControls/qmldir:
--------------------------------------------------------------------------------
1 | Module QmlControls
2 |
3 | QmlButton1 1.0 QmlButton1.qml
4 | QmlColoredImage 1.0 QmlColoredImage.qml
5 | QmlGradientImage 1.0 QmlGradientImage.qml
6 | QmlLabel 1.0 QmlLabel.qml
7 | QMLTextField 1.0 QmlTextField.qml
8 | QmlMenuButton 1.0 QmlMenuButton.qml
9 | QmlRadioButton 1.0 QmlRadioButton.qml
10 | QmlComboBox 1.0 QmlComboBox.qml
11 | singleton ScreenTools 1.0 ScreenTools.qml
12 |
13 |
--------------------------------------------------------------------------------
/Communication/src/QmlGeneral/qmldir:
--------------------------------------------------------------------------------
1 | Module QmlGeneral
2 |
3 |
4 |
--------------------------------------------------------------------------------
/CrazyMath.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath.zip
--------------------------------------------------------------------------------
/CrazyMath/CrazyMath.pro:
--------------------------------------------------------------------------------
1 | QT += quick \
2 | svg
3 |
4 | CONFIG += c++11
5 |
6 | # The following define makes your compiler emit warnings if you use
7 | # any Qt feature that has been marked deprecated (the exact warnings
8 | # depend on your compiler). Refer to the documentation for the
9 | # deprecated API to know how to port your code away from it.
10 | DEFINES += QT_DEPRECATED_WARNINGS
11 |
12 | # You can also make your code fail to compile if it uses deprecated APIs.
13 | # In order to do so, uncomment the following line.
14 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
15 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
16 |
17 | SOURCES += \
18 | MathProblem/MathProblem.cpp \
19 | SettingValues/Values.cc \
20 | main.cpp
21 |
22 | RESOURCES += qml.qrc
23 |
24 | # Additional import path used to resolve QML modules in Qt Creator's code model
25 | QML_IMPORT_PATH += $$PWD
26 |
27 | # Additional import path used to resolve QML modules just for Qt Quick Designer
28 | QML_DESIGNER_IMPORT_PATH =
29 |
30 | # Default rules for deployment.
31 | qnx: target.path = /tmp/$${TARGET}/bin
32 | else: unix:!android: target.path = /opt/$${TARGET}/bin
33 | !isEmpty(target.path): INSTALLS += target
34 |
35 | HEADERS += \
36 | MathProblem/MathProblem.h \
37 | SettingValues/Values.h
38 |
39 | DISTFILES += \
40 | android/AndroidManifest.xml \
41 | android/build.gradle \
42 | android/gradle/wrapper/gradle-wrapper.jar \
43 | android/gradle/wrapper/gradle-wrapper.properties \
44 | android/gradlew \
45 | android/gradlew.bat \
46 | android/res/values/libs.xml \
47 | language.zh_CN.ts
48 |
49 | contains(ANDROID_TARGET_ARCH,arm64-v8a) {
50 | ANDROID_PACKAGE_SOURCE_DIR = \
51 | $$PWD/android
52 | }
53 |
54 | TRANSLATIONS += $$PWD/Translations/zh_CN.ts
55 |
56 |
--------------------------------------------------------------------------------
/CrazyMath/MathProblem.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/MathProblem.cpp
--------------------------------------------------------------------------------
/CrazyMath/MathProblem.h:
--------------------------------------------------------------------------------
1 | #ifndef MATH_H
2 | #define MATH_H
3 |
4 | #endif // MATH_H
5 |
--------------------------------------------------------------------------------
/CrazyMath/MathProblem/MathProblem.h:
--------------------------------------------------------------------------------
1 | #ifndef MATH_PROBLEM_H
2 | #define MATH_PROBLEM_H
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | //using namespace::std;
10 | extern QGuiApplication* _app;
11 |
12 | class MathProblem : public QObject {
13 |
14 | Q_OBJECT
15 |
16 | public:
17 | MathProblem(QObject *parent = nullptr);
18 | ~MathProblem();
19 |
20 | Q_PROPERTY(bool isRight READ isRight NOTIFY isRightChanged)
21 | Q_PROPERTY(QString test READ test NOTIFY testChanged)
22 |
23 | bool isRight ();
24 | QString test() const {return _test;}
25 |
26 | Q_INVOKABLE QString nextMath(); //Q_INVOKABLE
27 |
28 |
29 | signals:
30 | void isRightChanged (bool isRight);
31 | void testChanged (QString test);
32 |
33 | private:
34 | int newIdx;
35 | bool _isRight;
36 | int _mathCount;
37 |
38 | static const char * _problems[];
39 | static const int _answers[];
40 | //start_cch_20220531
41 |
42 | QString _test;
43 | };
44 |
45 | #endif
46 |
47 |
48 | ///-------------------------------------第一版本-----------------------------------
49 |
50 | //#ifndef MATH_PROBLEM_H
51 | //#define MATH_PROBLEM_H
52 |
53 | //#include
54 | //#include
55 |
56 |
57 | //class MathProblem : public QObject {
58 |
59 | // Q_OBJECT
60 |
61 | //public:
62 | // MathProblem(QObject *parent = nullptr);
63 | // ~MathProblem();
64 |
65 | // Q_INVOKABLE QString nextMath(); //Q_INVOKABLE
66 |
67 | //private:
68 | // int newIdx;
69 |
70 | // static const char * _problems[];
71 | // static const int _answers[];
72 | //};
73 |
74 | //#endif
75 |
--------------------------------------------------------------------------------
/CrazyMath/QmlControls/CCColoredImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Styles 1.4
4 | import QtGraphicalEffects 1.0
5 |
6 | Item {
7 | property color color: "white" // Image color
8 |
9 | property alias asynchronous: image.asynchronous
10 | property alias cache: image.cache
11 | property alias fillMode: image.fillMode
12 | property alias horizontalAlignment: image.horizontalAlignment
13 | property alias mirror: image.mirror
14 | property alias paintedHeight: image.paintedHeight
15 | property alias paintedWidth: image.paintedWidth
16 | property alias progress: image.progress
17 | property alias smooth: image.smooth
18 | property alias mipmap: image.mipmap
19 | property alias source: image.source
20 | property alias sourceSize: image.sourceSize
21 | property alias status: image.status
22 | property alias verticalAlignment: image.verticalAlignment
23 | property alias coVisible: colorOver.visible
24 | property int _rotation: 0
25 |
26 | width: image.width
27 | height: image.height
28 |
29 | Image {
30 | id: image
31 | smooth: true
32 | mipmap: true
33 | antialiasing: true
34 | visible: false
35 | fillMode: Image.PreserveAspectFit
36 | anchors.fill: parent
37 | sourceSize.height: height
38 | rotation: _rotation
39 | }
40 |
41 | ColorOverlay {
42 | id: colorOver
43 | anchors.fill: image
44 | source: image
45 | color: parent.color
46 | rotation: _rotation
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/CrazyMath/QmlControls/CCLabel.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.12
3 |
4 | Text {
5 | font.pointSize: 10
6 | // font.family: "Microsoft Yahei"
7 | color: "white"
8 | antialiasing: true
9 | font.bold: true
10 |
11 | // font.family: "Noto Sans SC"
12 | }
13 |
--------------------------------------------------------------------------------
/CrazyMath/QmlControls/CCVertRect.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.12
3 |
4 | import QmlControls 1.0
5 |
6 | Rectangle {
7 | height: column.height + 20
8 | width: height
9 | radius: width/2
10 |
11 | //图像
12 | property alias imageSource : image.source
13 | property alias imageColor: image.color
14 |
15 | //文本
16 | property alias text: label.text
17 | property alias fontPointSize: label.font.pointSize
18 | property alias textColor: label.color
19 |
20 | Column {
21 | id: column
22 | anchors.centerIn: parent
23 | spacing: 0
24 |
25 | CCColoredImage {
26 | id: image
27 | anchors.horizontalCenter: parent.horizontalCenter
28 | width: 60
29 | height: width
30 | }
31 |
32 | CCLabel {
33 | id: label;
34 | color: 'white'
35 | anchors.horizontalCenter: parent.horizontalCenter
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/CrazyMath/QmlControls/qmldir:
--------------------------------------------------------------------------------
1 | Module QmlControls
2 |
3 | #Basic
4 | CCLabel 1.0 CCLabel.qml
5 | CCColoredImage 1.0 CCColoredImage.qml
6 |
7 | CCHoverHorzButton 1.0 CCHoverHorzButton.qml
8 | CCVertRect 1.0 CCVertRect.qml
9 |
10 | #CCButton 1.0 CCButton.qml
11 |
--------------------------------------------------------------------------------
/CrazyMath/SettingValues/Values.cc:
--------------------------------------------------------------------------------
1 | #include "Values.h"
2 | #include
3 | #include
4 |
5 | const char* Values::_groupKey = "values";
6 | const char* Values::_bestScoreKey = "bestScore";
7 |
8 | Values::Values(void)
9 | {
10 | QSettings settings;
11 | settings.beginGroup(_groupKey);
12 |
13 | //获取初值
14 | _bestScore = settings.value(_bestScoreKey).toInt();
15 | //更新 qml 值
16 | emit bestScoreChanged(_bestScore);
17 |
18 | qDebug() <<"Setting fileName is :" <
5 |
6 | class Values : public QObject
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | Values(void);
12 |
13 | Q_PROPERTY(int bestScore READ bestScore WRITE setBestScore NOTIFY bestScoreChanged)
14 |
15 | int bestScore(void) const { return _bestScore; }
16 |
17 | void setBestScore(const int& bestScore);
18 |
19 |
20 | signals:
21 | void bestScoreChanged(int bestScore);
22 |
23 |
24 | private:
25 | int _bestScore;
26 |
27 | static const char* _groupKey;
28 | static const char* _bestScoreKey;
29 | };
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/CrazyMath/Translations/lrelease:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/Translations/lrelease
--------------------------------------------------------------------------------
/CrazyMath/Translations/zh_CN.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/Translations/zh_CN.qm
--------------------------------------------------------------------------------
/CrazyMath/android-libCrazyMath.so-deployment-settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.",
3 | "qt": "C:/Qt/Qt5.12.6/5.12.6/android_arm64_v8a",
4 | "sdk": "C:/Qt/QtForAndroid/android-sdk-windows",
5 | "sdkBuildToolsRevision": "29.0.3",
6 | "ndk": "C:\\Qt\\QtForAndroid\\android-ndk-r20b",
7 | "toolchain-prefix": "llvm",
8 | "tool-prefix": "llvm",
9 | "toolchain-version": "4.9",
10 | "ndk-host": "windows-x86_64",
11 | "target-architecture": "arm64-v8a",
12 | "android-package-source-directory": "E:/32_Qt/1_MyProject/QmlLearningPro/QmlLearningPro/CrazyMath/android",
13 | "qml-import-paths": "E:/32_Qt/1_MyProject/QmlLearningPro/QmlLearningPro/CrazyMath",
14 | "qml-root-path": "E:/32_Qt/1_MyProject/QmlLearningPro/QmlLearningPro/CrazyMath",
15 | "stdcpp-path": "C:\\Qt\\QtForAndroid\\android-ndk-r20b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so",
16 | "useLLVM": true,
17 | "application-binary": "E:/32_Qt/1_MyProject/QmlLearningPro/QmlLearningPro/CrazyMath/libCrazyMath.so"
18 | }
19 |
--------------------------------------------------------------------------------
/CrazyMath/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.2.0'
9 | }
10 | }
11 |
12 | repositories {
13 | google()
14 | jcenter()
15 | }
16 |
17 | apply plugin: 'com.android.application'
18 |
19 | dependencies {
20 | implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
21 | }
22 |
23 | android {
24 | /*******************************************************
25 | * The following variables:
26 | * - androidBuildToolsVersion,
27 | * - androidCompileSdkVersion
28 | * - qt5AndroidDir - holds the path to qt android files
29 | * needed to build any Qt application
30 | * on Android.
31 | *
32 | * are defined in gradle.properties file. This file is
33 | * updated by QtCreator and androiddeployqt tools.
34 | * Changing them manually might break the compilation!
35 | *******************************************************/
36 |
37 | compileSdkVersion androidCompileSdkVersion.toInteger()
38 |
39 | buildToolsVersion '28.0.3'
40 |
41 | sourceSets {
42 | main {
43 | manifest.srcFile 'AndroidManifest.xml'
44 | java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
45 | aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
46 | res.srcDirs = [qt5AndroidDir + '/res', 'res']
47 | resources.srcDirs = ['src']
48 | renderscript.srcDirs = ['src']
49 | assets.srcDirs = ['assets']
50 | jniLibs.srcDirs = ['libs']
51 | }
52 | }
53 |
54 | lintOptions {
55 | abortOnError false
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/CrazyMath/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CrazyMath/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/CrazyMath/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/CrazyMath/android/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/android/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/CrazyMath/android/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/android/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/CrazyMath/android/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/android/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/CrazyMath/android/res/values/libs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - https://download.qt.io/ministro/android/qt5/qt-5.9
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CrazyMath/debug/CrazyMath.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/CrazyMath.exe
--------------------------------------------------------------------------------
/CrazyMath/debug/CrazyMath.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/CrazyMath.ilk
--------------------------------------------------------------------------------
/CrazyMath/debug/CrazyMath.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/CrazyMath.pdb
--------------------------------------------------------------------------------
/CrazyMath/debug/CrazyMath.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/CrazyMath.vc.pdb
--------------------------------------------------------------------------------
/CrazyMath/debug/MathProblem.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/MathProblem.obj
--------------------------------------------------------------------------------
/CrazyMath/debug/Values.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/Values.obj
--------------------------------------------------------------------------------
/CrazyMath/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/main.obj
--------------------------------------------------------------------------------
/CrazyMath/debug/moc_MathProblem.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/moc_MathProblem.obj
--------------------------------------------------------------------------------
/CrazyMath/debug/moc_Values.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/moc_Values.obj
--------------------------------------------------------------------------------
/CrazyMath/debug/moc_predefs.h:
--------------------------------------------------------------------------------
1 | #define _MSC_EXTENSIONS
2 | #define _INTEGRAL_MAX_BITS 64
3 | #define _MSC_VER 1916
4 | #define _MSC_FULL_VER 191627049
5 | #define _MSC_BUILD 0
6 | #define _M_AMD64 100
7 | #define _M_X64 100
8 | #define _WIN64
9 | #define _WIN32
10 | #define _CPPRTTI
11 | #define _DEBUG
12 | #define _MT
13 | #define _DLL
14 |
--------------------------------------------------------------------------------
/CrazyMath/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/CrazyMath/images/Clock.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CrazyMath/images/Correct.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CrazyMath/images/Error.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CrazyMath/images/Restart.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CrazyMath/images/Start.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CrazyMath/images/equal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/images/equal.png
--------------------------------------------------------------------------------
/CrazyMath/language.zh_CN.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/language.zh_CN.qm
--------------------------------------------------------------------------------
/CrazyMath/libCrazyMath.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/libCrazyMath.so
--------------------------------------------------------------------------------
/CrazyMath/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | QmlControls/CCLabel.qml
5 | QmlControls/qmldir
6 | QmlControls/CCHoverHorzButton.qml
7 | QmlControls/CCColoredImage.qml
8 | QmlControls/CCVertRect.qml
9 |
10 |
11 | Images/Correct.svg
12 | Images/Error.svg
13 | Images/Restart.svg
14 | Images/Start.svg
15 | Images/Clock.svg
16 |
17 |
18 | Translations/zh_CN.qm
19 | Translations/zh_CN.ts
20 |
21 |
22 |
--------------------------------------------------------------------------------
/CrazyMath/zh_CN.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/CrazyMath/zh_CN.qm
--------------------------------------------------------------------------------
/CrazyMath/zh_CN.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | main
6 |
7 |
8 | CrazyMath
9 | 疯狂算术
10 |
11 |
12 |
13 | Start
14 | 开始
15 |
16 |
17 |
18 | Correct
19 | 正确
20 |
21 |
22 |
23 | Error
24 | 错误
25 |
26 |
27 |
28 | GameOver
29 | 游戏结束!
30 |
31 |
32 |
33 | Score:
34 | 得分:
35 |
36 |
37 |
38 | Current Best:
39 | 最高:
40 |
41 |
42 |
43 | Restart
44 | 重新开始
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MapFermatSpiral/MapFermatSpiral.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | QT += \
4 | location \ # 地图定位相关
5 | positioning \ # 通过 QML 和 c++ 接口提供定位信息。
6 |
7 | #QMAKE_CXXFLAGS += -execution-charset:utf-8 # 让程序执行时使用utf-8字符集
8 | #QMAKE_CXXFLAGS += -source-charset:utf-8 # 告诉vc编译器识别源文件编码类型是utf-8
9 |
10 | CONFIG += c++11
11 |
12 | # The following define makes your compiler emit warnings if you use
13 | # any Qt feature that has been marked deprecated (the exact warnings
14 | # depend on your compiler). Refer to the documentation for the
15 | # deprecated API to know how to port your code away from it.
16 | DEFINES += QT_DEPRECATED_WARNINGS
17 |
18 | # You can also make your code fail to compile if it uses deprecated APIs.
19 | # In order to do so, uncomment the following line.
20 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
21 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
22 |
23 | SOURCES += \
24 | fermatspiralpath.cpp \
25 | main.cpp
26 |
27 | RESOURCES += qml.qrc
28 |
29 | # Additional import path used to resolve QML modules in Qt Creator's code model
30 | QML_IMPORT_PATH =
31 |
32 | # Additional import path used to resolve QML modules just for Qt Quick Designer
33 | QML_DESIGNER_IMPORT_PATH =
34 |
35 | # Default rules for deployment.
36 | qnx: target.path = /tmp/$${TARGET}/bin
37 | else: unix:!android: target.path = /opt/$${TARGET}/bin
38 | !isEmpty(target.path): INSTALLS += target
39 |
40 | HEADERS += \
41 | fermatspiralpath.h
42 |
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/MapFermatSpiral.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/MapFermatSpiral.exe
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/MapFermatSpiral.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/MapFermatSpiral.ilk
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/MapFermatSpiral.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/MapFermatSpiral.pdb
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/MapFermatSpiral.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/MapFermatSpiral.vc.pdb
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/fermatspiralpath.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/fermatspiralpath.obj
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/main.obj
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/moc_fermatspiralpath.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/moc_fermatspiralpath.obj
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/moc_predefs.h:
--------------------------------------------------------------------------------
1 | #define _MSC_EXTENSIONS
2 | #define _INTEGRAL_MAX_BITS 64
3 | #define _MSC_VER 1916
4 | #define _MSC_FULL_VER 191627049
5 | #define _MSC_BUILD 0
6 | #define _M_AMD64 100
7 | #define _M_X64 100
8 | #define _WIN64
9 | #define _WIN32
10 | #define _CPPRTTI
11 | #define _DEBUG
12 | #define _MT
13 | #define _DLL
14 |
--------------------------------------------------------------------------------
/MapFermatSpiral/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapFermatSpiral/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/MapFermatSpiral/fermatspiralpath.cpp:
--------------------------------------------------------------------------------
1 | #include "fermatspiralpath.h"
2 |
3 | #define M_PI (3.14159265358979323846)
4 | #define M_RAD (180/M_PI)
5 |
6 |
7 | FermatSpiralPath::FermatSpiralPath(void):
8 | _radius(60),
9 | _spacing(20)
10 | {
11 | SpiralPathAdd();
12 | }
13 |
14 | void FermatSpiralPath::SpiralPathAdd() {
15 |
16 | QGeoCoordinate corCenter(30.6562, 104.0657);
17 |
18 | QGeoCoordinate cor;
19 |
20 | _points.clear();
21 | _points.append(QVariant::fromValue(corCenter));
22 |
23 | double D_I = 0; //内径
24 | double N = _radius/_spacing; //圈数
25 |
26 | const int pointCount = 500;
27 | for (int i=0; i(pointCount-1);
31 |
32 | cor = corCenter.atDistanceAndAzimuth(D_I + _radius*phi, static_cast(N*phi * 2*M_PI*M_RAD));
33 | _points.append(QVariant::fromValue(cor));
34 |
35 | }
36 |
37 | pointsChanged();
38 | }
39 |
40 | void FermatSpiralPath::setRadius(const qreal &radius)
41 | {
42 | if( radius != 0.0) {
43 | _radius = radius;
44 | SpiralPathAdd();
45 | }
46 | }
47 |
48 | void FermatSpiralPath::setSpacing(const qreal &spacing)
49 | {
50 | if( spacing != 0.0) {
51 | _spacing = spacing;
52 | SpiralPathAdd();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/MapFermatSpiral/fermatspiralpath.h:
--------------------------------------------------------------------------------
1 | #ifndef FERMATSPIRALPATH_H
2 | #define FERMATSPIRALPATH_H
3 |
4 | #include "qgeocoordinate.h"
5 | #include "qvariant.h"
6 | #include "math.h"
7 |
8 | #include
9 |
10 | class FermatSpiralPath : public QObject
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | // FermatSpiralPath(QObject* parent);
16 |
17 | FermatSpiralPath(void);
18 |
19 | Q_PROPERTY(QVariantList points READ points NOTIFY pointsChanged)
20 |
21 | Q_PROPERTY(qreal radius READ radius WRITE setRadius)
22 | Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
23 |
24 |
25 | //read
26 | QVariantList points(void) const { return _points; }
27 | qreal radius(void) const { return _radius; }
28 | qreal spacing(void) const { return _spacing; }
29 |
30 | //write
31 | void setRadius (const qreal& radius);
32 | void setSpacing (const qreal& spacing);
33 |
34 | void SpiralPathAdd();
35 |
36 | signals:
37 | void pointsChanged (void);
38 |
39 | private:
40 | QVariantList _points;
41 | qreal _radius;
42 | qreal _spacing;
43 | };
44 |
45 | #endif // FERMATSPIRALPATH_H
46 |
--------------------------------------------------------------------------------
/MapFermatSpiral/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | int main(int argc, char *argv[])
7 | {
8 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
9 |
10 | QGuiApplication app(argc, argv);
11 |
12 | QQmlApplicationEngine engine;
13 |
14 | //start_cch_20211122
15 | qmlRegisterType ("cc.FermatSpiralPath", 1, 0, "FermatSpiralPath");
16 |
17 | const QUrl url(QStringLiteral("qrc:/main.qml"));
18 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
19 | &app, [url](QObject *obj, const QUrl &objUrl) {
20 | if (!obj && url == objUrl)
21 | QCoreApplication::exit(-1);
22 | }, Qt::QueuedConnection);
23 | engine.load(url);
24 |
25 | return app.exec();
26 | }
27 |
--------------------------------------------------------------------------------
/MapFermatSpiral/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MapGetdistance/MapGetdistance.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
32 | DISTFILES +=
33 |
--------------------------------------------------------------------------------
/MapGetdistance/debug/MapGetdistance.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapGetdistance/debug/MapGetdistance.exe
--------------------------------------------------------------------------------
/MapGetdistance/debug/MapGetdistance.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapGetdistance/debug/MapGetdistance.ilk
--------------------------------------------------------------------------------
/MapGetdistance/debug/MapGetdistance.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapGetdistance/debug/MapGetdistance.pdb
--------------------------------------------------------------------------------
/MapGetdistance/debug/MapGetdistance.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapGetdistance/debug/MapGetdistance.vc.pdb
--------------------------------------------------------------------------------
/MapGetdistance/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapGetdistance/debug/main.obj
--------------------------------------------------------------------------------
/MapGetdistance/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MapGetdistance/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/MapGetdistance/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/MapGetdistance/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | Getdistance.qml
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MenuForButton/ColoredImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick 2.12
3 | import QtGraphicalEffects 1.12
4 |
5 | Item {
6 | property alias asynchronous: image.asynchronous
7 | property alias cache: image.cache
8 | property alias fillMode: image.fillMode
9 | property alias horizontalAlignment: image.horizontalAlignment
10 | property alias mirror: image.mirror
11 | property alias paintedHeight: image.paintedHeight
12 | property alias paintedWidth: image.paintedWidth
13 | property alias progress: image.progress
14 | property alias smooth: image.smooth
15 | property alias mipmap: image.mipmap
16 | property alias source: image.source
17 | property alias sourceSize: image.sourceSize
18 | property alias status: image.status
19 | property alias verticalAlignment: image.verticalAlignment
20 | property alias imageOpacity: image.opacity;
21 | property alias sourceSizeHeight: image.sourceSize.height
22 | property alias sourceSizeWidth: image.sourceSize.width
23 |
24 | property alias coVisible: co.visible
25 | property alias color: co.color
26 |
27 |
28 | width: image.width
29 | height: image.height
30 |
31 | Image {
32 | id: image
33 | smooth: true
34 | mipmap: true
35 | antialiasing: true
36 | visible: true
37 | fillMode: Image.PreserveAspectFit
38 | anchors.fill: parent
39 | sourceSize.height: height
40 | }
41 |
42 | ColorOverlay {
43 | id: co;
44 | visible: true;
45 | anchors.fill: image
46 | source: image
47 | color: parent.color
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/MenuForButton/MenuForButton.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
--------------------------------------------------------------------------------
/MenuForButton/MyButton.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.9
2 | import QtQuick.Controls 2.5
3 |
4 | Button {
5 | id: button
6 | height: 20
7 | leftPadding: 4
8 | rightPadding: 4
9 | checkable: false
10 |
11 | property alias labelColor: _label.color
12 |
13 | onCheckedChanged: checkable = false
14 |
15 | background: Rectangle {
16 | anchors.fill: parent
17 | color: button.checked ? "#FFDC35" : Qt.rgba(0,0,0,0)
18 | }
19 |
20 | contentItem: Row { //可修改为Column
21 | spacing: 10
22 | anchors.verticalCenter: button.verticalCenter
23 |
24 | ColoredImage {
25 | id: innerImage
26 | width: 20
27 | height: width
28 | source: button.icon.source
29 | color: button.checked ? "#007979" : "black"
30 | }
31 |
32 | Text {
33 | id: _label
34 | visible: text !== ""
35 | text: button.text
36 | anchors.verticalCenter: parent.verticalCenter
37 | color: button.checked ? "#007979" : "black"
38 | font.bold: true
39 | font.pointSize: 15
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/MenuForButton/TestPage3.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | ColoredImage {
4 | source: "/images/focus"
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/MenuForButton/debug/MenuForButton.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/debug/MenuForButton.exe
--------------------------------------------------------------------------------
/MenuForButton/debug/MenuForButton.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/debug/MenuForButton.ilk
--------------------------------------------------------------------------------
/MenuForButton/debug/MenuForButton.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/debug/MenuForButton.pdb
--------------------------------------------------------------------------------
/MenuForButton/debug/MenuForButton.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/debug/MenuForButton.vc.pdb
--------------------------------------------------------------------------------
/MenuForButton/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/debug/main.obj
--------------------------------------------------------------------------------
/MenuForButton/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/MenuForButton/images/code.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/code.jpg
--------------------------------------------------------------------------------
/MenuForButton/images/dir1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/dir1.png
--------------------------------------------------------------------------------
/MenuForButton/images/dir2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/dir2.png
--------------------------------------------------------------------------------
/MenuForButton/images/dir3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/dir3.png
--------------------------------------------------------------------------------
/MenuForButton/images/dir4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/dir4.png
--------------------------------------------------------------------------------
/MenuForButton/images/dir5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/dir5.png
--------------------------------------------------------------------------------
/MenuForButton/images/focus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/focus.jpg
--------------------------------------------------------------------------------
/MenuForButton/images/line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/line.png
--------------------------------------------------------------------------------
/MenuForButton/images/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/menu.png
--------------------------------------------------------------------------------
/MenuForButton/images/working.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForButton/images/working.jpg
--------------------------------------------------------------------------------
/MenuForButton/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/MenuForButton/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | MyButton.qml
5 | TestPage1.qml
6 | TestPage2.qml
7 | TestPage3.qml
8 | ColoredImage.qml
9 |
10 |
11 | images/dir1.png
12 | images/dir2.png
13 | images/dir3.png
14 | images/dir4.png
15 | images/dir5.png
16 | images/line.png
17 | images/menu.png
18 | images/code.jpg
19 | images/focus.jpg
20 | images/working.jpg
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MenuForButton/slidier/ArtificialHorizonMain.qml.autosave:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick.Window 2.1
3 |
4 | Item {
5 |
6 | width: 400;
7 | height: 300
8 |
9 | //滑块条
10 | Rectangle {
11 | id: container
12 | property int oldWidth: 0
13 | anchors {
14 | bottom: parent.bottom;
15 | left: parent.left
16 | right: parent.right;
17 | leftMargin: 20;
18 | rightMargin: 20
19 | bottomMargin: 10
20 | }
21 | height: 16
22 |
23 | radius: height/2;
24 | opacity: 0.8
25 | antialiasing: true
26 | gradient: Gradient {
27 | GradientStop { position: 0.0; color: "gray" }
28 | GradientStop { position: 1.0; color: "white" }
29 | }
30 |
31 | onWidthChanged: {
32 | if (oldWidth === 0) {
33 | oldWidth = width;
34 | return
35 | }
36 |
37 | var desiredPercent = slider.x * 100 / (oldWidth - 32)
38 | slider.x = desiredPercent * (width - 32) / 100
39 | oldWidth = width
40 | }
41 |
42 | Rectangle {
43 | id: slider
44 | x: 1; y: 1; width: 30; height: 14
45 | radius: 6
46 | antialiasing: true
47 | gradient: Gradient {
48 | GradientStop { position: 0.0; color: "red" }
49 | GradientStop { position: 1.0; color: "blue" }
50 | }
51 | MouseArea {
52 | anchors.fill: parent
53 | anchors.margins: -16 // Increase mouse area a lot outside the slider
54 | drag.target: parent;
55 | drag.axis: Drag.XAxis
56 | drag.minimumX: 2;
57 | drag.maximumX: container.width - 32
58 | }
59 | }
60 | }
61 | QuitButton {
62 | anchors.right: parent.right
63 | anchors.top: parent.top
64 | anchors.margins: 10
65 | }
66 | }
67 | //! [0]
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/MenuForButton/slidier/ColorRect.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 |
3 | Item {
4 | property real value;
5 |
6 | id: root
7 | //[重点1]:clip, 当元素的子项超出父项范围后会自动裁剪,也就是子项超出了范围就剪切掉,不让他显示和起作用
8 | //在此中,限定在距离parent的54的范围内,默认为false
9 | clip: true
10 | anchors.fill: parent
11 | anchors.margins: 54;
12 |
13 | Item {
14 | width: root.width
15 | height: root.height * 3;
16 | anchors.centerIn: parent
17 | Rectangle {
18 | id: _top
19 | anchors.fill: parent
20 | smooth: true
21 | antialiasing: true
22 | gradient: Gradient {
23 | GradientStop { position: 0; color: "green" }
24 | GradientStop { position: 0.5; color: "aqua" }
25 | }
26 | }
27 | Rectangle {
28 | id: _bottom
29 | height: _top.height / 2
30 | anchors {
31 | left: _top.left;
32 | right: _top.right;
33 | bottom: _top.bottom
34 | }
35 | smooth: true
36 | antialiasing: true
37 | gradient: Gradient {
38 | GradientStop { position: 0.0; color: "yellow" }
39 | GradientStop { position: 1; color: "orange" }
40 | }
41 | }
42 | //蓝绿面板的上下平移
43 | transform: Translate{
44 | y: value //Y轴方向的偏移量
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MenuForButton/testPage1.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | ColoredImage {
4 | source: "/images/code"
5 | }
6 |
--------------------------------------------------------------------------------
/MenuForButton/testPage2.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 |
3 | ColoredImage {
4 | source: "/images/working"
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/MenuForListview/ColoredImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick 2.12
3 | import QtGraphicalEffects 1.12
4 |
5 | Item {
6 | property alias asynchronous: image.asynchronous
7 | property alias cache: image.cache
8 | property alias fillMode: image.fillMode
9 | property alias horizontalAlignment: image.horizontalAlignment
10 | property alias mirror: image.mirror
11 | property alias paintedHeight: image.paintedHeight
12 | property alias paintedWidth: image.paintedWidth
13 | property alias progress: image.progress
14 | property alias smooth: image.smooth
15 | property alias mipmap: image.mipmap
16 | property alias source: image.source
17 | property alias sourceSize: image.sourceSize
18 | property alias status: image.status
19 | property alias verticalAlignment: image.verticalAlignment
20 | property alias imageOpacity: image.opacity;
21 | property alias sourceSizeHeight: image.sourceSize.height
22 | property alias sourceSizeWidth: image.sourceSize.width
23 |
24 | property alias coVisible: co.visible
25 | property alias color: co.color
26 |
27 |
28 | width: image.width
29 | height: image.height
30 |
31 | Image {
32 | id: image
33 | smooth: true
34 | mipmap: true
35 | antialiasing: true
36 | visible: true
37 | fillMode: Image.PreserveAspectFit
38 | anchors.fill: parent
39 | sourceSize.height: height
40 | }
41 |
42 | ColorOverlay {
43 | id: co;
44 | visible: true;
45 | anchors.fill: image
46 | source: image
47 | color: parent.color
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/MenuForListview/MenuForListview.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
--------------------------------------------------------------------------------
/MenuForListview/debug/MenuForListview.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/debug/MenuForListview.exe
--------------------------------------------------------------------------------
/MenuForListview/debug/MenuForListview.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/debug/MenuForListview.ilk
--------------------------------------------------------------------------------
/MenuForListview/debug/MenuForListview.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/debug/MenuForListview.pdb
--------------------------------------------------------------------------------
/MenuForListview/debug/MenuForListview.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/debug/MenuForListview.vc.pdb
--------------------------------------------------------------------------------
/MenuForListview/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/debug/main.obj
--------------------------------------------------------------------------------
/MenuForListview/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/MenuForListview/images/code.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/code.jpg
--------------------------------------------------------------------------------
/MenuForListview/images/dir1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/dir1.png
--------------------------------------------------------------------------------
/MenuForListview/images/dir2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/dir2.png
--------------------------------------------------------------------------------
/MenuForListview/images/dir3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/dir3.png
--------------------------------------------------------------------------------
/MenuForListview/images/dir4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/dir4.png
--------------------------------------------------------------------------------
/MenuForListview/images/dir5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/dir5.png
--------------------------------------------------------------------------------
/MenuForListview/images/focus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/focus.jpg
--------------------------------------------------------------------------------
/MenuForListview/images/line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/line.png
--------------------------------------------------------------------------------
/MenuForListview/images/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/menu.png
--------------------------------------------------------------------------------
/MenuForListview/images/working.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForListview/images/working.jpg
--------------------------------------------------------------------------------
/MenuForListview/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/MenuForListview/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | ListviewMenu.qml
5 | ColoredImage.qml
6 |
7 |
8 | images/dir1.png
9 | images/dir2.png
10 | images/dir3.png
11 | images/dir4.png
12 | images/dir5.png
13 | images/line.png
14 | images/menu.png
15 | images/code.jpg
16 | images/focus.jpg
17 | images/working.jpg
18 |
19 |
20 |
--------------------------------------------------------------------------------
/MenuForRepeater/ColoredImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick 2.12
3 | import QtGraphicalEffects 1.12
4 |
5 | Item {
6 | property alias asynchronous: image.asynchronous
7 | property alias cache: image.cache
8 | property alias fillMode: image.fillMode
9 | property alias horizontalAlignment: image.horizontalAlignment
10 | property alias mirror: image.mirror
11 | property alias paintedHeight: image.paintedHeight
12 | property alias paintedWidth: image.paintedWidth
13 | property alias progress: image.progress
14 | property alias smooth: image.smooth
15 | property alias mipmap: image.mipmap
16 | property alias source: image.source
17 | property alias sourceSize: image.sourceSize
18 | property alias status: image.status
19 | property alias verticalAlignment: image.verticalAlignment
20 | property alias imageOpacity: image.opacity;
21 | property alias sourceSizeHeight: image.sourceSize.height
22 | property alias sourceSizeWidth: image.sourceSize.width
23 |
24 | property alias coVisible: co.visible
25 | property alias color: co.color
26 |
27 |
28 | width: image.width
29 | height: image.height
30 |
31 | Image {
32 | id: image
33 | smooth: true
34 | mipmap: true
35 | antialiasing: true
36 | visible: true
37 | fillMode: Image.PreserveAspectFit
38 | anchors.fill: parent
39 | sourceSize.height: height
40 | }
41 |
42 | ColorOverlay {
43 | id: co;
44 | visible: true;
45 | anchors.fill: image
46 | source: image
47 | color: parent.color
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/MenuForRepeater/MenuForRepeater.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
--------------------------------------------------------------------------------
/MenuForRepeater/debug/MenuForRepeater.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/debug/MenuForRepeater.exe
--------------------------------------------------------------------------------
/MenuForRepeater/debug/MenuForRepeater.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/debug/MenuForRepeater.ilk
--------------------------------------------------------------------------------
/MenuForRepeater/debug/MenuForRepeater.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/debug/MenuForRepeater.pdb
--------------------------------------------------------------------------------
/MenuForRepeater/debug/MenuForRepeater.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/debug/MenuForRepeater.vc.pdb
--------------------------------------------------------------------------------
/MenuForRepeater/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/debug/main.obj
--------------------------------------------------------------------------------
/MenuForRepeater/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/MenuForRepeater/images/code.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/code.jpg
--------------------------------------------------------------------------------
/MenuForRepeater/images/dir1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/dir1.png
--------------------------------------------------------------------------------
/MenuForRepeater/images/dir2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/dir2.png
--------------------------------------------------------------------------------
/MenuForRepeater/images/dir3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/dir3.png
--------------------------------------------------------------------------------
/MenuForRepeater/images/dir4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/dir4.png
--------------------------------------------------------------------------------
/MenuForRepeater/images/dir5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/dir5.png
--------------------------------------------------------------------------------
/MenuForRepeater/images/focus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/focus.jpg
--------------------------------------------------------------------------------
/MenuForRepeater/images/working.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForRepeater/images/working.jpg
--------------------------------------------------------------------------------
/MenuForRepeater/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/MenuForRepeater/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | RepeaterMenu.qml
5 | qml/slidier/ColorRect.qml
6 | qml/slidier/SlidierMain.qml
7 |
8 |
9 | images/dir1.png
10 | images/dir2.png
11 | images/dir3.png
12 | images/dir4.png
13 | images/dir5.png
14 | images/code.jpg
15 | images/focus.jpg
16 | images/working.jpg
17 |
18 |
19 |
--------------------------------------------------------------------------------
/MenuForRepeater/qml/slidier/ColorRect.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 |
3 | Item {
4 | property real value;
5 |
6 | id: root
7 | //[重点1]:clip, 当元素的子项超出父项范围后会自动裁剪,也就是子项超出了范围就剪切掉,不让他显示和起作用
8 | //在此中,限定在距离parent的54的范围内,默认为false
9 | clip: true
10 | anchors.fill: parent
11 | anchors.margins: 54;
12 |
13 | Item {
14 | width: root.width
15 | height: root.height * 3;
16 | anchors.centerIn: parent
17 | Rectangle {
18 | id: _top
19 | anchors.fill: parent
20 | smooth: true
21 | antialiasing: true
22 | gradient: Gradient {
23 | GradientStop { position: 0; color: "green" }
24 | GradientStop { position: 0.5; color: "aqua" }
25 | }
26 | }
27 | Rectangle {
28 | id: _bottom
29 | height: _top.height / 2
30 | anchors {
31 | left: _top.left;
32 | right: _top.right;
33 | bottom: _top.bottom
34 | }
35 | smooth: true
36 | antialiasing: true
37 | gradient: Gradient {
38 | GradientStop { position: 0.0; color: "yellow" }
39 | GradientStop { position: 1; color: "orange" }
40 | }
41 | }
42 | //蓝绿面板的上下平移
43 | transform: Translate{
44 | y: value //Y轴方向的偏移量
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/MenuForTabBar/ColoredImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import QtQuick 2.12
3 | import QtGraphicalEffects 1.12
4 |
5 | Item {
6 | property alias asynchronous: image.asynchronous
7 | property alias cache: image.cache
8 | property alias fillMode: image.fillMode
9 | property alias horizontalAlignment: image.horizontalAlignment
10 | property alias mirror: image.mirror
11 | property alias paintedHeight: image.paintedHeight
12 | property alias paintedWidth: image.paintedWidth
13 | property alias progress: image.progress
14 | property alias smooth: image.smooth
15 | property alias mipmap: image.mipmap
16 | property alias source: image.source
17 | property alias sourceSize: image.sourceSize
18 | property alias status: image.status
19 | property alias verticalAlignment: image.verticalAlignment
20 | property alias imageOpacity: image.opacity;
21 | property alias sourceSizeHeight: image.sourceSize.height
22 | property alias sourceSizeWidth: image.sourceSize.width
23 |
24 | property alias coVisible: co.visible
25 | property alias color: co.color
26 |
27 |
28 | width: image.width
29 | height: image.height
30 |
31 | Image {
32 | id: image
33 | smooth: true
34 | mipmap: true
35 | antialiasing: true
36 | visible: true
37 | fillMode: Image.PreserveAspectFit
38 | anchors.fill: parent
39 | sourceSize.height: height
40 | }
41 |
42 | ColorOverlay {
43 | id: co;
44 | visible: true;
45 | anchors.fill: image
46 | source: image
47 | color: parent.color
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/MenuForTabBar/MenuForTabBar.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
--------------------------------------------------------------------------------
/MenuForTabBar/debug/MenuForTabBar.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/debug/MenuForTabBar.exe
--------------------------------------------------------------------------------
/MenuForTabBar/debug/MenuForTabBar.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/debug/MenuForTabBar.ilk
--------------------------------------------------------------------------------
/MenuForTabBar/debug/MenuForTabBar.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/debug/MenuForTabBar.pdb
--------------------------------------------------------------------------------
/MenuForTabBar/debug/MenuForTabBar.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/debug/MenuForTabBar.vc.pdb
--------------------------------------------------------------------------------
/MenuForTabBar/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/debug/main.obj
--------------------------------------------------------------------------------
/MenuForTabBar/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/MenuForTabBar/images/code.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/code.jpg
--------------------------------------------------------------------------------
/MenuForTabBar/images/dir1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/dir1.png
--------------------------------------------------------------------------------
/MenuForTabBar/images/dir2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/dir2.png
--------------------------------------------------------------------------------
/MenuForTabBar/images/dir3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/dir3.png
--------------------------------------------------------------------------------
/MenuForTabBar/images/dir4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/dir4.png
--------------------------------------------------------------------------------
/MenuForTabBar/images/dir5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/dir5.png
--------------------------------------------------------------------------------
/MenuForTabBar/images/focus.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/focus.jpg
--------------------------------------------------------------------------------
/MenuForTabBar/images/line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/line.png
--------------------------------------------------------------------------------
/MenuForTabBar/images/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/menu.png
--------------------------------------------------------------------------------
/MenuForTabBar/images/working.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/MenuForTabBar/images/working.jpg
--------------------------------------------------------------------------------
/MenuForTabBar/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/MenuForTabBar/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | ColoredImage.qml
5 |
6 |
7 | images/dir1.png
8 | images/dir2.png
9 | images/dir3.png
10 | images/dir4.png
11 | images/dir5.png
12 | images/line.png
13 | images/menu.png
14 | images/code.jpg
15 | images/focus.jpg
16 | images/working.jpg
17 |
18 |
19 |
--------------------------------------------------------------------------------
/NetTools/NetTools.pro:
--------------------------------------------------------------------------------
1 | QT += quick \
2 | network \
3 | testlib
4 |
5 |
6 | CONFIG += c++11
7 |
8 |
9 | QMAKE_CXXFLAGS += -execution-charset:utf-8 # 让程序执行时使用utf-8字符集
10 | QMAKE_CXXFLAGS += -source-charset:utf-8 # 告诉vc编译器识别源文件编码类型是utf-8
11 |
12 |
13 | # The following define makes your compiler emit warnings if you use
14 | # any Qt feature that has been marked deprecated (the exact warnings
15 | # depend on your compiler). Refer to the documentation for the
16 | # deprecated API to know how to port your code away from it.
17 | DEFINES += QT_DEPRECATED_WARNINGS
18 |
19 | # You can also make your code fail to compile if it uses deprecated APIs.
20 | # In order to do so, uncomment the following line.
21 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
22 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
23 |
24 | SOURCES += \
25 | main.cpp \
26 | src/QmlControls/QmlObjectListModel.cc \
27 | src/TCPClient.cc \
28 | src/TCPServer.cc
29 |
30 | RESOURCES += qml.qrc
31 |
32 | # Additional import path used to resolve QML modules in Qt Creator's code model
33 | QML_IMPORT_PATH = $$PWD
34 |
35 | # Additional import path used to resolve QML modules just for Qt Quick Designer
36 | QML_DESIGNER_IMPORT_PATH =
37 |
38 | # Default rules for deployment.
39 | qnx: target.path = /tmp/$${TARGET}/bin
40 | else: unix:!android: target.path = /opt/$${TARGET}/bin
41 | !isEmpty(target.path): INSTALLS += target
42 |
43 | HEADERS += \
44 | src/QmlControls/QmlObjectListModel.h \
45 | src/TCPClient.h \
46 | src/TCPServer.h
47 |
48 | INCLUDEPATH += \
49 | src \
50 | src/QmlControls
51 |
52 |
--------------------------------------------------------------------------------
/NetTools/controls/CCColoredImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Styles 1.4
4 | import QtGraphicalEffects 1.0
5 |
6 | Item {
7 | property color color: "white" // Image color
8 |
9 | property alias asynchronous: image.asynchronous
10 | property alias cache: image.cache
11 | property alias fillMode: image.fillMode
12 | property alias horizontalAlignment: image.horizontalAlignment
13 | property alias mirror: image.mirror
14 | property alias paintedHeight: image.paintedHeight
15 | property alias paintedWidth: image.paintedWidth
16 | property alias progress: image.progress
17 | property alias smooth: image.smooth
18 | property alias mipmap: image.mipmap
19 | property alias source: image.source
20 | property alias sourceSize: image.sourceSize
21 | property alias status: image.status
22 | property alias verticalAlignment: image.verticalAlignment
23 | //start_cch_20220503
24 | property int _rotation: 0
25 |
26 |
27 | width: image.width
28 | height: image.height
29 |
30 | Image {
31 | id: image
32 | smooth: true
33 | mipmap: true
34 | antialiasing: true
35 | visible: false
36 | fillMode: Image.PreserveAspectFit
37 | anchors.fill: parent
38 | sourceSize.height: height
39 | //start_cch_20220503
40 | rotation: _rotation
41 | }
42 |
43 | ColorOverlay {
44 | anchors.fill: image
45 | source: image
46 | color: parent.color
47 | //start_cch_20220503
48 | rotation: _rotation
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/NetTools/controls/CCGradientImage.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.7
2 | import QtQuick.Controls 2.0
3 | import QtGraphicalEffects 1.12 ///--[Mark]
4 |
5 | LinearGradient
6 | {
7 | id: image
8 | width: height
9 |
10 | property alias iconSource: innerImage.source
11 |
12 | property real _startPos: 0.0
13 | property color _startColor: "white"
14 |
15 | property real _middlePos: (1-0.618)
16 | property color _middleColor: "white"
17 |
18 | property real _stopPos: 1.0
19 | property color _stopColor: qgcPal.ccTheme
20 |
21 | source: Image {
22 | id: innerImage
23 | mipmap: true
24 | antialiasing: true
25 | fillMode: Image.PreserveAspectFit
26 | }
27 |
28 | gradient: Gradient { //从上到下的
29 | GradientStop {
30 | position: _startPos
31 | color: _startColor
32 | }
33 |
34 | GradientStop {
35 | position: _middlePos
36 | color: _middleColor
37 | }
38 |
39 | GradientStop {
40 | position: _stopPos
41 | color: _stopColor
42 | }
43 | }
44 | start:Qt.point(0,0)
45 | end:Qt.point(0,height)
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/NetTools/controls/CCLabel.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 2.12
3 |
4 | Text {
5 | font.pointSize: 12
6 | font.family: "Microsoft Yahei"
7 | color: "white"
8 | antialiasing: true
9 | // font.bold: true
10 | // font.family: "Noto Sans SC"
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/NetTools/controls/CCMenuButton.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.9
2 | import QtQuick.Controls 2.5
3 |
4 | Button {
5 | id: button
6 | checkable: false
7 |
8 | property alias labelColor: _label.color
9 | property var imageSource
10 | property color _themeColor: "#a27e7e"//"#FFDC35"//"#a27e7e"
11 | onCheckedChanged: checkable = false
12 |
13 | background: Rectangle {
14 | anchors.fill: parent
15 | color: button.checked ? "#a27e7e"/*_themeColor*/ : Qt.rgba(0,0,0,0)
16 | border.color: "black"
17 | border.width: button.checked ? 1 : 0
18 | // color: button.checked ? "#FFDC35" : Qt.rgba(0,0,0,0)
19 | }
20 |
21 | contentItem: Row {
22 | spacing: 10
23 | anchors.verticalCenter: button.verticalCenter
24 |
25 | CCColoredImage {
26 | id: innerImage
27 | width: 20
28 | height: width
29 | source: button.icon.source
30 | color: button.checked ? "#black" : "black"
31 | visible: imageSource !== ""
32 | }
33 |
34 | Text {
35 | id: _label
36 | visible: text !== ""
37 | text: button.text
38 | anchors.verticalCenter: parent.verticalCenter
39 | color: button.checked ? "white" : "black"
40 | font.bold: true
41 | font.pointSize: 15
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/NetTools/controls/CCRadioButton.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.11
2 | import QtQuick.Controls 2.4
3 | import QtQuick.Controls.Styles 1.4
4 |
5 |
6 | RadioButton {
7 | id: control
8 | font.pointSize: 12
9 |
10 | property color textColor: "red"
11 | property color subColor: "#019858"
12 | property bool _noText: text === ""
13 |
14 | indicator: Rectangle {
15 | implicitWidth: 20
16 | implicitHeight: width
17 | color: "white"
18 | border.color: "black"
19 | radius: height / 2
20 | opacity: control.enabled ? 1 : 0.5
21 | x: control.leftPadding
22 | y: parent.height / 2 - height / 2
23 | Rectangle {
24 | anchors.centerIn: parent
25 | // Width should be an odd number to be centralized by the parent properly
26 | width: 2 * Math.floor(parent.width / 4) + 1
27 | height: width
28 | antialiasing: true
29 | radius: height * 0.5
30 | color: subColor
31 | visible: control.checked
32 | }
33 | }
34 |
35 | contentItem: CCLabel {
36 | text: control.text
37 | font.family: control.font.pointSize
38 | font.pointSize: control.font.pointSize
39 | font.bold: true
40 | color: control.textColor
41 | opacity: enabled ? 1.0 : 0.3
42 | verticalAlignment: Text.AlignVCenter
43 | leftPadding: control.indicator.width + (_noText ? 0 : 4)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/NetTools/controls/CCTextField.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 | import QtQuick.Controls 1.2
3 | import QtQuick.Controls.Styles 1.4
4 | import QtQuick.Layouts 1.2
5 |
6 | TextField {
7 | id: root
8 | textColor: "#000000"
9 | activeFocusOnPress: true
10 | antialiasing: true
11 | width: 150
12 |
13 | //点击输入框,则全选
14 | Component.onCompleted: selectAllIfActiveFocus()
15 | onActiveFocusChanged: selectAllIfActiveFocus()
16 | function selectAllIfActiveFocus() {
17 | if (activeFocus) {
18 | selectAll()
19 | }
20 | }
21 |
22 | style: TextFieldStyle {
23 | id: tfs
24 | font.pointSize: 13
25 | font.family: "Microsoft Yahei"
26 | renderType: Text.QtRendering // 渲染方式 This works around font rendering problems on windows
27 |
28 | background: Item {
29 | id: backgroundItem
30 | Rectangle {
31 | anchors.fill: parent
32 | anchors.bottomMargin: -2
33 | color: "#44ffffff" //边距的填充 可以用 green 测试
34 | }
35 |
36 | Rectangle {
37 | anchors.fill: parent
38 | border.width: 2//enabled ? 2 : 0
39 | border.color: enabled ? (root.activeFocus ? "#47b" : "#999" ) : "#E0E0E0"
40 | color: "#ffffff" //qgcPal.textField 边距的填充 可以用 red 测试
41 | radius: height *0.1
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/NetTools/controls/Controls/qmldir:
--------------------------------------------------------------------------------
1 | Module CC.Controls
2 |
3 | CCButton1 1.0 CCButton1.qml
4 | CCColoredImage 1.0 CCColoredImage.qml
5 | CCGradientImage 1.0 CCGradientImage.qml
6 | CCLabel 1.0 CCLabel.qml
7 | CCTextField 1.0 CCTextField.qml
8 | CCMenuButton 1.0 CCMenuButton.qml
9 | CCRadioButton 1.0 CCRadioButton.qml
10 |
--------------------------------------------------------------------------------
/NetTools/images/Disconnect.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/NetTools/images/Monitor.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/NetTools/images/Send.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/NetTools/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "TCPClient.h"
4 |
5 | //#include "qtquick2applicationviewer.h"
6 | #include
7 |
8 |
9 | QObject* SingletonTCPClientController(QQmlEngine*, QJSEngine*) {
10 | return new TCPClientController();
11 | }
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
16 |
17 | QGuiApplication app(argc, argv);
18 |
19 | ///init
20 | QString applicationName = QStringLiteral("NetTools");
21 | QString orgName = QStringLiteral("CCH");
22 | QString orgDomain = QStringLiteral("CCH");
23 | app.setApplicationName(applicationName);
24 | app.setOrganizationName(orgName);
25 | app.setOrganizationDomain(orgDomain);
26 | QSettings::setDefaultFormat(QSettings::IniFormat);
27 |
28 | QQmlApplicationEngine engine;
29 |
30 | engine.addImportPath(QStringLiteral("qrc:/qml"));
31 | // qmlRegisterType ("CC.Nettools", 1, 0, "TCPClient");
32 | //start_cch_20221216
33 | // engine.rootContext()->setContextProperty("TCPClient", new TCPClient);
34 | // qmlRegisterType ("CC.Nettools", 1, 0, "TCPClientController");
35 | qmlRegisterSingletonType ("CC.Nettools", 1, 0, "TCPClientController", SingletonTCPClientController);
36 |
37 | const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
38 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
39 | &app, [url](QObject *obj, const QUrl &objUrl) {
40 | if (!obj && url == objUrl)
41 | QCoreApplication::exit(-1);
42 | }, Qt::QueuedConnection);
43 | engine.load(url);
44 |
45 | return app.exec();
46 | }
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/NetTools/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | controls/CCButton1.qml
5 | controls/Controls/qmldir
6 | controls/CCLabel.qml
7 | controls/CCColoredImage.qml
8 | controls/CCGradientImage.qml
9 | controls/CCTextField.qml
10 | controls/CCMenuButton.qml
11 | controls/CCRadioButton.qml
12 |
13 |
14 | images/Disconnect.svg
15 | images/Monitor.svg
16 | images/Send.svg
17 |
18 |
19 |
--------------------------------------------------------------------------------
/NetTools/src/TCPServer.h:
--------------------------------------------------------------------------------
1 | #ifndef TCPServer_H
2 | #define TCPServer_H
3 |
4 | #include
5 |
6 | //#include //监听套接字
7 | //#include //通信套接字
8 | //#include
9 |
10 | #include
11 | #include
12 |
13 | #include
14 | #include "qloggingcategory.h"
15 |
16 |
17 | //Q_DECLARE_LOGGING_CATEGORY(CcTcpServer_H)
18 |
19 | class TCPServer : public QObject
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | /*explicit*/ TCPServer(QObject *parent = nullptr);
25 |
26 |
27 | Q_PROPERTY(quint16 serverPort READ serverPort WRITE setServerPort)
28 | Q_PROPERTY(bool isConnected READ isConnected NOTIFY isConnectedChanged)
29 | Q_PROPERTY(qreal gimbalPitch READ gimbalPitch NOTIFY gimbalPitchChanged)
30 |
31 |
32 | //READ
33 | quint16 serverPort () const { return _serverPort; }
34 | bool isConnected () const { return _isConnected; }
35 | qreal gimbalPitch () const { return _gimbalPitch; }
36 |
37 | //WRITE
38 | void setServerPort (const quint16 sp);
39 |
40 | Q_INVOKABLE void start (QString port);
41 | // Q_INVOKABLE bool start (uint16_t port, QHostAddress addr = QHostAddress::AnyIPv4);
42 | Q_INVOKABLE bool disconnect (void);
43 | Q_INVOKABLE bool sendData (const QString info);
44 |
45 | Q_INVOKABLE bool sendValue (char value);
46 | Q_INVOKABLE bool sendDataAdd (void);
47 |
48 | Q_INVOKABLE void timerStart (int dir);
49 |
50 | Q_INVOKABLE bool sendUpDown (int dir);
51 |
52 | void ReceiveParse(const QByteArray &buf);
53 |
54 |
55 | signals:
56 | void isConnectedChanged (const bool isConnect);
57 | void gimbalPitchChanged (qreal pitch);
58 |
59 | private slots:
60 | void newConnection();
61 | void readData();
62 |
63 | private:
64 | quint16 _serverPort;
65 |
66 | QTcpServer* _tcpServer = nullptr;
67 | QTcpSocket* _tcpSocket = nullptr;
68 |
69 | bool _isConnected = false;
70 | char _add = 0;
71 |
72 | QTimer _dirTimer;
73 | int _dir = 0;
74 | qreal _gimbalPitch = -90.0 ;
75 |
76 | };
77 |
78 | #endif
79 |
--------------------------------------------------------------------------------
/ParaProgressBar/ParaProgressBar.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
--------------------------------------------------------------------------------
/ParaProgressBar/Parallelogram.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 |
3 | Item {
4 | property real xs: 0 // 水平方向切变
5 | property real ys: 0 // 垂直方向切变
6 | property alias radius: rect.radius // 圆角
7 | property alias text: title.text // 文本
8 | property alias color: rect.color
9 |
10 | Rectangle {
11 | id: rect
12 | anchors.fill: parent
13 | color: "lightblue"
14 | // 切变矩阵
15 | // transform: Matrix4x4 {
16 | // matrix: Qt.matrix4x4(1, xs, 0, 0,
17 | // ys, 1, 0, 0,
18 | // 0, 0, 1, 0,
19 | // 0, 0, 0, 1)
20 |
21 | // }
22 |
23 | transform: Matrix4x4 {
24 | matrix: Qt.matrix4x4(1, xs, 0, 0,
25 | ys, 1, 0, 0,
26 | 0, 0, 1, 0,
27 | 0, 0, 0, 1)
28 |
29 | }
30 |
31 | Text {
32 | id: title
33 | anchors.centerIn: rect
34 | text: "0"
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ParaProgressBar/debug/ParaProgressBar.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/ParaProgressBar/debug/ParaProgressBar.exe
--------------------------------------------------------------------------------
/ParaProgressBar/debug/ParaProgressBar.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/ParaProgressBar/debug/ParaProgressBar.ilk
--------------------------------------------------------------------------------
/ParaProgressBar/debug/ParaProgressBar.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/ParaProgressBar/debug/ParaProgressBar.pdb
--------------------------------------------------------------------------------
/ParaProgressBar/debug/ParaProgressBar.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/ParaProgressBar/debug/ParaProgressBar.vc.pdb
--------------------------------------------------------------------------------
/ParaProgressBar/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/ParaProgressBar/debug/main.obj
--------------------------------------------------------------------------------
/ParaProgressBar/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/ParaProgressBar/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/ParaProgressBar/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/ParaProgressBar/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | Parallelogram.qml
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Popup/Popup.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
--------------------------------------------------------------------------------
/Popup/Test.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Window 2.12
3 | import QtQuick.Controls 2.4
4 |
5 | Item {
6 | Row {
7 | anchors.horizontalCenter: parent.horizontalCenter
8 | anchors.top: parent.top
9 | anchors.topMargin: 20
10 | spacing: 10
11 | Button {
12 | id: btn1
13 | text: "测试1"
14 | onClicked: {
15 | rootWindow.showPopupCenter(display1)
16 |
17 | }
18 | }
19 | Button {
20 | id: btn2
21 | text: "测试2"
22 | onClicked: {
23 | rootWindow.showPopupBottom(display2,btn2)
24 | }
25 | }
26 | }
27 |
28 | Component {
29 | id: display1
30 | Rectangle {
31 | width: lab1.width*1.5
32 | height: lab1.height*5
33 | radius: height*0.2
34 | color: "#FF9D6F"
35 | border.width: 4
36 | border.color: "black"
37 | Label {
38 | id: lab1
39 | anchors.centerIn: parent
40 | font.bold: true
41 | font.pointSize: 20
42 | text: "测试界面1(居中)"
43 | }
44 | }
45 | }
46 |
47 | Component {
48 | id: display2
49 | Rectangle {
50 | width: lab2.width*1.5
51 | height: lab2.height*5
52 | radius: height*0.2
53 | color: "#97CBFF"
54 | border.width: 4
55 | border.color: "black"
56 | Label {
57 | id: lab2
58 | anchors.centerIn: parent
59 | font.bold: true
60 | font.pointSize: 20
61 | text: "测试界面2(底部)"
62 | }
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Popup/debug/Popup.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Popup/debug/Popup.exe
--------------------------------------------------------------------------------
/Popup/debug/Popup.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Popup/debug/Popup.ilk
--------------------------------------------------------------------------------
/Popup/debug/Popup.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Popup/debug/Popup.pdb
--------------------------------------------------------------------------------
/Popup/debug/Popup.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Popup/debug/Popup.vc.pdb
--------------------------------------------------------------------------------
/Popup/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Popup/debug/main.obj
--------------------------------------------------------------------------------
/Popup/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/Popup/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/Popup/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/Popup/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | Test.qml
5 |
6 |
7 |
--------------------------------------------------------------------------------
/QmlLearningPro.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | # 20240820测试 20240820前创建的工程文件Android与 Windows均正常,具体见Readme
4 |
5 | SUBDIRS += \
6 | CanvasSector \ #扇形画布 https://blog.csdn.net/qq_16504163/article/details/116952399
7 | CrazyMath \ #疯狂数字游戏 https://blog.csdn.net/qq_16504163/article/details/120459571
8 | NetTools \
9 | TableView \
10 | MapFermatSpiral \ #地图中螺旋曲线 https://chuhan.blog.csdn.net/article/details/121621392
11 | MapGetdistance \ #地图中测距 https://blog.csdn.net/qq_16504163/article/details/109379164
12 | MenuForButton \ #工具栏目录1 https://blog.csdn.net/qq_16504163/article/details/109555984
13 | MenuForListview \ #工具栏目录2 以上
14 | MenuForRepeater \ #工具栏目录3 以上
15 | MenuForTabBar \ #工具栏目录4 以上
16 | ParaProgressBar \ #平行四边形进度条 https://blog.csdn.net/qq_16504163/article/details/115030440
17 | Popup \
18 | TranslationsDemo \
19 | VirtualJoystick \ \ #虚拟操作杆 https://blog.csdn.net/qq_16504163/article/details/119318325
20 | WordExportQml/qWord.pro
21 |
--------------------------------------------------------------------------------
/TableView/TableView.pro:
--------------------------------------------------------------------------------
1 | QT += quick \
2 | positioning \
3 | location
4 |
5 | CONFIG += c++11
6 |
7 |
8 | QMAKE_CXXFLAGS += -execution-charset:utf-8 # 让程序执行时使用utf-8字符集
9 | QMAKE_CXXFLAGS += -source-charset:utf-8 # 告诉vc编译器识别源文件编码类型是utf-8
10 |
11 | # The following define makes your compiler emit warnings if you use
12 | # any Qt feature that has been marked deprecated (the exact warnings
13 | # depend on your compiler). Refer to the documentation for the
14 | # deprecated API to know how to port your code away from it.
15 | DEFINES += QT_DEPRECATED_WARNINGS
16 |
17 | # You can also make your code fail to compile if it uses deprecated APIs.
18 | # In order to do so, uncomment the following line.
19 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
20 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
21 |
22 | SOURCES += \
23 | TargetCoordinate.cpp \
24 | main.cpp
25 |
26 | RESOURCES += qml.qrc
27 |
28 | # Additional import path used to resolve QML modules in Qt Creator's code model
29 | QML_IMPORT_PATH =
30 |
31 | # Additional import path used to resolve QML modules just for Qt Quick Designer
32 | QML_DESIGNER_IMPORT_PATH =
33 |
34 | # Default rules for deployment.
35 | qnx: target.path = /tmp/$${TARGET}/bin
36 | else: unix:!android: target.path = /opt/$${TARGET}/bin
37 | !isEmpty(target.path): INSTALLS += target
38 |
39 | HEADERS += \
40 | TargetCoordinate.h
41 |
--------------------------------------------------------------------------------
/TableView/TargetCoordinate.h:
--------------------------------------------------------------------------------
1 | #ifndef LOESIMULATIONEVALUATION_H
2 | #define LOESIMULATIONEVALUATION_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | class TargetCoordinate : public QAbstractTableModel
10 | {
11 | Q_OBJECT
12 |
13 | public:
14 |
15 | TargetCoordinate(QObject* parent = nullptr);
16 | ~TargetCoordinate();
17 |
18 | // Q_PROPERTY(QmlObjectListModel* mode READ mode /* WRITE setMode*/ NOTIFY modeChanged)
19 | Q_PROPERTY(QVariantList* mode READ mode NOTIFY modeChanged)
20 | QVariantList *mode (void) {return &_mode; }
21 |
22 | void InitTestData();
23 | void TestAdd();
24 |
25 | Q_INVOKABLE QAbstractItemModel *model();
26 | QGeoCoordinate getCoor(void);
27 | Q_INVOKABLE int insertRowsCoor(int row, int count) ;
28 | Q_INVOKABLE void removeRowsCoor(int row);
29 | Q_INVOKABLE void refreshTableView(void);
30 |
31 | // Q_INVOKABLE void testAddWayPoint();
32 |
33 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
34 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
35 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
36 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
37 | Qt::ItemFlags flags(const QModelIndex &index) const override;
38 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
39 | Q_INVOKABLE void addCoordinate(const QGeoCoordinate &coordinate);
40 | void removeCoordinate(int row);
41 | QGeoCoordinate getCoordinate(int row) const;
42 |
43 | QHash roleNames() const override;
44 | enum TABLE_ITEM_ROLE
45 | {
46 | numRole = Qt::UserRole+1,
47 | lngRole ,
48 | latRole,
49 | altRole,
50 |
51 | };
52 |
53 | signals:
54 | void modeChanged ();
55 |
56 | public slots:
57 |
58 | private:
59 |
60 | QHash m_roleName;
61 |
62 | QList m_coordinates;
63 |
64 |
65 | QVariantList _mode;
66 |
67 | double _tmplat ;
68 | double _tmplng;
69 | double _tmpalt ;
70 | };
71 |
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/TableView/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "TargetCoordinate.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
8 |
9 | QGuiApplication app(argc, argv);
10 |
11 |
12 | qmlRegisterType ("Ext.TC", 1, 0, "TargetCoordinate");
13 |
14 |
15 | QQmlApplicationEngine engine;
16 | const QUrl url(QStringLiteral("qrc:/main.qml"));
17 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
18 | &app, [url](QObject *obj, const QUrl &objUrl) {
19 | if (!obj && url == objUrl)
20 | QCoreApplication::exit(-1);
21 | }, Qt::QueuedConnection);
22 | engine.load(url);
23 |
24 | return app.exec();
25 | }
26 |
--------------------------------------------------------------------------------
/TableView/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TranslationsDemo/TranslationTest.cpp:
--------------------------------------------------------------------------------
1 | #include "TranslationTest.h"
2 |
3 | QGuiApplication* _app = nullptr;
4 |
5 |
6 | const QStringList TranslationTest::_rangeTypeNames = {
7 | _app->translate( "ColorTest", QT_TRANSLATE_NOOP("ColorTest", "red")),
8 | _app->translate( "ColorTest", QT_TRANSLATE_NOOP("ColorTest", "blue")),
9 | _app->translate( "ColorTest", QT_TRANSLATE_NOOP("ColorTest", "yellow"))
10 | };
11 |
12 |
13 | const char *TranslationTest::greetingStrings[] = {
14 | QT_TRANSLATE_NOOP( "FriendlyConversation", "Hello"),
15 | QT_TRANSLATE_NOOP( "FriendlyConversation", "Goodbye"),
16 | QT_TRANSLATE_NOOP( "FriendlyConversation", "How are you?")
17 | };
18 |
19 | QString TranslationTest::globalGreeting(int type)
20 | {
21 | return _app->translate( "FriendlyConversation", greetingStrings[type]);
22 | }
23 |
24 | TranslationTest::TranslationTest(QObject *parent) : QObject(parent)
25 | {
26 | }
27 |
28 | //QStringList TranslationTest::GetQStringList() {
29 | // QStringList tmp;
30 | // tmp.append(_app->translate( "ColorTest", QT_TRANSLATE_NOOP("ColorTest", "red")));
31 | // tmp.append(_app->translate( "ColorTest", QT_TRANSLATE_NOOP("ColorTest", "blue")));
32 | // tmp.append(_app->translate( "ColorTest", QT_TRANSLATE_NOOP("ColorTest", "yellow")));
33 |
34 | // return tmp;
35 | //}
36 |
37 | QString TranslationTest::AppTranslate(const char* cchar)
38 | {
39 | const char* context = "ContextTest";
40 | return _app->translate( context, QT_TRANSLATE_NOOP(context, cchar));
41 | }
42 |
43 | QStringList TranslationTest::GetQStringList() {
44 | QStringList tmp;
45 |
46 | QMap flightMode = {
47 | { STABILIZE, AppTranslate("Stabilize")},
48 | { ALT_HOLD, AppTranslate("Altitude Hold")},
49 | { POS_HOLD, AppTranslate("Position Hold")}
50 | };
51 |
52 | for(uint32_t i: flightMode.keys()) {
53 | tmp.append(flightMode[i]); // tmp << enumToString[i];
54 | }
55 | return tmp;
56 | }
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/TranslationsDemo/TranslationTest.h:
--------------------------------------------------------------------------------
1 | #ifndef TRANSLATIONTEST_H
2 | #define TRANSLATIONTEST_H
3 |
4 | #include
5 | #include
6 |
7 | extern QGuiApplication* _app;
8 |
9 |
10 | class TranslationTest : public QObject
11 | {
12 | Q_OBJECT
13 | public:
14 | explicit TranslationTest(QObject *parent = nullptr);
15 |
16 | enum Mode {
17 | STABILIZE = 0, // hold level position
18 | ALT_HOLD ,
19 | POS_HOLD
20 | };
21 |
22 | Q_PROPERTY(QStringList qStringListTest READ GetQStringList CONSTANT)
23 | // QStringList rangeTypeNames () { return _rangeTypeNames; }
24 |
25 | QString AppTranslate(const char* cchar);
26 |
27 | Q_INVOKABLE QString globalGreeting(int type) ;
28 | Q_INVOKABLE QStringList GetQStringList();
29 |
30 | signals:
31 |
32 | public slots:
33 |
34 | private:
35 | static const char *greetingStrings[];
36 | static const QStringList _rangeTypeNames;
37 |
38 | };
39 |
40 | #endif // TRANSLATIONTEST_H
41 |
--------------------------------------------------------------------------------
/TranslationsDemo/Translations/zh_CN.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/Translations/zh_CN.qm
--------------------------------------------------------------------------------
/TranslationsDemo/Translations/zh_CN.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | main
6 |
7 |
8 | Hello World
9 | Hello World
10 |
11 |
12 |
13 | Qml Test1
14 | Qml 测试1
15 |
16 |
17 |
18 | FriendlyConversation
19 |
20 |
21 | Hello
22 | 你好
23 |
24 |
25 |
26 | Goodbye
27 | 再见
28 |
29 |
30 |
31 | How are you?
32 | 你好吗?
33 |
34 |
35 |
36 | ContextTest
37 |
38 |
39 | Stabilize
40 | 增稳
41 |
42 |
43 |
44 | Altitude Hold
45 | 高度保持
46 |
47 |
48 |
49 | Position Hold
50 | 位置保持
51 |
52 |
53 |
54 | ColorTest
55 |
56 |
57 | red
58 | 红色
59 |
60 |
61 |
62 | blue
63 | 蓝色
64 |
65 |
66 |
67 | yellow
68 | 黄色
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/TranslationsDemo/TranslationsDemo.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | TranslationTest.cpp \
18 | main.cpp
19 |
20 | RESOURCES += qml.qrc
21 |
22 | # Additional import path used to resolve QML modules in Qt Creator's code model
23 | QML_IMPORT_PATH =
24 |
25 | # Additional import path used to resolve QML modules just for Qt Quick Designer
26 | QML_DESIGNER_IMPORT_PATH =
27 |
28 | # Default rules for deployment.
29 | qnx: target.path = /tmp/$${TARGET}/bin
30 | else: unix:!android: target.path = /opt/$${TARGET}/bin
31 | !isEmpty(target.path): INSTALLS += target
32 |
33 | DISTFILES +=
34 |
35 | TRANSLATIONS += $$PWD/Translations/zh_CN.ts
36 |
37 | HEADERS += \
38 | TranslationTest.h
39 |
40 |
--------------------------------------------------------------------------------
/TranslationsDemo/debug/TranslationTest.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/TranslationTest.obj
--------------------------------------------------------------------------------
/TranslationsDemo/debug/TranslationsDemo.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/TranslationsDemo.exe
--------------------------------------------------------------------------------
/TranslationsDemo/debug/TranslationsDemo.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/TranslationsDemo.ilk
--------------------------------------------------------------------------------
/TranslationsDemo/debug/TranslationsDemo.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/TranslationsDemo.pdb
--------------------------------------------------------------------------------
/TranslationsDemo/debug/TranslationsDemo.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/TranslationsDemo.vc.pdb
--------------------------------------------------------------------------------
/TranslationsDemo/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/main.obj
--------------------------------------------------------------------------------
/TranslationsDemo/debug/moc_TranslationTest.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/moc_TranslationTest.obj
--------------------------------------------------------------------------------
/TranslationsDemo/debug/moc_predefs.h:
--------------------------------------------------------------------------------
1 | #define _MSC_EXTENSIONS
2 | #define _INTEGRAL_MAX_BITS 64
3 | #define _MSC_VER 1916
4 | #define _MSC_FULL_VER 191627049
5 | #define _MSC_BUILD 0
6 | #define _M_AMD64 100
7 | #define _M_X64 100
8 | #define _WIN64
9 | #define _WIN32
10 | #define _CPPRTTI
11 | #define _DEBUG
12 | #define _MT
13 | #define _DLL
14 |
--------------------------------------------------------------------------------
/TranslationsDemo/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/TranslationsDemo/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/TranslationsDemo/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 | #include
6 | #include
7 | #include "TranslationTest.h"
8 |
9 |
10 | void setLanguage(QGuiApplication *app) {
11 |
12 | QLocale locale = QLocale::system();
13 |
14 | if(locale.language() == QLocale::Chinese)
15 | {
16 | QTranslator *translator = new QTranslator(app);
17 | ///--以下三种方法都可以加载翻译文件
18 | if(translator->load(":/translations/zh_CN.qm"))
19 | // if(translator->load(locale, ":/translations/zh_CN.qm", "", ":/i18n"))
20 | // if (translator->load(locale, "zh_CN", ".", ":/translations", ".qm"))
21 | {
22 | app->installTranslator(translator);
23 | }
24 | else {
25 | qDebug() << "Error loading source localization ";
26 | }
27 | }
28 | }
29 |
30 | static QObject *backendInterfaceProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
31 | {
32 | Q_UNUSED(engine)
33 | Q_UNUSED(scriptEngine)
34 |
35 | return new TranslationTest();
36 | }
37 |
38 | int main(int argc, char *argv[])
39 | {
40 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
41 |
42 | QGuiApplication app(argc, argv);
43 |
44 | setLanguage(&app);
45 |
46 | QQmlApplicationEngine engine;
47 | const QUrl url(QStringLiteral("qrc:/main.qml"));
48 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
49 | &app, [url](QObject *obj, const QUrl &objUrl) {
50 | if (!obj && url == objUrl)
51 | QCoreApplication::exit(-1);
52 | }, Qt::QueuedConnection);
53 |
54 | engine.rootContext()->setContextProperty("TranslationTest", new TranslationTest); //[flag3]
55 | // qmlRegisterSingletonType ("CC.QML", 1, 0, "TranslationTest", backendInterfaceProvider);
56 |
57 | engine.load(url);
58 |
59 |
60 |
61 | return app.exec();
62 | }
63 |
--------------------------------------------------------------------------------
/TranslationsDemo/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Window 2.12
3 | import QtQuick.Controls 2.12
4 |
5 | //import CC.QML 1.0
6 |
7 | Window {
8 | visible: true
9 | width: 640
10 | height: 480
11 | title: qsTr("Hello World")
12 |
13 | Column {
14 | anchors.centerIn: parent
15 | spacing: 15
16 | // Label {
17 | // text: qsTr("Qml Test1")
18 | // font.pointSize: 15
19 | // }
20 |
21 | Label {
22 | text: TranslationTest.globalGreeting(0)
23 | font.pointSize: 15
24 | }
25 | Label {
26 | text: TranslationTest.globalGreeting(1)
27 | font.pointSize: 15
28 | }
29 |
30 | // Rectangle {
31 | // width: parent.width
32 | // height: 2
33 | // color: "red"
34 | // }
35 |
36 | // Repeater {
37 | // id: repeater
38 | // model: TranslationTest.qStringListTest
39 | // Label {
40 | // text: modelData
41 | // font.pointSize: 15
42 | // font.bold: true //黑体
43 | // }
44 | // }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/TranslationsDemo/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 | Translations/zh_CN.ts
7 | Translations/zh_CN.qm
8 |
9 |
10 |
--------------------------------------------------------------------------------
/VirtualJoystick/VirtualJoystick.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
32 | DISTFILES += \
33 | android/AndroidManifest.xml \
34 | android/build.gradle \
35 | android/gradle/wrapper/gradle-wrapper.jar \
36 | android/gradle/wrapper/gradle-wrapper.properties \
37 | android/gradlew \
38 | android/gradlew.bat \
39 | android/res/values/libs.xml
40 |
41 | contains(ANDROID_TARGET_ARCH,arm64-v8a) {
42 | ANDROID_PACKAGE_SOURCE_DIR = \
43 | $$PWD/android
44 | }
45 |
--------------------------------------------------------------------------------
/VirtualJoystick/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.2.0'
9 | }
10 | }
11 |
12 | repositories {
13 | google()
14 | jcenter()
15 | }
16 |
17 | apply plugin: 'com.android.application'
18 |
19 | dependencies {
20 | implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
21 | }
22 |
23 | android {
24 | /*******************************************************
25 | * The following variables:
26 | * - androidBuildToolsVersion,
27 | * - androidCompileSdkVersion
28 | * - qt5AndroidDir - holds the path to qt android files
29 | * needed to build any Qt application
30 | * on Android.
31 | *
32 | * are defined in gradle.properties file. This file is
33 | * updated by QtCreator and androiddeployqt tools.
34 | * Changing them manually might break the compilation!
35 | *******************************************************/
36 |
37 | compileSdkVersion androidCompileSdkVersion.toInteger()
38 |
39 | buildToolsVersion '28.0.3'
40 |
41 | sourceSets {
42 | main {
43 | manifest.srcFile 'AndroidManifest.xml'
44 | java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
45 | aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
46 | res.srcDirs = [qt5AndroidDir + '/res', 'res']
47 | resources.srcDirs = ['src']
48 | renderscript.srcDirs = ['src']
49 | assets.srcDirs = ['assets']
50 | jniLibs.srcDirs = ['libs']
51 | }
52 | }
53 |
54 | lintOptions {
55 | abortOnError false
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/VirtualJoystick/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/VirtualJoystick/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/VirtualJoystick/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/VirtualJoystick/android/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/android/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/VirtualJoystick/android/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/android/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/VirtualJoystick/android/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/android/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/VirtualJoystick/android/res/values/libs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - https://download.qt.io/ministro/android/qt5/qt-5.9
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/VirtualJoystick/debug/VirtualJoystick.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/debug/VirtualJoystick.exe
--------------------------------------------------------------------------------
/VirtualJoystick/debug/VirtualJoystick.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/debug/VirtualJoystick.ilk
--------------------------------------------------------------------------------
/VirtualJoystick/debug/VirtualJoystick.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/debug/VirtualJoystick.pdb
--------------------------------------------------------------------------------
/VirtualJoystick/debug/VirtualJoystick.vc.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/debug/VirtualJoystick.vc.pdb
--------------------------------------------------------------------------------
/VirtualJoystick/debug/main.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/debug/main.obj
--------------------------------------------------------------------------------
/VirtualJoystick/debug/qrc_qml.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/debug/qrc_qml.obj
--------------------------------------------------------------------------------
/VirtualJoystick/images/Cat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/images/Cat.png
--------------------------------------------------------------------------------
/VirtualJoystick/images/Dog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/images/Dog.png
--------------------------------------------------------------------------------
/VirtualJoystick/images/Dog.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/VirtualJoystick/images/Down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/VirtualJoystick/images/JoystickBezelLight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/images/JoystickBezelLight.png
--------------------------------------------------------------------------------
/VirtualJoystick/images/Left.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/VirtualJoystick/images/Right.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/VirtualJoystick/images/Up.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/VirtualJoystick/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/qml/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/VirtualJoystick/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick.Window 2.12
2 | import QtQuick 2.12
3 | import QtQuick.Controls 1.2
4 |
5 | Window {
6 | visible: true
7 | width: 192 * 4
8 | height: 108 * 4
9 | color: "grey"
10 |
11 | property real _offset: leftStick.width/2
12 |
13 | JoystickThumbPad {
14 | id: leftStick
15 | anchors.leftMargin: xPositionDelta + _offset
16 | anchors.bottomMargin: -yPositionDelta + _offset
17 | anchors.left: parent.left
18 | anchors.bottom: parent.bottom
19 | width: 100
20 | height: 100
21 | imageHeight: 20
22 | }
23 |
24 | JoystickThumbPad {
25 | id: rightStick
26 | anchors.rightMargin: -xPositionDelta + _offset
27 | anchors.bottomMargin: -yPositionDelta + _offset
28 | anchors.right: parent.right
29 | anchors.bottom: parent.bottom
30 | width: 100
31 | height: 100
32 | imageHeight: 20
33 | }
34 |
35 | Output {
36 | id: output
37 | x: 50
38 | y: 10
39 | height: parent.height - leftStick.height*2 - y*2
40 | width: parent.width - x*2
41 | }
42 |
43 | ///--You can also use signals
44 | Timer {
45 | interval: 50 // 20Hz
46 | running: true
47 | repeat: true
48 | onTriggered: {
49 | output.leftX = leftStick.xAxis
50 | output.leftY = leftStick.yAxis
51 | output.rightX = rightStick.xAxis
52 | output.rightY = rightStick.yAxis
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/VirtualJoystick/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | qml/JoystickThumbPad.qml
5 | qml/Output.qml
6 |
7 |
8 | images/Down.svg
9 | images/Left.svg
10 | images/Up.svg
11 | images/Right.svg
12 | images/JoystickBezelLight.png
13 | images/Cat.svg
14 | images/Dog.svg
15 | images/Dog.png
16 | images/Cat.png
17 |
18 |
19 |
--------------------------------------------------------------------------------
/VirtualJoystick/qml/Output.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Controls 1.2
3 |
4 | Item {
5 |
6 | property real leftX
7 | property real leftY
8 |
9 | property real rightX
10 | property real rightY
11 |
12 | Rectangle {
13 | id: dogRect
14 | width: (parent.width - 50)/2
15 | height: parent.height
16 | color: "#FFE6D9"
17 | border.width: 2
18 | border.color: "black"
19 |
20 | property real imageCenter: dogImage.width / 2
21 | property real moveX: Math.max(Math.min(leftX*width - imageCenter, width - dogImage.width) , 0)
22 | property real moveY: Math.max(Math.min(leftY*height - imageCenter, height - dogImage.height), 0)
23 |
24 | Image {
25 | id: dogImage
26 | mipmap: true
27 | fillMode: Image.PreserveAspectFit
28 | source: "/images/Dog.png"
29 | x: dogRect.moveX
30 | y: dogRect.moveY
31 | }
32 | }
33 |
34 | Rectangle {
35 | id: catRect
36 | width: (parent.width - 50)/2
37 | height: parent.height
38 | color: "#FFE6D9"
39 | anchors.left: dogRect.right
40 | anchors.leftMargin: 50
41 | border.width: 2
42 | border.color: "black"
43 | property real imageCenter: catImage.width / 2
44 |
45 | property real moveX: Math.max(Math.min(rightX*width - imageCenter , width - catImage.width) , 0)
46 | property real moveY: Math.max(Math.min(rightY*height - imageCenter, height - catImage.height), 0)
47 |
48 | Image {
49 | id: catImage
50 | mipmap: true
51 | fillMode: Image.PreserveAspectFit
52 | source: "/images/Cat.png"
53 | x: catRect.moveX
54 | y: catRect.moveY
55 | }
56 | }
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/VirtualJoystick/virtualJoystick.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/virtualJoystick.ico
--------------------------------------------------------------------------------
/VirtualJoystick/virtualJoystick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/VirtualJoystick/virtualJoystick.png
--------------------------------------------------------------------------------
/WordExportQml/.qmake.stash:
--------------------------------------------------------------------------------
1 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
2 | QMAKE_CXX.QMAKE_MSC_VER = 1929
3 | QMAKE_CXX.QMAKE_MSC_FULL_VER = 192930154
4 | QMAKE_CXX.COMPILER_MACROS = \
5 | QT_COMPILER_STDCXX \
6 | QMAKE_MSC_VER \
7 | QMAKE_MSC_FULL_VER
8 | QMAKE_CXX.INCDIRS = \
9 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\ATLMFC\\include" \
10 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\include" \
11 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt" \
12 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\shared" \
13 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\um" \
14 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\winrt" \
15 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\cppwinrt"
16 | QMAKE_CXX.LIBDIRS = \
17 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\ATLMFC\\lib\\x64" \
18 | "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\lib\\x64" \
19 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x64" \
20 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\um\\x64"
21 |
--------------------------------------------------------------------------------
/WordExportQml/Test.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chenchuhan/QmlLearningPro/8bf0a24989ea177543687c122fd870866eb985f9/WordExportQml/Test.docx
--------------------------------------------------------------------------------
/WordExportQml/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "src/OfficeExporter.h"
5 |
6 | int main(int argc, char *argv[])
7 | {
8 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
9 |
10 | QGuiApplication app(argc, argv);
11 |
12 | qmlRegisterType("com.example.OfficeExporter", 1, 0, "OfficeExporter");
13 |
14 | QQmlApplicationEngine engine;
15 | const QUrl url(QStringLiteral("qrc:/main.qml"));
16 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
17 | &app, [url](QObject *obj, const QUrl &objUrl) {
18 | if (!obj && url == objUrl)
19 | QCoreApplication::exit(-1);
20 | }, Qt::QueuedConnection);
21 | engine.load(url);
22 |
23 | return app.exec();
24 | }
25 |
--------------------------------------------------------------------------------
/WordExportQml/qWord.pro:
--------------------------------------------------------------------------------
1 | QT += quick axcontainer
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp \
18 | src/OfficeExporter.cpp
19 |
20 | RESOURCES += qml.qrc
21 |
22 | # Additional import path used to resolve QML modules in Qt Creator's code model
23 | QML_IMPORT_PATH =
24 |
25 | # Additional import path used to resolve QML modules just for Qt Quick Designer
26 | QML_DESIGNER_IMPORT_PATH =
27 |
28 | # Default rules for deployment.
29 | qnx: target.path = /tmp/$${TARGET}/bin
30 | else: unix:!android: target.path = /opt/$${TARGET}/bin
31 | !isEmpty(target.path): INSTALLS += target
32 |
33 | HEADERS += \
34 | src/OfficeExporter.h
35 |
--------------------------------------------------------------------------------
/WordExportQml/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WordExportQml/src/OfficeExporter.h:
--------------------------------------------------------------------------------
1 | #ifndef OFFICEEXPORTER_H
2 | #define OFFICEEXPORTER_H
3 |
4 | #include
5 | #include
6 |
7 | class OfficeExporter : public QObject {
8 | Q_OBJECT
9 | public:
10 | explicit OfficeExporter(QObject *parent = nullptr);
11 |
12 | Q_INVOKABLE bool exportWord(const QString &filePath, const QString &content);
13 |
14 | // 创建并保存 Word 文档
15 | Q_INVOKABLE bool createAndSaveWordDocument(const QString &filePath, const QString &content);
16 |
17 | Q_INVOKABLE bool createFromTemplate(const QString &templatePath, const QString &outputPath, const QVariantMap &data);
18 |
19 | bool replaceMultiple(const QString &templatePath, const QString &outputPath, const QMap &placeholders);
20 |
21 | };
22 | #endif // OFFICEEXPORTER_H
23 |
--------------------------------------------------------------------------------
/untitled/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
7 |
8 | QGuiApplication app(argc, argv);
9 |
10 | QQmlApplicationEngine engine;
11 | const QUrl url(QStringLiteral("qrc:/main.qml"));
12 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
13 | &app, [url](QObject *obj, const QUrl &objUrl) {
14 | if (!obj && url == objUrl)
15 | QCoreApplication::exit(-1);
16 | }, Qt::QueuedConnection);
17 | engine.load(url);
18 |
19 | return app.exec();
20 | }
21 |
--------------------------------------------------------------------------------
/untitled/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.12
2 | import QtQuick.Window 2.12
3 |
4 | Window {
5 | visible: true
6 | width: 640
7 | height: 480
8 | title: qsTr("Hello World")
9 | }
10 |
--------------------------------------------------------------------------------
/untitled/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/untitled/untitled.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 |
3 | CONFIG += c++11
4 |
5 | # The following define makes your compiler emit warnings if you use
6 | # any Qt feature that has been marked deprecated (the exact warnings
7 | # depend on your compiler). Refer to the documentation for the
8 | # deprecated API to know how to port your code away from it.
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | # You can also make your code fail to compile if it uses deprecated APIs.
12 | # In order to do so, uncomment the following line.
13 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
14 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
15 |
16 | SOURCES += \
17 | main.cpp
18 |
19 | RESOURCES += qml.qrc
20 |
21 | # Additional import path used to resolve QML modules in Qt Creator's code model
22 | QML_IMPORT_PATH =
23 |
24 | # Additional import path used to resolve QML modules just for Qt Quick Designer
25 | QML_DESIGNER_IMPORT_PATH =
26 |
27 | # Default rules for deployment.
28 | qnx: target.path = /tmp/$${TARGET}/bin
29 | else: unix:!android: target.path = /opt/$${TARGET}/bin
30 | !isEmpty(target.path): INSTALLS += target
31 |
--------------------------------------------------------------------------------