mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-07 12:07:40 +08:00
Compare commits
42 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 |
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
@ -50,7 +50,7 @@ jobs:
|
|||||||
cmake --version
|
cmake --version
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
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
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: package
|
- name: package
|
||||||
|
2
.github/workflows/ubuntu.yml
vendored
2
.github/workflows/ubuntu.yml
vendored
@ -55,7 +55,7 @@ jobs:
|
|||||||
cmake --version
|
cmake --version
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
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
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: install QT linux deploy
|
- name: install QT linux deploy
|
||||||
|
2
.github/workflows/windows-mingw.yml
vendored
2
.github/workflows/windows-mingw.yml
vendored
@ -62,7 +62,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
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
|
cmake --build . --target all --config Release --parallel
|
||||||
|
|
||||||
- name: package
|
- name: package
|
||||||
|
2
.github/workflows/windows.yml
vendored
2
.github/workflows/windows.yml
vendored
@ -51,7 +51,7 @@ jobs:
|
|||||||
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 }}
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release -GNinja ..
|
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
|
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%
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -34,4 +34,6 @@ CMakeLists.txt.user*
|
|||||||
src/build-preset/plugins.qmltypes
|
src/build-preset/plugins.qmltypes
|
||||||
bin
|
bin
|
||||||
.DS_Store
|
.DS_Store
|
||||||
build
|
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)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|
||||||
这是一个漂亮的Fluent组件库,使用QML插件开发的。main分支是Qt6.4.3,如果需要qt5的请切换至qt5分支,<a href="https://github.com/zhuzichu520/FluentUI/wiki/%E6%96%B0%E6%89%8B%E5%85%A5%E9%97%A8" target="_blank">如何使用?</a>
|
这是一个漂亮的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]|
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
project(example VERSION 0.1 LANGUAGES CXX)
|
project(example VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
if(APPLE)
|
||||||
#获取文件路径分隔符(解决执行命令的时候有些平台会报错)
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
endif()
|
||||||
|
|
||||||
#设置可执行文件输出目录
|
#设置可执行文件输出目录
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
@ -15,6 +16,12 @@ else()
|
|||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#获取文件路径分隔符(解决执行命令的时候有些平台会报错)
|
||||||
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
|
#设置版本号
|
||||||
|
add_definitions(-DVERSION=1,3,0,0)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
|
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
|
||||||
|
|
||||||
#遍历所有Cpp文件
|
#遍历所有Cpp文件
|
||||||
@ -32,20 +39,27 @@ foreach(filepath ${QML_PATHS})
|
|||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
#遍历所有资源文件
|
#遍历所有资源文件
|
||||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp qmldir)
|
||||||
foreach(filepath ${RES_PATHS})
|
foreach(filepath ${RES_PATHS})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
list(APPEND resource_files ${filename})
|
list(APPEND resource_files ${filename})
|
||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
#添加可执行文件
|
#添加可执行文件
|
||||||
qt_add_executable(example
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
${sources_files}
|
qt_add_executable(example
|
||||||
)
|
${sources_files}
|
||||||
|
example.rc
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
qt_add_executable(example
|
||||||
|
${sources_files}
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
#复制动态库到可执行文件同级目录下
|
#复制动态库到可执行文件同级目录下
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/msvc/*.dll)
|
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/msvc/*.dll)
|
||||||
else()
|
else()
|
||||||
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
|
set(DLLPATH ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
|
||||||
@ -63,7 +77,7 @@ endif()
|
|||||||
qt_add_qml_module(example
|
qt_add_qml_module(example
|
||||||
URI example
|
URI example
|
||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
QML_FILES ${qml_files} qml/global/qmldir
|
QML_FILES ${qml_files}
|
||||||
RESOURCES ${resource_files}
|
RESOURCES ${resource_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -77,8 +91,9 @@ set_target_properties(example PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
#链接库
|
#链接库
|
||||||
target_link_libraries(example
|
target_link_libraries(example PRIVATE
|
||||||
PRIVATE Qt6::Quick
|
Qt6::Quick
|
||||||
|
fluentuiplugin
|
||||||
)
|
)
|
||||||
|
|
||||||
#安装
|
#安装
|
||||||
|
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
|
BIN
example/favicon.ico
Normal file
BIN
example/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 116 KiB |
@ -8,13 +8,11 @@ Window {
|
|||||||
id:app
|
id:app
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluApp.init(app)
|
FluApp.init(app)
|
||||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
|
||||||
FluTheme.darkMode = FluDarkMode.System
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
FluApp.routes = {
|
FluApp.routes = {
|
||||||
"/":"qrc:/example/qml/window/MainWindow.qml",
|
"/":"qrc:/example/qml/window/MainWindow.qml",
|
||||||
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
"/chat":"qrc:/example/qml/window/ChatWindow.qml",
|
|
||||||
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
||||||
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
|
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("复制成功")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +120,9 @@ FluExpander{
|
|||||||
"FluStatusView",
|
"FluStatusView",
|
||||||
"FluRatingControl",
|
"FluRatingControl",
|
||||||
"FluPasswordBox",
|
"FluPasswordBox",
|
||||||
"FluBreadcrumbBar"
|
"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,6 +18,7 @@ FluObject{
|
|||||||
FluApp.navigate("/about")
|
FluApp.navigate("/about")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:lang.settings
|
title:lang.settings
|
||||||
icon:FluentIcons.Settings
|
icon:FluentIcons.Settings
|
||||||
@ -23,4 +26,5 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_Settings.qml")
|
navigationView.push("qrc:/example/qml/page/T_Settings.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,14 @@ 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:/example/res/svg/home_dark.svg" : "qrc:/example/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:/example/qml/page/T_Home.qml")
|
navigationView.push("qrc:/example/qml/page/T_Home.qml")
|
||||||
}
|
}
|
||||||
@ -34,6 +34,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/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:/example/res/image/control/Slider.png"
|
image:"qrc:/example/res/image/control/Slider.png"
|
||||||
@ -240,6 +246,12 @@ 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:{
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,6 @@ 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
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"BreadcurmbBar"
|
title:"BreadcurmbBar"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var items = []
|
var items = []
|
||||||
|
@ -7,12 +7,8 @@ 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
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"CalendarPicker"
|
title:"CalendarPicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"CheckBox"
|
title:"CheckBox"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"ColorPicker"
|
title:"ColorPicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Dialog"
|
title:"Dialog"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"FlipView"
|
title:"FlipView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -7,11 +7,6 @@ import FluentUI
|
|||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:0
|
|
||||||
bottomPadding:20
|
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:model_header
|
id:model_header
|
||||||
ListElement{
|
ListElement{
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"InfoBar"
|
title:"InfoBar"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"MediaPlayer"
|
title:"MediaPlayer"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if(visible){
|
if(visible){
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -11,10 +11,6 @@ FluScrollablePage{
|
|||||||
property var loginPageRegister: registerForWindowResult("/login")
|
property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: loginPageRegister
|
target: loginPageRegister
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Pivot"
|
title:"Pivot"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"RatingControl"
|
title:"RatingControl"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ 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{
|
||||||
|
@ -9,10 +9,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Settings"
|
title:"Settings"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -28,7 +24,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.dark_mode
|
text:lang.dark_mode
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
Repeater{
|
Repeater{
|
||||||
@ -62,7 +58,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.navigation_view_display_mode
|
text:lang.navigation_view_display_mode
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
Repeater{
|
Repeater{
|
||||||
@ -93,7 +89,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.locale
|
text:lang.locale
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,10 +8,6 @@ import FluentUI
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
id:layout_actions
|
id:layout_actions
|
||||||
|
@ -7,14 +7,10 @@ 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{
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TableView"
|
title:"TableView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const columns = [
|
const columns = [
|
||||||
@ -71,7 +67,6 @@ FluScrollablePage{
|
|||||||
leftPadding:6
|
leftPadding:6
|
||||||
rightPadding:6
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
console.debug(dataModel.index)
|
|
||||||
showSuccess(JSON.stringify(dataObject))
|
showSuccess(JSON.stringify(dataObject))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TextBox"
|
title:"TextBox"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage {
|
FluScrollablePage {
|
||||||
|
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
function randomName() {
|
function randomName() {
|
||||||
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,15 +15,9 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
@ -34,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,6 +113,7 @@ FluWindow {
|
|||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 15
|
Layout.leftMargin: 15
|
||||||
FluText{
|
FluText{
|
||||||
text:"捐赠:"
|
text:"捐赠:"
|
||||||
@ -124,15 +125,15 @@ 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:/example/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:/example/res/image/qrcode_zfb.jpg"
|
source: "qrc:/example/res/image/qrcode_zfb.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,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,只要时间充足我就会解决的!!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,261 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Controls
|
|
||||||
import FluentUI
|
|
||||||
import Controller
|
|
||||||
import QtQuick.Dialogs
|
|
||||||
|
|
||||||
FluWindow {
|
|
||||||
|
|
||||||
title:"ChatGPT"
|
|
||||||
width: 680
|
|
||||||
height: 600
|
|
||||||
minimumWidth: 500
|
|
||||||
minimumHeight: 600
|
|
||||||
|
|
||||||
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:/example/res/svg/avatar_2.svg" : "qrc:/example/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()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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
|
||||||
|
@ -4,7 +4,6 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import example
|
|
||||||
import "qrc:///example/qml/global/"
|
import "qrc:///example/qml/global/"
|
||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
@ -16,6 +15,7 @@ FluWindow {
|
|||||||
closeDestory:false
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 460
|
||||||
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
closeFunc:function(event){
|
closeFunc:function(event){
|
||||||
close_app.open()
|
close_app.open()
|
||||||
@ -31,14 +31,6 @@ FluWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
z:9
|
|
||||||
showDark: true
|
|
||||||
width:parent.width
|
|
||||||
darkText: lang.dark_mode
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemTrayIcon {
|
SystemTrayIcon {
|
||||||
id:system_tray
|
id:system_tray
|
||||||
visible: true
|
visible: true
|
||||||
@ -48,7 +40,7 @@ FluWindow {
|
|||||||
MenuItem {
|
MenuItem {
|
||||||
text: "退出"
|
text: "退出"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
window.destoryWindow()
|
window.deleteWindow()
|
||||||
FluApp.closeApp()
|
FluApp.closeApp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +68,7 @@ FluWindow {
|
|||||||
positiveText:"退出"
|
positiveText:"退出"
|
||||||
neutralText:"取消"
|
neutralText:"取消"
|
||||||
onPositiveClicked:{
|
onPositiveClicked:{
|
||||||
window.destoryWindow()
|
window.deleteWindow()
|
||||||
FluApp.closeApp()
|
FluApp.closeApp()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +94,27 @@ FluWindow {
|
|||||||
ItemsOriginal.startPageByItem(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: {
|
Component.onCompleted: {
|
||||||
ItemsOriginal.navigationView = nav_view
|
ItemsOriginal.navigationView = nav_view
|
||||||
ItemsFooter.navigationView = nav_view
|
ItemsFooter.navigationView = nav_view
|
||||||
|
@ -16,18 +16,12 @@ FluWindow {
|
|||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleInstance
|
launchMode: FluWindow.SingleInstance
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"SingleInstance"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
FluTextBox{
|
FluTextBox{
|
||||||
anchors{
|
anchors{
|
||||||
top:parent.top
|
top:parent.top
|
||||||
|
@ -15,12 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"SingleTask"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
|
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
|
||||||
|
@ -15,12 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.Standard
|
launchMode: FluWindow.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,11 +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.8");
|
version(VER_STR);
|
||||||
lang(new En());
|
lang(new En());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
|
@ -6,11 +6,7 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include "lang/Lang.h"
|
#include "lang/Lang.h"
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
#include "controller/ChatController.h"
|
|
||||||
#include "tool/IPC.h"
|
#include "tool/IPC.h"
|
||||||
#if defined(STATICLIB)
|
|
||||||
#include <FluentUI.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -41,10 +37,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
#if defined(STATICLIB)
|
|
||||||
FluentUI::initialize(&engine);
|
|
||||||
#endif
|
|
||||||
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
|
||||||
QQmlContext * context = engine.rootContext();
|
QQmlContext * context = engine.rootContext();
|
||||||
Lang* lang = appInfo->lang();
|
Lang* lang = appInfo->lang();
|
||||||
context->setContextProperty("lang",lang);
|
context->setContextProperty("lang",lang);
|
||||||
@ -53,6 +45,7 @@ int main(int argc, char *argv[])
|
|||||||
});
|
});
|
||||||
context->setContextProperty("appInfo",appInfo);
|
context->setContextProperty("appInfo",appInfo);
|
||||||
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
|
// const QUrl url(QStringLiteral("qrc:/example/qml/TestWindow.qml"));
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||||
if (!obj && url == objUrl)
|
if (!obj && url == objUrl)
|
||||||
|
@ -1,59 +1,75 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(fluentui LANGUAGES CXX)
|
|
||||||
|
|
||||||
|
project(fluentuiplugin LANGUAGES CXX)
|
||||||
|
|
||||||
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(APPLE)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
else()
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
#设置QML插件输出目录->D:\Qt\6.4.3\msvc2019_64\qml\FluentUI
|
||||||
|
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||||
|
|
||||||
|
#设置版本号
|
||||||
|
add_definitions(-DVERSION=1,3,0,0)
|
||||||
|
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml ShaderTools)
|
||||||
|
|
||||||
|
#遍历所有Cpp文件
|
||||||
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
foreach(filepath ${CPP_FILES})
|
foreach(filepath ${CPP_FILES})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
list(APPEND sources_files ${filename})
|
list(APPEND sources_files ${filename})
|
||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#遍历所有qml文件
|
||||||
file(GLOB_RECURSE QML_PATHS *.qml)
|
file(GLOB_RECURSE QML_PATHS *.qml)
|
||||||
foreach(filepath ${QML_PATHS})
|
foreach(filepath ${QML_PATHS})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
list(APPEND qml_files ${filename})
|
list(APPEND qml_files ${filename})
|
||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
#遍历所有资源文件
|
||||||
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.qsb *.metainfo)
|
||||||
foreach(filepath ${RES_PATHS})
|
foreach(filepath ${RES_PATHS})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
list(APPEND resource_files ${filename})
|
list(APPEND resource_files ${filename})
|
||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
|
#修改资源文件导出路径
|
||||||
foreach(filepath IN LISTS qml_files resource_files)
|
foreach(filepath IN LISTS qml_files resource_files)
|
||||||
string(REPLACE "imports/FluentUI/" "" filename ${filepath})
|
string(REPLACE "imports/FluentUI/" "" filename ${filepath})
|
||||||
set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
|
set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
qt_add_qml_module(fluentui
|
#添加qml模块
|
||||||
OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/FluentUI
|
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
|
VERSION 1.0
|
||||||
URI "FluentUI"
|
URI "FluentUI"
|
||||||
SOURCES ${sources_files}
|
SOURCES ${sources_files} fluentui.rc
|
||||||
QML_FILES ${qml_files}
|
QML_FILES ${qml_files}
|
||||||
RESOURCES ${resource_files}
|
RESOURCES ${resource_files}
|
||||||
|
#支持designer
|
||||||
|
DESIGNER_SUPPORTED
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(fluentui PROPERTIES
|
#链接库
|
||||||
WIN32_EXECUTABLE TRUE
|
target_link_libraries(fluentuiplugin PUBLIC
|
||||||
MACOSX_BUNDLE TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(fluentui PUBLIC
|
|
||||||
Qt::Core
|
Qt::Core
|
||||||
Qt::Quick
|
Qt::Quick
|
||||||
Qt::Qml
|
Qt::Qml
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#链接库 win32库 不然mingw会编译错误
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(fluentui PRIVATE dwmapi user32)
|
target_link_libraries(fluentuiplugin PRIVATE dwmapi user32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#如果是debug,则生成的库文件名后面拼接d
|
||||||
|
set_target_properties(fluentuiplugin PROPERTIES DEBUG_POSTFIX "d")
|
||||||
|
18
src/Def.h
18
src/Def.h
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
namespace Fluent_DarkMode {
|
namespace Fluent_DarkMode {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
enum Fluent_DarkModeType {
|
enum Fluent_DarkModeType {
|
||||||
System = 0x0,
|
System = 0x0,
|
||||||
Light = 0x1,
|
Light = 0x1,
|
||||||
Dark = 0x2,
|
Dark = 0x2,
|
||||||
};
|
};
|
||||||
QML_NAMED_ELEMENT(FluDarkMode)
|
Q_ENUM_NS(Fluent_DarkModeType)
|
||||||
Q_ENUMS(Fluent_DarkModeType);
|
QML_NAMED_ELEMENT(FluDarkMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Fluent_Awesome {
|
namespace Fluent_Awesome {
|
||||||
@ -1422,8 +1422,8 @@ enum class Fluent_AwesomeType {
|
|||||||
SpeechSolidBold=0xf8b2,
|
SpeechSolidBold=0xf8b2,
|
||||||
ClickedOutLoudSolidBold=0xf8b3,
|
ClickedOutLoudSolidBold=0xf8b3,
|
||||||
};
|
};
|
||||||
QML_NAMED_ELEMENT(FluentIcons)
|
Q_ENUM_NS(Fluent_AwesomeType)
|
||||||
Q_ENUMS(Fluent_AwesomeType)
|
QML_NAMED_ELEMENT(FluentIcons)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DEF_H
|
#endif // DEF_H
|
||||||
|
@ -8,35 +8,16 @@
|
|||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include "FluTheme.h"
|
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
FluApp* FluApp::m_instance = nullptr;
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
|
||||||
#pragma comment(lib, "User32.lib")
|
FluApp *FluApp::getInstance()
|
||||||
#include <dwmapi.h>
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
static bool isCompositionEnabled()
|
|
||||||
{
|
{
|
||||||
BOOL composition_enabled = FALSE;
|
if(FluApp::m_instance == nullptr){
|
||||||
bool success = ::DwmIsCompositionEnabled(&composition_enabled) == S_OK;
|
FluApp::m_instance = new FluApp;
|
||||||
return composition_enabled && success;
|
}
|
||||||
}
|
return FluApp::m_instance;
|
||||||
#endif
|
|
||||||
|
|
||||||
FluApp* FluApp::fluApp = nullptr;
|
|
||||||
FluTheme* FluApp::fluTheme = nullptr;
|
|
||||||
FluColors* FluApp::flutColors = nullptr;
|
|
||||||
|
|
||||||
void FluApp::setFluApp(FluApp* val){
|
|
||||||
FluApp::fluApp = val;
|
|
||||||
}
|
|
||||||
void FluApp::setFluTheme(FluTheme* val){
|
|
||||||
FluApp::fluTheme = val;
|
|
||||||
}
|
|
||||||
void FluApp::setFluColors(FluColors* val){
|
|
||||||
FluApp::flutColors = val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FluApp::FluApp(QObject *parent)
|
FluApp::FluApp(QObject *parent)
|
||||||
@ -45,21 +26,15 @@ FluApp::FluApp(QObject *parent)
|
|||||||
QFontDatabase::addApplicationFont(":/FluentUI/Font/Segoe_Fluent_Icons.ttf");
|
QFontDatabase::addApplicationFont(":/FluentUI/Font/Segoe_Fluent_Icons.ttf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluApp::~FluApp(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void FluApp::init(QQuickWindow *window){
|
void FluApp::init(QQuickWindow *window){
|
||||||
this->appWindow = window;
|
this->appWindow = window;
|
||||||
QQmlEngine *engine = qmlEngine(appWindow);
|
|
||||||
QQmlComponent component(engine, ":/FluentUI/Controls/FluSingleton.qml");
|
|
||||||
component.create();
|
|
||||||
nativeEvent = new NativeEventFilter();
|
|
||||||
qApp->installNativeEventFilter(nativeEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::run(){
|
void FluApp::run(){
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if(!isCompositionEnabled()){
|
|
||||||
fluTheme->frameless(false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
navigate(initialRoute());
|
navigate(initialRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,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;
|
||||||
int launchMode = view->property("launchMode").toInt();
|
for (auto& pair : wnds) {
|
||||||
if(launchMode==1){
|
QString r = pair->property("route").toString();
|
||||||
for (auto& pair : wnds) {
|
if(r == route){
|
||||||
QString r = pair->property("route").toString();
|
view = pair;
|
||||||
if(r == route){
|
break;
|
||||||
pair->setProperty("argument",argument);
|
|
||||||
pair->raise();
|
|
||||||
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(fluTheme->frameless()){
|
if(view){
|
||||||
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);
|
||||||
@ -133,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);
|
||||||
}
|
}
|
||||||
|
73
src/FluApp.h
73
src/FluApp.h
@ -9,45 +9,84 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
|
#include "FluTools.h"
|
||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
#include "NativeEventFilter.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);
|
||||||
|
|
||||||
QML_NAMED_ELEMENT(FluApp)
|
QML_NAMED_ELEMENT(FluApp)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
public:
|
private:
|
||||||
static FluApp *getInstance();
|
/**
|
||||||
|
* @brief FluApp 将默认构造函数设置为私有,则qml创建单例就会走create工厂方法创建单例
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
explicit FluApp(QObject *parent = nullptr);
|
explicit FluApp(QObject *parent = nullptr);
|
||||||
~FluApp(){
|
public:
|
||||||
if (nativeEvent != Q_NULLPTR) {
|
~FluApp();
|
||||||
delete nativeEvent;
|
static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
nativeEvent = Q_NULLPTR;
|
{
|
||||||
}
|
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);
|
|
||||||
Q_INVOKABLE QString uuid();
|
/**
|
||||||
|
* @brief closeApp
|
||||||
|
*/
|
||||||
Q_INVOKABLE void closeApp();
|
Q_INVOKABLE void closeApp();
|
||||||
Q_INVOKABLE void setFluApp(FluApp* val);
|
|
||||||
Q_INVOKABLE void setFluTheme(FluTheme* val);
|
|
||||||
Q_INVOKABLE void setFluColors(FluColors* val);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief wnds
|
||||||
|
*/
|
||||||
QMap<quint64, QQuickWindow*> wnds;
|
QMap<quint64, QQuickWindow*> wnds;
|
||||||
static FluApp* fluApp;
|
|
||||||
static FluTheme* fluTheme;
|
|
||||||
static FluColors* flutColors;
|
|
||||||
private:
|
private:
|
||||||
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
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
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
|
|
||||||
|
FluColors* FluColors::m_instance = nullptr;
|
||||||
|
|
||||||
|
FluColors *FluColors::getInstance()
|
||||||
|
{
|
||||||
|
if(FluColors::m_instance == nullptr){
|
||||||
|
FluColors::m_instance = new FluColors;
|
||||||
|
}
|
||||||
|
return FluColors::m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
FluColors::FluColors(QObject *parent)
|
FluColors::FluColors(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#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
|
||||||
@ -33,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);
|
||||||
@ -44,8 +46,15 @@ class FluColors : public QObject
|
|||||||
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
||||||
QML_NAMED_ELEMENT(FluColors)
|
QML_NAMED_ELEMENT(FluColors)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
public:
|
private:
|
||||||
explicit FluColors(QObject *parent = nullptr);
|
explicit FluColors(QObject *parent = nullptr);
|
||||||
|
static FluColors* m_instance;
|
||||||
|
public:
|
||||||
|
static FluColors *getInstance();
|
||||||
|
static FluColors *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUCOLORS_H
|
#endif // FLUCOLORS_H
|
||||||
|
@ -12,7 +12,7 @@ FluRegister::FluRegister(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FluRegister::launch(const QJsonObject& argument){
|
void FluRegister::launch(const QJsonObject& argument){
|
||||||
FluApp::fluApp->navigate(path(),argument,this);
|
FluApp::getInstance()->navigate(path(),argument,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluRegister::onResult(const QJsonObject& data){
|
void FluRegister::onResult(const QJsonObject& data){
|
||||||
|
@ -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);
|
||||||
|
}
|
27
src/FluTextStyle.h
Normal file
27
src/FluTextStyle.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef FLUTEXTSTYLE_H
|
||||||
|
#define FLUTEXTSTYLE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
#include <QFont>
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
class FluTextStyle : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit FluTextStyle(QObject *parent = nullptr);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Caption);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Body);
|
||||||
|
Q_PROPERTY_AUTO(QFont,BodyStrong);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Subtitle);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Title);
|
||||||
|
Q_PROPERTY_AUTO(QFont,TitleLarge);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Display);
|
||||||
|
QML_NAMED_ELEMENT(FluTextStyle)
|
||||||
|
QML_SINGLETON
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FLUTEXTSTYLE_H
|
@ -5,16 +5,24 @@
|
|||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
|
FluTheme* FluTheme::m_instance = nullptr;
|
||||||
|
|
||||||
|
FluTheme *FluTheme::getInstance()
|
||||||
|
{
|
||||||
|
if(FluTheme::m_instance == nullptr){
|
||||||
|
FluTheme::m_instance = new FluTheme;
|
||||||
|
}
|
||||||
|
return FluTheme::m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
FluTheme::FluTheme(QObject *parent)
|
FluTheme::FluTheme(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
||||||
Q_EMIT darkChanged();
|
Q_EMIT darkChanged();
|
||||||
});
|
});
|
||||||
primaryColor(FluApp::flutColors->Blue());
|
primaryColor(FluColors::getInstance()->Blue());
|
||||||
textSize(13);
|
|
||||||
nativeText(false);
|
nativeText(false);
|
||||||
frameless(true);
|
|
||||||
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
@ -6,19 +6,43 @@
|
|||||||
#include "FluColorSet.h"
|
#include "FluColorSet.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluTheme class
|
||||||
|
*/
|
||||||
class FluTheme : public QObject
|
class FluTheme : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
/**
|
||||||
|
* @brief dark 改变窗口夜间样式,只读属性,可以通过darkMode切换
|
||||||
|
*/
|
||||||
Q_PROPERTY(bool dark READ dark NOTIFY darkChanged)
|
Q_PROPERTY(bool dark READ dark NOTIFY darkChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief primaryColor 主题颜色
|
||||||
|
*/
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
||||||
Q_PROPERTY_AUTO(bool,frameless);
|
|
||||||
|
/**
|
||||||
|
* @brief darkMode 夜间模式,支持System=0、Light=1、Dark=2
|
||||||
|
*/
|
||||||
Q_PROPERTY_AUTO(int,darkMode);
|
Q_PROPERTY_AUTO(int,darkMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nativeText 本地渲染文本
|
||||||
|
*/
|
||||||
Q_PROPERTY_AUTO(bool,nativeText);
|
Q_PROPERTY_AUTO(bool,nativeText);
|
||||||
Q_PROPERTY_AUTO(int,textSize);
|
|
||||||
QML_NAMED_ELEMENT(FluTheme)
|
QML_NAMED_ELEMENT(FluTheme)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
public:
|
private:
|
||||||
|
static FluTheme* m_instance;
|
||||||
explicit FluTheme(QObject *parent = nullptr);
|
explicit FluTheme(QObject *parent = nullptr);
|
||||||
|
public:
|
||||||
|
static FluTheme *getInstance();
|
||||||
|
static FluTheme *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
bool dark();
|
bool dark();
|
||||||
Q_SIGNAL void darkChanged();
|
Q_SIGNAL void darkChanged();
|
||||||
private:
|
private:
|
||||||
|
42
src/FluTools.cpp
Normal file
42
src/FluTools.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "FluTools.h"
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
|
FluTools* FluTools::m_instance = nullptr;
|
||||||
|
|
||||||
|
FluTools *FluTools::getInstance()
|
||||||
|
{
|
||||||
|
if(FluTools::m_instance == nullptr){
|
||||||
|
FluTools::m_instance = new FluTools;
|
||||||
|
}
|
||||||
|
return FluTools::m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluTools::FluTools(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluTools::clipText(const QString& text){
|
||||||
|
QGuiApplication::clipboard()->setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FluTools::uuid(){
|
||||||
|
return QUuid::createUuid().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FluTools::readFile(const QString &fileName)
|
||||||
|
{
|
||||||
|
QString content;
|
||||||
|
QFile file(fileName);
|
||||||
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
|
QTextStream stream(&file);
|
||||||
|
content = stream.readAll();
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
47
src/FluTools.h
Normal file
47
src/FluTools.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#ifndef FLUTOOLS_H
|
||||||
|
#define FLUTOOLS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluTools class
|
||||||
|
*/
|
||||||
|
class FluTools : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
QML_NAMED_ELEMENT(FluTools)
|
||||||
|
QML_SINGLETON
|
||||||
|
private:
|
||||||
|
explicit FluTools(QObject *parent = nullptr);
|
||||||
|
static FluTools* m_instance;
|
||||||
|
public:
|
||||||
|
static FluTools *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
|
static FluTools *getInstance();
|
||||||
|
/**
|
||||||
|
* @brief clipText 将字符串添加到剪切板
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void clipText(const QString& text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief uuid 获取uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QString uuid();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief readFile 读取文件内容
|
||||||
|
* @param fileName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QString readFile(const QString &fileName);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FLUTOOLS_H
|
@ -1,81 +0,0 @@
|
|||||||
#include "NativeEventFilter.h"
|
|
||||||
#include "FluTheme.h"
|
|
||||||
#include "FluApp.h"
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
|
||||||
#pragma comment(lib, "User32.lib")
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if (eventType == "windows_generic_MSG" && FluApp::fluTheme->frameless()) {
|
|
||||||
MSG* msg = static_cast<MSG *>(message);
|
|
||||||
if (msg == Q_NULLPTR)
|
|
||||||
return false;
|
|
||||||
if(!FluApp::fluApp->wnds.contains((WId)msg->hwnd)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch(msg->message) {
|
|
||||||
case WM_NCCALCSIZE:{
|
|
||||||
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
|
||||||
if (params.rgrc[0].top != 0)
|
|
||||||
params.rgrc[0].top -= 1;
|
|
||||||
*result = WVR_REDRAW;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case WM_NCHITTEST: {
|
|
||||||
auto view = FluApp::fluApp->wnds[(WId)msg->hwnd];
|
|
||||||
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
|
||||||
const LONG borderWidth = 8;
|
|
||||||
RECT winrect;
|
|
||||||
GetWindowRect(msg->hwnd, &winrect);
|
|
||||||
long x = GET_X_LPARAM(msg->lParam);
|
|
||||||
long y = GET_Y_LPARAM(msg->lParam);
|
|
||||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
|
||||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
|
||||||
*result = HTBOTTOMLEFT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
|
||||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
|
||||||
*result = HTBOTTOMRIGHT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
|
||||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
|
||||||
*result = HTTOPLEFT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
|
||||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
|
||||||
*result = HTTOPRIGHT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x >= winrect.left && x < winrect.left + borderWidth && isResize) {
|
|
||||||
*result = HTLEFT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x < winrect.right && x >= winrect.right - borderWidth && isResize) {
|
|
||||||
*result = HTRIGHT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
|
||||||
*result = HTBOTTOM;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
|
||||||
*result = HTTOP;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
#ifndef NATIVEEVENTFILTER_H
|
|
||||||
#define NATIVEEVENTFILTER_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QAbstractNativeEventFilter>
|
|
||||||
|
|
||||||
class NativeEventFilter : public QAbstractNativeEventFilter
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // NATIVEEVENTFILTER_H
|
|
@ -2,20 +2,6 @@
|
|||||||
|
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
#include "FluTheme.h"
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
|
||||||
#pragma comment(lib, "User32.lib")
|
|
||||||
#include <dwmapi.h>
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
enum class Style : DWORD
|
|
||||||
{
|
|
||||||
windowed = (WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN),
|
|
||||||
aero_borderless = (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN)
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WindowHelper::WindowHelper(QObject *parent)
|
WindowHelper::WindowHelper(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
@ -27,24 +13,6 @@ void WindowHelper::initWindow(QQuickWindow* window){
|
|||||||
this->window = window;
|
this->window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::firstUpdate(){
|
|
||||||
if(isFisrt){
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if(FluApp::fluTheme->frameless()){
|
|
||||||
HWND wnd = (HWND)window->winId();
|
|
||||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
|
||||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
|
||||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
|
||||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
|
||||||
ShowWindow(wnd, SW_SHOW);
|
|
||||||
window->setFlag(Qt::FramelessWindowHint,false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
isFisrt = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
||||||
FluRegister *p = new FluRegister(window);
|
FluRegister *p = new FluRegister(window);
|
||||||
p->from(window);
|
p->from(window);
|
||||||
@ -52,9 +20,9 @@ QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
|||||||
return QVariant::fromValue(p);
|
return QVariant::fromValue(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::destoryWindow(){
|
void WindowHelper::deleteWindow(){
|
||||||
if(this->window){
|
if(this->window){
|
||||||
FluApp::fluApp->wnds.remove(this->window->winId());
|
FluApp::getInstance()->wnds.remove(this->window->winId());
|
||||||
this->window->deleteLater();
|
this->window->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The WindowHelper class
|
||||||
|
*/
|
||||||
class WindowHelper : public QObject
|
class WindowHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -15,14 +18,27 @@ class WindowHelper : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit WindowHelper(QObject *parent = nullptr);
|
explicit WindowHelper(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief initWindow FluWindow中初始化调用
|
||||||
|
* @param window
|
||||||
|
*/
|
||||||
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
||||||
Q_INVOKABLE void destoryWindow();
|
|
||||||
|
/**
|
||||||
|
* @brief deleteWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void deleteWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief createRegister 创建一个FluRegsiter对象,在FluWindow中registerForWindowResult方法调用
|
||||||
|
* @param window
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||||
Q_INVOKABLE void firstUpdate();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQuickWindow* window;
|
QQuickWindow* window;
|
||||||
bool isFisrt=true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WINDOWHELPER_H
|
#endif // WINDOWHELPER_H
|
||||||
|
40
src/fluentui.rc
Normal file
40
src/fluentui.rc
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#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", "FluentUI for QML."
|
||||||
|
VALUE "CompanyName", "zhuzichu"
|
||||||
|
VALUE "FileDescription", "fluentui"
|
||||||
|
VALUE "FileVersion", VER_STR
|
||||||
|
VALUE "InternalName", ""
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2023"
|
||||||
|
VALUE "OriginalFilename", ""
|
||||||
|
VALUE "ProductName", "fluentui"
|
||||||
|
VALUE "ProductVersion", VER_STR
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
32
src/imports/FluentUI/Controls/FluAcrylic.qml
Normal file
32
src/imports/FluentUI/Controls/FluAcrylic.qml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Qt5Compat.GraphicalEffects
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: control
|
||||||
|
|
||||||
|
property alias color: rect.color
|
||||||
|
property alias acrylicOpacity: rect.opacity
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: rect
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "white"
|
||||||
|
opacity: 0.05
|
||||||
|
}
|
||||||
|
|
||||||
|
ShaderEffectSource {
|
||||||
|
id: effect_source
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceItem: control.parent
|
||||||
|
sourceRect: Qt.rect(control.x, control.y, control.width, control.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
GaussianBlur {
|
||||||
|
radius: 20
|
||||||
|
anchors.fill: effect_source
|
||||||
|
source: effect_source
|
||||||
|
samples: 1 + radius * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -31,7 +31,7 @@ Rectangle{
|
|||||||
|
|
||||||
id:root
|
id:root
|
||||||
color: Qt.rgba(0,0,0,0)
|
color: Qt.rgba(0,0,0,0)
|
||||||
visible: FluTheme.frameless
|
visible: false
|
||||||
height: visible ? 30 : 0
|
height: visible ? 30 : 0
|
||||||
opacity: visible
|
opacity: visible
|
||||||
z: 65535
|
z: 65535
|
||||||
@ -55,9 +55,6 @@ Rectangle{
|
|||||||
leftMargin: 10
|
leftMargin: 10
|
||||||
}
|
}
|
||||||
color:root.textColor
|
color:root.textColor
|
||||||
fontStyle: FluText.Title
|
|
||||||
font.pixelSize: 14
|
|
||||||
font.bold: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
|
@ -18,6 +18,7 @@ Button {
|
|||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||||
|
font:FluTextStyle.Body
|
||||||
|
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
||||||
@ -38,6 +39,7 @@ Button {
|
|||||||
text: control.text
|
text: control.text
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
font: control.font
|
||||||
color: {
|
color: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(disabled){
|
||||||
|
@ -65,7 +65,7 @@ Popup {
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
fontStyle: FluText.TitleLarge
|
font: FluTextStyle.TitleLarge
|
||||||
text:title
|
text:title
|
||||||
topPadding: 20
|
topPadding: 20
|
||||||
leftPadding: 20
|
leftPadding: 20
|
||||||
@ -80,7 +80,7 @@ Popup {
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_message
|
id:text_message
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
text:message
|
text:message
|
||||||
topPadding: 14
|
topPadding: 14
|
||||||
|
@ -17,7 +17,7 @@ Item {
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
fontStyle: FluText.TitleLarge
|
font: FluTextStyle.TitleLarge
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: control.topPadding
|
topMargin: control.topPadding
|
||||||
|
38
src/imports/FluentUI/Controls/FluCopyableText.qml
Normal file
38
src/imports/FluentUI/Controls/FluCopyableText.qml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
|
||||||
|
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
||||||
|
|
||||||
|
id:control
|
||||||
|
color: textColor
|
||||||
|
readOnly: true
|
||||||
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
|
padding: 0
|
||||||
|
leftPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
|
topPadding: 0
|
||||||
|
bottomPadding: 0
|
||||||
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
|
TextMetrics {
|
||||||
|
id: text_metrics
|
||||||
|
font:control.font
|
||||||
|
text: control.text
|
||||||
|
}
|
||||||
|
background: Item{
|
||||||
|
implicitWidth: text_metrics.width+10
|
||||||
|
implicitHeight: text_metrics.height
|
||||||
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
|
TapHandler {
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
||||||
|
}
|
||||||
|
FluTextBoxMenu{
|
||||||
|
id:menu
|
||||||
|
inputItem: control
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -19,6 +19,7 @@ Button {
|
|||||||
rightPadding:15
|
rightPadding:15
|
||||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
|
font:FluTextStyle.Body
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
radius: 4
|
radius: 4
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
@ -37,6 +38,7 @@ Button {
|
|||||||
}
|
}
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
text: control.text
|
text: control.text
|
||||||
|
font: control.font
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: {
|
color: {
|
||||||
|
@ -5,8 +5,6 @@ import FluentUI
|
|||||||
|
|
||||||
TextArea{
|
TextArea{
|
||||||
|
|
||||||
property int fontStyle: FluText.Body
|
|
||||||
property int pixelSize : FluTheme.textSize
|
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
||||||
@ -23,6 +21,7 @@ TextArea{
|
|||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
@ -35,46 +34,6 @@ TextArea{
|
|||||||
}
|
}
|
||||||
return placeholderNormalColor
|
return placeholderNormalColor
|
||||||
}
|
}
|
||||||
font.bold: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return true
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return true
|
|
||||||
case FluText.Title:
|
|
||||||
return true
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return true
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return true
|
|
||||||
case FluText.Body:
|
|
||||||
return false
|
|
||||||
case FluText.Caption:
|
|
||||||
return false
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font.pixelSize: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return text.pixelSize * 4.857
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return text.pixelSize * 2.857
|
|
||||||
case FluText.Title:
|
|
||||||
return text.pixelSize * 2
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return text.pixelSize * 1.428
|
|
||||||
case FluText.Body:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.Caption:
|
|
||||||
return text.pixelSize * 0.857
|
|
||||||
default:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
background: FluTextBoxBackground{ inputItem: control }
|
background: FluTextBoxBackground{ inputItem: control }
|
||||||
TapHandler {
|
TapHandler {
|
||||||
|
@ -19,12 +19,8 @@ Item {
|
|||||||
property FluObject items
|
property FluObject items
|
||||||
property FluObject footerItems
|
property FluObject footerItems
|
||||||
property int displayMode: FluNavigationView.Auto
|
property int displayMode: FluNavigationView.Auto
|
||||||
property Component autoSuggestBox
|
property Component autoSuggestBox
|
||||||
property var window : {
|
property Component actionItem
|
||||||
if(Window.window == null)
|
|
||||||
return null
|
|
||||||
return Window.window
|
|
||||||
}
|
|
||||||
|
|
||||||
id:control
|
id:control
|
||||||
|
|
||||||
@ -148,7 +144,7 @@ Item {
|
|||||||
width: layout_list.width
|
width: layout_list.width
|
||||||
FluText{
|
FluText{
|
||||||
text:model.title
|
text:model.title
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
anchors{
|
anchors{
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left:parent.left
|
left:parent.left
|
||||||
@ -471,7 +467,7 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
id:nav_app_bar
|
id:nav_app_bar
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 50
|
height: 40
|
||||||
z:999
|
z:999
|
||||||
RowLayout{
|
RowLayout{
|
||||||
height:parent.height
|
height:parent.height
|
||||||
@ -479,8 +475,8 @@ Item {
|
|||||||
FluIconButton{
|
FluIconButton{
|
||||||
iconSource: FluentIcons.ChromeBack
|
iconSource: FluentIcons.ChromeBack
|
||||||
Layout.leftMargin: 5
|
Layout.leftMargin: 5
|
||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: 30
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: 30
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
disabled: nav_swipe.depth === 1
|
disabled: nav_swipe.depth === 1
|
||||||
iconSize: 13
|
iconSize: 13
|
||||||
@ -503,13 +499,13 @@ Item {
|
|||||||
id:btn_nav
|
id:btn_nav
|
||||||
iconSource: FluentIcons.GlobalNavButton
|
iconSource: FluentIcons.GlobalNavButton
|
||||||
iconSize: 15
|
iconSize: 15
|
||||||
Layout.preferredWidth: d.isMinimal ? 40 : 0
|
Layout.preferredWidth: d.isMinimal ? 30 : 0
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: 30
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
onClicked: {
|
onClicked: {
|
||||||
d.enableNavigationPanel = !d.enableNavigationPanel
|
d.enableNavigationPanel = !d.enableNavigationPanel
|
||||||
}
|
}
|
||||||
visible: Layout.preferredWidth !== 0
|
visible: d.isMinimal
|
||||||
Behavior on Layout.preferredWidth{
|
Behavior on Layout.preferredWidth{
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
@ -529,13 +525,30 @@ Item {
|
|||||||
}
|
}
|
||||||
return 5
|
return 5
|
||||||
}
|
}
|
||||||
|
sourceSize: Qt.size(40,40)
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
text:control.title
|
text:control.title
|
||||||
Layout.leftMargin: 12
|
Layout.leftMargin: 12
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item{
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: parent.height
|
||||||
|
width: {
|
||||||
|
if(loader_action.item){
|
||||||
|
return loader_action.item.width
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Loader{
|
||||||
|
id:loader_action
|
||||||
|
anchors.centerIn: parent
|
||||||
|
sourceComponent: actionItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -581,7 +594,7 @@ Item {
|
|||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: d.isMinimalAndPanel||d.isCompactAndPanel
|
visible: d.isMinimalAndPanel||d.isCompactAndPanel
|
||||||
onClicked: {
|
onClicked: {
|
||||||
d.enableNavigationPanel = false
|
d.enableNavigationPanel = false
|
||||||
}
|
}
|
||||||
@ -620,7 +633,7 @@ Item {
|
|||||||
if(d.isMinimal || d.isCompactAndPanel){
|
if(d.isMinimal || d.isCompactAndPanel){
|
||||||
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||||
}
|
}
|
||||||
if(window && window.active){
|
if(Window.window.active){
|
||||||
return FluTheme.dark ? Qt.rgba(26/255,34/255,41/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
return FluTheme.dark ? Qt.rgba(26/255,34/255,41/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||||
}
|
}
|
||||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||||
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
readonly property int flag : 0
|
readonly property int flag : 0
|
||||||
property string title
|
property string title
|
||||||
property int order : 0
|
property int order : 0
|
||||||
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property var parent
|
property var parent
|
||||||
property int idx
|
property int idx
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluObject {
|
FluObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property string title
|
property string title
|
||||||
property var icon
|
property var icon
|
||||||
property Component cusIcon
|
property Component cusIcon
|
||||||
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property string title
|
property string title
|
||||||
property var parent
|
property var parent
|
||||||
property int idx
|
property int idx
|
||||||
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluApp.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
property var parent
|
property var parent
|
||||||
property int idx
|
property int idx
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import FluentUI
|
|||||||
|
|
||||||
TextField{
|
TextField{
|
||||||
|
|
||||||
property int fontStyle: FluText.Body
|
|
||||||
property int pixelSize : FluTheme.textSize
|
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property int iconSource: 0
|
property int iconSource: 0
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
@ -24,6 +22,7 @@ TextField{
|
|||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
@ -36,46 +35,6 @@ TextField{
|
|||||||
}
|
}
|
||||||
return placeholderNormalColor
|
return placeholderNormalColor
|
||||||
}
|
}
|
||||||
font.bold: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return true
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return true
|
|
||||||
case FluText.Title:
|
|
||||||
return true
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return true
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return true
|
|
||||||
case FluText.Body:
|
|
||||||
return false
|
|
||||||
case FluText.Caption:
|
|
||||||
return false
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font.pixelSize: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return text.pixelSize * 4.857
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return text.pixelSize * 2.857
|
|
||||||
case FluText.Title:
|
|
||||||
return text.pixelSize * 2
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return text.pixelSize * 1.428
|
|
||||||
case FluText.Body:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.Caption:
|
|
||||||
return text.pixelSize * 0.857
|
|
||||||
default:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
rightPadding: icon_end.visible ? 50 : 30
|
rightPadding: icon_end.visible ? 50 : 30
|
||||||
background: FluTextBoxBackground{
|
background: FluTextBoxBackground{
|
||||||
|
@ -57,8 +57,7 @@ Item {
|
|||||||
contentItem: Item{
|
contentItem: Item{
|
||||||
FluText {
|
FluText {
|
||||||
id:item_title
|
id:item_title
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
font.bold: false
|
|
||||||
text: modelData.title
|
text: modelData.title
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: {
|
color: {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user