mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-05 17:55:25 +08:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
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%
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -35,3 +35,5 @@ 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,2,9,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
|
||||||
|
fluentui
|
||||||
)
|
)
|
||||||
|
|
||||||
#安装
|
#安装
|
||||||
|
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 |
@ -36,7 +36,7 @@ FluExpander{
|
|||||||
topMargin: 5
|
topMargin: 5
|
||||||
}
|
}
|
||||||
onClicked:{
|
onClicked:{
|
||||||
FluApp.clipText(content.text)
|
FluTools.clipText(content.text)
|
||||||
showSuccess("复制成功")
|
showSuccess("复制成功")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,12 +83,5 @@ FluContentPage {
|
|||||||
textSize = value/100*6+FluTheme.textSize
|
textSize = value/100*6+FluTheme.textSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
@ -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,59 +1,71 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(fluentui LANGUAGES CXX)
|
project(fluentui 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()
|
||||||
|
|
||||||
|
#设置可执行文件输出目录
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||||
|
else()
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#设置版本号
|
||||||
|
add_definitions(-DVERSION=1,2,9,0)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||||
|
|
||||||
|
#遍历所有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)
|
||||||
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()
|
||||||
|
|
||||||
|
#添加qml模块
|
||||||
qt_add_qml_module(fluentui
|
qt_add_qml_module(fluentui
|
||||||
OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/FluentUI
|
OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI
|
||||||
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}
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(fluentui PROPERTIES
|
#链接库
|
||||||
WIN32_EXECUTABLE TRUE
|
|
||||||
MACOSX_BUNDLE TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(fluentui PUBLIC
|
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(fluentui PRIVATE dwmapi user32)
|
||||||
endif()
|
endif()
|
||||||
|
@ -8,9 +8,7 @@
|
|||||||
#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
|
#ifdef Q_OS_WIN
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
#pragma comment(lib, "User32.lib")
|
#pragma comment(lib, "User32.lib")
|
||||||
@ -26,18 +24,12 @@ static bool isCompositionEnabled()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
FluApp* FluApp::fluApp = nullptr;
|
FluApp* FluApp::fluApp = nullptr;
|
||||||
FluTheme* FluApp::fluTheme = nullptr;
|
|
||||||
FluColors* FluApp::flutColors = nullptr;
|
|
||||||
|
|
||||||
void FluApp::setFluApp(FluApp* val){
|
FluTheme* FluApp::fluTheme = nullptr;
|
||||||
FluApp::fluApp = val;
|
|
||||||
}
|
FluColors* FluApp::fluColors = nullptr;
|
||||||
void FluApp::setFluTheme(FluTheme* val){
|
|
||||||
FluApp::fluTheme = val;
|
FluTools* FluApp::fluTools = nullptr;
|
||||||
}
|
|
||||||
void FluApp::setFluColors(FluColors* val){
|
|
||||||
FluApp::flutColors = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
FluApp::FluApp(QObject *parent)
|
FluApp::FluApp(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
@ -45,6 +37,29 @@ FluApp::FluApp(QObject *parent)
|
|||||||
QFontDatabase::addApplicationFont(":/FluentUI/Font/Segoe_Fluent_Icons.ttf");
|
QFontDatabase::addApplicationFont(":/FluentUI/Font/Segoe_Fluent_Icons.ttf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluApp::~FluApp(){
|
||||||
|
if (nativeEvent != Q_NULLPTR) {
|
||||||
|
delete nativeEvent;
|
||||||
|
nativeEvent = Q_NULLPTR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluApp::setFluApp(FluApp* val){
|
||||||
|
FluApp::fluApp = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluApp::setFluTheme(FluTheme* val){
|
||||||
|
FluApp::fluTheme = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluApp::setFluColors(FluColors* val){
|
||||||
|
FluApp::fluColors = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluApp::setFluTools(FluTools* val){
|
||||||
|
FluApp::fluTools = val;
|
||||||
|
}
|
||||||
|
|
||||||
void FluApp::init(QQuickWindow *window){
|
void FluApp::init(QQuickWindow *window){
|
||||||
this->appWindow = window;
|
this->appWindow = window;
|
||||||
QQmlEngine *engine = qmlEngine(appWindow);
|
QQmlEngine *engine = qmlEngine(appWindow);
|
||||||
@ -133,14 +148,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);
|
||||||
}
|
}
|
||||||
|
120
src/FluApp.h
120
src/FluApp.h
@ -9,45 +9,125 @@
|
|||||||
#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 "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:
|
|
||||||
static FluApp *getInstance();
|
|
||||||
explicit FluApp(QObject *parent = nullptr);
|
|
||||||
~FluApp(){
|
|
||||||
if (nativeEvent != Q_NULLPTR) {
|
|
||||||
delete nativeEvent;
|
|
||||||
nativeEvent = Q_NULLPTR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Q_INVOKABLE void run();
|
|
||||||
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
|
||||||
Q_INVOKABLE void init(QQuickWindow *window);
|
|
||||||
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
|
||||||
Q_INVOKABLE void clipText(const QString& text);
|
|
||||||
Q_INVOKABLE QString uuid();
|
|
||||||
Q_INVOKABLE void closeApp();
|
|
||||||
Q_INVOKABLE void setFluApp(FluApp* val);
|
|
||||||
Q_INVOKABLE void setFluTheme(FluTheme* val);
|
|
||||||
Q_INVOKABLE void setFluColors(FluColors* val);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit FluApp(QObject *parent = nullptr);
|
||||||
|
~FluApp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief init
|
||||||
|
* @param window
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void init(QQuickWindow *window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief awesomelist
|
||||||
|
* @param keyword
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief closeApp
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void closeApp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setFluApp 在FluSingleton.qml调用,拿到QML中FluApp的单例
|
||||||
|
* @param val
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void setFluApp(FluApp* val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setFluTheme 在FluSingleton.qml调用,拿到QML中FluTheme的单例
|
||||||
|
* @param val
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void setFluTheme(FluTheme* val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setFluColors 在FluSingleton.qml调用,拿到QML中FluColors的单例
|
||||||
|
* @param val
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void setFluColors(FluColors* val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setFluColors 在FluSingleton.qml调用,拿到QML中FluTools的单例
|
||||||
|
* @param val
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void setFluTools(FluTools* val);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief wnds
|
||||||
|
*/
|
||||||
QMap<quint64, QQuickWindow*> wnds;
|
QMap<quint64, QQuickWindow*> wnds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief fluApp
|
||||||
|
*/
|
||||||
static FluApp* fluApp;
|
static FluApp* fluApp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief fluTheme
|
||||||
|
*/
|
||||||
static FluTheme* fluTheme;
|
static FluTheme* fluTheme;
|
||||||
static FluColors* flutColors;
|
|
||||||
|
/**
|
||||||
|
* @brief fluColors
|
||||||
|
*/
|
||||||
|
static FluColors* fluColors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief fluTools
|
||||||
|
*/
|
||||||
|
static FluTools* fluTools;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief nativeEvent
|
||||||
|
*/
|
||||||
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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)
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@ FluTheme::FluTheme(QObject *parent)
|
|||||||
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
||||||
Q_EMIT darkChanged();
|
Q_EMIT darkChanged();
|
||||||
});
|
});
|
||||||
primaryColor(FluApp::flutColors->Blue());
|
primaryColor(FluApp::fluColors->Blue());
|
||||||
textSize(13);
|
textSize(13);
|
||||||
nativeText(false);
|
nativeText(false);
|
||||||
frameless(true);
|
frameless(true);
|
||||||
|
@ -6,15 +6,42 @@
|
|||||||
#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)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief frameless 是否是无边框窗口,只支持windows部分电脑
|
||||||
|
*/
|
||||||
Q_PROPERTY_AUTO(bool,frameless);
|
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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief textSize 文字大小
|
||||||
|
*/
|
||||||
Q_PROPERTY_AUTO(int,textSize);
|
Q_PROPERTY_AUTO(int,textSize);
|
||||||
|
|
||||||
QML_NAMED_ELEMENT(FluTheme)
|
QML_NAMED_ELEMENT(FluTheme)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
public:
|
public:
|
||||||
|
18
src/FluTools.cpp
Normal file
18
src/FluTools.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "FluTools.h"
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QUuid>
|
||||||
|
|
||||||
|
FluTools::FluTools(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluTools::clipText(const QString& text){
|
||||||
|
QGuiApplication::clipboard()->setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FluTools::uuid(){
|
||||||
|
return QUuid::createUuid().toString();
|
||||||
|
}
|
34
src/FluTools.h
Normal file
34
src/FluTools.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef FLUTOOLS_H
|
||||||
|
#define FLUTOOLS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluTools class
|
||||||
|
*/
|
||||||
|
class FluTools : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
QML_NAMED_ELEMENT(FluTools)
|
||||||
|
QML_SINGLETON
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit FluTools(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief clipText 将字符串添加到剪切板
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void clipText(const QString& text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief uuid 获取uuid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QString uuid();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FLUTOOLS_H
|
@ -4,6 +4,9 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QAbstractNativeEventFilter>
|
#include <QAbstractNativeEventFilter>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The NativeEventFilter class
|
||||||
|
*/
|
||||||
class NativeEventFilter : public QAbstractNativeEventFilter
|
class NativeEventFilter : public QAbstractNativeEventFilter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -28,21 +28,17 @@ void WindowHelper::initWindow(QQuickWindow* window){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::firstUpdate(){
|
void WindowHelper::firstUpdate(){
|
||||||
if(isFisrt){
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if(FluApp::fluTheme->frameless()){
|
if(FluApp::fluTheme->frameless()){
|
||||||
HWND wnd = (HWND)window->winId();
|
HWND wnd = (HWND)window->winId();
|
||||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
||||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||||
ShowWindow(wnd, SW_SHOW);
|
ShowWindow(wnd, SW_SHOW);
|
||||||
window->setFlag(Qt::FramelessWindowHint,false);
|
window->setFlag(Qt::FramelessWindowHint,false);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
isFisrt = false;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
||||||
|
@ -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,32 @@ 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief destoryWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
|
||||||
|
*/
|
||||||
Q_INVOKABLE void destoryWindow();
|
Q_INVOKABLE void destoryWindow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief firstUpdate 窗口创建成功后调用,只调用一次
|
||||||
|
*/
|
||||||
Q_INVOKABLE void firstUpdate();
|
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
|
@ -581,7 +581,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
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ QtObject {
|
|||||||
FluApp.setFluApp(FluApp)
|
FluApp.setFluApp(FluApp)
|
||||||
FluApp.setFluColors(FluColors)
|
FluApp.setFluColors(FluColors)
|
||||||
FluApp.setFluTheme(FluTheme)
|
FluApp.setFluTheme(FluTheme)
|
||||||
|
FluApp.setFluTools(FluTools)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -133,9 +133,9 @@ Item {
|
|||||||
drag.axis: Drag.XAxis
|
drag.axis: Drag.XAxis
|
||||||
|
|
||||||
onWheel: (wheel)=>{
|
onWheel: (wheel)=>{
|
||||||
if (wheel.angleDelta.y > 0) scroll_nav.decrease()
|
if (wheel.angleDelta.y > 0) scroll_nav.decrease()
|
||||||
else scroll_nav.increase()
|
else scroll_nav.increase()
|
||||||
}
|
}
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
d.itemPress = true
|
d.itemPress = true
|
||||||
@ -264,6 +264,11 @@ Item {
|
|||||||
Layout.preferredWidth: visible?item_container.width - 41 - item_btn_close.width:0
|
Layout.preferredWidth: visible?item_container.width - 41 - item_btn_close.width:0
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
FluTooltip{
|
||||||
|
visible: item_mouse_hove.containsMouse
|
||||||
|
text:item_text.text
|
||||||
|
delay: 1000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,12 @@ Item {
|
|||||||
signal requestPage(int page,int count)
|
signal requestPage(int page,int count)
|
||||||
|
|
||||||
id:control
|
id:control
|
||||||
implicitHeight: layout_coumns.height + layout_table.height
|
implicitHeight: layout_table.height
|
||||||
|
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
property int coumnsWidth: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -32,6 +37,12 @@ Item {
|
|||||||
onColumnsChanged: {
|
onColumnsChanged: {
|
||||||
model_coumns.clear()
|
model_coumns.clear()
|
||||||
model_coumns.append(columns)
|
model_coumns.append(columns)
|
||||||
|
var w = 0
|
||||||
|
for(var i=0;i<model_coumns.count;i++){
|
||||||
|
var item = model_coumns.get(i)
|
||||||
|
w=w+item.width
|
||||||
|
}
|
||||||
|
d.coumnsWidth = w
|
||||||
}
|
}
|
||||||
|
|
||||||
onDataSourceChanged: {
|
onDataSourceChanged: {
|
||||||
@ -39,115 +50,137 @@ Item {
|
|||||||
model_data_source.append(dataSource)
|
model_data_source.append(dataSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
FluRectangle{
|
Flickable{
|
||||||
id:layout_coumns
|
id:layout_flickable
|
||||||
height: control.itemHeight
|
height: layout_table.height
|
||||||
width: parent.width
|
|
||||||
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
|
||||||
radius: [12,12,0,0]
|
|
||||||
|
|
||||||
Row{
|
|
||||||
id:list_coumns
|
|
||||||
spacing: 0
|
|
||||||
anchors.fill: parent
|
|
||||||
Repeater{
|
|
||||||
model: model_coumns
|
|
||||||
delegate: Item{
|
|
||||||
height: list_coumns.height
|
|
||||||
width: model.width
|
|
||||||
FluText{
|
|
||||||
text:model.title
|
|
||||||
anchors{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 14
|
|
||||||
}
|
|
||||||
fontStyle: FluText.BodyStrong
|
|
||||||
}
|
|
||||||
FluDivider{
|
|
||||||
width: 1
|
|
||||||
height: 40
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
visible: index !== list_coumns.count-1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle{
|
|
||||||
anchors.fill: layout_table
|
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView{
|
|
||||||
id:layout_table
|
|
||||||
anchors{
|
anchors{
|
||||||
top: layout_coumns.bottom
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
height: contentHeight
|
contentWidth: layout_table.width
|
||||||
clip:true
|
ScrollBar.horizontal: FluScrollBar {
|
||||||
footer: Item{
|
|
||||||
height: 50
|
|
||||||
width: layout_table.width
|
|
||||||
FluPagination{
|
|
||||||
id:pagination
|
|
||||||
height: 40
|
|
||||||
pageCurrent: control.pageCurrent
|
|
||||||
itemCount: control.itemCount
|
|
||||||
pageCount: control.pageCount
|
|
||||||
onRequestPage:
|
|
||||||
(page,count)=> {
|
|
||||||
control.requestPage(page,count)
|
|
||||||
}
|
|
||||||
anchors{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
model:model_data_source
|
Rectangle{
|
||||||
delegate: Item{
|
anchors.fill: layout_table
|
||||||
height: list_coumns.height
|
radius: 5
|
||||||
width: layout_table.width
|
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
property var model_values : getObjectValues(index)
|
}
|
||||||
property var itemObject: getObject(index)
|
ListView{
|
||||||
property var listModel: model
|
id:layout_table
|
||||||
Row{
|
height: contentHeight
|
||||||
spacing: 0
|
width: Math.max(layout_flickable.width,d.coumnsWidth)
|
||||||
anchors.fill: parent
|
clip:true
|
||||||
Repeater{
|
interactive: false
|
||||||
model: model_values
|
|
||||||
delegate:Item{
|
header: FluRectangle{
|
||||||
height: list_coumns.height
|
id:layout_coumns
|
||||||
width: modelData.width
|
height: control.itemHeight
|
||||||
Loader{
|
width: parent.width
|
||||||
property var model : modelData
|
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
property var dataModel : listModel
|
radius: [5,5,0,0]
|
||||||
property var dataObject : itemObject
|
|
||||||
anchors.fill: parent
|
Row{
|
||||||
sourceComponent: {
|
id:list_coumns
|
||||||
if(model.itemData instanceof Component){
|
spacing: 0
|
||||||
return model.itemData
|
anchors.fill: parent
|
||||||
|
Repeater{
|
||||||
|
model: model_coumns
|
||||||
|
delegate: Item{
|
||||||
|
height: list_coumns.height
|
||||||
|
width: model.width
|
||||||
|
FluText{
|
||||||
|
text:model.title
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 14
|
||||||
}
|
}
|
||||||
return com_text
|
fontStyle: FluText.BodyStrong
|
||||||
|
}
|
||||||
|
FluDivider{
|
||||||
|
width: 1
|
||||||
|
height: 40
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: index !== list_coumns.count-1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluDivider{
|
|
||||||
width: parent.width
|
footer: Item{
|
||||||
height: 1
|
height: 50
|
||||||
anchors.right: parent.right
|
width: layout_table.width
|
||||||
anchors.bottom: parent.bottom
|
FluPagination{
|
||||||
|
id:pagination
|
||||||
|
height: 40
|
||||||
|
pageCurrent: control.pageCurrent
|
||||||
|
itemCount: control.itemCount
|
||||||
|
pageCount: control.pageCount
|
||||||
|
onRequestPage:
|
||||||
|
(page,count)=> {
|
||||||
|
control.requestPage(page,count)
|
||||||
|
}
|
||||||
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model:model_data_source
|
||||||
|
delegate: Item{
|
||||||
|
height: table_row.maxHeight
|
||||||
|
width: layout_table.width
|
||||||
|
property var model_values : getObjectValues(index)
|
||||||
|
property var itemObject: getObject(index)
|
||||||
|
property var listModel: model
|
||||||
|
Row{
|
||||||
|
id: table_row
|
||||||
|
spacing: 0
|
||||||
|
anchors.fill: parent
|
||||||
|
property int maxHeight: itemHeight
|
||||||
|
Repeater{
|
||||||
|
model: model_values
|
||||||
|
delegate:Item{
|
||||||
|
height: table_row.maxHeight
|
||||||
|
width: modelData.width
|
||||||
|
Loader{
|
||||||
|
property var model : modelData
|
||||||
|
property var dataModel : listModel
|
||||||
|
property var dataObject : itemObject
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceComponent: {
|
||||||
|
if(model.itemData instanceof Component){
|
||||||
|
return model.itemData
|
||||||
|
}
|
||||||
|
return com_text
|
||||||
|
}
|
||||||
|
onHeightChanged:
|
||||||
|
{
|
||||||
|
table_row.maxHeight = Math.max(table_row.maxHeight,height,itemHeight)
|
||||||
|
parent.height = table_row.maxHeight
|
||||||
|
table_row.parent.height = table_row.maxHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluDivider{
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_text
|
id:com_text
|
||||||
Item{
|
Item{
|
||||||
@ -157,9 +190,11 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:table_value
|
||||||
text:String(model.itemData)
|
text:String(model.itemData)
|
||||||
width: parent.width - 14
|
width: parent.width - 14
|
||||||
elide: Text.ElideRight
|
wrapMode: Text.WordWrap
|
||||||
|
onImplicitHeightChanged: parent.parent.parent.height = Math.max(implicitHeight + 20,itemHeight)
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
@ -28,6 +28,11 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
signal initArgument(var argument)
|
signal initArgument(var argument)
|
||||||
|
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
property bool firstFlag: true
|
||||||
|
}
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
color: {
|
color: {
|
||||||
@ -51,8 +56,9 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onActiveChanged: {
|
onActiveChanged: {
|
||||||
if(active){
|
if(d.firstFlag){
|
||||||
helper.firstUpdate()
|
helper.firstUpdate()
|
||||||
|
d.firstFlag = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user