mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-01 15:42:20 +08:00
Compare commits
93 Commits
Author | SHA1 | Date | |
---|---|---|---|
e1c6c04013 | |||
0c19164c54 | |||
86790c9562 | |||
b784f70479 | |||
4bd6712782 | |||
8668e39446 | |||
a0dae17117 | |||
0a1c6d54bc | |||
f8146f24ea | |||
dd16b4703d | |||
7d5fcc6e47 | |||
9c843a7157 | |||
e4accb8064 | |||
747d18364b | |||
cb85f10758 | |||
88cae89f31 | |||
a14e502abd | |||
b20046c0a9 | |||
b5c0ec50a8 | |||
8281fa1e9d | |||
26e9b5d298 | |||
eaad0dc565 | |||
9a494e938c | |||
ad35ac2588 | |||
c81910a41f | |||
cff6aaf6f4 | |||
a1c8672a5a | |||
df5e657ad1 | |||
fb4ed03530 | |||
7ceb4f27a3 | |||
292e96cdfd | |||
c925ab79c6 | |||
f51d9f960b | |||
86fa76edee | |||
4222597ef0 | |||
a3adedf164 | |||
a70ddf7087 | |||
afeb6daea5 | |||
a258d429c2 | |||
7a25a48fdb | |||
0e434a36e7 | |||
36561fd75a | |||
430fac2f77 | |||
c15470f723 | |||
2aef114969 | |||
c0e470d78e | |||
c8f2d7c926 | |||
b032e0306f | |||
36ac017e3d | |||
981445630b | |||
9494ec4ac6 | |||
d71441e7c5 | |||
9f0b8c5ec5 | |||
94c0356c25 | |||
9e73f33877 | |||
adc8040604 | |||
82d1edc43c | |||
da17b31be7 | |||
67518fb4e6 | |||
2bd03ad9d8 | |||
e16a8d6b09 | |||
9e0050be63 | |||
a4398d1a2f | |||
a27e5db032 | |||
f7c17a27b6 | |||
020a75ac93 | |||
1b0cdd6152 | |||
1a9cca4300 | |||
d939546f31 | |||
9f9d9da601 | |||
6d24cbf37c | |||
d2929ad701 | |||
689843fbef | |||
c6db001b74 | |||
3ec0841b44 | |||
b3d1568de4 | |||
2511c5dba8 | |||
3049be128f | |||
3291b3a882 | |||
d5744a39bd | |||
882606b2f6 | |||
aba33c4d1f | |||
51aef3f3ec | |||
221afeea58 | |||
c19f5d4c48 | |||
d2eb72cc5b | |||
420a9b2bbb | |||
59dacd8fae | |||
7489a4bcbe | |||
6dd859dd1d | |||
98363542d3 | |||
5b836a4d82 | |||
7dcb65f7b6 |
40
.github/workflows/macos.yml
vendored
40
.github/workflows/macos.yml
vendored
@ -2,14 +2,19 @@ name: MacOS
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/macos.yml'
|
- '.github/workflows/macos.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/macos.yml'
|
- '.github/workflows/macos.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -22,12 +27,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
targetName: example
|
targetName: example
|
||||||
steps:
|
steps:
|
||||||
- name: '⚙️ Cache Qt'
|
- name: Check out repository
|
||||||
id: cache-qt
|
uses: actions/checkout@v3
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ runner.workspace }}/Qt
|
submodules: recursive
|
||||||
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
@ -35,24 +39,30 @@ jobs:
|
|||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
- name: Set up Ninja
|
||||||
|
uses: seanmiddleditch/gha-setup-ninja@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
version: 1.10.2
|
||||||
|
|
||||||
- name: build macos
|
- name: build macos
|
||||||
run: |
|
run: |
|
||||||
qmake
|
cmake --version
|
||||||
make
|
mkdir build
|
||||||
# 打包
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=/Users/runner/work/FluentUI/Qt/6.4.3/macos -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: package
|
- name: package
|
||||||
run: |
|
run: |
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
macdeployqt bin/release/${targetName}.app -qmldir=. -verbose=1 -dmg
|
macdeployqt bin/release/${targetName}.app -qmldir=. -verbose=1 -dmg
|
||||||
# 上传artifacts
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
|
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
|
||||||
path: bin/release/${{ env.targetName }}.app
|
path: bin/release/${{ env.targetName }}.app
|
||||||
# tag 上传Release
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
49
.github/workflows/ubuntu.yml
vendored
49
.github/workflows/ubuntu.yml
vendored
@ -1,17 +1,21 @@
|
|||||||
name: Ubuntu
|
name: Ubuntu
|
||||||
# Qt官方没有linux平台的x86包
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/ubuntu.yml'
|
- '.github/workflows/ubuntu.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
- '.github/workflows/ubuntu.yml'
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
|
- '.github/workflows/ubuntu.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -24,12 +28,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
targetName: example
|
targetName: example
|
||||||
steps:
|
steps:
|
||||||
- name: '⚙️ Cache Qt'
|
- name: Check out repository
|
||||||
id: cache-qt
|
uses: actions/checkout@v3
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ runner.workspace }}/Qt
|
submodules: recursive
|
||||||
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
@ -37,35 +40,45 @@ jobs:
|
|||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
|
|
||||||
|
- name: Set up Ninja
|
||||||
|
uses: seanmiddleditch/gha-setup-ninja@v3
|
||||||
|
with:
|
||||||
|
version: 1.10.2
|
||||||
|
|
||||||
- name: ubuntu install GL library
|
- name: ubuntu install GL library
|
||||||
run: sudo apt-get install -y libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev
|
run: sudo apt-get install -y libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
- name: build ubuntu
|
- name: build ubuntu
|
||||||
run: |
|
run: |
|
||||||
qmake
|
ninja --version
|
||||||
make
|
cmake --version
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=/home/runner/work/FluentUI/Qt/6.4.3/gcc_64 -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: install QT linux deploy
|
- name: install QT linux deploy
|
||||||
uses: miurahr/install-linuxdeploy-action@v1
|
uses: miurahr/install-linuxdeploy-action@v1
|
||||||
with:
|
with:
|
||||||
plugins: qt appimage
|
plugins: qt appimage
|
||||||
|
|
||||||
- name: Check if svg file exists
|
- name: Check if svg file exists
|
||||||
run: if [ ! -f "${targetName}.svg" ]; then echo "File not found, creating..."; touch ${targetName}.svg; fi
|
run: if [ ! -f "${targetName}.svg" ]; then echo "File not found, creating..."; touch ${targetName}.svg; fi
|
||||||
# 打包
|
|
||||||
- name: package
|
- name: package
|
||||||
run: |
|
run: |
|
||||||
# make sure Qt plugin finds QML sources so it can deploy the imported files
|
# make sure Qt plugin finds QML sources so it can deploy the imported files
|
||||||
export QML_SOURCES_PATHS=src
|
export QML_SOURCES_PATHS=./
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
|
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
|
||||||
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
|
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
|
||||||
# 上传artifacts
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}
|
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}
|
||||||
path: ${{ env.targetName }}.AppImage
|
path: ${{ env.targetName }}.AppImage
|
||||||
# tag 上传Release
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
35
.github/workflows/windows-mingw.yml
vendored
35
.github/workflows/windows-mingw.yml
vendored
@ -2,14 +2,19 @@ name: Windows MinGW
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/windows-mingw.yml'
|
- '.github/workflows/windows-mingw.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
- '.github/workflows/windows-mingw.yml'
|
- 'scripts/**'
|
||||||
|
- '.github/workflows/windows-mingw.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -25,6 +30,11 @@ jobs:
|
|||||||
targetName: example.exe
|
targetName: example.exe
|
||||||
fileName: example
|
fileName: example
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
@ -32,26 +42,29 @@ jobs:
|
|||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
- name: Qt6 environment configuration
|
- name: Qt6 environment configuration
|
||||||
if: ${{ startsWith( matrix.qt_ver, 6 ) }}
|
if: ${{ startsWith( matrix.qt_ver, 6 ) }}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
Write-Output "${{ env.Qt6_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
Write-Output "${{ env.Qt6_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
Write-Output "${{ env.Qt6_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
Write-Output "${{ env.Qt6_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
- name: where is qmake & where is mingw32-make
|
|
||||||
|
- name: where is cmake & where is mingw32-make
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
Get-Command -Name 'qmake' | Format-List
|
Get-Command -Name 'cmake' | Format-List
|
||||||
Get-Command -Name 'mingw32-make' | Format-List
|
Get-Command -Name 'mingw32-make' | Format-List
|
||||||
|
|
||||||
- name: mingw-build
|
- name: mingw-build
|
||||||
id: build
|
id: build
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
qmake
|
mkdir build
|
||||||
mingw32-make
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=D:\a\FluentUI\Qt\6.4.3\mingw_64 -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: package
|
- name: package
|
||||||
id: package
|
id: package
|
||||||
env:
|
env:
|
||||||
@ -61,10 +74,12 @@ jobs:
|
|||||||
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}
|
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}
|
||||||
$name = ${env:archiveName}
|
$name = ${env:archiveName}
|
||||||
echo "::set-output name=packageName::$name"
|
echo "::set-output name=packageName::$name"
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.package.outputs.packageName }}
|
name: ${{ steps.package.outputs.packageName }}
|
||||||
path: ${{ steps.package.outputs.packageName }}
|
path: ${{ steps.package.outputs.packageName }}
|
||||||
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
48
.github/workflows/windows.yml
vendored
48
.github/workflows/windows.yml
vendored
@ -1,24 +1,25 @@
|
|||||||
name: Windows
|
name: Windows
|
||||||
on:
|
on:
|
||||||
# push代码时触发workflow
|
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
|
- 'example/**'
|
||||||
|
- 'scripts/**'
|
||||||
- '.github/workflows/windows.yml'
|
- '.github/workflows/windows.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- '*.pro'
|
- '*.txt'
|
||||||
|
- 'example/**'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
- '.github/workflows/windows.yml'
|
- 'scripts/**'
|
||||||
|
- '.github/workflows/windows.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
# 运行平台, windows-latest目前是windows server 2019
|
|
||||||
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
# 矩阵配置
|
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-2019]
|
os: [windows-2019]
|
||||||
include:
|
include:
|
||||||
@ -29,40 +30,34 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
targetName: example.exe
|
targetName: example.exe
|
||||||
fileName: example
|
fileName: example
|
||||||
# 步骤
|
|
||||||
steps:
|
steps:
|
||||||
- name: '⚙️ Cache Qt'
|
- name: Check out repository
|
||||||
id: cache-qt
|
uses: actions/checkout@v3
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: ${{ runner.workspace }}\Qt
|
submodules: recursive
|
||||||
key: ${{runner.os}}-qtcachedir-${{ matrix.qt_ver }}
|
|
||||||
# 安装Qt
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
# 使用外部action。这个action专门用来安装Qt
|
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.qt_ver }}
|
version: ${{ matrix.qt_ver }}
|
||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
cache: ${{steps.cache-qt.outputs.cache-hit}}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
# 拉取代码
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
# msvc编译
|
|
||||||
- name: msvc-build
|
- name: msvc-build
|
||||||
id: build
|
id: build
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
|
||||||
qmake
|
mkdir build
|
||||||
nmake
|
cd build
|
||||||
|
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=D:\a\FluentUI\Qt\6.4.3\msvc2019_64 -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
||||||
|
cmake --build . --target all --config Release --parallel
|
||||||
echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
|
echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
|
||||||
echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
|
echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
|
||||||
echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
|
echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
|
||||||
echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
|
echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
|
||||||
# 打包
|
|
||||||
- name: package
|
- name: package
|
||||||
id: package
|
id: package
|
||||||
env:
|
env:
|
||||||
@ -73,14 +68,13 @@ jobs:
|
|||||||
& scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName}
|
& scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName}
|
||||||
# 记录packageName给后续step
|
# 记录packageName给后续step
|
||||||
$name = ${env:archiveName}
|
$name = ${env:archiveName}
|
||||||
echo "::set-output name=packageName::$name"
|
echo "::set-output name=packageName::$name"
|
||||||
# tag 查询github-Release
|
|
||||||
# 上传artifacts
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.package.outputs.packageName }}
|
name: ${{ steps.package.outputs.packageName }}
|
||||||
path: ${{ steps.package.outputs.packageName }}
|
path: ${{ steps.package.outputs.packageName }}
|
||||||
# tag 上传Release
|
|
||||||
- name: uploadRelease
|
- name: uploadRelease
|
||||||
if: startsWith(github.event.ref, 'refs/tags/')
|
if: startsWith(github.event.ref, 'refs/tags/')
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -33,4 +33,7 @@ CMakeLists.txt.user*
|
|||||||
|
|
||||||
src/build-preset/plugins.qmltypes
|
src/build-preset/plugins.qmltypes
|
||||||
bin
|
bin
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
build
|
||||||
|
cmake-build-*
|
||||||
|
.idea
|
@ -1,4 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(FluentUI VERSION 0.1 LANGUAGES CXX)
|
project(FluentUI VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
TEMPLATE = subdirs
|
|
||||||
|
|
||||||
SUBDIRS += \
|
|
||||||
src/FluentUI.pro \
|
|
||||||
example
|
|
||||||
example.depends = src/FluentUI.pro
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|
||||||
这是一个漂亮的Fluent组件库,使用QML插件开发的。main分支是Qt6.4.3,如果需要qt5的请切换至qt5分支
|
这是一个漂亮的Fluent组件库,使用QML插件开发的。main分支是Qt6.4.3,<a href="https://github.com/zhuzichu520/FluentUI/wiki/%E6%96%B0%E6%89%8B%E5%85%A5%E9%97%A8" target="_blank">如何使用?</a>。如果需要qt5的请切换至qt5分支,<a href="https://github.com/zhuzichu520/FluentUI/wiki/%E6%96%B0%E6%89%8B%E5%85%A5%E9%97%A8%EF%BC%881.2.7%E4%BB%A5%E5%8F%8A%E4%B9%8B%E5%89%8D%E7%89%88%E6%9C%AC%EF%BC%89" target="_blank">如何使用?</a>
|
||||||
|
|
||||||
## 编译状态
|
## 编译状态
|
||||||
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Window
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import FluentUI
|
|
||||||
|
|
||||||
Window {
|
|
||||||
id:app
|
|
||||||
Component.onCompleted: {
|
|
||||||
FluApp.init(app)
|
|
||||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
|
||||||
FluTheme.dark = false
|
|
||||||
FluApp.routes = {
|
|
||||||
"/":"qrc:/page/MainPage.qml",
|
|
||||||
"/about":"qrc:/page/AboutPage.qml",
|
|
||||||
"/login":"qrc:/page/LoginPage.qml",
|
|
||||||
"/chat":"qrc:/page/ChatPage.qml",
|
|
||||||
"/media":"qrc:/page/MediaPage.qml",
|
|
||||||
"/singleTaskWindow":"qrc:/page/SingleTaskWindow.qml",
|
|
||||||
"/standardWindow":"qrc:/page/StandardWindow.qml",
|
|
||||||
"/singleInstanceWindow":"qrc:/page/SingleInstanceWindow.qml"
|
|
||||||
}
|
|
||||||
FluApp.initialRoute = "/"
|
|
||||||
FluApp.run()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +1,68 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(example)
|
|
||||||
|
|
||||||
|
project(example VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
if(APPLE)
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
#设置可执行文件输出目录
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||||
|
else()
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#获取文件路径分隔符(解决执行命令的时候有些平台会报错)
|
||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
#设置版本号
|
||||||
set(platform 64)
|
add_definitions(-DVERSION=1,3,0,0)
|
||||||
else()
|
|
||||||
set(platform 32)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/debug)
|
|
||||||
else()
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin/release)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED)
|
#遍历所有Cpp文件
|
||||||
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
|
foreach(filepath ${CPP_FILES})
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND sources_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
set(SOURCES
|
#遍历所有qml文件
|
||||||
ChatController.cpp
|
file(GLOB_RECURSE QML_PATHS *.qml)
|
||||||
AppInfo.cpp
|
foreach(filepath ${QML_PATHS})
|
||||||
main.cpp
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
)
|
list(APPEND qml_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
set(HEADERS
|
#遍历所有资源文件
|
||||||
ChatController.h
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp qmldir)
|
||||||
AppInfo.h
|
foreach(filepath ${RES_PATHS})
|
||||||
)
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND resource_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
set(RESOURCES
|
#添加可执行文件
|
||||||
qml.qrc
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
)
|
qt_add_executable(example
|
||||||
|
${sources_files}
|
||||||
set(RC_ICONS
|
example.rc
|
||||||
favicon.ico
|
)
|
||||||
)
|
else ()
|
||||||
|
qt_add_executable(example
|
||||||
qt_add_resources(QT_RESOURCES ${RESOURCES})
|
${sources_files}
|
||||||
|
)
|
||||||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS})
|
endif ()
|
||||||
|
|
||||||
|
#复制动态库到可执行文件同级目录下
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/msvc/*.dll)
|
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/msvc/*.dll)
|
||||||
else()
|
else()
|
||||||
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/mingw/*.dll)
|
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
|
||||||
endif()
|
endif()
|
||||||
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
|
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
|
||||||
file(GLOB DLL_FILES ${DLLPATH})
|
file(GLOB DLL_FILES ${DLLPATH})
|
||||||
@ -61,27 +73,30 @@ if(WIN32)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
#添加qml模块
|
||||||
QT_DEPRECATED_WARNINGS
|
qt_add_qml_module(example
|
||||||
QT_NO_WARNING_OUTPUT
|
URI example
|
||||||
|
VERSION 1.0
|
||||||
|
QML_FILES ${qml_files}
|
||||||
|
RESOURCES ${resource_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
#设置属性
|
||||||
Qt6::Core
|
set_target_properties(example PROPERTIES
|
||||||
|
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||||
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
|
MACOSX_BUNDLE TRUE
|
||||||
|
WIN32_EXECUTABLE TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
#链接库
|
||||||
|
target_link_libraries(example PRIVATE
|
||||||
Qt6::Quick
|
Qt6::Quick
|
||||||
Qt6::QuickControls2
|
fluentuiplugin
|
||||||
Qt6::Concurrent
|
|
||||||
Qt6::Network
|
|
||||||
Qt6::Multimedia
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
#安装
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE WIN32 _WINDOWS)
|
install(TARGETS example
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
|
BUNDLE DESTINATION .
|
||||||
endif()
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
||||||
MACOSX_BUNDLE_INFO_PLIST Info.plist
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
#include "ChatController.h"
|
|
||||||
|
|
||||||
ChatController::ChatController(QObject *parent)
|
|
||||||
: QObject{parent}
|
|
||||||
{
|
|
||||||
isLoading(false);
|
|
||||||
networkManager = new QNetworkAccessManager(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ChatController::sendMessage(const QString& text){
|
|
||||||
isLoading(true);
|
|
||||||
QUrl apiUrl("https://api.openai.com/v1/chat/completions");
|
|
||||||
QNetworkRequest request(apiUrl);
|
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
|
||||||
request.setRawHeader("Authorization", QString::fromStdString("Bearer %1").arg(QString::fromUtf8(QByteArray::fromBase64(baseKey.toUtf8()))).toUtf8());
|
|
||||||
QJsonObject requestData;
|
|
||||||
requestData.insert("model", "gpt-3.5-turbo");
|
|
||||||
messages.append(createMessage("user",text));
|
|
||||||
requestData.insert("messages", messages);
|
|
||||||
QJsonDocument requestDoc(requestData);
|
|
||||||
QByteArray requestDataBytes = requestDoc.toJson();
|
|
||||||
QNetworkReply* reply = networkManager->post(request, requestDataBytes);
|
|
||||||
connect(reply, &QNetworkReply::finished,this, [=]() {
|
|
||||||
if (reply->error() == QNetworkReply::NoError) {
|
|
||||||
QString responseString = QString::fromUtf8(reply->readAll());
|
|
||||||
qDebug() << responseString;
|
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(responseString.toUtf8());
|
|
||||||
QJsonObject jsonObj = doc.object();
|
|
||||||
QString text = jsonObj.value("choices").toArray().at(0).toObject().value("message").toObject().value("content").toString();
|
|
||||||
if(text.isEmpty()){
|
|
||||||
text = "响应错误:content为空数据";
|
|
||||||
}else{
|
|
||||||
messages.append(createMessage("assistant",text));
|
|
||||||
}
|
|
||||||
responseData(text.trimmed());
|
|
||||||
} else {
|
|
||||||
responseData("网络错误:"+reply->errorString());
|
|
||||||
}
|
|
||||||
isLoading(false);
|
|
||||||
reply->deleteLater();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject ChatController::createMessage(const QString& role,const QString& content){
|
|
||||||
QJsonObject message;
|
|
||||||
message.insert("role",role);
|
|
||||||
message.insert("content",content);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatController::clipText(const QString& text){
|
|
||||||
qDebug()<<text;
|
|
||||||
QClipboard *clipboard = QGuiApplication::clipboard();
|
|
||||||
clipboard->setText(text);
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
#ifndef CHATCONTROLLER_H
|
|
||||||
#define CHATCONTROLLER_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QClipboard>
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QFile>
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
class ChatController : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY_AUTO(bool,isLoading)
|
|
||||||
Q_PROPERTY_AUTO(QString,responseData);
|
|
||||||
public:
|
|
||||||
explicit ChatController(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
Q_INVOKABLE void sendMessage(const QString& text);
|
|
||||||
Q_INVOKABLE void clipText(const QString& text);
|
|
||||||
private:
|
|
||||||
QJsonObject createMessage(const QString& role,const QString& content);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QNetworkAccessManager* networkManager;
|
|
||||||
QJsonArray messages;
|
|
||||||
QString baseKey = "c2stbXgxWm5MQkZ5TzhNYzNmRWl6eDZUM0JsYmtGSnNBWjNiakJjSXB6WGN3QW9KSk11";
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CHATCONTROLLER_H
|
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>NSAppTransportSecurity</key>
|
|
||||||
<dict>
|
|
||||||
<key>NSAllowsArbitraryLoads</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>example</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string></string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.zhuzichu.example</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
|
||||||
<string>10.13</string>
|
|
||||||
<key>NOTE</key>
|
|
||||||
<string>This file was generated by Qt/QMake.</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string>NSApplication</string>
|
|
||||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
@ -1,64 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Window
|
|
||||||
import QtQuick.Controls
|
|
||||||
import FluentUI
|
|
||||||
import "./component"
|
|
||||||
|
|
||||||
FluScrollablePage{
|
|
||||||
|
|
||||||
title:"Dialog"
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
height: 68
|
|
||||||
paddings: 10
|
|
||||||
Layout.topMargin: 20
|
|
||||||
FluButton{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
Layout.topMargin: 20
|
|
||||||
text:"Show Dialog"
|
|
||||||
onClicked: {
|
|
||||||
dialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CodeExpander{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
code:'FluContentDialog{
|
|
||||||
id:dialog
|
|
||||||
title:"友情提示"
|
|
||||||
message:"确定要退出程序么?"
|
|
||||||
negativeText:"取消"
|
|
||||||
onNegativeClicked:{
|
|
||||||
showSuccess("点击取消按钮")
|
|
||||||
}
|
|
||||||
positiveText:"确定"
|
|
||||||
onPositiveClicked:{
|
|
||||||
showSuccess("点击确定按钮")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialog.open()
|
|
||||||
'
|
|
||||||
}
|
|
||||||
|
|
||||||
FluContentDialog{
|
|
||||||
id:dialog
|
|
||||||
title:"友情提示"
|
|
||||||
message:"确定要退出程序么?"
|
|
||||||
negativeText:"取消"
|
|
||||||
onNegativeClicked:{
|
|
||||||
showSuccess("点击取消按钮")
|
|
||||||
}
|
|
||||||
positiveText:"确定"
|
|
||||||
onPositiveClicked:{
|
|
||||||
showSuccess("点击确定按钮")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
QT += quick quickcontrols2 concurrent network multimedia
|
|
||||||
CONFIG += c++17
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
lang/En.h \
|
|
||||||
lang/Lang.h \
|
|
||||||
lang/Zh.h \
|
|
||||||
stdafx.h \
|
|
||||||
ChatController.h \
|
|
||||||
AppInfo.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
ChatController.cpp \
|
|
||||||
AppInfo.cpp \
|
|
||||||
lang/En.cpp \
|
|
||||||
lang/Lang.cpp \
|
|
||||||
lang/Zh.cpp \
|
|
||||||
main.cpp
|
|
||||||
|
|
||||||
RESOURCES += qml.qrc
|
|
||||||
|
|
||||||
RC_ICONS = favicon.ico
|
|
||||||
|
|
||||||
QML_IMPORT_PATH =
|
|
||||||
QML_DESIGNER_IMPORT_PATH =
|
|
||||||
|
|
||||||
CONFIG(debug,debug|release) {
|
|
||||||
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/debug)
|
|
||||||
} else {
|
|
||||||
DESTDIR = $$absolute_path($${_PRO_FILE_PWD_}/../bin/release)
|
|
||||||
}
|
|
||||||
|
|
||||||
win32 {
|
|
||||||
|
|
||||||
contains(QMAKE_CC, cl) {
|
|
||||||
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/msvc/*.dll) $$DESTDIR
|
|
||||||
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
|
||||||
} else {
|
|
||||||
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/mingw/*.dll) $$DESTDIR
|
|
||||||
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|
||||||
!isEmpty(target.path): INSTALLS += target
|
|
||||||
|
|
||||||
mac: {
|
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
|
||||||
}
|
|
42
example/example.rc
Normal file
42
example/example.rc
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
IDI_ICON1 ICON "favicon.ico"
|
||||||
|
|
||||||
|
#define STR(x) #x
|
||||||
|
#define VER_JOIN(a,b,c,d) STR(a.b.c.d)
|
||||||
|
#define VER_JOIN_(x) VER_JOIN x
|
||||||
|
#define VER_STR VER_JOIN_((VERSION))
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION VERSION
|
||||||
|
PRODUCTVERSION VERSION
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS VS_FF_DEBUG
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS VOS_NT_WINDOWS32
|
||||||
|
FILETYPE VFT_APP
|
||||||
|
FILESUBTYPE VFT2_UNKNOWN
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Comments", "Built by the FluentUI."
|
||||||
|
VALUE "CompanyName", "zhuzichu"
|
||||||
|
VALUE "FileDescription", "example"
|
||||||
|
VALUE "FileVersion", VER_STR
|
||||||
|
VALUE "InternalName", ""
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2023"
|
||||||
|
VALUE "OriginalFilename", ""
|
||||||
|
VALUE "ProductName", "example"
|
||||||
|
VALUE "ProductVersion", VER_STR
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
@ -1,38 +0,0 @@
|
|||||||
#include <QGuiApplication>
|
|
||||||
#include <QQmlApplicationEngine>
|
|
||||||
#include <QQmlContext>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QQuickWindow>
|
|
||||||
#include <QQuickStyle>
|
|
||||||
#include <QProcess>
|
|
||||||
#include "lang/Lang.h"
|
|
||||||
#include "AppInfo.h"
|
|
||||||
#include "ChatController.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
QCoreApplication::setOrganizationName("ZhuZiChu");
|
|
||||||
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
|
||||||
QCoreApplication::setApplicationName("FluentUI");
|
|
||||||
QQuickStyle::setStyle("Basic");
|
|
||||||
QGuiApplication app(argc, argv);
|
|
||||||
app.setQuitOnLastWindowClosed(false);
|
|
||||||
QQmlApplicationEngine engine;
|
|
||||||
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
|
||||||
AppInfo* appInfo = new AppInfo();
|
|
||||||
QQmlContext * context = engine.rootContext();
|
|
||||||
Lang* lang = appInfo->lang();
|
|
||||||
context->setContextProperty("lang",lang);
|
|
||||||
QObject::connect(appInfo,&AppInfo::langChanged,&app,[context,appInfo]{
|
|
||||||
context->setContextProperty("lang",appInfo->lang());
|
|
||||||
});
|
|
||||||
context->setContextProperty("appInfo",appInfo);
|
|
||||||
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
||||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
||||||
if (!obj && url == objUrl)
|
|
||||||
QCoreApplication::exit(-1);
|
|
||||||
}, Qt::QueuedConnection);
|
|
||||||
engine.load(url);
|
|
||||||
return app.exec();
|
|
||||||
}
|
|
@ -1,262 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Controls
|
|
||||||
import FluentUI
|
|
||||||
import Controller
|
|
||||||
import QtQuick.Dialogs
|
|
||||||
|
|
||||||
FluWindow {
|
|
||||||
|
|
||||||
width: 680
|
|
||||||
height: 600
|
|
||||||
minimumWidth: 500
|
|
||||||
minimumHeight: 600
|
|
||||||
|
|
||||||
title:"ChatGPT"
|
|
||||||
|
|
||||||
onInitArgument:
|
|
||||||
(argument)=>{
|
|
||||||
scrollview.focus = true
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatController{
|
|
||||||
id:controller
|
|
||||||
|
|
||||||
onResponseDataChanged: {
|
|
||||||
appendMessage(false,responseData)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ListModel{
|
|
||||||
id:model_message
|
|
||||||
ListElement{
|
|
||||||
isMy:false
|
|
||||||
text:"欢迎使用ChatGPT"
|
|
||||||
}
|
|
||||||
ListElement{
|
|
||||||
isMy:true
|
|
||||||
text:"好的,3Q"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"ChatGPT"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_text
|
|
||||||
TextEdit {
|
|
||||||
id:item_text
|
|
||||||
text: message
|
|
||||||
wrapMode: Text.WrapAnywhere
|
|
||||||
readOnly: true
|
|
||||||
selectByMouse: true
|
|
||||||
selectByKeyboard: true
|
|
||||||
selectedTextColor: Qt.rgba(51,153,255,1)
|
|
||||||
color:FluColors.Black
|
|
||||||
selectionColor: {
|
|
||||||
if(FluTheme.dark){
|
|
||||||
return FluTheme.primaryColor.lighter
|
|
||||||
}else{
|
|
||||||
return FluTheme.primaryColor.dark
|
|
||||||
}
|
|
||||||
}
|
|
||||||
width: Math.min(list_message.width-200,600,implicitWidth)
|
|
||||||
TapHandler{
|
|
||||||
acceptedButtons: Qt.RightButton
|
|
||||||
onTapped: {
|
|
||||||
menu_item.showMenu(item_text.selectedText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluArea{
|
|
||||||
id:layout_content
|
|
||||||
anchors{
|
|
||||||
top: appbar.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: layout_bottom.top
|
|
||||||
margins: 10
|
|
||||||
}
|
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(245/255,245/255,245/255,1)
|
|
||||||
ListView{
|
|
||||||
id:list_message
|
|
||||||
anchors.fill: parent
|
|
||||||
model:model_message
|
|
||||||
clip: true
|
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
|
||||||
preferredHighlightBegin: 0
|
|
||||||
preferredHighlightEnd: 0
|
|
||||||
highlightMoveDuration: 0
|
|
||||||
header:Item{
|
|
||||||
width: list_message.width
|
|
||||||
height:20
|
|
||||||
}
|
|
||||||
footer:Item{
|
|
||||||
width: list_message.width
|
|
||||||
height:20
|
|
||||||
}
|
|
||||||
delegate: Item{
|
|
||||||
width: ListView.view.width
|
|
||||||
height: childrenRect.height
|
|
||||||
|
|
||||||
FluRectangle{
|
|
||||||
id:item_avatar
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
radius:[15,15,15,15]
|
|
||||||
anchors{
|
|
||||||
right: isMy ? parent.right : undefined
|
|
||||||
rightMargin: isMy ? 20 : undefined
|
|
||||||
left: isMy ? undefined : parent.left
|
|
||||||
leftMargin: isMy ? undefined : 20
|
|
||||||
top:parent.top
|
|
||||||
}
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(100,100)
|
|
||||||
source: isMy ? "qrc:/res/svg/avatar_2.svg" : "qrc:/res/image/logo_openai.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle{
|
|
||||||
id:item_layout_content
|
|
||||||
color: isMy ? "#FF95EC69" : "#FFFFFF"
|
|
||||||
width: item_msg_loader.width+10
|
|
||||||
height: item_msg_loader.height+10
|
|
||||||
radius: 3
|
|
||||||
anchors{
|
|
||||||
top: item_avatar.top
|
|
||||||
right: isMy ? item_avatar.left : undefined
|
|
||||||
rightMargin: isMy ? 10 : undefined
|
|
||||||
left: isMy ? undefined : item_avatar.right
|
|
||||||
leftMargin: isMy ? undefined : 10
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader{
|
|
||||||
id:item_msg_loader
|
|
||||||
property var message: model.text
|
|
||||||
anchors.centerIn: parent
|
|
||||||
sourceComponent: com_text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Item{
|
|
||||||
id:item_layout_bottom
|
|
||||||
width: parent.width
|
|
||||||
anchors.top: item_layout_content.bottom
|
|
||||||
height: 20
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluArea{
|
|
||||||
id:layout_bottom
|
|
||||||
height: 90
|
|
||||||
anchors{
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: 10
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
leftMargin: 10
|
|
||||||
rightMargin: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ScrollView{
|
|
||||||
id:scrollview
|
|
||||||
anchors{
|
|
||||||
bottom: parent.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: button_send.left
|
|
||||||
bottomMargin: 10
|
|
||||||
leftMargin: 10
|
|
||||||
rightMargin: 10
|
|
||||||
}
|
|
||||||
height: Math.min(textbox.implicitHeight,64)
|
|
||||||
FluMultilineTextBox{
|
|
||||||
id:textbox
|
|
||||||
focus:true
|
|
||||||
placeholderText: "请输入消息"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluFilledButton{
|
|
||||||
id:button_send
|
|
||||||
text:controller.isLoading ? timer_loading.loadingText :"发送"
|
|
||||||
anchors{
|
|
||||||
bottom: parent.bottom
|
|
||||||
right: parent.right
|
|
||||||
bottomMargin: 10
|
|
||||||
rightMargin: 10
|
|
||||||
}
|
|
||||||
width: 60
|
|
||||||
disabled: controller.isLoading
|
|
||||||
onClicked:{
|
|
||||||
var text = textbox.text
|
|
||||||
appendMessage(true,text)
|
|
||||||
controller.sendMessage(text)
|
|
||||||
textbox.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer{
|
|
||||||
id:timer_loading
|
|
||||||
property int count : 0
|
|
||||||
property string loadingText : ""
|
|
||||||
interval: 500
|
|
||||||
running: controller.isLoading
|
|
||||||
repeat: true
|
|
||||||
onTriggered: {
|
|
||||||
switch(count%3){
|
|
||||||
case 0:
|
|
||||||
loadingText = "."
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
loadingText = ".."
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
loadingText = "..."
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
loadingText = ""
|
|
||||||
break
|
|
||||||
}
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluMenu{
|
|
||||||
id:menu_item
|
|
||||||
focus: false
|
|
||||||
property string selectedText: ""
|
|
||||||
FluMenuItem{
|
|
||||||
text:"复制"
|
|
||||||
onClicked: {
|
|
||||||
controller.clipText(menu_item.selectedText)
|
|
||||||
showSuccess("复制成功")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function showMenu(text){
|
|
||||||
menu_item.selectedText = text
|
|
||||||
menu_item.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendMessage(isMy,text){
|
|
||||||
model_message.append({isMy:isMy,text:text})
|
|
||||||
list_message.positionViewAtEnd()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Window
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Qt.labs.platform
|
|
||||||
import FluentUI
|
|
||||||
import "qrc:///global/"
|
|
||||||
|
|
||||||
FluWindow {
|
|
||||||
id:window
|
|
||||||
width: 1000
|
|
||||||
height: 640
|
|
||||||
title: "FluentUI"
|
|
||||||
closeDestory:false
|
|
||||||
minimumWidth: 520
|
|
||||||
minimumHeight: 460
|
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
z:9
|
|
||||||
showDark: true
|
|
||||||
width:parent.width
|
|
||||||
darkText: lang.dark_mode
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemTrayIcon {
|
|
||||||
visible: true
|
|
||||||
icon.source: "qrc:/res/image/favicon.ico"
|
|
||||||
tooltip: "FluentUI"
|
|
||||||
menu: Menu {
|
|
||||||
MenuItem {
|
|
||||||
text: "退出"
|
|
||||||
onTriggered: {
|
|
||||||
window.destoryWindow()
|
|
||||||
FluApp.closeApp()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onActivated:
|
|
||||||
(reason)=>{
|
|
||||||
if(reason === SystemTrayIcon.Trigger){
|
|
||||||
window.show()
|
|
||||||
window.raise()
|
|
||||||
window.requestActivate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FluNavigationView{
|
|
||||||
id:nav_view
|
|
||||||
anchors.fill: parent
|
|
||||||
items: ItemsOriginal
|
|
||||||
footerItems:ItemsFooter
|
|
||||||
z:11
|
|
||||||
displayMode:MainEvent.displayMode
|
|
||||||
logo: "qrc:/res/image/favicon.ico"
|
|
||||||
title:"FluentUI"
|
|
||||||
autoSuggestBox:FluAutoSuggestBox{
|
|
||||||
width: 280
|
|
||||||
anchors.centerIn: parent
|
|
||||||
iconSource: FluentIcons.Search
|
|
||||||
items: ItemsOriginal.getSearchData()
|
|
||||||
placeholderText: lang.search
|
|
||||||
onItemClicked:
|
|
||||||
(data)=>{
|
|
||||||
ItemsOriginal.startPageByItem(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
ItemsOriginal.navigationView = nav_view
|
|
||||||
ItemsFooter.navigationView = nav_view
|
|
||||||
nav_view.setCurrentIndex(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
172
example/qml.qrc
172
example/qml.qrc
@ -1,172 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>App.qml</file>
|
|
||||||
<file>res/image/image_huoyin.webp</file>
|
|
||||||
<file>res/svg/avatar_1.svg</file>
|
|
||||||
<file>res/svg/avatar_2.svg</file>
|
|
||||||
<file>res/svg/avatar_3.svg</file>
|
|
||||||
<file>res/svg/avatar_4.svg</file>
|
|
||||||
<file>res/svg/avatar_5.svg</file>
|
|
||||||
<file>res/svg/avatar_6.svg</file>
|
|
||||||
<file>res/svg/avatar_7.svg</file>
|
|
||||||
<file>res/svg/avatar_8.svg</file>
|
|
||||||
<file>res/svg/avatar_9.svg</file>
|
|
||||||
<file>res/svg/avatar_10.svg</file>
|
|
||||||
<file>res/svg/avatar_11.svg</file>
|
|
||||||
<file>res/svg/avatar_12.svg</file>
|
|
||||||
<file>page/AboutPage.qml</file>
|
|
||||||
<file>page/MainPage.qml</file>
|
|
||||||
<file>page/LoginPage.qml</file>
|
|
||||||
<file>T_ToggleSwitch.qml</file>
|
|
||||||
<file>T_Typography.qml</file>
|
|
||||||
<file>T_Awesome.qml</file>
|
|
||||||
<file>T_Buttons.qml</file>
|
|
||||||
<file>T_Rectangle.qml</file>
|
|
||||||
<file>T_InfoBar.qml</file>
|
|
||||||
<file>T_Progress.qml</file>
|
|
||||||
<file>T_Slider.qml</file>
|
|
||||||
<file>T_TextBox.qml</file>
|
|
||||||
<file>T_Theme.qml</file>
|
|
||||||
<file>T_Dialog.qml</file>
|
|
||||||
<file>T_TreeView.qml</file>
|
|
||||||
<file>T_Expander.qml</file>
|
|
||||||
<file>T_TimePicker.qml</file>
|
|
||||||
<file>T_DatePicker.qml</file>
|
|
||||||
<file>T_MultiWindow.qml</file>
|
|
||||||
<file>T_Menu.qml</file>
|
|
||||||
<file>res/image/banner_1.jpg</file>
|
|
||||||
<file>res/image/banner_2.jpg</file>
|
|
||||||
<file>res/image/banner_3.jpg</file>
|
|
||||||
<file>res/image/logo_openai.png</file>
|
|
||||||
<file>page/ChatPage.qml</file>
|
|
||||||
<file>T_Tooltip.qml</file>
|
|
||||||
<file>T_Badge.qml</file>
|
|
||||||
<file>T_CalendarPicker.qml</file>
|
|
||||||
<file>T_ColorPicker.qml</file>
|
|
||||||
<file>T_Carousel.qml</file>
|
|
||||||
<file>T_MediaPlayer.qml</file>
|
|
||||||
<file>T_TabView.qml</file>
|
|
||||||
<file>res/image/favicon.ico</file>
|
|
||||||
<file>T_Home.qml</file>
|
|
||||||
<file>res/image/bg_home_header.png</file>
|
|
||||||
<file>res/image/ic_home_github.png</file>
|
|
||||||
<file>res/image/control/Acrylic.png</file>
|
|
||||||
<file>res/image/control/AnimatedIcon.png</file>
|
|
||||||
<file>res/image/control/AnimatedVisualPlayer.png</file>
|
|
||||||
<file>res/image/control/AnimationInterop.png</file>
|
|
||||||
<file>res/image/control/AppBarButton.png</file>
|
|
||||||
<file>res/image/control/AppBarSeparator.png</file>
|
|
||||||
<file>res/image/control/AppBarToggleButton.png</file>
|
|
||||||
<file>res/image/control/AutomationProperties.png</file>
|
|
||||||
<file>res/image/control/AutoSuggestBox.png</file>
|
|
||||||
<file>res/image/control/Border.png</file>
|
|
||||||
<file>res/image/control/BreadcrumbBar.png</file>
|
|
||||||
<file>res/image/control/Button.png</file>
|
|
||||||
<file>res/image/control/CalendarDatePicker.png</file>
|
|
||||||
<file>res/image/control/CalendarView.png</file>
|
|
||||||
<file>res/image/control/Canvas.png</file>
|
|
||||||
<file>res/image/control/Checkbox.png</file>
|
|
||||||
<file>res/image/control/Clipboard.png</file>
|
|
||||||
<file>res/image/control/ColorPaletteResources.png</file>
|
|
||||||
<file>res/image/control/ColorPicker.png</file>
|
|
||||||
<file>res/image/control/ComboBox.png</file>
|
|
||||||
<file>res/image/control/CommandBar.png</file>
|
|
||||||
<file>res/image/control/CommandBarFlyout.png</file>
|
|
||||||
<file>res/image/control/CompactSizing.png</file>
|
|
||||||
<file>res/image/control/ConnectedAnimation.png</file>
|
|
||||||
<file>res/image/control/ContentDialog.png</file>
|
|
||||||
<file>res/image/control/CreateMultipleWindows.png</file>
|
|
||||||
<file>res/image/control/DataGrid.png</file>
|
|
||||||
<file>res/image/control/DatePicker.png</file>
|
|
||||||
<file>res/image/control/DropDownButton.png</file>
|
|
||||||
<file>res/image/control/EasingFunction.png</file>
|
|
||||||
<file>res/image/control/Expander.png</file>
|
|
||||||
<file>res/image/control/FilePicker.png</file>
|
|
||||||
<file>res/image/control/FlipView.png</file>
|
|
||||||
<file>res/image/control/Flyout.png</file>
|
|
||||||
<file>res/image/control/Grid.png</file>
|
|
||||||
<file>res/image/control/GridView.png</file>
|
|
||||||
<file>res/image/control/HyperlinkButton.png</file>
|
|
||||||
<file>res/image/control/IconElement.png</file>
|
|
||||||
<file>res/image/control/Image.png</file>
|
|
||||||
<file>res/image/control/ImplicitTransition.png</file>
|
|
||||||
<file>res/image/control/InfoBadge.png</file>
|
|
||||||
<file>res/image/control/InfoBar.png</file>
|
|
||||||
<file>res/image/control/InkCanvas.png</file>
|
|
||||||
<file>res/image/control/InkToolbar.png</file>
|
|
||||||
<file>res/image/control/InputValidation.png</file>
|
|
||||||
<file>res/image/control/ItemsRepeater.png</file>
|
|
||||||
<file>res/image/control/Line.png</file>
|
|
||||||
<file>res/image/control/ListBox.png</file>
|
|
||||||
<file>res/image/control/ListView.png</file>
|
|
||||||
<file>res/image/control/MediaPlayerElement.png</file>
|
|
||||||
<file>res/image/control/MenuBar.png</file>
|
|
||||||
<file>res/image/control/MenuFlyout.png</file>
|
|
||||||
<file>res/image/control/NavigationView.png</file>
|
|
||||||
<file>res/image/control/NumberBox.png</file>
|
|
||||||
<file>res/image/control/PageTransition.png</file>
|
|
||||||
<file>res/image/control/ParallaxView.png</file>
|
|
||||||
<file>res/image/control/PasswordBox.png</file>
|
|
||||||
<file>res/image/control/PersonPicture.png</file>
|
|
||||||
<file>res/image/control/PipsPager.png</file>
|
|
||||||
<file>res/image/control/Pivot.png</file>
|
|
||||||
<file>res/image/control/ProgressBar.png</file>
|
|
||||||
<file>res/image/control/ProgressRing.png</file>
|
|
||||||
<file>res/image/control/PullToRefresh.png</file>
|
|
||||||
<file>res/image/control/RadialGradientBrush.png</file>
|
|
||||||
<file>res/image/control/RadioButton.png</file>
|
|
||||||
<file>res/image/control/RadioButtons.png</file>
|
|
||||||
<file>res/image/control/RatingControl.png</file>
|
|
||||||
<file>res/image/control/RelativePanel.png</file>
|
|
||||||
<file>res/image/control/RepeatButton.png</file>
|
|
||||||
<file>res/image/control/RevealFocus.png</file>
|
|
||||||
<file>res/image/control/RichEditBox.png</file>
|
|
||||||
<file>res/image/control/RichTextBlock.png</file>
|
|
||||||
<file>res/image/control/ScrollViewer.png</file>
|
|
||||||
<file>res/image/control/SemanticZoom.png</file>
|
|
||||||
<file>res/image/control/Shape.png</file>
|
|
||||||
<file>res/image/control/Slider.png</file>
|
|
||||||
<file>res/image/control/Sound.png</file>
|
|
||||||
<file>res/image/control/SplitButton.png</file>
|
|
||||||
<file>res/image/control/SplitView.png</file>
|
|
||||||
<file>res/image/control/StackPanel.png</file>
|
|
||||||
<file>res/image/control/StandardUICommand.png</file>
|
|
||||||
<file>res/image/control/SwipeControl.png</file>
|
|
||||||
<file>res/image/control/TabView.png</file>
|
|
||||||
<file>res/image/control/TeachingTip.png</file>
|
|
||||||
<file>res/image/control/TextBlock.png</file>
|
|
||||||
<file>res/image/control/TextBox.png</file>
|
|
||||||
<file>res/image/control/ThemeTransition.png</file>
|
|
||||||
<file>res/image/control/TimePicker.png</file>
|
|
||||||
<file>res/image/control/TitleBar.png</file>
|
|
||||||
<file>res/image/control/ToggleButton.png</file>
|
|
||||||
<file>res/image/control/ToggleSplitButton.png</file>
|
|
||||||
<file>res/image/control/ToggleSwitch.png</file>
|
|
||||||
<file>res/image/control/ToolTip.png</file>
|
|
||||||
<file>res/image/control/TreeView.png</file>
|
|
||||||
<file>res/image/control/VariableSizedWrapGrid.png</file>
|
|
||||||
<file>res/image/control/Viewbox.png</file>
|
|
||||||
<file>res/image/control/WebView.png</file>
|
|
||||||
<file>res/image/control/XamlUICommand.png</file>
|
|
||||||
<file>T_CheckBox.qml</file>
|
|
||||||
<file>global/ItemsOriginal.qml</file>
|
|
||||||
<file>global/qmldir</file>
|
|
||||||
<file>global/ItemsFooter.qml</file>
|
|
||||||
<file>page/MediaPage.qml</file>
|
|
||||||
<file>T_FlipView.qml</file>
|
|
||||||
<file>T_Pivot.qml</file>
|
|
||||||
<file>component/CodeExpander.qml</file>
|
|
||||||
<file>T_TableView.qml</file>
|
|
||||||
<file>T_StatusView.qml</file>
|
|
||||||
<file>T_Settings.qml</file>
|
|
||||||
<file>global/MainEvent.qml</file>
|
|
||||||
<file>res/svg/home.svg</file>
|
|
||||||
<file>res/svg/home_dark.svg</file>
|
|
||||||
<file>page/StandardWindow.qml</file>
|
|
||||||
<file>page/SingleTaskWindow.qml</file>
|
|
||||||
<file>page/SingleInstanceWindow.qml</file>
|
|
||||||
<file>T_RatingControl.qml</file>
|
|
||||||
<file>res/image/qrcode_wx.jpg</file>
|
|
||||||
<file>res/image/qrcode_zfb.jpg</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
24
example/qml/App.qml
Normal file
24
example/qml/App.qml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id:app
|
||||||
|
Component.onCompleted: {
|
||||||
|
FluApp.init(app)
|
||||||
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
|
FluApp.routes = {
|
||||||
|
"/":"qrc:/example/qml/window/MainWindow.qml",
|
||||||
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
|
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
||||||
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
|
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml"
|
||||||
|
}
|
||||||
|
FluApp.initialRoute = "/"
|
||||||
|
FluApp.run()
|
||||||
|
}
|
||||||
|
}
|
14
example/qml/TestWindow.qml
Normal file
14
example/qml/TestWindow.qml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import QtQuick
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
FluWindow {
|
||||||
|
id:window
|
||||||
|
width: 400
|
||||||
|
height: 400
|
||||||
|
visible: true
|
||||||
|
|
||||||
|
FluButton{
|
||||||
|
text:"123"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -36,7 +36,7 @@ FluExpander{
|
|||||||
topMargin: 5
|
topMargin: 5
|
||||||
}
|
}
|
||||||
onClicked:{
|
onClicked:{
|
||||||
FluApp.clipText(content.text)
|
FluTools.clipText(content.text)
|
||||||
showSuccess("复制成功")
|
showSuccess("复制成功")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +68,6 @@ FluExpander{
|
|||||||
"FluComboBox",
|
"FluComboBox",
|
||||||
"FluContentDialog",
|
"FluContentDialog",
|
||||||
"FluContentPage",
|
"FluContentPage",
|
||||||
"FluControl",
|
|
||||||
"FluDatePicker",
|
"FluDatePicker",
|
||||||
"FluDivider",
|
"FluDivider",
|
||||||
"FluDropDownButton",
|
"FluDropDownButton",
|
||||||
@ -119,7 +118,11 @@ FluExpander{
|
|||||||
"FluColors",
|
"FluColors",
|
||||||
"FluTheme",
|
"FluTheme",
|
||||||
"FluStatusView",
|
"FluStatusView",
|
||||||
"FluRatingControl"
|
"FluRatingControl",
|
||||||
|
"FluPasswordBox",
|
||||||
|
"FluBreadcrumbBar",
|
||||||
|
"FluCopyableText",
|
||||||
|
"FluAcrylic"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
@ -4,11 +4,13 @@ import QtQuick
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluObject{
|
FluObject{
|
||||||
id:footer_items
|
|
||||||
|
|
||||||
property var navigationView
|
property var navigationView
|
||||||
|
|
||||||
|
id:footer_items
|
||||||
|
|
||||||
FluPaneItemSeparator{}
|
FluPaneItemSeparator{}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:lang.about
|
title:lang.about
|
||||||
icon:FluentIcons.Contact
|
icon:FluentIcons.Contact
|
||||||
@ -16,11 +18,13 @@ FluObject{
|
|||||||
FluApp.navigate("/about")
|
FluApp.navigate("/about")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:lang.settings
|
title:lang.settings
|
||||||
icon:FluentIcons.Settings
|
icon:FluentIcons.Settings
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Settings.qml")
|
navigationView.push("qrc:/example/qml/page/T_Settings.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,16 +9,16 @@ FluObject{
|
|||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:lang.home
|
title:lang.home
|
||||||
// icon:FluentIcons.Home
|
icon:FluentIcons.Home
|
||||||
cusIcon: Image{
|
// cusIcon: Image{
|
||||||
anchors.centerIn: parent
|
// anchors.centerIn: parent
|
||||||
source: FluTheme.dark ? "qrc:/res/svg/home_dark.svg" : "qrc:/res/svg/home.svg"
|
// source: FluTheme.dark ? "qrc:/example/res/svg/home_dark.svg" : "qrc:/example/res/svg/home.svg"
|
||||||
sourceSize: Qt.size(30,30)
|
// sourceSize: Qt.size(30,30)
|
||||||
width: 18
|
// width: 18
|
||||||
height: 18
|
// height: 18
|
||||||
}
|
// }
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Home.qml")
|
navigationView.push("qrc:/example/qml/page/T_Home.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,35 +27,41 @@ FluObject{
|
|||||||
icon:FluentIcons.CheckboxComposite
|
icon:FluentIcons.CheckboxComposite
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Buttons"
|
title:"Buttons"
|
||||||
image:"qrc:/res/image/control/Button.png"
|
image:"qrc:/example/res/image/control/Button.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that responds to user input and raisesa Click event."
|
desc:"A control that responds to user input and raisesa Click event."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Buttons.qml")
|
navigationView.push("qrc:/example/qml/page/T_Buttons.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Text"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_Text.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
image:"qrc:/res/image/control/Slider.png"
|
image:"qrc:/example/res/image/control/Slider.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack."
|
desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Slider.qml")
|
navigationView.push("qrc:/example/qml/page/T_Slider.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"CheckBox"
|
title:"CheckBox"
|
||||||
image:"qrc:/res/image/control/Checkbox.png"
|
image:"qrc:/example/res/image/control/Checkbox.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that a user can select or clear."
|
desc:"A control that a user can select or clear."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_CheckBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_CheckBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_ToggleSwitch.qml")
|
navigationView.push("qrc:/example/qml/page/T_ToggleSwitch.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,31 +72,31 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TextBox"
|
title:"TextBox"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TextBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_TextBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TimePicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_TimePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"DatePicker"
|
title:"DatePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_DatePicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_DatePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"CalendarPicker"
|
title:"CalendarPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_CalendarPicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_CalendarPicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ColorPicker"
|
title:"ColorPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_ColorPicker.qml")
|
navigationView.push("qrc:/example/qml/page/T_ColorPicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,53 +106,53 @@ FluObject{
|
|||||||
icon:FluentIcons.SurfaceHub
|
icon:FluentIcons.SurfaceHub
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"InfoBar"
|
title:"InfoBar"
|
||||||
image:"qrc:/res/image/control/InfoBar.png"
|
image:"qrc:/example/res/image/control/InfoBar.png"
|
||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"An inline message to display app-wide statuschange information."
|
desc:"An inline message to display app-wide statuschange information."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_InfoBar.qml")
|
navigationView.push("qrc:/example/qml/page/T_InfoBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Progress.qml")
|
navigationView.push("qrc:/example/qml/page/T_Progress.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"RatingControl"
|
title:"RatingControl"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_RatingControl.qml")
|
navigationView.push("qrc:/example/qml/page/T_RatingControl.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Badge"
|
title:"Badge"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Badge.qml")
|
navigationView.push("qrc:/example/qml/page/T_Badge.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Rectangle"
|
title:"Rectangle"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Rectangle.qml")
|
navigationView.push("qrc:/example/qml/page/T_Rectangle.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_StatusView.qml")
|
navigationView.push("qrc:/example/qml/page/T_StatusView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Carousel.qml")
|
navigationView.push("qrc:/example/qml/page/T_Carousel.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Expander.qml")
|
navigationView.push("qrc:/example/qml/page/T_Expander.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,19 +163,19 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Dialog"
|
title:"Dialog"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Dialog.qml")
|
navigationView.push("qrc:/example/qml/page/T_Dialog.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Tooltip.qml")
|
navigationView.push("qrc:/example/qml/page/T_Tooltip.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Menu.qml")
|
navigationView.push("qrc:/example/qml/page/T_Menu.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,54 +185,60 @@ FluObject{
|
|||||||
icon:FluentIcons.AllApps
|
icon:FluentIcons.AllApps
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Pivot"
|
title:"Pivot"
|
||||||
image:"qrc:/res/image/control/Pivot.png"
|
image:"qrc:/example/res/image/control/Pivot.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:3
|
order:3
|
||||||
desc:"Presents information from different sources in atabbed view."
|
desc:"Presents information from different sources in atabbed view."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Pivot.qml")
|
navigationView.push("qrc:/example/qml/page/T_Pivot.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"BreadcrumbBar"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_BreadcrumbBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TabView"
|
title:"TabView"
|
||||||
image:"qrc:/res/image/control/TabView.png"
|
image:"qrc:/example/res/image/control/TabView.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:1
|
order:1
|
||||||
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
|
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TabView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TabView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TreeView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TreeView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TableView"
|
title:"TableView"
|
||||||
image:"qrc:/res/image/control/DataGrid.png"
|
image:"qrc:/example/res/image/control/DataGrid.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:4
|
order:4
|
||||||
desc:"The TableView control provides a flexible way to display a collection of data in rows and columns"
|
desc:"The TableView control provides a flexible way to display a collection of data in rows and columns"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TableView.qml")
|
navigationView.push("qrc:/example/qml/page/T_TableView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_MultiWindow.qml")
|
navigationView.push("qrc:/example/qml/page/T_MultiWindow.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"FlipView"
|
title:"FlipView"
|
||||||
image:"qrc:/res/image/control/FlipView.png"
|
image:"qrc:/example/res/image/control/FlipView.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:2
|
order:2
|
||||||
desc:"Presents a collection of items that the user canflip through, one item at a time."
|
desc:"Presents a collection of items that the user canflip through, one item at a time."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_FlipView.qml")
|
navigationView.push("qrc:/example/qml/page/T_FlipView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,22 +246,28 @@ FluObject{
|
|||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:lang.theming
|
title:lang.theming
|
||||||
icon:FluentIcons.Brightness
|
icon:FluentIcons.Brightness
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Acrylic"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_Acrylic.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Theme.qml")
|
navigationView.push("qrc:/example/qml/page/T_Theme.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Typography"
|
title:"Typography"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Typography.qml")
|
navigationView.push("qrc:/example/qml/page/T_Typography.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Awesome"
|
title:"Awesome"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Awesome.qml")
|
navigationView.push("qrc:/example/qml/page/T_Awesome.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,12 +277,12 @@ FluObject{
|
|||||||
icon:FluentIcons.Media
|
icon:FluentIcons.Media
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MediaPlayer"
|
title:"MediaPlayer"
|
||||||
image:"qrc:/res/image/control/MediaPlayerElement.png"
|
image:"qrc:/example/res/image/control/MediaPlayerElement.png"
|
||||||
recentlyAdded:true
|
recentlyAdded:true
|
||||||
order:0
|
order:0
|
||||||
desc:"A control to display video and image content."
|
desc:"A control to display video and image content."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_MediaPlayer.qml")
|
navigationView.push("qrc:/example/qml/page/T_MediaPlayer.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
60
example/qml/page/T_Acrylic.qml
Normal file
60
example/qml/page/T_Acrylic.qml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Acrylic"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 1439/5+20
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
FluRectangle{
|
||||||
|
width: 1080/5
|
||||||
|
height: 1439/5
|
||||||
|
radius:[25,25,25,25]
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 20
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
source: "qrc:/example/res/image/image_huoyin.webp"
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
FluAcrylic {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 100
|
||||||
|
height: 100
|
||||||
|
FluText {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "Acrylic"
|
||||||
|
color: "#FFFFFF"
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'Image{
|
||||||
|
width: 800
|
||||||
|
height: 600
|
||||||
|
source: "qrc:/example/res/image/image_huoyin.webp"
|
||||||
|
radius: 8
|
||||||
|
FluAcrylic{
|
||||||
|
width: 100
|
||||||
|
height: 100
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,10 +8,6 @@ FluContentPage {
|
|||||||
|
|
||||||
title:"Awesome"
|
title:"Awesome"
|
||||||
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
|
|
||||||
FluTextBox{
|
FluTextBox{
|
||||||
id:text_box
|
id:text_box
|
||||||
placeholderText: "请输入关键字"
|
placeholderText: "请输入关键字"
|
||||||
@ -55,7 +51,7 @@ FluContentPage {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var text ="FluentIcons."+modelData.name;
|
var text ="FluentIcons."+modelData.name;
|
||||||
FluApp.clipText(text)
|
FluTools.clipText(text)
|
||||||
showSuccess("您复制了 "+text)
|
showSuccess("您复制了 "+text)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,17 +3,12 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Badge"
|
title:"Badge"
|
||||||
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -103,6 +98,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'Rectangle{
|
code:'Rectangle{
|
||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
94
example/qml/page/T_BreadcrumbBar.qml
Normal file
94
example/qml/page/T_BreadcrumbBar.qml
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"BreadcurmbBar"
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var items = []
|
||||||
|
for(var i=0;i<10;i++){
|
||||||
|
items.push({title:"Item_"+(i+1)})
|
||||||
|
}
|
||||||
|
breadcrumb_1.items = items
|
||||||
|
breadcrumb_2.items = items
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluBreadcrumbBar{
|
||||||
|
id:breadcrumb_1
|
||||||
|
width:parent.width
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClickItem:
|
||||||
|
(model)=>{
|
||||||
|
showSuccess(model.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width:parent.width
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
FluFilledButton{
|
||||||
|
text:"Reset sample"
|
||||||
|
onClicked:{
|
||||||
|
var items = []
|
||||||
|
for(var i=0;i<10;i++){
|
||||||
|
items.push({title:"Item_"+(i+1)})
|
||||||
|
}
|
||||||
|
breadcrumb_2.items = items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluBreadcrumbBar{
|
||||||
|
id:breadcrumb_2
|
||||||
|
separator:">"
|
||||||
|
spacing:8
|
||||||
|
textSize:18
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onClickItem:
|
||||||
|
(model)=>{
|
||||||
|
//不是点击最后一个item元素
|
||||||
|
if(model.index+1!==count()){
|
||||||
|
breadcrumb_2.remove(model.index+1,count()-model.index-1)
|
||||||
|
}
|
||||||
|
showSuccess(model.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluBreadcrumbBar{
|
||||||
|
width:parent.width
|
||||||
|
separator:">"
|
||||||
|
spacing:8
|
||||||
|
textSize:18
|
||||||
|
onClickItem: (model)=>{
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -2,16 +2,13 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
title:"Buttons"
|
|
||||||
|
|
||||||
leftPadding:10
|
title:"Buttons"
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -51,6 +48,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluTextButton{
|
code:'FluTextButton{
|
||||||
text:"Text Button"
|
text:"Text Button"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -92,6 +90,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluButton{
|
code:'FluButton{
|
||||||
text:"Standard Button"
|
text:"Standard Button"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -133,6 +132,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluFilledButton{
|
code:'FluFilledButton{
|
||||||
text:"Filled Button"
|
text:"Filled Button"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -174,6 +174,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluToggleButton{
|
code:'FluToggleButton{
|
||||||
text:"Toggle Button"
|
text:"Toggle Button"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -216,6 +217,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluIconButton{
|
code:'FluIconButton{
|
||||||
iconSource:FluentIcons.ChromeCloseContrast
|
iconSource:FluentIcons.ChromeCloseContrast
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -266,6 +268,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluDropDownButton{
|
code:'FluDropDownButton{
|
||||||
text:"DropDownButton"
|
text:"DropDownButton"
|
||||||
items:[
|
items:[
|
||||||
@ -327,6 +330,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluRadioButton{
|
code:'FluRadioButton{
|
||||||
selected:true
|
selected:true
|
||||||
text:"Text Button"
|
text:"Text Button"
|
||||||
@ -365,6 +369,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluCheckBox{
|
code:'FluCheckBox{
|
||||||
text:"Check Box"
|
text:"Check Box"
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"CalendarPicker"
|
title:"CalendarPicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -23,6 +19,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluCalendarView{
|
code:'FluCalendarView{
|
||||||
|
|
||||||
}'
|
}'
|
||||||
@ -44,6 +41,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluCalendarPicker{
|
code:'FluCalendarPicker{
|
||||||
|
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -32,18 +28,19 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 5
|
Layout.leftMargin: 5
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
carousel.setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
|
carousel.setData([{url:"qrc:/example/res/image/banner_1.jpg"},{url:"qrc:/example/res/image/banner_2.jpg"},{url:"qrc:/example/res/image/banner_3.jpg"}])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluCarousel{
|
code:'FluCarousel{
|
||||||
width: 400
|
width: 400
|
||||||
height: 300
|
height: 300
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
|
setData([{url:"qrc:/example/res/image/banner_1.jpg"},{url:"qrc:/example/res/image/banner_2.jpg"},{url:"qrc:/example/res/image/banner_3.jpg"}])
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
}
|
}
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"CheckBox"
|
title:"CheckBox"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -30,6 +26,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluCheckBox{
|
code:'FluCheckBox{
|
||||||
text:"Text"
|
text:"Text"
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"ColorPicker"
|
title:"ColorPicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -41,6 +37,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluColorView{
|
code:'FluColorView{
|
||||||
|
|
||||||
}'
|
}'
|
||||||
@ -64,6 +61,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluColorPicker{
|
code:'FluColorPicker{
|
||||||
|
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -32,6 +28,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluDatePicker{
|
code:'FluDatePicker{
|
||||||
|
|
||||||
}'
|
}'
|
||||||
@ -59,6 +56,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluDatePicker{
|
code:'FluDatePicker{
|
||||||
showYear:false
|
showYear:false
|
||||||
}'
|
}'
|
118
example/qml/page/T_Dialog.qml
Normal file
118
example/qml/page/T_Dialog.qml
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Dialog"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
FluButton{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
Layout.topMargin: 20
|
||||||
|
text:"Show Double Button Dialog"
|
||||||
|
onClicked: {
|
||||||
|
double_btn_dialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluContentDialog{
|
||||||
|
id:dialog
|
||||||
|
title:"友情提示"
|
||||||
|
message:"确定要退出程序么?"
|
||||||
|
negativeText:"取消"
|
||||||
|
buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
onNegativeClicked:{
|
||||||
|
showSuccess("点击取消按钮")
|
||||||
|
}
|
||||||
|
positiveText:"确定"
|
||||||
|
onPositiveClicked:{
|
||||||
|
showSuccess("点击确定按钮")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialog.open()'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluContentDialog{
|
||||||
|
id:double_btn_dialog
|
||||||
|
title:"友情提示"
|
||||||
|
message:"确定要退出程序么?"
|
||||||
|
buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
negativeText:"取消"
|
||||||
|
onNegativeClicked:{
|
||||||
|
showSuccess("点击取消按钮")
|
||||||
|
}
|
||||||
|
positiveText:"确定"
|
||||||
|
onPositiveClicked:{
|
||||||
|
showSuccess("点击确定按钮")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
FluButton{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
Layout.topMargin: 20
|
||||||
|
text:"Show Triple Button Dialog"
|
||||||
|
onClicked: {
|
||||||
|
triple_btn_dialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluContentDialog{
|
||||||
|
id:dialog
|
||||||
|
title:"友情提示"
|
||||||
|
message:"确定要退出程序么?"
|
||||||
|
negativeText:"取消"
|
||||||
|
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
negativeText:"取消"
|
||||||
|
onNegativeClicked:{
|
||||||
|
showSuccess("点击取消按钮")
|
||||||
|
}
|
||||||
|
positiveText:"确定"
|
||||||
|
onPositiveClicked:{
|
||||||
|
showSuccess("点击确定按钮")
|
||||||
|
}
|
||||||
|
neutralText:"最小化"
|
||||||
|
onNeutralClicked:{
|
||||||
|
showSuccess("点击最小化按钮")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialog.open()'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluContentDialog{
|
||||||
|
id:triple_btn_dialog
|
||||||
|
title:"友情提示"
|
||||||
|
message:"确定要退出程序么?"
|
||||||
|
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
negativeText:"取消"
|
||||||
|
onNegativeClicked:{
|
||||||
|
showSuccess("点击取消按钮")
|
||||||
|
}
|
||||||
|
positiveText:"确定"
|
||||||
|
onPositiveClicked:{
|
||||||
|
showSuccess("点击确定按钮")
|
||||||
|
}
|
||||||
|
neutralText:"最小化"
|
||||||
|
onNeutralClicked:{
|
||||||
|
showSuccess("点击最小化按钮")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,26 +3,22 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: layout_column.height+40
|
height: layout_column.height+20
|
||||||
paddings: 10
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Column{
|
Column{
|
||||||
id:layout_column
|
id:layout_column
|
||||||
spacing: 15
|
spacing: 15
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
top:parent.top
|
||||||
left:parent.left
|
left:parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,12 +73,12 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluExpander{
|
code:'FluExpander{
|
||||||
headerText:"打开一个单选框"
|
headerText:"打开一个单选框"
|
||||||
Item{
|
Item{
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"FlipView"
|
title:"FlipView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -25,17 +21,17 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluFlipView{
|
FluFlipView{
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_2.jpg"
|
source: "qrc:/example/res/image/banner_2.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_3.jpg"
|
source: "qrc:/example/res/image/banner_3.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
@ -44,19 +40,20 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluFlipView{
|
code:'FluFlipView{
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
@ -77,18 +74,18 @@ FluScrollablePage{
|
|||||||
FluFlipView{
|
FluFlipView{
|
||||||
vertical:true
|
vertical:true
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
sourceSize: Qt.size(400,300)
|
sourceSize: Qt.size(400,300)
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_2.jpg"
|
source: "qrc:/example/res/image/banner_2.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_3.jpg"
|
source: "qrc:/example/res/image/banner_3.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
@ -97,20 +94,21 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluFlipView{
|
code:'FluFlipView{
|
||||||
vertical:true
|
vertical:true
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
@ -2,20 +2,15 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "qrc:///global/"
|
import "qrc:///example/qml/global/"
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:0
|
|
||||||
bottomPadding:20
|
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:model_header
|
id:model_header
|
||||||
ListElement{
|
ListElement{
|
||||||
icon:"qrc:/res/image/ic_home_github.png"
|
icon:"qrc:/example/res/image/ic_home_github.png"
|
||||||
title:"FluentUI GitHub"
|
title:"FluentUI GitHub"
|
||||||
desc:"The latest FluentUI controls and styles for your applications."
|
desc:"The latest FluentUI controls and styles for your applications."
|
||||||
url:"https://github.com/zhuzichu520/FluentUI"
|
url:"https://github.com/zhuzichu520/FluentUI"
|
||||||
@ -30,7 +25,7 @@ FluScrollablePage{
|
|||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
verticalAlignment: Qt.AlignTop
|
verticalAlignment: Qt.AlignTop
|
||||||
source: "qrc:/res/image/bg_home_header.png"
|
source: "qrc:/example/res/image/bg_home_header.png"
|
||||||
}
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -41,7 +36,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"FluentUI Gallery"
|
text:"FluentUI Gallery"
|
||||||
fontStyle: FluText.TitleLarge
|
font: FluTextStyle.TitleLarge
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -101,7 +96,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text: model.title
|
text: model.title
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
}
|
}
|
||||||
@ -184,7 +179,7 @@ FluScrollablePage{
|
|||||||
FluText{
|
FluText{
|
||||||
id:item_title
|
id:item_title
|
||||||
text:modelData.title
|
text:modelData.title
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
anchors{
|
anchors{
|
||||||
left: item_icon.right
|
left: item_icon.right
|
||||||
leftMargin: 20
|
leftMargin: 20
|
||||||
@ -198,7 +193,7 @@ FluScrollablePage{
|
|||||||
color:FluColors.Grey120
|
color:FluColors.Grey120
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
fontStyle: FluText.Caption
|
font: FluTextStyle.Caption
|
||||||
maximumLineCount: 2
|
maximumLineCount: 2
|
||||||
anchors{
|
anchors{
|
||||||
left: item_title.left
|
left: item_title.left
|
||||||
@ -236,7 +231,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text: "Recently added samples"
|
text: "Recently added samples"
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
}
|
}
|
||||||
@ -253,7 +248,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text: "Recently updated samples"
|
text: "Recently updated samples"
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
}
|
}
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"InfoBar"
|
title:"InfoBar"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -52,6 +48,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'showInfo("这是一个Info样式的InfoBar")
|
code:'showInfo("这是一个Info样式的InfoBar")
|
||||||
|
|
||||||
showWarning("这是一个Warning样式的InfoBar")
|
showWarning("这是一个Warning样式的InfoBar")
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"MediaPlayer"
|
title:"MediaPlayer"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if(visible){
|
if(visible){
|
||||||
@ -38,6 +34,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluMediaPlayer{
|
code:'FluMediaPlayer{
|
||||||
id:player
|
id:player
|
||||||
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -53,6 +49,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluMenu{
|
code:'FluMenu{
|
||||||
id:menu
|
id:menu
|
||||||
FluMenuItem:{
|
FluMenuItem:{
|
@ -3,18 +3,14 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
property string password: ""
|
property string password: ""
|
||||||
property var loginPageRegister: registerForPageResult("/login")
|
property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: loginPageRegister
|
target: loginPageRegister
|
||||||
@ -95,6 +91,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluWindow{
|
code:'FluWindow{
|
||||||
//launchMode: FluWindow.Standard
|
//launchMode: FluWindow.Standard
|
||||||
//launchMode: FluWindow.SingleTask
|
//launchMode: FluWindow.SingleTask
|
||||||
@ -128,6 +125,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluButton{
|
code:'FluButton{
|
||||||
text:"点击跳转"
|
text:"点击跳转"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -165,7 +163,8 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
code:'property var loginPageRegister: registerForPageResult("/login")
|
Layout.topMargin: -1
|
||||||
|
code:'property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: loginPageRegister
|
target: loginPageRegister
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Pivot"
|
title:"Pivot"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -50,6 +46,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluPivot{
|
code:'FluPivot{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
FluPivotItem:{
|
FluPivotItem:{
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -47,6 +43,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluProgressBar{
|
code:'FluProgressBar{
|
||||||
|
|
||||||
}
|
}
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"RatingControl"
|
title:"RatingControl"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -34,6 +30,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluRatingControl{
|
code:'FluRatingControl{
|
||||||
|
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Rectangle"
|
title:"Rectangle"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -67,7 +63,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"配合图片使用"
|
text:"配合图片使用"
|
||||||
fontStyle: FluText.SubTitle
|
font: FluTextStyle.Subtitle
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
}
|
}
|
||||||
RowLayout{
|
RowLayout{
|
||||||
@ -79,7 +75,7 @@ FluScrollablePage{
|
|||||||
Image {
|
Image {
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: "qrc:/res/svg/avatar_1.svg"
|
source: "qrc:/example/res/svg/avatar_1.svg"
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,7 +87,7 @@ FluScrollablePage{
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
source: "qrc:/res/svg/avatar_2.svg"
|
source: "qrc:/example/res/svg/avatar_2.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluRectangle{
|
FluRectangle{
|
||||||
@ -102,7 +98,7 @@ FluScrollablePage{
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
source: "qrc:/res/svg/avatar_3.svg"
|
source: "qrc:/example/res/svg/avatar_3.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluRectangle{
|
FluRectangle{
|
||||||
@ -113,7 +109,7 @@ FluScrollablePage{
|
|||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
source: "qrc:/res/svg/avatar_4.svg"
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +119,7 @@ FluScrollablePage{
|
|||||||
radius:[25,25,25,25]
|
radius:[25,25,25,25]
|
||||||
Image {
|
Image {
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
source: "qrc:/res/image/image_huoyin.webp"
|
source: "qrc:/example/res/image/image_huoyin.webp"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
}
|
}
|
||||||
@ -134,6 +130,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluRectangle{
|
code:'FluRectangle{
|
||||||
radius: [25,25,25,25]
|
radius: [25,25,25,25]
|
||||||
width: 50
|
width: 50
|
||||||
@ -141,7 +138,7 @@ FluScrollablePage{
|
|||||||
Image{
|
Image{
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: "qrc:/res/svg/avatar_4.svg"
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
sourceSize: Qt.size(width,height)
|
sourceSize: Qt.size(width,height)
|
||||||
}
|
}
|
||||||
}'
|
}'
|
@ -3,21 +3,17 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///global/"
|
import "qrc:///example/qml/global/"
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Settings"
|
title:"Settings"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 168
|
height: 136
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
@ -26,24 +22,23 @@ FluScrollablePage{
|
|||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.navigation_view_display_mode
|
text:lang.dark_mode
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
|
|
||||||
Repeater{
|
Repeater{
|
||||||
id:repeater
|
model: [{title:"System",mode:FluDarkMode.System},{title:"Light",mode:FluDarkMode.Light},{title:"Dark",mode:FluDarkMode.Dark}]
|
||||||
model: [{title:"Open",mode:FluNavigationView.Open},{title:"Compact",mode:FluNavigationView.Compact},{title:"Minimal",mode:FluNavigationView.Minimal},{title:"Auto",mode:FluNavigationView.Auto}]
|
|
||||||
delegate: FluRadioButton{
|
delegate: FluRadioButton{
|
||||||
selected : MainEvent.displayMode===modelData.mode
|
selected : FluTheme.darkMode === modelData.mode
|
||||||
text:modelData.title
|
text:modelData.title
|
||||||
onClicked:{
|
onClicked:{
|
||||||
MainEvent.displayMode = modelData.mode
|
FluTheme.darkMode = modelData.mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -54,6 +49,37 @@ FluScrollablePage{
|
|||||||
height: 168
|
height: 168
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 10
|
||||||
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
text:lang.navigation_view_display_mode
|
||||||
|
font: FluTextStyle.BodyStrong
|
||||||
|
Layout.bottomMargin: 4
|
||||||
|
}
|
||||||
|
Repeater{
|
||||||
|
model: [{title:"Open",mode:FluNavigationView.Open},{title:"Compact",mode:FluNavigationView.Compact},{title:"Minimal",mode:FluNavigationView.Minimal},{title:"Auto",mode:FluNavigationView.Auto}]
|
||||||
|
delegate: FluRadioButton{
|
||||||
|
selected : MainEvent.displayMode===modelData.mode
|
||||||
|
text:modelData.title
|
||||||
|
onClicked:{
|
||||||
|
MainEvent.displayMode = modelData.mode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 80
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 10
|
spacing: 10
|
||||||
anchors{
|
anchors{
|
||||||
@ -63,7 +89,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.locale
|
text:lang.locale
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +108,6 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,16 +2,12 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "./component"
|
import "../component"
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -25,6 +21,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluSlider{
|
code:'FluSlider{
|
||||||
value:50
|
value:50
|
||||||
}'
|
}'
|
||||||
@ -46,6 +43,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluSlider{
|
code:'FluSlider{
|
||||||
vertical:true
|
vertical:true
|
||||||
value:50
|
value:50
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
id:layout_actions
|
id:layout_actions
|
||||||
@ -78,6 +74,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluStatusView{
|
code:'FluStatusView{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
statusMode: FluStatusView.Loading
|
statusMode: FluStatusView.Loading
|
@ -3,18 +3,14 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TabView"
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
property var colors : [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
property var colors : [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
||||||
|
|
||||||
|
title:"TabView"
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_page
|
id:com_page
|
||||||
Rectangle{
|
Rectangle{
|
||||||
@ -24,7 +20,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function newTab(){
|
function newTab(){
|
||||||
tab_view.appendTab("qrc:/res/image/favicon.ico","Document "+tab_view.count(),com_page,colors[Math.floor(Math.random() * 8)].dark)
|
tab_view.appendTab("qrc:/example/res/image/favicon.ico","Document "+tab_view.count(),com_page,colors[Math.floor(Math.random() * 8)].dark)
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@ -113,6 +109,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluTabView{
|
code:'FluTabView{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@ -128,7 +125,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function newTab(){
|
function newTab(){
|
||||||
tab_view.appendTab("qrc:/res/image/favicon.ico","Document 1",com_page,argument)
|
tab_view.appendTab("qrc:/example/res/image/favicon.ico","Document 1",com_page,argument)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'
|
'
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TableView"
|
title:"TableView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const columns = [
|
const columns = [
|
||||||
@ -68,10 +64,9 @@ FluScrollablePage{
|
|||||||
text:"编辑"
|
text:"编辑"
|
||||||
topPadding:3
|
topPadding:3
|
||||||
bottomPadding:3
|
bottomPadding:3
|
||||||
leftPadding:3
|
leftPadding:6
|
||||||
rightPadding:3
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
console.debug(dataModel.index)
|
|
||||||
showSuccess(JSON.stringify(dataObject))
|
showSuccess(JSON.stringify(dataObject))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,8 +74,8 @@ FluScrollablePage{
|
|||||||
text:"删除"
|
text:"删除"
|
||||||
topPadding:3
|
topPadding:3
|
||||||
bottomPadding:3
|
bottomPadding:3
|
||||||
leftPadding:3
|
leftPadding:6
|
||||||
rightPadding:3
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
showError(JSON.stringify(dataObject))
|
showError(JSON.stringify(dataObject))
|
||||||
}
|
}
|
||||||
@ -110,7 +105,6 @@ FluScrollablePage{
|
|||||||
id:table_view
|
id:table_view
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
width:parent.width
|
|
||||||
pageCurrent:1
|
pageCurrent:1
|
||||||
pageCount:10
|
pageCount:10
|
||||||
itemCount: 1000
|
itemCount: 1000
|
||||||
@ -141,15 +135,15 @@ FluScrollablePage{
|
|||||||
width:100
|
width:100
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
table_view.columns = columns
|
table_view.columns = columns
|
||||||
const dataSource = [
|
const dataSource = [
|
||||||
{
|
{
|
||||||
name: "孙悟空”,
|
name: "孙悟空”,
|
||||||
age: 500,
|
age: 500,
|
||||||
address:"钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
address:"钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
||||||
nickname:"齐天大圣"
|
nickname:"齐天大圣"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
table_view.dataSource = columns
|
table_view.dataSource = columns
|
||||||
}
|
}
|
||||||
}'
|
}'
|
32
example/qml/page/T_Text.qml
Normal file
32
example/qml/page/T_Text.qml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Text"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 60
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
FluCopyableText{
|
||||||
|
text: "这是一个可以支持复制的Text"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluCopyableText{
|
||||||
|
text:"这是一个可以支持复制的Text"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TextBox"
|
title:"TextBox"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -45,19 +41,59 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluTextBox{
|
code:'FluTextBox{
|
||||||
placeholderText:"单行输入框"
|
placeholderText:"单行输入框"
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
paddings: 10
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluPasswordBox{
|
||||||
|
Layout.topMargin: 20
|
||||||
|
placeholderText: "请输入密码"
|
||||||
|
Layout.preferredWidth: 300
|
||||||
|
disabled:password_box_switch.selected
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:password_box_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluPasswordBox{
|
||||||
|
placeholderText:"请输入密码"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 36+multiine_textbox.height
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
FluMultilineTextBox{
|
FluMultilineTextBox{
|
||||||
|
id:multiine_textbox
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
placeholderText: "多行输入框"
|
placeholderText: "多行输入框"
|
||||||
Layout.preferredWidth: 300
|
Layout.preferredWidth: 300
|
||||||
@ -83,6 +119,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluMultilineTextBox{
|
code:'FluMultilineTextBox{
|
||||||
placeholderText:"多行输入框"
|
placeholderText:"多行输入框"
|
||||||
}'
|
}'
|
||||||
@ -122,6 +159,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluAutoSuggestBox{
|
code:'FluAutoSuggestBox{
|
||||||
placeholderText:"AutoSuggestBox"
|
placeholderText:"AutoSuggestBox"
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -58,7 +54,11 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: 5
|
Layout.topMargin: 5
|
||||||
selected: FluTheme.dark
|
selected: FluTheme.dark
|
||||||
clickFunc:function(){
|
clickFunc:function(){
|
||||||
FluTheme.dark = !FluTheme.dark
|
if(FluTheme.dark){
|
||||||
|
FluTheme.darkMode = FluDarkMode.Light
|
||||||
|
}else{
|
||||||
|
FluTheme.darkMode = FluDarkMode.Dark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
@ -76,12 +76,12 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluTheme.primaryColor = FluColors.Orange
|
code:'FluTheme.primaryColor = FluColors.Orange
|
||||||
|
|
||||||
FluTheme.dark = true
|
FluTheme.dark = true
|
||||||
|
|
||||||
FluTheme.nativeText = true
|
FluTheme.nativeText = true'
|
||||||
'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -37,6 +33,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluTimePicker{
|
code:'FluTimePicker{
|
||||||
|
|
||||||
}'
|
}'
|
||||||
@ -67,6 +64,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluTimePicker{
|
code:'FluTimePicker{
|
||||||
hourFormat:FluTimePicker.HH
|
hourFormat:FluTimePicker.HH
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -30,6 +26,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluToggleSwitch{
|
code:'FluToggleSwitch{
|
||||||
text:"Text"
|
text:"Text"
|
||||||
}'
|
}'
|
@ -3,15 +3,11 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -45,6 +41,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluIconButton{
|
code:'FluIconButton{
|
||||||
iconSource:FluentIcons.ChromeCloseContrast
|
iconSource:FluentIcons.ChromeCloseContrast
|
||||||
iconSize: 15
|
iconSize: 15
|
||||||
@ -87,6 +84,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluButton{
|
code:'FluButton{
|
||||||
id:button_1
|
id:button_1
|
||||||
text:"删除"
|
text:"删除"
|
||||||
@ -98,8 +96,7 @@ FluScrollablePage{
|
|||||||
onClicked:{
|
onClicked:{
|
||||||
showSuccess("点击一个Button")
|
showSuccess("点击一个Button")
|
||||||
}
|
}
|
||||||
}
|
}'
|
||||||
'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3,15 +3,11 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage {
|
FluScrollablePage {
|
||||||
|
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
function randomName() {
|
function randomName() {
|
||||||
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
||||||
@ -142,6 +138,7 @@ FluScrollablePage {
|
|||||||
|
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
code:'FluTreeView{
|
code:'FluTreeView{
|
||||||
id:tree_view
|
id:tree_view
|
||||||
width:240
|
width:240
|
@ -5,11 +5,9 @@ import FluentUI
|
|||||||
|
|
||||||
FluContentPage {
|
FluContentPage {
|
||||||
|
|
||||||
|
property real textScale: 1
|
||||||
|
|
||||||
title: "Typography"
|
title: "Typography"
|
||||||
property int textSize: FluTheme.textSize
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
slider.seek(0)
|
slider.seek(0)
|
||||||
@ -26,47 +24,49 @@ FluContentPage {
|
|||||||
paddings: 10
|
paddings: 10
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
scale: textScale
|
||||||
|
transformOrigin: Item.TopLeft
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Display
|
||||||
text:"Display"
|
text:"Display"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Display
|
||||||
fontStyle: FluText.Display
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_TitleLarge
|
||||||
text:"Title Large"
|
text:"Title Large"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.TitleLarge
|
||||||
fontStyle: FluText.TitleLarge
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Title
|
||||||
text:"Title"
|
text:"Title"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Title
|
||||||
fontStyle: FluText.Title
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Subtitle
|
||||||
text:"Subtitle"
|
text:"Subtitle"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Subtitle
|
||||||
fontStyle: FluText.SubTitle
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_BodyStrong
|
||||||
text:"Body Strong"
|
text:"Body Strong"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.BodyStrong
|
||||||
fontStyle: FluText.BodyStrong
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Body
|
||||||
text:"Body"
|
text:"Body"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Body
|
||||||
fontStyle: FluText.Body
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Caption
|
||||||
text:"Caption"
|
text:"Caption"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Caption
|
||||||
fontStyle: FluText.Caption
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,15 +80,8 @@ FluContentPage {
|
|||||||
topMargin: 30
|
topMargin: 30
|
||||||
}
|
}
|
||||||
onValueChanged:{
|
onValueChanged:{
|
||||||
textSize = value/100*6+FluTheme.textSize
|
textScale = 1+value/100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"关于"
|
||||||
width: 600
|
width: 600
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 600
|
minimumWidth: 600
|
||||||
@ -15,17 +15,9 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
title:"关于"
|
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"关于"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
anchors{
|
anchors{
|
||||||
top: appbar.bottom
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
@ -36,11 +28,17 @@ FluWindow {
|
|||||||
spacing: 14
|
spacing: 14
|
||||||
FluText{
|
FluText{
|
||||||
text:"FluentUI"
|
text:"FluentUI"
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
FluApp.navigate("/")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"v%1".arg(appInfo.version)
|
text:"v%1".arg(appInfo.version)
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,6 +64,8 @@ FluWindow {
|
|||||||
}
|
}
|
||||||
FluTextButton{
|
FluTextButton{
|
||||||
id:text_hublink
|
id:text_hublink
|
||||||
|
topPadding:0
|
||||||
|
bottomPadding:0
|
||||||
text:"https://github.com/zhuzichu520/FluentUI"
|
text:"https://github.com/zhuzichu520/FluentUI"
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -81,6 +81,8 @@ FluWindow {
|
|||||||
text:"B站:"
|
text:"B站:"
|
||||||
}
|
}
|
||||||
FluTextButton{
|
FluTextButton{
|
||||||
|
topPadding:0
|
||||||
|
bottomPadding:0
|
||||||
text:"https://www.bilibili.com/video/BV1mg4y1M71w/"
|
text:"https://www.bilibili.com/video/BV1mg4y1M71w/"
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -111,6 +113,7 @@ FluWindow {
|
|||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 15
|
Layout.leftMargin: 15
|
||||||
FluText{
|
FluText{
|
||||||
text:"捐赠:"
|
text:"捐赠:"
|
||||||
@ -122,16 +125,16 @@ FluWindow {
|
|||||||
Layout.preferredHeight: 252
|
Layout.preferredHeight: 252
|
||||||
Row{
|
Row{
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
spacing: 60
|
spacing: 30
|
||||||
Image{
|
Image{
|
||||||
width: 164.55
|
width: 250
|
||||||
height: 224.25
|
height: 250
|
||||||
source: "qrc:/res/image/qrcode_wx.jpg"
|
source: "qrc:/example/res/image/qrcode_wx.jpg"
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
width: 162
|
width: 250
|
||||||
height: 252
|
height: 250
|
||||||
source: "qrc:/res/image/qrcode_zfb.jpg"
|
source: "qrc:/example/res/image/qrcode_zfb.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,12 +142,11 @@ FluWindow {
|
|||||||
RowLayout{
|
RowLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
Layout.leftMargin: 15
|
Layout.leftMargin: 15
|
||||||
|
Layout.topMargin: 20
|
||||||
FluText{
|
FluText{
|
||||||
id:text_desc
|
id:text_desc
|
||||||
text:"个人开发,维护不易,你们的捐赠就是我继续更新的动力!\n有什么问题提Issues,只要时间充足我就会解决的!!"
|
text:"个人开发,维护不易,你们的捐赠就是我继续更新的动力!\n有什么问题提Issues,只要时间充足我就会解决的!!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,13 +6,13 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"登录"
|
||||||
width: 400
|
width: 400
|
||||||
height: 400
|
height: 400
|
||||||
minimumWidth: 400
|
minimumWidth: 400
|
||||||
minimumHeight: 400
|
minimumHeight: 400
|
||||||
maximumWidth: 400
|
maximumWidth: 400
|
||||||
maximumHeight: 400
|
maximumHeight: 400
|
||||||
title:"登录"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
||||||
@ -20,12 +20,6 @@ FluWindow {
|
|||||||
textbox_password.focus = true
|
textbox_password.focus = true
|
||||||
}
|
}
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"登录"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
anchors{
|
anchors{
|
||||||
left: parent.left
|
left: parent.left
|
125
example/qml/window/MainWindow.qml
Normal file
125
example/qml/window/MainWindow.qml
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Qt.labs.platform
|
||||||
|
import FluentUI
|
||||||
|
import "qrc:///example/qml/global/"
|
||||||
|
|
||||||
|
FluWindow {
|
||||||
|
|
||||||
|
id:window
|
||||||
|
title: "FluentUI"
|
||||||
|
width: 1000
|
||||||
|
height: 640
|
||||||
|
closeDestory:false
|
||||||
|
minimumWidth: 520
|
||||||
|
minimumHeight: 460
|
||||||
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
|
closeFunc:function(event){
|
||||||
|
close_app.open()
|
||||||
|
event.accepted = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections{
|
||||||
|
target: appInfo
|
||||||
|
function onActiveWindow(){
|
||||||
|
window.show()
|
||||||
|
window.raise()
|
||||||
|
window.requestActivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemTrayIcon {
|
||||||
|
id:system_tray
|
||||||
|
visible: true
|
||||||
|
icon.source: "qrc:/example/res/image/favicon.ico"
|
||||||
|
tooltip: "FluentUI"
|
||||||
|
menu: Menu {
|
||||||
|
MenuItem {
|
||||||
|
text: "退出"
|
||||||
|
onTriggered: {
|
||||||
|
window.deleteWindow()
|
||||||
|
FluApp.closeApp()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onActivated:
|
||||||
|
(reason)=>{
|
||||||
|
if(reason === SystemTrayIcon.Trigger){
|
||||||
|
window.show()
|
||||||
|
window.raise()
|
||||||
|
window.requestActivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluContentDialog{
|
||||||
|
id:close_app
|
||||||
|
title:"退出"
|
||||||
|
message:"确定要退出程序吗?"
|
||||||
|
negativeText:"最小化"
|
||||||
|
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
onNegativeClicked:{
|
||||||
|
system_tray.showMessage("友情提示","FluentUI已隐藏至托盘,点击托盘可再次激活窗口");
|
||||||
|
window.hide()
|
||||||
|
}
|
||||||
|
positiveText:"退出"
|
||||||
|
neutralText:"取消"
|
||||||
|
onPositiveClicked:{
|
||||||
|
window.deleteWindow()
|
||||||
|
FluApp.closeApp()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FluNavigationView{
|
||||||
|
id:nav_view
|
||||||
|
anchors.fill: parent
|
||||||
|
items: ItemsOriginal
|
||||||
|
footerItems:ItemsFooter
|
||||||
|
z:11
|
||||||
|
displayMode:MainEvent.displayMode
|
||||||
|
logo: "qrc:/example/res/image/favicon.ico"
|
||||||
|
title:"FluentUI"
|
||||||
|
autoSuggestBox:FluAutoSuggestBox{
|
||||||
|
width: 280
|
||||||
|
anchors.centerIn: parent
|
||||||
|
iconSource: FluentIcons.Search
|
||||||
|
items: ItemsOriginal.getSearchData()
|
||||||
|
placeholderText: lang.search
|
||||||
|
onItemClicked:
|
||||||
|
(data)=>{
|
||||||
|
ItemsOriginal.startPageByItem(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
actionItem:Item{
|
||||||
|
height: 40
|
||||||
|
width: 148
|
||||||
|
RowLayout{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: 5
|
||||||
|
FluText{
|
||||||
|
text:lang.dark_mode
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
selected: FluTheme.dark
|
||||||
|
clickFunc:function(){
|
||||||
|
if(FluTheme.dark){
|
||||||
|
FluTheme.darkMode = FluDarkMode.Light
|
||||||
|
}else{
|
||||||
|
FluTheme.darkMode = FluDarkMode.Dark
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
ItemsOriginal.navigationView = nav_view
|
||||||
|
ItemsFooter.navigationView = nav_view
|
||||||
|
nav_view.setCurrentIndex(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,31 +5,23 @@ import FluentUI
|
|||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
|
title:"视频播放器"
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
minimumWidth: 640
|
minimumWidth: 640
|
||||||
minimumHeight: 480
|
minimumHeight: 480
|
||||||
|
|
||||||
title:"视频播放器"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
||||||
player.source = argument.source
|
player.source = argument.source
|
||||||
}
|
}
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"视频播放器"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FluMediaPlayer{
|
FluMediaPlayer{
|
||||||
id:player
|
id:player
|
||||||
anchors{
|
anchors{
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
top: appbar.bottom
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"SingleInstance"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,14 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleInstance
|
launchMode: FluWindow.SingleInstance
|
||||||
|
|
||||||
title:"SingleInstance"
|
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"SingleInstance"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
FluTextBox{
|
FluTextBox{
|
||||||
anchors{
|
anchors{
|
||||||
top:parent.top
|
top:parent.top
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"SingleTask"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,14 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
title:"SingleTask"
|
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"SingleTask"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
|
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"Standard"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,14 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.Standard
|
launchMode: FluWindow.Standard
|
||||||
|
|
||||||
title:"Standard"
|
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"Standard"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text:"我是一个Standard模式的窗口,每次我都会创建一个新的窗口"
|
text:"我是一个Standard模式的窗口,每次我都会创建一个新的窗口"
|
Binary file not shown.
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 52 KiB |
Binary file not shown.
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 68 KiB |
@ -1,12 +1,17 @@
|
|||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
#include "lang/En.h"
|
#include "lang/En.h"
|
||||||
#include "lang/Zh.h"
|
#include "lang/Zh.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#define STR(x) #x
|
||||||
|
#define VER_JOIN(a,b,c,d) STR(a.b.c.d)
|
||||||
|
#define VER_JOIN_(x) VER_JOIN x
|
||||||
|
#define VER_STR VER_JOIN_((VERSION))
|
||||||
|
|
||||||
AppInfo::AppInfo(QObject *parent)
|
AppInfo::AppInfo(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
version("1.2.5");
|
version(VER_STR);
|
||||||
lang(new En());
|
lang(new En());
|
||||||
}
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ class AppInfo : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AppInfo(QObject *parent = nullptr);
|
explicit AppInfo(QObject *parent = nullptr);
|
||||||
Q_INVOKABLE void changeLang(const QString& locale);
|
Q_INVOKABLE void changeLang(const QString& locale);
|
||||||
|
Q_SIGNAL void activeWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPINFO_H
|
#endif // APPINFO_H
|
@ -13,6 +13,7 @@ En::En(QObject *parent)
|
|||||||
theming("Theming");
|
theming("Theming");
|
||||||
media("Media");
|
media("Media");
|
||||||
dark_mode("Dark Mode");
|
dark_mode("Dark Mode");
|
||||||
|
sys_dark_mode("Sync with system");
|
||||||
search("Search");
|
search("Search");
|
||||||
about("About");
|
about("About");
|
||||||
settings("Settings");
|
settings("Settings");
|
@ -2,7 +2,7 @@
|
|||||||
#define LANG_H
|
#define LANG_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "stdafx.h"
|
#include "../stdafx.h"
|
||||||
|
|
||||||
class Lang : public QObject
|
class Lang : public QObject
|
||||||
{
|
{
|
||||||
@ -16,6 +16,7 @@ class Lang : public QObject
|
|||||||
Q_PROPERTY_AUTO(QString,theming);
|
Q_PROPERTY_AUTO(QString,theming);
|
||||||
Q_PROPERTY_AUTO(QString,media);
|
Q_PROPERTY_AUTO(QString,media);
|
||||||
Q_PROPERTY_AUTO(QString,dark_mode);
|
Q_PROPERTY_AUTO(QString,dark_mode);
|
||||||
|
Q_PROPERTY_AUTO(QString,sys_dark_mode);
|
||||||
Q_PROPERTY_AUTO(QString,search);
|
Q_PROPERTY_AUTO(QString,search);
|
||||||
Q_PROPERTY_AUTO(QString,about);
|
Q_PROPERTY_AUTO(QString,about);
|
||||||
Q_PROPERTY_AUTO(QString,settings);
|
Q_PROPERTY_AUTO(QString,settings);
|
@ -13,6 +13,7 @@ Zh::Zh(QObject *parent)
|
|||||||
theming("主题");
|
theming("主题");
|
||||||
media("媒体");
|
media("媒体");
|
||||||
dark_mode("夜间模式");
|
dark_mode("夜间模式");
|
||||||
|
sys_dark_mode("跟随系统");
|
||||||
search("查找");
|
search("查找");
|
||||||
about("关于");
|
about("关于");
|
||||||
settings("设置");
|
settings("设置");
|
56
example/src/main.cpp
Normal file
56
example/src/main.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
#include <QQmlContext>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QQuickWindow>
|
||||||
|
#include <QProcess>
|
||||||
|
#include "lang/Lang.h"
|
||||||
|
#include "AppInfo.h"
|
||||||
|
#include "tool/IPC.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
//将样式设置为Basic,不然会导致组件显示异常
|
||||||
|
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||||
|
//6.4及以下监听系统深色模式变化
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
||||||
|
#endif
|
||||||
|
QGuiApplication::setOrganizationName("ZhuZiChu");
|
||||||
|
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||||
|
QGuiApplication::setApplicationName("FluentUI");
|
||||||
|
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
||||||
|
QGuiApplication app(argc, argv);
|
||||||
|
AppInfo* appInfo = new AppInfo();
|
||||||
|
IPC ipc(0);
|
||||||
|
QString activeWindowEvent = "activeWindow";
|
||||||
|
if(!ipc.isCurrentOwner()){
|
||||||
|
ipc.postEvent(activeWindowEvent,QString().toUtf8(),0);
|
||||||
|
delete appInfo;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(ipc.isAttached()){
|
||||||
|
ipc.registerEventHandler(activeWindowEvent,[&appInfo](const QByteArray&){
|
||||||
|
Q_EMIT appInfo->activeWindow();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
QQmlApplicationEngine engine;
|
||||||
|
QQmlContext * context = engine.rootContext();
|
||||||
|
Lang* lang = appInfo->lang();
|
||||||
|
context->setContextProperty("lang",lang);
|
||||||
|
QObject::connect(appInfo,&AppInfo::langChanged,&app,[context,appInfo]{
|
||||||
|
context->setContextProperty("lang",appInfo->lang());
|
||||||
|
});
|
||||||
|
context->setContextProperty("appInfo",appInfo);
|
||||||
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
|
// const QUrl url(QStringLiteral("qrc:/example/qml/TestWindow.qml"));
|
||||||
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||||
|
if (!obj && url == objUrl)
|
||||||
|
QCoreApplication::exit(-1);
|
||||||
|
}, Qt::QueuedConnection);
|
||||||
|
engine.load(url);
|
||||||
|
return app.exec();
|
||||||
|
}
|
250
example/src/tool/IPC.cpp
Normal file
250
example/src/tool/IPC.cpp
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
#include "IPC.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QThread>
|
||||||
|
#include <ctime>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
|
||||||
|
IPC::IPC(uint32_t profileId)
|
||||||
|
: profileId{profileId}
|
||||||
|
, globalMemory{"ipc-" IPC_PROTOCOL_VERSION}
|
||||||
|
{
|
||||||
|
qRegisterMetaType<IPCEventHandler>("IPCEventHandler");
|
||||||
|
timer.setInterval(EVENT_TIMER_MS);
|
||||||
|
timer.setSingleShot(true);
|
||||||
|
connect(&timer, &QTimer::timeout, this, &IPC::processEvents);
|
||||||
|
std::default_random_engine randEngine((std::random_device())());
|
||||||
|
std::uniform_int_distribution<uint64_t> distribution;
|
||||||
|
globalId = distribution(randEngine);
|
||||||
|
qDebug() << "Our global IPC ID is " << globalId;
|
||||||
|
if (globalMemory.create(sizeof(IPCMemory))) {
|
||||||
|
if (globalMemory.lock()) {
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
memset(mem, 0, sizeof(IPCMemory));
|
||||||
|
mem->globalId = globalId;
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
globalMemory.unlock();
|
||||||
|
} else {
|
||||||
|
qWarning() << "Couldn't lock to take ownership";
|
||||||
|
}
|
||||||
|
} else if (globalMemory.attach()) {
|
||||||
|
qDebug() << "Attaching to the global shared memory";
|
||||||
|
} else {
|
||||||
|
qDebug() << "Failed to attach to the global shared memory, giving up. Error:"
|
||||||
|
<< globalMemory.error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
processEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::~IPC()
|
||||||
|
{
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
qWarning() << "Failed to lock in ~IPC";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCurrentOwnerNoLock()) {
|
||||||
|
global()->globalId = 0;
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t IPC::postEvent(const QString& name, const QByteArray& data, uint32_t dest)
|
||||||
|
{
|
||||||
|
QByteArray binName = name.toUtf8();
|
||||||
|
if (binName.length() > (int32_t)sizeof(IPCEvent::name)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.length() > (int32_t)sizeof(IPCEvent::data)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
qDebug() << "Failed to lock in postEvent()";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCEvent* evt = nullptr;
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
time_t result = 0;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; !evt && i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
if (mem->events[i].posted == 0) {
|
||||||
|
evt = &mem->events[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt) {
|
||||||
|
memset(evt, 0, sizeof(IPCEvent));
|
||||||
|
memcpy(evt->name, binName.constData(), binName.length());
|
||||||
|
memcpy(evt->data, data.constData(), data.length());
|
||||||
|
mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(nullptr));
|
||||||
|
evt->dest = dest;
|
||||||
|
evt->sender = qApp->applicationPid();
|
||||||
|
qDebug() << "postEvent " << name << "to" << dest;
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isCurrentOwner()
|
||||||
|
{
|
||||||
|
if (globalMemory.lock()) {
|
||||||
|
const bool isOwner = isCurrentOwnerNoLock();
|
||||||
|
globalMemory.unlock();
|
||||||
|
return isOwner;
|
||||||
|
} else {
|
||||||
|
qWarning() << "isCurrentOwner failed to lock, returning false";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::registerEventHandler(const QString& name, IPCEventHandler handler)
|
||||||
|
{
|
||||||
|
eventHandlers[name] = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isEventAccepted(time_t time)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (difftime(global()->lastProcessed, time) > 0) {
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
if (mem->events[i].posted == time && mem->events[i].processed) {
|
||||||
|
result = mem->events[i].accepted;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout /*=-1*/)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
time_t start = time(nullptr);
|
||||||
|
forever
|
||||||
|
{
|
||||||
|
result = isEventAccepted(postTime);
|
||||||
|
if (result || (timeout > 0 && difftime(time(nullptr), start) >= timeout)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
QThread::msleep(0);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isAttached() const
|
||||||
|
{
|
||||||
|
return globalMemory.isAttached();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::setProfileId(uint32_t profileId)
|
||||||
|
{
|
||||||
|
this->profileId = profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::IPCEvent* IPC::fetchEvent()
|
||||||
|
{
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
IPCEvent* evt = &mem->events[i];
|
||||||
|
if ((evt->processed && difftime(time(nullptr), evt->processed) > EVENT_GC_TIMEOUT)
|
||||||
|
|| (!evt->processed && difftime(time(nullptr), evt->posted) > EVENT_GC_TIMEOUT)) {
|
||||||
|
memset(evt, 0, sizeof(IPCEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt->posted && !evt->processed && evt->sender != qApp->applicationPid()
|
||||||
|
&& (evt->dest == profileId || (evt->dest == 0 && isCurrentOwnerNoLock()))) {
|
||||||
|
return evt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::runEventHandler(IPCEventHandler handler, const QByteArray& arg)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if (QThread::currentThread() == qApp->thread()) {
|
||||||
|
result = handler(arg);
|
||||||
|
} else {
|
||||||
|
QMetaObject::invokeMethod(this, "runEventHandler", Qt::BlockingQueuedConnection,
|
||||||
|
Q_RETURN_ARG(bool, result), Q_ARG(IPCEventHandler, handler),
|
||||||
|
Q_ARG(const QByteArray&, arg));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::processEvents()
|
||||||
|
{
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
timer.start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
|
||||||
|
if (mem->globalId == globalId) {
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
} else {
|
||||||
|
if (difftime(time(nullptr), mem->lastProcessed) >= OWNERSHIP_TIMEOUT_S) {
|
||||||
|
qDebug() << "Previous owner timed out, taking ownership" << mem->globalId << "->"
|
||||||
|
<< globalId;
|
||||||
|
memset(mem, 0, sizeof(IPCMemory));
|
||||||
|
mem->globalId = globalId;
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (IPCEvent* evt = fetchEvent()) {
|
||||||
|
QString name = QString::fromUtf8(evt->name);
|
||||||
|
auto it = eventHandlers.find(name);
|
||||||
|
if (it != eventHandlers.end()) {
|
||||||
|
evt->accepted = runEventHandler(it.value(), evt->data);
|
||||||
|
qDebug() << "Processed event:" << name << "posted:" << evt->posted
|
||||||
|
<< "accepted:" << evt->accepted;
|
||||||
|
if (evt->dest == 0) {
|
||||||
|
if (evt->accepted) {
|
||||||
|
evt->processed = time(nullptr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
evt->processed = time(nullptr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "Received event:" << name << "without handler";
|
||||||
|
qDebug() << "Available handlers:" << eventHandlers.keys();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
globalMemory.unlock();
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isCurrentOwnerNoLock()
|
||||||
|
{
|
||||||
|
const void* const data = globalMemory.data();
|
||||||
|
if (!data) {
|
||||||
|
qWarning() << "isCurrentOwnerNoLock failed to access the memory, returning false";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (*static_cast<const uint64_t*>(data) == globalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::IPCMemory* IPC::global()
|
||||||
|
{
|
||||||
|
return static_cast<IPCMemory*>(globalMemory.data());
|
||||||
|
}
|
75
example/src/tool/IPC.h
Normal file
75
example/src/tool/IPC.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#ifndef IPC_H
|
||||||
|
#define IPC_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSharedMemory>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <ctime>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
using IPCEventHandler = std::function<bool(const QByteArray&)>;
|
||||||
|
|
||||||
|
#define IPC_PROTOCOL_VERSION "1"
|
||||||
|
|
||||||
|
class IPC : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static const int EVENT_TIMER_MS = 1000;
|
||||||
|
static const int EVENT_GC_TIMEOUT = 5;
|
||||||
|
static const int EVENT_QUEUE_SIZE = 32;
|
||||||
|
static const int OWNERSHIP_TIMEOUT_S = 5;
|
||||||
|
|
||||||
|
public:
|
||||||
|
IPC(uint32_t profileId);
|
||||||
|
~IPC();
|
||||||
|
|
||||||
|
struct IPCEvent
|
||||||
|
{
|
||||||
|
uint32_t dest;
|
||||||
|
int32_t sender;
|
||||||
|
char name[16];
|
||||||
|
char data[128];
|
||||||
|
time_t posted;
|
||||||
|
time_t processed;
|
||||||
|
uint32_t flags;
|
||||||
|
bool accepted;
|
||||||
|
bool global;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IPCMemory
|
||||||
|
{
|
||||||
|
uint64_t globalId;
|
||||||
|
time_t lastEvent;
|
||||||
|
time_t lastProcessed;
|
||||||
|
IPCEvent events[IPC::EVENT_QUEUE_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
time_t postEvent(const QString& name, const QByteArray& data = QByteArray(), uint32_t dest = 0);
|
||||||
|
bool isCurrentOwner();
|
||||||
|
void registerEventHandler(const QString& name, IPCEventHandler handler);
|
||||||
|
bool isEventAccepted(time_t time);
|
||||||
|
bool waitUntilAccepted(time_t time, int32_t timeout = -1);
|
||||||
|
bool isAttached() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setProfileId(uint32_t profileId);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IPCMemory* global();
|
||||||
|
bool runEventHandler(IPCEventHandler handler, const QByteArray& arg);
|
||||||
|
IPCEvent* fetchEvent();
|
||||||
|
void processEvents();
|
||||||
|
bool isCurrentOwnerNoLock();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTimer timer;
|
||||||
|
uint64_t globalId;
|
||||||
|
uint32_t profileId;
|
||||||
|
QSharedMemory globalMemory;
|
||||||
|
QMap<QString, IPCEventHandler> eventHandlers;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IPC_H
|
@ -17,7 +17,7 @@ function Main() {
|
|||||||
|
|
||||||
New-Item -ItemType Directory $archiveName
|
New-Item -ItemType Directory $archiveName
|
||||||
# 拷贝exe
|
# 拷贝exe
|
||||||
Copy-Item bin\release\* $archiveName\
|
Copy-Item bin\release\* $archiveName\ -Force -Recurse | Out-Null
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
||||||
# 删除不必要的文件
|
# 删除不必要的文件
|
||||||
|
@ -27,7 +27,7 @@ function Main() {
|
|||||||
|
|
||||||
New-Item -ItemType Directory $archiveName
|
New-Item -ItemType Directory $archiveName
|
||||||
# 拷贝exe
|
# 拷贝exe
|
||||||
Copy-Item bin\release\* $archiveName\
|
Copy-Item bin\release\* $archiveName\ -Force -Recurse | Out-Null
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName
|
||||||
# 删除不必要的文件
|
# 删除不必要的文件
|
||||||
|
@ -1,67 +1,75 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(FluentUI)
|
|
||||||
|
|
||||||
|
project(fluentuiplugin LANGUAGES CXX)
|
||||||
|
|
||||||
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
if(APPLE)
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
find_package(Qt6 COMPONENTS Core Quick Svg REQUIRED)
|
|
||||||
set(QT_INSTALL_QML ${Qt6Core_DIR}/../../../qml)
|
|
||||||
set(TARGET_TYPE SHARED)
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(TARGET_RESOURCES res.qrc)
|
#设置QML插件输出目录->D:\Qt\6.4.3\msvc2019_64\qml\FluentUI
|
||||||
set(TARGET_SOURCES
|
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||||
Def.cpp
|
|
||||||
FluApp.cpp
|
#设置版本号
|
||||||
FluColorSet.cpp
|
add_definitions(-DVERSION=1,3,0,0)
|
||||||
FluColors.cpp
|
|
||||||
FluRegister.cpp
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml ShaderTools)
|
||||||
FluTheme.cpp
|
|
||||||
Fluent.cpp
|
#遍历所有Cpp文件
|
||||||
FluentUI.cpp
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
NativeEventFilter.cpp
|
foreach(filepath ${CPP_FILES})
|
||||||
WindowHelper.cpp
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
qml_plugin.cpp
|
list(APPEND sources_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#遍历所有qml文件
|
||||||
|
file(GLOB_RECURSE QML_PATHS *.qml)
|
||||||
|
foreach(filepath ${QML_PATHS})
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND qml_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#遍历所有资源文件
|
||||||
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.qsb *.metainfo)
|
||||||
|
foreach(filepath ${RES_PATHS})
|
||||||
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
|
list(APPEND resource_files ${filename})
|
||||||
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#修改资源文件导出路径
|
||||||
|
foreach(filepath IN LISTS qml_files resource_files)
|
||||||
|
string(REPLACE "imports/FluentUI/" "" filename ${filepath})
|
||||||
|
set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
#添加qml模块
|
||||||
|
qt_add_library(fluentuiplugin SHARED)
|
||||||
|
qt_add_qml_module(fluentuiplugin
|
||||||
|
#没有下面这行代码就会生成fluentuiplugin.dll与fluentuipluginplugin.dll两个动态库
|
||||||
|
PLUGIN_TARGET fluentuiplugin
|
||||||
|
OUTPUT_DIRECTORY ${QML_PLUGIN_DIRECTORY}
|
||||||
|
VERSION 1.0
|
||||||
|
URI "FluentUI"
|
||||||
|
SOURCES ${sources_files} fluentui.rc
|
||||||
|
QML_FILES ${qml_files}
|
||||||
|
RESOURCES ${resource_files}
|
||||||
|
#支持designer
|
||||||
|
DESIGNER_SUPPORTED
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TARGET_HEADERS
|
#链接库
|
||||||
Def.h
|
target_link_libraries(fluentuiplugin PUBLIC
|
||||||
FluApp.h
|
Qt::Core
|
||||||
FluColorSet.h
|
Qt::Quick
|
||||||
FluColors.h
|
Qt::Qml
|
||||||
FluRegister.h
|
|
||||||
FluTheme.h
|
|
||||||
Fluent.h
|
|
||||||
FluentUI.h
|
|
||||||
NativeEventFilter.h
|
|
||||||
WindowHelper.h
|
|
||||||
qml_plugin.h
|
|
||||||
stdafx.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DVERSION_IN="1.0.0")
|
#链接库 win32库 不然mingw会编译错误
|
||||||
add_definitions(-DVURI_STR="FluentUI")
|
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} ${TARGET_TYPE} ${TARGET_SOURCES} ${TARGET_HEADERS} ${TARGET_RESOURCES})
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE dwmapi user32)
|
target_link_libraries(fluentuiplugin PRIVATE dwmapi user32)
|
||||||
else()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
#如果是debug,则生成的库文件名后面拼接d
|
||||||
|
set_target_properties(fluentuiplugin PROPERTIES DEBUG_POSTFIX "d")
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick Qt6::Svg)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
include(build_windows.cmake)
|
|
||||||
else()
|
|
||||||
include(build_macos.cmake)
|
|
||||||
endif()
|
|
||||||
|
15
src/Def.h
15
src/Def.h
@ -2,6 +2,18 @@
|
|||||||
#define DEF_H
|
#define DEF_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
|
||||||
|
namespace Fluent_DarkMode {
|
||||||
|
Q_NAMESPACE
|
||||||
|
enum Fluent_DarkModeType {
|
||||||
|
System = 0x0,
|
||||||
|
Light = 0x1,
|
||||||
|
Dark = 0x2,
|
||||||
|
};
|
||||||
|
Q_ENUM_NS(Fluent_DarkModeType)
|
||||||
|
QML_NAMED_ELEMENT(FluDarkMode)
|
||||||
|
}
|
||||||
|
|
||||||
namespace Fluent_Awesome {
|
namespace Fluent_Awesome {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
@ -1410,7 +1422,8 @@ enum class Fluent_AwesomeType {
|
|||||||
SpeechSolidBold=0xf8b2,
|
SpeechSolidBold=0xf8b2,
|
||||||
ClickedOutLoudSolidBold=0xf8b3,
|
ClickedOutLoudSolidBold=0xf8b3,
|
||||||
};
|
};
|
||||||
Q_ENUMS(Fluent_AwesomeType)
|
Q_ENUM_NS(Fluent_AwesomeType)
|
||||||
|
QML_NAMED_ELEMENT(FluentIcons)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DEF_H
|
#endif // DEF_H
|
||||||
|
@ -6,22 +6,10 @@
|
|||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <QFontDatabase>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include "FluTheme.h"
|
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#include <dwmapi.h>
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
static bool isCompositionEnabled()
|
|
||||||
{
|
|
||||||
BOOL composition_enabled = FALSE;
|
|
||||||
bool success = ::DwmIsCompositionEnabled(&composition_enabled) == S_OK;
|
|
||||||
return composition_enabled && success;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FluApp* FluApp::m_instance = nullptr;
|
FluApp* FluApp::m_instance = nullptr;
|
||||||
|
|
||||||
FluApp *FluApp::getInstance()
|
FluApp *FluApp::getInstance()
|
||||||
@ -35,6 +23,11 @@ FluApp *FluApp::getInstance()
|
|||||||
FluApp::FluApp(QObject *parent)
|
FluApp::FluApp(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
QFontDatabase::addApplicationFont(":/FluentUI/Font/Segoe_Fluent_Icons.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
FluApp::~FluApp(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::init(QQuickWindow *window){
|
void FluApp::init(QQuickWindow *window){
|
||||||
@ -42,11 +35,6 @@ void FluApp::init(QQuickWindow *window){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::run(){
|
void FluApp::run(){
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if(!isCompositionEnabled()){
|
|
||||||
FluTheme::getInstance()->frameless(false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
navigate(initialRoute());
|
navigate(initialRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,31 +51,28 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
|||||||
properties.insert("pageRegister",QVariant::fromValue(fluRegister));
|
properties.insert("pageRegister",QVariant::fromValue(fluRegister));
|
||||||
}
|
}
|
||||||
properties.insert("argument",argument);
|
properties.insert("argument",argument);
|
||||||
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
QQuickWindow *view=nullptr;
|
||||||
|
for (auto& pair : wnds) {
|
||||||
int launchMode = view->property("launchMode").toInt();
|
QString r = pair->property("route").toString();
|
||||||
if(launchMode==1){
|
if(r == route){
|
||||||
for (auto& pair : wnds) {
|
view = pair;
|
||||||
QString r = pair->property("route").toString();
|
break;
|
||||||
if(r == route){
|
|
||||||
pair->requestActivate();
|
|
||||||
view->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if(launchMode==2){
|
|
||||||
for (auto& pair : wnds) {
|
|
||||||
QString r = pair->property("route").toString();
|
|
||||||
if(r == route){
|
|
||||||
pair->close();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(view){
|
||||||
if(FluTheme::getInstance()->frameless()){
|
//如果窗口存在,则判断启动模式
|
||||||
view->setFlag(Qt::FramelessWindowHint,true);
|
int launchMode = view->property("launchMode").toInt();
|
||||||
|
if(launchMode == 1){
|
||||||
|
view->setProperty("argument",argument);
|
||||||
|
view->show();
|
||||||
|
view->raise();
|
||||||
|
view->requestActivate();
|
||||||
|
return;
|
||||||
|
}else if(launchMode == 2){
|
||||||
|
view->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||||
wnds.insert(view->winId(),view);
|
wnds.insert(view->winId(),view);
|
||||||
if(fluRegister){
|
if(fluRegister){
|
||||||
fluRegister->to(view);
|
fluRegister->to(view);
|
||||||
@ -120,14 +105,6 @@ QJsonArray FluApp::awesomelist(const QString& keyword)
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::clipText(const QString& text){
|
|
||||||
QGuiApplication::clipboard()->setText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString FluApp::uuid(){
|
|
||||||
return QUuid::createUuid().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluApp::closeApp(){
|
void FluApp::closeApp(){
|
||||||
qApp->exit(0);
|
qApp->exit(0);
|
||||||
}
|
}
|
||||||
|
65
src/FluApp.h
65
src/FluApp.h
@ -3,43 +3,90 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include "FluTheme.h"
|
||||||
|
#include "FluTools.h"
|
||||||
|
#include "FluColors.h"
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluApp class
|
||||||
|
*/
|
||||||
class FluApp : public QObject
|
class FluApp : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
/**
|
||||||
|
* @brief initialRoute 初始路由
|
||||||
|
*/
|
||||||
Q_PROPERTY_AUTO(QString,initialRoute);
|
Q_PROPERTY_AUTO(QString,initialRoute);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief routes 路由表
|
||||||
|
*/
|
||||||
Q_PROPERTY_AUTO(QJsonObject,routes);
|
Q_PROPERTY_AUTO(QJsonObject,routes);
|
||||||
|
|
||||||
public:
|
QML_NAMED_ELEMENT(FluApp)
|
||||||
|
QML_SINGLETON
|
||||||
static FluApp *getInstance();
|
private:
|
||||||
|
/**
|
||||||
|
* @brief FluApp 将默认构造函数设置为私有,则qml创建单例就会走create工厂方法创建单例
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
explicit FluApp(QObject *parent = nullptr);
|
explicit FluApp(QObject *parent = nullptr);
|
||||||
|
public:
|
||||||
|
~FluApp();
|
||||||
|
static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
|
static FluApp *getInstance();
|
||||||
|
/**
|
||||||
|
* @brief run
|
||||||
|
*/
|
||||||
Q_INVOKABLE void run();
|
Q_INVOKABLE void run();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief navigate
|
||||||
|
* @param route
|
||||||
|
* @param argument
|
||||||
|
* @param fluRegister
|
||||||
|
*/
|
||||||
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief init
|
||||||
|
* @param window
|
||||||
|
*/
|
||||||
Q_INVOKABLE void init(QQuickWindow *window);
|
Q_INVOKABLE void init(QQuickWindow *window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief awesomelist
|
||||||
|
* @param keyword
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
||||||
|
|
||||||
Q_INVOKABLE void clipText(const QString& text);
|
/**
|
||||||
|
* @brief closeApp
|
||||||
Q_INVOKABLE QString uuid();
|
*/
|
||||||
|
|
||||||
Q_INVOKABLE void closeApp();
|
Q_INVOKABLE void closeApp();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief wnds
|
||||||
|
*/
|
||||||
QMap<quint64, QQuickWindow*> wnds;
|
QMap<quint64, QQuickWindow*> wnds;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static FluApp* m_instance;
|
static FluApp* m_instance;
|
||||||
|
/**
|
||||||
|
* @brief appWindow
|
||||||
|
*/
|
||||||
QWindow *appWindow;
|
QWindow *appWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluColorSet class
|
||||||
|
*/
|
||||||
class FluColorSet : public QObject
|
class FluColorSet : public QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY_AUTO(QString,darkest)
|
Q_PROPERTY_AUTO(QString,darkest)
|
||||||
Q_PROPERTY_AUTO(QString,darker)
|
Q_PROPERTY_AUTO(QString,darker)
|
||||||
@ -17,7 +19,6 @@ class FluColorSet : public QObject
|
|||||||
Q_PROPERTY_AUTO(QString,lightest)
|
Q_PROPERTY_AUTO(QString,lightest)
|
||||||
public:
|
public:
|
||||||
explicit FluColorSet(QObject *parent = nullptr);
|
explicit FluColorSet(QObject *parent = nullptr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUCOLORSET_H
|
#endif // FLUCOLORSET_H
|
||||||
|
@ -2,9 +2,13 @@
|
|||||||
#define FLUCOLORS_H
|
#define FLUCOLORS_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
#include "FluColorSet.h"
|
#include "FluColorSet.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluColors class
|
||||||
|
*/
|
||||||
class FluColors : public QObject
|
class FluColors : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -32,7 +36,6 @@ class FluColors : public QObject
|
|||||||
Q_PROPERTY_AUTO(QString,Grey200);
|
Q_PROPERTY_AUTO(QString,Grey200);
|
||||||
Q_PROPERTY_AUTO(QString,Grey210);
|
Q_PROPERTY_AUTO(QString,Grey210);
|
||||||
Q_PROPERTY_AUTO(QString,Grey220);
|
Q_PROPERTY_AUTO(QString,Grey220);
|
||||||
|
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,Yellow);
|
Q_PROPERTY_AUTO(FluColorSet*,Yellow);
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,Orange);
|
Q_PROPERTY_AUTO(FluColorSet*,Orange);
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,Red);
|
Q_PROPERTY_AUTO(FluColorSet*,Red);
|
||||||
@ -41,13 +44,17 @@ class FluColors : public QObject
|
|||||||
Q_PROPERTY_AUTO(FluColorSet*,Blue);
|
Q_PROPERTY_AUTO(FluColorSet*,Blue);
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,Teal);
|
Q_PROPERTY_AUTO(FluColorSet*,Teal);
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
||||||
|
QML_NAMED_ELEMENT(FluColors)
|
||||||
public:
|
QML_SINGLETON
|
||||||
explicit FluColors(QObject *parent = nullptr);
|
|
||||||
static FluColors *getInstance();
|
|
||||||
private:
|
private:
|
||||||
|
explicit FluColors(QObject *parent = nullptr);
|
||||||
static FluColors* m_instance;
|
static FluColors* m_instance;
|
||||||
|
public:
|
||||||
|
static FluColors *getInstance();
|
||||||
|
static FluColors *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUCOLORS_H
|
#endif // FLUCOLORS_H
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluRegister class
|
||||||
|
*/
|
||||||
class FluRegister : public QObject
|
class FluRegister : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -15,8 +18,22 @@ class FluRegister : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit FluRegister(QObject *parent = nullptr);
|
explicit FluRegister(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief launch 窗口跳转
|
||||||
|
* @param argument 跳转携带参数
|
||||||
|
*/
|
||||||
Q_INVOKABLE void launch(const QJsonObject& argument = {});
|
Q_INVOKABLE void launch(const QJsonObject& argument = {});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief onResult 将结果数据回传到上一个窗口
|
||||||
|
* @param data 结果数据
|
||||||
|
*/
|
||||||
Q_INVOKABLE void onResult(const QJsonObject& data = {});
|
Q_INVOKABLE void onResult(const QJsonObject& data = {});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief result 收到结果数据的信号
|
||||||
|
* @param data 结果数据
|
||||||
|
*/
|
||||||
Q_SIGNAL void result(const QJsonObject& data);
|
Q_SIGNAL void result(const QJsonObject& data);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
38
src/FluTextStyle.cpp
Normal file
38
src/FluTextStyle.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "FluTextStyle.h"
|
||||||
|
|
||||||
|
FluTextStyle::FluTextStyle(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
QFont caption;
|
||||||
|
caption.setPixelSize(12);
|
||||||
|
Caption(caption);
|
||||||
|
|
||||||
|
QFont body;
|
||||||
|
body.setPixelSize(14);
|
||||||
|
Body(body);
|
||||||
|
|
||||||
|
QFont bodyStrong;
|
||||||
|
bodyStrong.setPixelSize(14);
|
||||||
|
bodyStrong.setBold(true);
|
||||||
|
BodyStrong(bodyStrong);
|
||||||
|
|
||||||
|
QFont subtitle;
|
||||||
|
subtitle.setPixelSize(20);
|
||||||
|
subtitle.setBold(true);
|
||||||
|
Subtitle(subtitle);
|
||||||
|
|
||||||
|
QFont title;
|
||||||
|
title.setPixelSize(28);
|
||||||
|
title.setBold(true);
|
||||||
|
Title(title);
|
||||||
|
|
||||||
|
QFont titleLarge;
|
||||||
|
titleLarge.setPixelSize(40);
|
||||||
|
titleLarge.setBold(true);
|
||||||
|
TitleLarge(titleLarge);
|
||||||
|
|
||||||
|
QFont display;
|
||||||
|
display.setPixelSize(68);
|
||||||
|
display.setBold(true);
|
||||||
|
Display(display);
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user