Compare commits

..

55 Commits

Author SHA1 Message Date
44f7948df3 update 2024-04-12 16:50:49 +08:00
0ab315e258 update 2024-04-12 16:26:32 +08:00
44acdbcf7f update 2024-04-11 20:29:59 +08:00
3997daaa11 update 2024-04-11 19:18:37 +08:00
531f659e59 update 2024-04-11 15:27:15 +08:00
3f6ef13cd0 update 2024-04-11 15:09:47 +08:00
96fef84c2d update 2024-04-11 14:56:22 +08:00
a3f375c9ef update 2024-04-11 14:51:43 +08:00
6a31e86505 update 2024-04-09 20:53:52 +08:00
6ebd659e13 update 2024-04-04 22:47:07 +08:00
bd8c80feb8 update 2024-04-04 17:43:58 +08:00
6b617d10d5 update 2024-04-04 17:08:45 +08:00
cf163f5e3b update 2024-04-04 16:53:31 +08:00
b4329fdd0a update 2024-04-04 12:11:08 +08:00
84b2045b5f update 2024-04-04 02:48:26 +08:00
18193a18be update 2024-04-04 02:01:52 +08:00
fe08b08c1f update 2024-04-04 01:10:14 +08:00
ef96618151 update 2024-04-03 21:52:26 +08:00
be34220652 update 2024-04-03 19:31:01 +08:00
5cf0812562 update 2024-04-03 19:30:15 +08:00
c2b845658d update 2024-04-03 13:24:30 +08:00
eb4ec242b1 update 2024-04-03 11:28:18 +08:00
a95916ab03 update 2024-04-03 11:19:35 +08:00
bf5bedc9ed update 2024-04-03 11:09:35 +08:00
7d1666597f update 2024-04-02 00:32:06 +08:00
da9f63eb24 update 2024-03-31 21:56:11 +08:00
68015776ab update 2024-03-31 21:52:06 +08:00
d222cb640c update 2024-03-31 11:17:05 +08:00
0ab7f811e3 update 2024-03-31 10:59:15 +08:00
6a5f9d04a9 update 2024-03-29 16:56:09 +08:00
cb33af8836 update 2024-03-29 16:23:16 +08:00
5fd934b5f5 update 2024-03-29 00:51:55 +08:00
b7fde5f79c update 2024-03-29 00:48:58 +08:00
41cbeef3fd update 2024-03-28 19:18:56 +08:00
f616a2da6a update 2024-03-27 14:13:36 +08:00
b6c3f0eda9 update 2024-03-27 10:52:47 +08:00
06aa16c0eb update 2024-03-27 10:25:58 +08:00
c52439ac39 update 2024-03-27 09:45:56 +08:00
e81a2cc849 update 2024-03-27 00:36:56 +08:00
485bcc8acc update 2024-03-25 22:17:05 +08:00
07fedb43a8 update 2024-03-25 21:01:47 +08:00
d6c0492665 update 2024-03-25 14:43:23 +08:00
9d06c6d1e9 update 2024-03-24 22:12:20 +08:00
0ca486dfa1 fix bug 2024-03-24 12:45:34 +08:00
3257f59c68 update 2024-03-24 10:50:01 +08:00
ff68491baf update 2024-03-24 10:27:16 +08:00
247b8db7c4 update 2024-03-24 10:20:50 +08:00
07a43825d1 update 2024-03-24 10:17:20 +08:00
e0254f2f80 fix bug 2024-03-23 22:28:14 +08:00
37101c97c5 update 2024-03-23 22:17:03 +08:00
7e1490f8f4 update 2024-03-22 12:59:39 +08:00
98770cb907 update 2024-03-21 13:33:35 +08:00
bd942659df update 2024-03-21 11:30:17 +08:00
796be2a8f2 update FluWindowDialog 2024-03-21 11:29:49 +08:00
d655dc0141 update 2024-03-20 23:35:15 +08:00
387 changed files with 10407 additions and 44731 deletions

View File

@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.20)
project(FluentUI VERSION 1.0) project(FluentUI VERSION 1.0)
if(MSVC) if (MSVC)
#让Release也生成pdb文件 #让Release也生成pdb文件
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
endif() endif ()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/.cmake/) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake/)
include(GetGitRevisionDescription) include(GetGitRevisionDescription)
@ -22,8 +22,8 @@ add_subdirectory(src)
#Release也支持日志打印代码位置 #Release也支持日志打印代码位置
target_compile_definitions(fluentuiplugin target_compile_definitions(fluentuiplugin
PRIVATE PRIVATE
QT_MESSAGELOGCONTEXT QT_MESSAGELOGCONTEXT
) )
if (FLUENTUI_BUILD_EXAMPLES) if (FLUENTUI_BUILD_EXAMPLES)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
project(example VERSION 1.0 LANGUAGES CXX) project(example VERSION 1.0)
#配置通用编译 #配置通用编译
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
@ -10,18 +10,18 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
#判断FluentUI库类型 #判断FluentUI库类型
if(FLUENTUI_BUILD_STATIC_LIB) if (FLUENTUI_BUILD_STATIC_LIB)
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB) add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
endif() endif ()
#设置可执行文件输出目录 #设置可执行文件输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
if(APPLE) if (APPLE)
set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS) set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS)
else() else ()
set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif() endif ()
#导入Qt相关依赖包 #导入Qt相关依赖包
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick Svg Network) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick Svg Network)
@ -32,46 +32,46 @@ find_program(QT_LUPDATE NAMES lupdate)
find_program(QT_LRELEASE NAMES lrelease) find_program(QT_LRELEASE NAMES lrelease)
file(GLOB TS_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.ts) file(GLOB TS_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.ts)
add_custom_target(Script-UpdateTranslations add_custom_target(Script-UpdateTranslations
COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${APPLICATION_DIR_PATH}/i18n COMMAND ${CMAKE_COMMAND} -E make_directory ${APPLICATION_DIR_PATH}/i18n
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_NAME}_en_US.qm ${PROJECT_NAME}_zh_CN.qm ${APPLICATION_DIR_PATH}/i18n COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_NAME}_en_US.qm ${PROJECT_NAME}_zh_CN.qm ${APPLICATION_DIR_PATH}/i18n
SOURCES ${TS_FILE_PATHS} SOURCES ${TS_FILE_PATHS}
) )
##生成版本信息头文件 ##生成版本信息头文件
set(HEADER_FILE_VERSION_PATH ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Version.h) set(HEADER_FILE_VERSION_PATH ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Version.h)
configure_file( configure_file(
${CMAKE_SOURCE_DIR}/.cmake/Version.h.in ${CMAKE_SOURCE_DIR}/.cmake/Version.h.in
${HEADER_FILE_VERSION_PATH} ${HEADER_FILE_VERSION_PATH}
) )
#遍历所有Cpp文件 #遍历所有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)
if(WIN32) if (WIN32)
list(APPEND sources_files "src/app_dmp.h") list(APPEND sources_files "src/app_dmp.h")
endif() endif ()
#如果是Windows平台则生成rc文件还有inno setup脚本文件 #如果是Windows平台则生成rc文件还有inno setup脚本文件
set(EXAMPLE_VERSION_RC_PATH "") set(EXAMPLE_VERSION_RC_PATH "")
if(WIN32) if (WIN32)
set(EXAMPLE_VERSION_RC_PATH ${CMAKE_CURRENT_BINARY_DIR}/version_${PROJECT_NAME}.rc) set(EXAMPLE_VERSION_RC_PATH ${CMAKE_CURRENT_BINARY_DIR}/version_${PROJECT_NAME}.rc)
configure_file( configure_file(
${CMAKE_SOURCE_DIR}/.cmake/version_exe.rc.in ${CMAKE_SOURCE_DIR}/.cmake/version_exe.rc.in
${EXAMPLE_VERSION_RC_PATH} ${EXAMPLE_VERSION_RC_PATH}
) )
configure_file( configure_file(
${CMAKE_SOURCE_DIR}/.cmake/InstallerScript.iss.in ${CMAKE_SOURCE_DIR}/.cmake/InstallerScript.iss.in
${CMAKE_SOURCE_DIR}/action-cli/InstallerScript.iss ${CMAKE_SOURCE_DIR}/action-cli/InstallerScript.iss
) )
endif() endif ()
#加快qrc编译 #加快qrc编译
qt_add_big_resources(QRC_RESOURCES ${PROJECT_NAME}.qrc) qt_add_big_resources(QRC_RESOURCES ${PROJECT_NAME}.qrc)
@ -80,34 +80,34 @@ set_property(SOURCE ${PROJECT_NAME}.qrc PROPERTY SKIP_AUTORCC ON)
list(APPEND sources_files ${QRC_RESOURCES}) list(APPEND sources_files ${QRC_RESOURCES})
#添加可执行文件 #添加可执行文件
if(WIN32) if (WIN32)
list(APPEND sources_files ${EXAMPLE_VERSION_RC_PATH}) list(APPEND sources_files ${EXAMPLE_VERSION_RC_PATH})
endif() endif ()
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) if (${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(${PROJECT_NAME} qt_add_executable(${PROJECT_NAME}
MANUAL_FINALIZATION MANUAL_FINALIZATION
${sources_files} ${sources_files}
) )
else() else ()
add_executable(${PROJECT_NAME} add_executable(${PROJECT_NAME}
${sources_files} ${sources_files}
) )
endif() endif ()
add_dependencies(${PROJECT_NAME} Script-UpdateTranslations) add_dependencies(${PROJECT_NAME} Script-UpdateTranslations)
#复制程序运行所需要的动态库 #复制程序运行所需要的动态库
if(WIN32) if (WIN32)
if(MSVC) if (MSVC)
if(CMAKE_SIZEOF_VOID_P EQUAL 4) if (CMAKE_SIZEOF_VOID_P EQUAL 4)
file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x86/*.dll) file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x86/*.dll)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x64/*.dll) file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x64/*.dll)
endif() endif ()
elseif(MINGW) elseif (MINGW)
file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll) file(GLOB_RECURSE 3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
endif() endif ()
file(COPY ${3RDPARTY_DLL_DIR} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) file(COPY ${3RDPARTY_DLL_DIR} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif() endif ()
#复制FluentUI源码到运行目录下用于脚手架生成 #复制FluentUI源码到运行目录下用于脚手架生成
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/source/) file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/source/)
@ -115,37 +115,37 @@ file(COPY ${CMAKE_SOURCE_DIR}/src/ DESTINATION ${APPLICATION_DIR_PATH}/source/)
#导入component头文件,不然通过QML_NAMED_ELEMENT生成的c++类会找不到头文件报错 #导入component头文件,不然通过QML_NAMED_ELEMENT生成的c++类会找不到头文件报错
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/component ${CMAKE_CURRENT_SOURCE_DIR}/src/component
) )
#如果是静态库则需要手动注册插件导入FluentUI.h头文件 #如果是静态库则需要手动注册插件导入FluentUI.h头文件
if(FLUENTUI_BUILD_STATIC_LIB) if (FLUENTUI_BUILD_STATIC_LIB)
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src
) )
endif() endif ()
#设置属性 #设置属性
set_target_properties(${PROJECT_NAME} PROPERTIES set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.${PROJECT_NAME}.com MACOSX_BUNDLE_GUI_IDENTIFIER my.${PROJECT_NAME}.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE WIN32_EXECUTABLE TRUE
) )
#Release也支持日志打印代码位置 #Release也支持日志打印代码位置
target_compile_definitions(${PROJECT_NAME} target_compile_definitions(${PROJECT_NAME}
PRIVATE PRIVATE
QT_MESSAGELOGCONTEXT QT_MESSAGELOGCONTEXT
) )
#目标文件链接库 #目标文件链接库
target_link_libraries(${PROJECT_NAME} PRIVATE target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Svg
Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Network
fluentuiplugin fluentuiplugin
) )
#添加部署脚本 #添加部署脚本
@ -153,23 +153,23 @@ if (CMAKE_BUILD_TYPE MATCHES "Release")
if (APPLE) if (APPLE)
find_program(QT_DEPLOY_QT NAMES macdeployqt) find_program(QT_DEPLOY_QT NAMES macdeployqt)
add_custom_target(Script-DeployRelease add_custom_target(Script-DeployRelease
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.app -qmldir=${CMAKE_CURRENT_LIST_DIR} COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.app -qmldir=${CMAKE_CURRENT_LIST_DIR}
COMMENT "MacOs Deploying Qt Dependencies After Build........." COMMENT "MacOs Deploying Qt Dependencies After Build........."
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
endif() endif ()
if(WIN32) if (WIN32)
find_program(QT_DEPLOY_QT NAMES windeployqt) find_program(QT_DEPLOY_QT NAMES windeployqt)
add_custom_target(Script-DeployRelease add_custom_target(Script-DeployRelease
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.exe -qmldir=${CMAKE_CURRENT_LIST_DIR} COMMAND ${QT_DEPLOY_QT} --qmldir=${CMAKE_CURRENT_LIST_DIR} --plugindir ${CMAKE_SOURCE_DIR}/dist/plugins --no-translations --compiler-runtime ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.exe
COMMENT "Windows Deploying Qt Dependencies After Build........." COMMENT "Windows Deploying Qt Dependencies After Build........."
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
endif() endif ()
endif() endif ()

View File

@ -127,7 +127,6 @@
<file>qml/global/ItemsOriginal.qml</file> <file>qml/global/ItemsOriginal.qml</file>
<file>qml/global/qmldir</file> <file>qml/global/qmldir</file>
<file>qml/page/T_Acrylic.qml</file> <file>qml/page/T_Acrylic.qml</file>
<file>qml/page/T_Awesome.qml</file>
<file>qml/page/T_Badge.qml</file> <file>qml/page/T_Badge.qml</file>
<file>qml/page/T_BreadcrumbBar.qml</file> <file>qml/page/T_BreadcrumbBar.qml</file>
<file>qml/page/T_Buttons.qml</file> <file>qml/page/T_Buttons.qml</file>
@ -177,12 +176,9 @@
<file>qml/window/SingleInstanceWindow.qml</file> <file>qml/window/SingleInstanceWindow.qml</file>
<file>qml/window/SingleTaskWindow.qml</file> <file>qml/window/SingleTaskWindow.qml</file>
<file>qml/window/StandardWindow.qml</file> <file>qml/window/StandardWindow.qml</file>
<file>res/image/bg_scenic.png</file>
<file>res/image/image_1.jpg</file> <file>res/image/image_1.jpg</file>
<file>qml/window/PageWindow.qml</file> <file>qml/window/PageWindow.qml</file>
<file>qml/page/T_StaggeredLayout.qml</file> <file>qml/page/T_StaggeredLayout.qml</file>
<file>qml/viewmodel/SettingsViewModel.qml</file>
<file>qml/viewmodel/TextBoxViewModel.qml</file>
<file>qml/page/T_Clip.qml</file> <file>qml/page/T_Clip.qml</file>
<file>qml/page/T_3D.qml</file> <file>qml/page/T_3D.qml</file>
<file>qml/page/T_Network.qml</file> <file>qml/page/T_Network.qml</file>
@ -197,7 +193,6 @@
<file>res/image/ic_crash.png</file> <file>res/image/ic_crash.png</file>
<file>qml/window/CrashWindow.qml</file> <file>qml/window/CrashWindow.qml</file>
<file>qml/page/T_SplitLayout.qml</file> <file>qml/page/T_SplitLayout.qml</file>
<file>qml/window/FluentInitalizrWindow.qml</file>
<file>res/template/CMakeLists.txt.in</file> <file>res/template/CMakeLists.txt.in</file>
<file>res/template/src/App.qml.in</file> <file>res/template/src/App.qml.in</file>
<file>res/template/src/CMakeLists.txt.in</file> <file>res/template/src/CMakeLists.txt.in</file>
@ -208,5 +203,13 @@
<file>res/template/src/qml.qrc.in</file> <file>res/template/src/qml.qrc.in</file>
<file>res/template/src/zh_CN.ts.in</file> <file>res/template/src/zh_CN.ts.in</file>
<file>res/template/src/README.md.in</file> <file>res/template/src/README.md.in</file>
<file>qml/global/GlobalModel.qml</file>
<file>qml/page/T_Sheet.qml</file>
<file>qml/page/T_GroupBox.qml</file>
<file>res/image/bg_scenic.jpg</file>
<file>qml/window/FluentInitializrWindow.qml</file>
<file>qml/page/T_OpenGL.qml</file>
<file>qml/page/T_Icons.qml</file>
</qresource> </qresource>
<qresource prefix="/"/>
</RCC> </RCC>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,41 +4,37 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import FluentUI 1.0 import FluentUI 1.0
Item { FluLauncher {
id: app id: app
Connections{ Connections{
target: FluTheme target: FluTheme
function onDarkModeChanged(){ function onDarkModeChanged(){
SettingsHelper.saveDarkMode(FluTheme.darkMode) SettingsHelper.saveDarkMode(FluTheme.darkMode)
} }
} }
Connections{ Connections{
target: FluApp target: FluApp
function onUseSystemAppBarChanged(){ function onUseSystemAppBarChanged(){
SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar) SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar)
} }
} }
Connections{ Connections{
target: TranslateHelper target: TranslateHelper
function onCurrentChanged(){ function onCurrentChanged(){
SettingsHelper.saveLanguage(TranslateHelper.current) SettingsHelper.saveLanguage(TranslateHelper.current)
} }
} }
Component.onCompleted: { Component.onCompleted: {
FluNetwork.openLog = false Network.openLog = false
FluNetwork.setInterceptor(function(param){ Network.setInterceptor(function(param){
param.addHeader("Token","000000000000000000000") param.addHeader("Token","000000000000000000000")
}) })
FluApp.init(app,Qt.locale(TranslateHelper.current)) FluApp.init(app,Qt.locale(TranslateHelper.current))
FluApp.windowIcon = "qrc:/example/res/image/favicon.ico" FluApp.windowIcon = "qrc:/example/res/image/favicon.ico"
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar() FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluTheme.darkMode = SettingsHelper.getDarkMode() FluTheme.darkMode = SettingsHelper.getDarkMode()
FluTheme.enableAnimation = true FluTheme.animationEnabled = true
FluApp.routes = { FluRouter.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",
@ -51,9 +47,9 @@ Item {
} }
var args = Qt.application.arguments var args = Qt.application.arguments
if(args.length>=2 && args[1].startsWith("-crashed=")){ if(args.length>=2 && args[1].startsWith("-crashed=")){
FluApp.navigate("/crash",{crashFilePath:args[1].replace("-crashed=","")}) FluRouter.navigate("/crash",{crashFilePath:args[1].replace("-crashed=","")})
}else{ }else{
FluApp.navigate("/") FluRouter.navigate("/")
} }
} }
} }

View File

@ -9,10 +9,10 @@ FluScrollablePage{
title: qsTr("Bar Chart") title: qsTr("Bar Chart")
FluArea{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent
@ -69,10 +69,10 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent

View File

@ -13,10 +13,10 @@ FluScrollablePage{
return Math.random().toFixed(1); return Math.random().toFixed(1);
} }
FluArea{ FluFrame{
height: 370 Layout.preferredWidth: 500
width: 500 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent

View File

@ -9,10 +9,10 @@ FluScrollablePage{
title: qsTr("Line Chart") title: qsTr("Line Chart")
FluArea{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent

View File

@ -9,10 +9,10 @@ FluScrollablePage{
title: qsTr("Pie Chart") title: qsTr("Pie Chart")
FluArea{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent
@ -50,10 +50,10 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent

View File

@ -9,10 +9,10 @@ FluScrollablePage{
title: qsTr("Polar Area Chart") title: qsTr("Polar Area Chart")
FluArea{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent

View File

@ -9,10 +9,10 @@ FluScrollablePage{
title: qsTr("Radar Chart") title: qsTr("Radar Chart")
FluArea{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent

View File

@ -13,10 +13,10 @@ FluScrollablePage{
return Math.random().toFixed(1); return Math.random().toFixed(1);
} }
FluArea{ FluFrame{
height: 370 Layout.preferredWidth: 500
width: 500 Layout.preferredHeight: 370
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{
anchors.fill: parent anchors.fill: parent
@ -119,5 +119,4 @@ FluScrollablePage{
} }
} }
} }
} }

View File

@ -135,7 +135,11 @@ FluExpander{
"FluLoadingButton", "FluLoadingButton",
"FluClip", "FluClip",
"FluNetwork", "FluNetwork",
"FluShortcutPicker" "FluShortcutPicker",
"FluWindowResultLauncher",
"FluRouter",
"FluGroupBox",
"FluSheet",
]; ];
code = code.replace(/\n/g, "<br>"); code = code.replace(/\n/g, "<br>");
code = code.replace(/ /g, "&nbsp;"); code = code.replace(/ /g, "&nbsp;");

View File

@ -0,0 +1,10 @@
pragma Singleton
import QtQuick 2.15
import FluentUI 1.0
QtObject{
property int displayMode: FluNavigationViewType.Auto
}

View File

@ -16,7 +16,7 @@ FluObject{
title:qsTr("About") title:qsTr("About")
icon:FluentIcons.Contact icon:FluentIcons.Contact
onTapListener:function(){ onTapListener:function(){
FluApp.navigate("/about") FluRouter.navigate("/about")
} }
} }

View File

@ -104,6 +104,12 @@ FluObject{
url: "qrc:/example/qml/page/T_ToggleSwitch.qml" url: "qrc:/example/qml/page/T_ToggleSwitch.qml"
onTap: { navigationView.push(url) } onTap: { navigationView.push(url) }
} }
FluPaneItem{
title: qsTr("GroupBox")
menuDelegate: paneItemMenu
url: "qrc:/example/qml/page/T_GroupBox.qml"
onTap: { navigationView.push(url) }
}
FluPaneItem{ FluPaneItem{
title: qsTr("PaneItem Disabled") title: qsTr("PaneItem Disabled")
disabled: true disabled: true
@ -271,6 +277,12 @@ FluObject{
url: "qrc:/example/qml/page/T_Menu.qml" url: "qrc:/example/qml/page/T_Menu.qml"
onTap: { navigationView.push(url) } onTap: { navigationView.push(url) }
} }
FluPaneItem{
title: qsTr("Sheet")
menuDelegate: paneItemMenu
url: "qrc:/example/qml/page/T_Sheet.qml"
onTap: { navigationView.push(url) }
}
} }
FluPaneItemExpander{ FluPaneItemExpander{
@ -352,9 +364,9 @@ FluObject{
onTap: { navigationView.push(url) } onTap: { navigationView.push(url) }
} }
FluPaneItem{ FluPaneItem{
title: qsTr("Awesome") title: qsTr("Icons")
menuDelegate: paneItemMenu menuDelegate: paneItemMenu
url: "qrc:/example/qml/page/T_Awesome.qml" url: "qrc:/example/qml/page/T_Icons.qml"
onTap: { navigationView.push(url) } onTap: { navigationView.push(url) }
} }
} }
@ -414,6 +426,12 @@ FluObject{
FluPaneItemExpander{ FluPaneItemExpander{
title: qsTr("Other") title: qsTr("Other")
icon: FluentIcons.Shop icon: FluentIcons.Shop
FluPaneItem{
title: qsTr("OpenGL")
menuDelegate: paneItemMenu
url: "qrc:/example/qml/page/T_OpenGL.qml"
onTap: { navigationView.push(url) }
}
FluPaneItem{ FluPaneItem{
title: qsTr("QRCode") title: qsTr("QRCode")
menuDelegate: paneItemMenu menuDelegate: paneItemMenu
@ -462,7 +480,7 @@ FluObject{
FluPaneItem{ FluPaneItem{
title: qsTr("Hot Loader") title: qsTr("Hot Loader")
onTapListener: function(){ onTapListener: function(){
FluApp.navigate("/hotload") FluRouter.navigate("/hotload")
} }
} }
FluPaneItem{ FluPaneItem{
@ -473,10 +491,12 @@ FluObject{
} }
FluPaneItem{ FluPaneItem{
title: qsTr("Test Crash") title: qsTr("Test Crash")
visible: FluTools.isWin()
onTapListener: function(){ onTapListener: function(){
AppInfo.testCrash() AppInfo.testCrash()
} }
Component.onCompleted: {
visible = FluTools.isWin()
}
} }
} }

View File

@ -1,2 +1,3 @@
singleton ItemsOriginal 1.0 ItemsOriginal.qml singleton ItemsOriginal 1.0 ItemsOriginal.qml
singleton ItemsFooter 1.0 ItemsFooter.qml singleton ItemsFooter 1.0 ItemsFooter.qml
singleton GlobalModel 1.0 GlobalModel.qml

View File

@ -11,7 +11,6 @@ FluScrollablePage{
RowLayout{ RowLayout{
spacing: 10 spacing: 10
Layout.topMargin: 20
FluText{ FluText{
text:"tintColor:" text:"tintColor:"
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -42,10 +41,10 @@ FluScrollablePage{
value: 32 value: 32
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 1200/4+20 Layout.preferredHeight: 1200/4+20
paddings: 10 padding: 10
Layout.topMargin: 10 Layout.topMargin: 10
FluClip{ FluClip{
width: 1920/4 width: 1920/4
@ -54,7 +53,7 @@ FluScrollablePage{
Image { Image {
id:image id:image
asynchronous: true asynchronous: true
source: "qrc:/example/res/image/bg_scenic.png" source: "qrc:/example/res/image/bg_scenic.jpg"
anchors.fill: parent anchors.fill: parent
sourceSize: Qt.size(2*width,2*height) sourceSize: Qt.size(2*width,2*height)
} }
@ -72,7 +71,7 @@ FluScrollablePage{
anchors.centerIn: parent anchors.centerIn: parent
text: "Acrylic" text: "Acrylic"
color: "#FFFFFF" color: "#FFFFFF"
font.bold: true font: FluTextStyle.Subtitle
} }
MouseArea { MouseArea {
property point clickPos: Qt.point(0,0) property point clickPos: Qt.point(0,0)
@ -95,7 +94,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'Image{ code:'Image{
id:image id:image
width: 800 width: 800

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Badge") title: qsTr("Badge")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20
height: 120 height: 120
paddings: 10 padding: 10
Column{ Column{
spacing: 15 spacing: 15
@ -114,7 +113,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'Rectangle{ code:'Rectangle{
width: 40 width: 40
height: 40 height: 40

View File

@ -18,11 +18,10 @@ FluScrollablePage{
breadcrumb_2.items = items breadcrumb_2.items = items
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20
FluBreadcrumbBar{ FluBreadcrumbBar{
id:breadcrumb_1 id:breadcrumb_1
@ -36,10 +35,10 @@ FluScrollablePage{
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
ColumnLayout{ ColumnLayout{
@ -77,7 +76,7 @@ FluScrollablePage{
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluBreadcrumbBar{ code:'FluBreadcrumbBar{
width:parent.width width:parent.width
separator:">" separator:">"

View File

@ -10,15 +10,14 @@ FluScrollablePage{
title: qsTr("Buttons") title: qsTr("Buttons")
FluText{ FluText{
Layout.topMargin: 20
text: qsTr("Support the Tab key to switch focus, and the Space key to perform click events") text: qsTr("Support the Tab key to switch focus, and the Space key to perform click events")
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 Layout.topMargin: 10
Layout.topMargin: 20 padding: 10
FluTextButton{ FluTextButton{
disabled: text_button_switch.checked disabled: text_button_switch.checked
@ -42,7 +41,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluTextButton{ code:'FluTextButton{
text:"Text Button" text:"Text Button"
onClicked: { onClicked: {
@ -51,10 +50,10 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluButton{ FluButton{
@ -79,7 +78,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluButton{ code:'FluButton{
text:"Standard Button" text:"Standard Button"
onClicked: { onClicked: {
@ -88,11 +87,11 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
Layout.topMargin: 20 Layout.topMargin: 20
paddings: 10 padding: 10
FluFilledButton{ FluFilledButton{
disabled: filled_button_switch.checked disabled: filled_button_switch.checked
@ -116,7 +115,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluFilledButton{ code:'FluFilledButton{
text:"Filled Button" text:"Filled Button"
onClicked: { onClicked: {
@ -125,11 +124,11 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
Layout.topMargin: 20 Layout.topMargin: 20
paddings: 10 padding: 10
FluToggleButton{ FluToggleButton{
disabled:toggle_button_switch.checked disabled:toggle_button_switch.checked
@ -150,7 +149,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluToggleButton{ code:'FluToggleButton{
text:"Toggle Button" text:"Toggle Button"
onClicked: { onClicked: {
@ -172,11 +171,11 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
Layout.topMargin: 20 Layout.topMargin: 20
paddings: 10 padding: 10
FluProgressButton{ FluProgressButton{
id: btn_progress id: btn_progress
@ -202,7 +201,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluProgressButton{ code:'FluProgressButton{
text:"Progress Button" text:"Progress Button"
onClicked: { onClicked: {
@ -211,11 +210,11 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
Layout.topMargin: 20 Layout.topMargin: 20
paddings: 10 padding: 10
FluLoadingButton{ FluLoadingButton{
id: btn_loading id: btn_loading
@ -241,7 +240,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluLoadingButton{ code:'FluLoadingButton{
text:"Loading Button" text:"Loading Button"
onClicked: { onClicked: {
@ -251,10 +250,10 @@ FluScrollablePage{
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: layout_icon_button.height + 30 Layout.preferredHeight: layout_icon_button.height + 30
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
Flow{ Flow{
id: layout_icon_button id: layout_icon_button
@ -323,7 +322,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluIconButton{ code:'FluIconButton{
iconSource:FluentIcons.ChromeCloseContrast iconSource:FluentIcons.ChromeCloseContrast
onClicked: { onClicked: {
@ -332,10 +331,10 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluDropDownButton{ FluDropDownButton{
disabled: drop_down_button_switch.checked disabled: drop_down_button_switch.checked
@ -371,7 +370,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluDropDownButton{ code:'FluDropDownButton{
text:"DropDownButton" text:"DropDownButton"
FluMenuItem{ FluMenuItem{
@ -389,10 +388,10 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluRadioButtons{ FluRadioButtons{
spacing: 8 spacing: 8
@ -424,7 +423,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluRadioButton{ code:'FluRadioButton{
checked:true checked:true
text:"Text Button" text:"Text Button"

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("CalendarPicker") title: qsTr("CalendarPicker")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 80
height: 80 padding: 10
paddings: 10
ColumnLayout{ ColumnLayout{
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -28,7 +27,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluCalendarPicker{ code:'FluCalendarPicker{
}' }'

View File

@ -11,7 +11,6 @@ FluScrollablePage{
FluCaptcha{ FluCaptcha{
id: captcha id: captcha
Layout.topMargin: 20
ignoreCase:switch_case.checked ignoreCase:switch_case.checked
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent

View File

@ -22,11 +22,10 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 370 height: 370
paddings: 10 padding: 10
Layout.topMargin: 20
Column{ Column{
spacing: 15 spacing: 15
anchors{ anchors{
@ -62,10 +61,10 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 340 height: 340
paddings: 10 padding: 10
Layout.topMargin: 10 Layout.topMargin: 10
Column{ Column{
spacing: 15 spacing: 15
@ -104,7 +103,6 @@ FluScrollablePage{
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
text:model.title text:model.title
color: FluColors.Grey10 color: FluColors.Grey10
font.pixelSize: 15
} }
} }
} }
@ -126,7 +124,7 @@ FluScrollablePage{
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluCarousel{ code:'FluCarousel{
id:carousel id:carousel
width: 400 width: 400

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("CheckBox") title: qsTr("CheckBox")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 72 Layout.preferredHeight: 72
paddings: 10 padding: 10
Layout.topMargin: 20
FluText{ FluText{
text: qsTr("A 2-state CheckBox") text: qsTr("A 2-state CheckBox")
@ -49,16 +48,16 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluCheckBox{ code:'FluCheckBox{
text:"Text" text:"Text"
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 72 Layout.preferredHeight: 72
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluText{ FluText{
@ -104,7 +103,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluCheckBox{ code:'FluCheckBox{
text:"Text" text:"Text"
indeterminate:true indeterminate:true

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Clip") title: qsTr("Clip")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 380
height: 380 padding: 10
paddings: 10
Column{ Column{
spacing: 15 spacing: 15
@ -88,7 +87,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluClip{ code:'FluClip{
radius: [25,25,25,25] radius: [25,25,25,25]
width: 50 width: 50

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("ColorPicker") title: qsTr("ColorPicker")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 60
height: 60 padding: 10
paddings: 10
RowLayout{ RowLayout{
FluText{ FluText{
text: qsTr("Click to Select a Color - >") text: qsTr("Click to Select a Color - >")
@ -33,7 +32,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluColorPicker{ code:'FluColorPicker{
}' }'

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("ComboBox") title: qsTr("ComboBox")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 80 Layout.preferredHeight: 80
paddings: 5 padding: 5
Layout.topMargin: 20
Column{ Column{
spacing: 5 spacing: 5
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -32,10 +31,10 @@ FluScrollablePage{
} }
} }
FluArea { FluFrame {
Layout.fillWidth: true Layout.fillWidth: true
height: 80 Layout.preferredHeight: 80
paddings: 5 padding: 5
Layout.topMargin: 20 Layout.topMargin: 20
Column{ Column{
spacing: 5 spacing: 5
@ -56,10 +55,10 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 80 height: 80
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
Column{ Column{
spacing: 5 spacing: 5
@ -85,7 +84,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluComboBox{ code:'FluComboBox{
editable: true editable: true
model: ListModel { model: ListModel {

View File

@ -7,13 +7,12 @@ import "../component"
FluScrollablePage{ FluScrollablePage{
title: qsTr("TimePicker") title: qsTr("DatePicker")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 80
height: 80 padding: 10
paddings: 10
ColumnLayout{ ColumnLayout{
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -32,17 +31,17 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluDatePicker{ code:'FluDatePicker{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 80 Layout.preferredHeight: 80
paddings: 10 padding: 10
ColumnLayout{ ColumnLayout{
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -61,7 +60,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluDatePicker{ code:'FluDatePicker{
showYear:false showYear:false
}' }'

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Dialog") title: qsTr("Dialog")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20
FluButton{ FluButton{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: qsTr("Show Double Button Dialog") text: qsTr("Show Double Button Dialog")
@ -24,7 +23,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluContentDialog{ code:'FluContentDialog{
id:dialog id:dialog
title: qsTr("Friendly Reminder") title: qsTr("Friendly Reminder")
@ -57,10 +56,10 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluButton{ FluButton{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -72,7 +71,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluContentDialog{ code:'FluContentDialog{
id: dialog id: dialog
title: qsTr("Friendly Reminder") title: qsTr("Friendly Reminder")
@ -114,10 +113,10 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluButton{ FluButton{
anchors.top: parent.top anchors.top: parent.top
@ -138,7 +137,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluContentDialog{ code:'FluContentDialog{
id: dialog id: dialog
title: qsTr("Friendly Reminder") title: qsTr("Friendly Reminder")

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Expander") title: qsTr("Expander")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: layout_column.height+20 height: layout_column.height+20
paddings: 10 padding: 10
Layout.topMargin: 20
Column{ Column{
id:layout_column id:layout_column
spacing: 15 spacing: 15
@ -83,7 +82,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluExpander{ code:'FluExpander{
headerText: qsTr("Open a radio box") headerText: qsTr("Open a radio box")
Item{ Item{

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("FlipView") title: qsTr("FlipView")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 340 Layout.preferredHeight: 340
paddings: 10 padding: 10
Layout.topMargin: 20
ColumnLayout{ ColumnLayout{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
FluText{ FluText{
@ -40,7 +39,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluFlipView{ code:'FluFlipView{
Image{ Image{
source: "qrc:/example/res/image/banner_1.jpg" source: "qrc:/example/res/image/banner_1.jpg"
@ -61,10 +60,10 @@ FluScrollablePage{
' '
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 340 height: 340
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
ColumnLayout{ ColumnLayout{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -93,7 +92,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluFlipView{ code:'FluFlipView{
vertical:true vertical:true
Image{ Image{

View File

@ -0,0 +1,48 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import FluentUI 1.0
import "../component"
FluScrollablePage{
title: qsTr("GroupBox")
FluGroupBox {
title: qsTr("CheckBox Group")
ColumnLayout {
spacing: 10
anchors.fill: parent
FluCheckBox { text: qsTr("E-mail") }
FluCheckBox { text: qsTr("Calendar") }
FluCheckBox { text: qsTr("Contacts") }
}
}
FluGroupBox {
title: qsTr("RadioButton Group")
FluRadioButtons {
spacing: 10
FluRadioButton { text: qsTr("E-mail") }
FluRadioButton { text: qsTr("Calendar") }
FluRadioButton { text: qsTr("Contacts") }
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: 4
code:'FluGroupBox {
title: qsTr("CheckBox Group")
ColumnLayout {
spacing: 10
anchors.fill: parent
FluCheckBox { text: qsTr("E-mail") }
FluCheckBox { text: qsTr("Calendar") }
FluCheckBox { text: qsTr("Contacts") }
}
}'
}
}

View File

@ -9,10 +9,11 @@ import "../global"
FluScrollablePage{ FluScrollablePage{
launchMode: FluPageType.SingleTask launchMode: FluPageType.SingleTask
animDisabled: true animationEnabled: false
header: Item{}
FluentInitalizrWindow{ FluentInitializrWindow{
id:fluent_initalizr id:fluent_Initializr
} }
ListModel{ ListModel{
@ -28,11 +29,11 @@ FluScrollablePage{
} }
ListElement{ ListElement{
icon: "qrc:/example/res/image/favicon.ico" icon: "qrc:/example/res/image/favicon.ico"
title: qsTr("FluentUI Initalizr") title: qsTr("FluentUI Initializr")
desc: qsTr("FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options.") desc: qsTr("FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options.")
url: "https://github.com/zhuzichu520/FluentUI" url: "https://github.com/zhuzichu520/FluentUI"
clicked: function(model){ clicked: function(model){
fluent_initalizr.showDialog() fluent_Initializr.showDialog()
} }
} }
} }
@ -121,6 +122,7 @@ FluScrollablePage{
Layout.leftMargin: 20 Layout.leftMargin: 20
color: FluColors.Grey120 color: FluColors.Grey120
font.pixelSize: 12 font.pixelSize: 12
font.family: FluTextStyle.family
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
} }
} }
@ -177,7 +179,7 @@ FluScrollablePage{
property string desc: modelData.extra.desc property string desc: modelData.extra.desc
width: 320 width: 320
height: 120 height: 120
FluArea{ FluFrame{
radius: 8 radius: 8
width: 300 width: 300
height: 100 height: 100

View File

@ -6,14 +6,13 @@ import FluentUI 1.0
FluContentPage { FluContentPage {
title: qsTr("Awesome") title: qsTr("Icons")
FluTextBox{ FluTextBox{
id:text_box id: text_box
placeholderText: qsTr("Please enter a keyword") placeholderText: qsTr("Please enter a keyword")
anchors{ anchors{
topMargin: 20 top: parent.top
top:parent.top
} }
} }
@ -29,42 +28,45 @@ FluContentPage {
} }
} }
GridView{ GridView{
id:grid_view id: grid_view
cellWidth: 80 cellWidth: 110
cellHeight: 80 cellHeight: 110
clip: true clip: true
boundsBehavior: GridView.StopAtBounds boundsBehavior: GridView.StopAtBounds
model:FluTheme.awesomeList() model:FluTheme.awesomeList()
ScrollBar.vertical: FluScrollBar {} ScrollBar.vertical: FluScrollBar {}
anchors{ anchors{
topMargin: 10 topMargin: 10
top:text_box.bottom top: text_box.bottom
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }
delegate: Item { delegate: Item {
width: 68 width: 100
height: 80 height: 100
FluIconButton{ FluIconButton{
id:item_icon id:item_icon
iconSource:modelData.icon iconSource: modelData.icon
anchors.horizontalCenter: parent.horizontalCenter iconSize: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
bottomPadding: 30
anchors.fill: parent
onClicked: { onClicked: {
var text ="FluentIcons."+modelData.name; var text ="FluentIcons."+modelData.name;
FluTools.clipText(text) FluTools.clipText(text)
showSuccess(qsTr("You Copied ")+text) showSuccess(qsTr("You Copied ")+text)
} }
} FluText{
FluText { width: parent.width
id:item_name horizontalAlignment: Qt.AlignHCenter
font.pixelSize: 10 wrapMode: Text.WrapAnywhere
anchors.horizontalCenter: parent.horizontalCenter text: modelData.name
anchors.top: item_icon.bottom anchors.top: parent.top
width:parent.width anchors.topMargin: 60
wrapMode: Text.WrapAnywhere }
text: modelData.name
horizontalAlignment: Text.AlignHCenter
} }
} }
} }

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Image") title: qsTr("Image")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 260 Layout.preferredHeight: 260
paddings: 10 padding: 10
Layout.topMargin: 20
Column{ Column{
spacing: 15 spacing: 15
anchors{ anchors{
@ -37,7 +36,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluImage{ code:'FluImage{
width: 400 width: 400
height: 300 height: 300

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("InfoBar") title: qsTr("InfoBar")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 270
height: 270 padding: 10
paddings: 10
ColumnLayout{ ColumnLayout{
spacing: 14 spacing: 14
anchors{ anchors{
@ -60,7 +59,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'showInfo(qsTr("This is an InfoBar in the Info Style")) code:'showInfo(qsTr("This is an InfoBar in the Info Style"))
showWarning(qsTr("This is an InfoBar in the Warning Style")) showWarning(qsTr("This is an InfoBar in the Warning Style"))

View File

@ -47,11 +47,10 @@ FluScrollablePage{
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20
Column{ Column{
id: layout_column id: layout_column
spacing: 15 spacing: 15
@ -78,7 +77,7 @@ FluScrollablePage{
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluMenu{ code:'FluMenu{
id:menu id:menu
FluMenuItem:{ FluMenuItem:{
@ -99,10 +98,10 @@ menu.popup()
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
Column{ Column{
spacing: 15 spacing: 15
@ -151,7 +150,7 @@ menu.popup()
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluMenuBar{ code:'FluMenuBar{
id:menu id:menu
FluMenu:{ FluMenu:{

View File

@ -8,23 +8,23 @@ import "../component"
FluScrollablePage{ FluScrollablePage{
property string password: "" property string password: ""
property var loginPageRegister: registerForWindowResult("/login")
title: qsTr("MultiWindow") title: qsTr("MultiWindow")
Connections{ FluWindowResultLauncher{
target: loginPageRegister id:loginResultLauncher
function onResult(data) path: "/login"
{ onResult:
password = data.password (data)=>{
} password = data.password
}
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 86 Layout.preferredHeight: 86
paddings: 10 padding: 10
Layout.topMargin: 20
Column{ Column{
spacing: 15 spacing: 15
anchors{ anchors{
@ -37,16 +37,16 @@ FluScrollablePage{
FluButton{ FluButton{
text: qsTr("Create Window") text: qsTr("Create Window")
onClicked: { onClicked: {
FluApp.navigate("/standardWindow") FluRouter.navigate("/standardWindow")
} }
} }
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 86 Layout.preferredHeight: 86
paddings: 10 padding: 10
Layout.topMargin: 10 Layout.topMargin: 10
Column{ Column{
spacing: 15 spacing: 15
@ -61,16 +61,16 @@ FluScrollablePage{
FluButton{ FluButton{
text: qsTr("Create Window") text: qsTr("Create Window")
onClicked: { onClicked: {
FluApp.navigate("/singleTaskWindow") FluRouter.navigate("/singleTaskWindow")
} }
} }
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 86 Layout.preferredHeight: 86
paddings: 10 padding: 10
Layout.topMargin: 10 Layout.topMargin: 10
Column{ Column{
spacing: 15 spacing: 15
@ -84,14 +84,14 @@ FluScrollablePage{
FluButton{ FluButton{
text: qsTr("Create Window") text: qsTr("Create Window")
onClicked: { onClicked: {
FluApp.navigate("/singleInstanceWindow") FluRouter.navigate("/singleInstanceWindow")
} }
} }
} }
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluWindow{ code:'FluWindow{
//launchMode: FluWindowType.Standard //launchMode: FluWindowType.Standard
//launchMode: FluWindowType.SingleTask //launchMode: FluWindowType.SingleTask
@ -101,10 +101,10 @@ FluScrollablePage{
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
Column{ Column{
spacing: 15 spacing: 15
@ -118,27 +118,27 @@ FluScrollablePage{
FluButton{ FluButton{
text: qsTr("Create Window") text: qsTr("Create Window")
onClicked: { onClicked: {
FluApp.navigate("/about") FluRouter.navigate("/about")
} }
} }
} }
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluButton{ code:'FluButton{
text: qsTr("Create Window") text: qsTr("Create Window")
onClicked: { onClicked: {
FluApp.navigate("/about") FluRouter.navigate("/about")
} }
} }
' '
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 130 Layout.preferredHeight: 130
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
Column{ Column{
@ -153,7 +153,7 @@ FluScrollablePage{
FluButton{ FluButton{
text: qsTr("Create Window") text: qsTr("Create Window")
onClicked: { onClicked: {
loginPageRegister.launch({username:"zhuzichu"}) loginResultLauncher.launch({username:"zhuzichu"})
} }
} }
FluText{ FluText{
@ -163,21 +163,20 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'property var loginPageRegister: registerForWindowResult("/login") code:'FluWindowResultLauncher{
id:loginResultLauncher
Connections{ path: "/login"
target: loginPageRegister onResult:
function onResult(data) (data)=>{
{ password = data.password
password = data.password }
}
} }
FluButton{ FluButton{
text: qsTr("Create Window") text: qsTr("Create Window")
onClicked: { onClicked: {
loginPageRegister.launch({username:"zhuzichu"}) loginResultLauncher.launch({username:"zhuzichu"})
} }
} }
' '

View File

@ -4,6 +4,7 @@ import QtQuick.Window 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import FluentUI 1.0 import FluentUI 1.0
import Qt.labs.platform 1.0 import Qt.labs.platform 1.0
import example 1.0
import "../component" import "../component"
FluContentPage{ FluContentPage{
@ -11,7 +12,7 @@ FluContentPage{
id:root id:root
title: qsTr("Network") title: qsTr("Network")
FluNetworkCallable{ NetworkCallable{
id:callable id:callable
onStart: { onStart: {
showLoading() showLoading()
@ -39,7 +40,6 @@ FluContentPage{
clip: true clip: true
anchors{ anchors{
top: parent.top top: parent.top
topMargin: 20
bottom: parent.bottom bottom: parent.bottom
left: parent.left left: parent.left
} }
@ -56,7 +56,7 @@ FluContentPage{
text: "Get" text: "Get"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.get("https://httpbingo.org/get") Network.get("https://httpbingo.org/get")
.addQuery("name","孙悟空") .addQuery("name","孙悟空")
.addQuery("age",500) .addQuery("age",500)
.addQuery("address","花果山水帘洞") .addQuery("address","花果山水帘洞")
@ -70,7 +70,7 @@ FluContentPage{
text: "Head" text: "Head"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.head("https://httpbingo.org/head") Network.head("https://httpbingo.org/head")
.addQuery("name","孙悟空") .addQuery("name","孙悟空")
.addQuery("age",500) .addQuery("age",500)
.addQuery("address","花果山水帘洞") .addQuery("address","花果山水帘洞")
@ -84,7 +84,7 @@ FluContentPage{
text: "Post Body" text: "Post Body"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postBody("https://httpbingo.org/post") Network.postBody("https://httpbingo.org/post")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空") .setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root) .bind(root)
.go(callable) .go(callable)
@ -96,7 +96,7 @@ FluContentPage{
text: "Post Form" text: "Post Form"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postForm("https://httpbingo.org/post") Network.postForm("https://httpbingo.org/post")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -110,7 +110,7 @@ FluContentPage{
text: "Post JSON" text: "Post JSON"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJson("https://httpbingo.org/post") Network.postJson("https://httpbingo.org/post")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -124,7 +124,7 @@ FluContentPage{
text: "Post JSON Array" text: "Post JSON Array"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJsonArray("https://httpbingo.org/post") Network.postJsonArray("https://httpbingo.org/post")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -138,7 +138,7 @@ FluContentPage{
text: "Put Body" text: "Put Body"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.putBody("https://httpbingo.org/put") Network.putBody("https://httpbingo.org/put")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空") .setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root) .bind(root)
.go(callable) .go(callable)
@ -150,7 +150,7 @@ FluContentPage{
text: "Put Form" text: "Put Form"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.putForm("https://httpbingo.org/put") Network.putForm("https://httpbingo.org/put")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -164,7 +164,7 @@ FluContentPage{
text: "Put JSON" text: "Put JSON"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.putJson("https://httpbingo.org/put") Network.putJson("https://httpbingo.org/put")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -178,7 +178,7 @@ FluContentPage{
text: "Put JSON Array" text: "Put JSON Array"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.putJsonArray("https://httpbingo.org/put") Network.putJsonArray("https://httpbingo.org/put")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -192,7 +192,7 @@ FluContentPage{
text: "Patch Body" text: "Patch Body"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.patchBody("https://httpbingo.org/patch") Network.patchBody("https://httpbingo.org/patch")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空") .setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root) .bind(root)
.go(callable) .go(callable)
@ -204,7 +204,7 @@ FluContentPage{
text: "Patch Form" text: "Patch Form"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.patchForm("https://httpbingo.org/patch") Network.patchForm("https://httpbingo.org/patch")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -218,7 +218,7 @@ FluContentPage{
text: "Patch JSON" text: "Patch JSON"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.patchJson("https://httpbingo.org/patch") Network.patchJson("https://httpbingo.org/patch")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -232,7 +232,7 @@ FluContentPage{
text: "Patch JSON Array" text: "Patch JSON Array"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.patchJsonArray("https://httpbingo.org/patch") Network.patchJsonArray("https://httpbingo.org/patch")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -246,7 +246,7 @@ FluContentPage{
text: "Delete Body" text: "Delete Body"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.deleteBody("https://httpbingo.org/delete") Network.deleteBody("https://httpbingo.org/delete")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空") .setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root) .bind(root)
.go(callable) .go(callable)
@ -258,7 +258,7 @@ FluContentPage{
text: "Delete Form" text: "Delete Form"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.deleteForm("https://httpbingo.org/delete") Network.deleteForm("https://httpbingo.org/delete")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -272,7 +272,7 @@ FluContentPage{
text: "Delete JSON" text: "Delete JSON"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.deleteJson("https://httpbingo.org/delete") Network.deleteJson("https://httpbingo.org/delete")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -286,7 +286,7 @@ FluContentPage{
text: "Delete JSON Array" text: "Delete JSON Array"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.deleteJsonArray("https://httpbingo.org/delete") Network.deleteJsonArray("https://httpbingo.org/delete")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -300,7 +300,7 @@ FluContentPage{
text: "Open Log" text: "Open Log"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJson("https://httpbingo.org/post") Network.postJson("https://httpbingo.org/post")
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -315,7 +315,7 @@ FluContentPage{
text: "Custom Header" text: "Custom Header"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJson("https://httpbingo.org/post") Network.postJson("https://httpbingo.org/post")
.addHeader("os","PC") .addHeader("os","PC")
.addHeader("version","1.0.0") .addHeader("version","1.0.0")
.add("name","孙悟空") .add("name","孙悟空")
@ -331,8 +331,8 @@ FluContentPage{
text: "RequestFailedReadCache" text: "RequestFailedReadCache"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJson("https://httpbingo.org/post") Network.postJson("https://httpbingo.org/post")
.setCacheMode(FluNetworkType.RequestFailedReadCache) .setCacheMode(NetworkType.RequestFailedReadCache)
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -347,8 +347,8 @@ FluContentPage{
text: "IfNoneCacheRequest" text: "IfNoneCacheRequest"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJson("https://httpbingo.org/post") Network.postJson("https://httpbingo.org/post")
.setCacheMode(FluNetworkType.IfNoneCacheRequest) .setCacheMode(NetworkType.IfNoneCacheRequest)
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -363,8 +363,8 @@ FluContentPage{
text: "FirstCacheThenRequest" text: "FirstCacheThenRequest"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJson("https://httpbingo.org/post") Network.postJson("https://httpbingo.org/post")
.setCacheMode(FluNetworkType.FirstCacheThenRequest) .setCacheMode(NetworkType.FirstCacheThenRequest)
.add("name","孙悟空") .add("name","孙悟空")
.add("age",500) .add("age",500)
.add("address","花果山水帘洞") .add("address","花果山水帘洞")
@ -379,7 +379,7 @@ FluContentPage{
text: "Timeout And Retry" text: "Timeout And Retry"
onClicked: { onClicked: {
text_info.text = "" text_info.text = ""
FluNetwork.postJson("https://httpbingo.org/post") Network.postJson("https://httpbingo.org/post")
.setTimeout(5000) .setTimeout(5000)
.setRetry(3) .setRetry(3)
.add("name","孙悟空") .add("name","孙悟空")
@ -407,7 +407,7 @@ FluContentPage{
text: "Download File" text: "Download File"
onClicked: { onClicked: {
folder_dialog.showDialog(function(path){ folder_dialog.showDialog(function(path){
FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4") Network.get("http://vjs.zencdn.net/v/oceans.mp4")
.toDownload(path) .toDownload(path)
.bind(root) .bind(root)
.go(callable_download_file) .go(callable_download_file)
@ -421,7 +421,7 @@ FluContentPage{
text: "Breakpoint Download File" text: "Breakpoint Download File"
onClicked: { onClicked: {
folder_dialog.showDialog(function(path){ folder_dialog.showDialog(function(path){
FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4") Network.get("http://vjs.zencdn.net/v/oceans.mp4")
.toDownload(path,true) .toDownload(path,true)
.bind(root) .bind(root)
.go(callable_breakpoint_download_file) .go(callable_breakpoint_download_file)
@ -431,7 +431,7 @@ FluContentPage{
} }
} }
FluNetworkCallable{ NetworkCallable{
id:callable_upload_file id:callable_upload_file
onStart: { onStart: {
btn_upload.disabled = true btn_upload.disabled = true
@ -455,7 +455,7 @@ FluContentPage{
} }
} }
FluNetworkCallable{ NetworkCallable{
id:callable_download_file id:callable_download_file
onStart: { onStart: {
btn_download.progress = 0 btn_download.progress = 0
@ -480,7 +480,7 @@ FluContentPage{
} }
} }
FluNetworkCallable{ NetworkCallable{
id:callable_breakpoint_download_file id:callable_breakpoint_download_file
onStart: { onStart: {
btn_download_breakpoint.progress = 0 btn_download_breakpoint.progress = 0
@ -508,7 +508,7 @@ FluContentPage{
FileDialog { FileDialog {
id: file_dialog id: file_dialog
onAccepted: { onAccepted: {
FluNetwork.postForm("https://httpbingo.org/post") Network.postForm("https://httpbingo.org/post")
.setRetry(1)//只请求一次 .setRetry(1)//只请求一次
.add("accessToken","12345678") .add("accessToken","12345678")
.addFile("file",FluTools.toLocalPath(file_dialog.currentFile)) .addFile("file",FluTools.toLocalPath(file_dialog.currentFile))
@ -532,7 +532,7 @@ FluContentPage{
} }
} }
FluArea{ FluFrame{
anchors{ anchors{
top: layout_flick.top top: layout_flick.top
bottom: layout_flick.bottom bottom: layout_flick.bottom

View File

@ -0,0 +1,26 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import example 1.0
import "../component"
FluContentPage{
title: qsTr("OpenGL")
FluFrame{
anchors.fill: parent
OpenGLItem{
anchors.fill: parent
SequentialAnimation on t {
NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
loops: Animation.Infinite
running: true
}
}
}
}

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Pagination") title: qsTr("Pagination")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 200 Layout.preferredHeight: 200
paddings: 10 padding: 10
Layout.topMargin: 20
ColumnLayout{ ColumnLayout{
spacing: 20 spacing: 20
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -37,7 +36,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluPagination{ code:'FluPagination{
pageCurrent: 1 pageCurrent: 1
itemCount: 1000 itemCount: 1000

View File

@ -9,13 +9,10 @@ FluScrollablePage{
title: qsTr("Pivot") title: qsTr("Pivot")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 400
height: 400 padding: 10
paddings: 10
FluPivot{ FluPivot{
anchors.fill: parent anchors.fill: parent
@ -49,7 +46,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluPivot{ code:'FluPivot{
anchors.fill: parent anchors.fill: parent
FluPivotItem:{ FluPivotItem:{

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Progress") title: qsTr("Progress")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 130
height: 130 padding: 10
paddings: 10
ColumnLayout{ ColumnLayout{
spacing: 10 spacing: 10
@ -32,7 +31,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluProgressBar{ code:'FluProgressBar{
} }
@ -42,11 +41,11 @@ FluProgressRing{
' '
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 286 Layout.preferredHeight: 286
paddings: 10 padding: 10
ColumnLayout{ ColumnLayout{
spacing: 10 spacing: 10
@ -88,7 +87,7 @@ FluProgressRing{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluProgressBar{ code:'FluProgressBar{
indeterminate: false indeterminate: false
} }

View File

@ -11,7 +11,6 @@ FluScrollablePage{
FluQRCode{ FluQRCode{
id:qrcode id:qrcode
Layout.topMargin: 20
size:slider_size.value size:slider_size.value
text:text_box.text text:text_box.text
color:color_picker.current color:color_picker.current

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("RadioButton") title: qsTr("RadioButton")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20
Row{ Row{
spacing: 30 spacing: 30
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -41,16 +40,16 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluRadioButton{ code:'FluRadioButton{
text:"Text" text:"Text"
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluRadioButtons{ FluRadioButtons{
spacing: 8 spacing: 8
@ -83,7 +82,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluRadioButtons{ code:'FluRadioButtons{
spacing: 8 spacing: 8
FluRadioButton{ FluRadioButton{

View File

@ -9,11 +9,10 @@ FluScrollablePage {
title: qsTr("RatingControl") title: qsTr("RatingControl")
FluArea { FluFrame {
Layout.fillWidth: true Layout.fillWidth: true
height: 100 Layout.preferredHeight: 100
paddings: 10 padding: 10
Layout.topMargin: 20
Column { Column {
spacing: 10 spacing: 10
@ -27,7 +26,7 @@ FluScrollablePage {
CodeExpander { CodeExpander {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code: 'FluRatingControl{ code: 'FluRatingControl{
}' }'

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Rectangle") title: qsTr("Rectangle")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 80
height: 80 padding: 10
paddings: 10
Column{ Column{
spacing: 15 spacing: 15
@ -64,7 +63,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluRectangle{ code:'FluRectangle{
radius: [25,25,25,25] radius: [25,25,25,25]
width: 50 width: 50

View File

@ -9,6 +9,6 @@ FluPage{
launchMode: FluPageType.SingleTop launchMode: FluPageType.SingleTop
FluRemoteLoader{ FluRemoteLoader{
anchors.fill: parent anchors.fill: parent
source: "https://zhu-zichu.gitee.io/Qt5_T_RemoteLoader.qml" source: "https://zhu-zichu.gitee.io/Qt_174_RemoteLoader.qml"
} }
} }

View File

@ -4,38 +4,24 @@ import QtQuick.Window 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import FluentUI 1.0 import FluentUI 1.0
import "../component" import "../component"
import "../viewmodel"
import "../global" import "../global"
FluScrollablePage{ FluScrollablePage{
title: qsTr("Settings") title: qsTr("Settings")
SettingsViewModel{
id:viewmodel_settings
}
FluEvent{ FluEvent{
id:event_checkupdate_finish
name: "checkUpdateFinish" name: "checkUpdateFinish"
onTriggered: { onTriggered: {
btn_checkupdate.loading = false btn_checkupdate.loading = false
} }
} }
Component.onCompleted: { FluFrame{
FluEventBus.registerEvent(event_checkupdate_finish)
}
Component.onDestruction: {
FluEventBus.unRegisterEvent(event_checkupdate_finish)
}
FluArea{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 60 Layout.preferredHeight: 60
paddings: 10 padding: 10
Row{ Row{
spacing: 20 spacing: 20
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -56,11 +42,11 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 50 height: 50
paddings: 10 padding: 10
FluCheckBox{ FluCheckBox{
text: qsTr("Use System AppBar") text: qsTr("Use System AppBar")
checked: FluApp.useSystemAppBar checked: FluApp.useSystemAppBar
@ -72,11 +58,11 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 50 height: 50
paddings: 10 padding: 10
FluCheckBox{ FluCheckBox{
text:qsTr("Fits AppBar Windows") text:qsTr("Fits AppBar Windows")
checked: window.fitsAppBarWindows checked: window.fitsAppBarWindows
@ -95,15 +81,15 @@ FluScrollablePage{
negativeText: qsTr("Cancel") negativeText: qsTr("Cancel")
positiveText: qsTr("OK") positiveText: qsTr("OK")
onPositiveClicked: { onPositiveClicked: {
FluApp.exit(931) FluRouter.exit(931)
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 128 height: 128
paddings: 10 padding: 10
ColumnLayout{ ColumnLayout{
spacing: 5 spacing: 5
@ -129,11 +115,11 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 160 height: 160
paddings: 10 padding: 10
ColumnLayout{ ColumnLayout{
spacing: 5 spacing: 5
@ -149,10 +135,10 @@ FluScrollablePage{
Repeater{ Repeater{
model: [{title:qsTr("Open"),mode:FluNavigationViewType.Open},{title:qsTr("Compact"),mode:FluNavigationViewType.Compact},{title:qsTr("Minimal"),mode:FluNavigationViewType.Minimal},{title:qsTr("Auto"),mode:FluNavigationViewType.Auto}] model: [{title:qsTr("Open"),mode:FluNavigationViewType.Open},{title:qsTr("Compact"),mode:FluNavigationViewType.Compact},{title:qsTr("Minimal"),mode:FluNavigationViewType.Minimal},{title:qsTr("Auto"),mode:FluNavigationViewType.Auto}]
delegate: FluRadioButton{ delegate: FluRadioButton{
checked : viewmodel_settings.displayMode===modelData.mode text: modelData.title
text:modelData.title checked: GlobalModel.displayMode === modelData.mode
clickListener:function(){ clickListener:function(){
viewmodel_settings.displayMode = modelData.mode GlobalModel.displayMode = modelData.mode
} }
} }
} }
@ -169,11 +155,11 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 80 height: 80
paddings: 10 padding: 10
ColumnLayout{ ColumnLayout{
spacing: 10 spacing: 10

View File

@ -0,0 +1,90 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import FluentUI 1.0
import "../component"
FluScrollablePage{
title: qsTr("Sheet")
FluSheet{
id:sheet
title: qsTr("Title")
FluText{
text: qsTr("Some contents...\nSome contents...\nSome contents...")
anchors{
left: parent.left
leftMargin: 10
}
}
}
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 280
padding: 10
Column{
anchors.centerIn: parent
spacing: 10
Row{
spacing: 10
FluButton{
width: 80
height: 30
text: qsTr("top")
onClicked: {
sheet.open(FluSheetType.Top)
}
}
FluButton{
width: 80
height: 30
text: qsTr("right")
onClicked: {
sheet.open(FluSheetType.Right)
}
}
}
Row{
spacing: 10
FluButton{
width: 80
height: 30
text: qsTr("bottom")
onClicked: {
sheet.open(FluSheetType.Bottom)
}
}
FluButton{
width: 80
height: 30
text: qsTr("left")
onClicked: {
sheet.open(FluSheetType.Left)
}
}
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -6
code:'FluSheet{
id:sheet
title: qsTr("Title")
FluText{
text: qsTr("Some contents...")
anchors{
left: parent.left
leftMargin: 10
}
}
}
sheet.open(FluSheetType.Bottom)
'
}
}

View File

@ -9,18 +9,17 @@ FluScrollablePage{
title: qsTr("ShortcutPicker") title: qsTr("ShortcutPicker")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 100
height: 100 padding: 10
paddings: 10
FluShortcutPicker{ FluShortcutPicker{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluShortcutPicker{ code:'FluShortcutPicker{
}' }'

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Slider") title: qsTr("Slider")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 200 Layout.preferredHeight: 200
Layout.topMargin: 20 padding: 10
paddings: 10
Row{ Row{
spacing: 30 spacing: 30
@ -27,18 +26,18 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluSlider{ code:'FluSlider{
value:50 value:50
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 200 Layout.preferredHeight: 200
Layout.topMargin: 20 Layout.topMargin: 20
paddings: 10 padding: 10
Row{ Row{
spacing: 30 spacing: 30
FluRangeSlider{ FluRangeSlider{
@ -51,7 +50,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluRangeSlider{ code:'FluRangeSlider{
orientation: Qt.Vertical orientation: Qt.Vertical
}' }'

View File

@ -13,7 +13,6 @@ FluContentPage{
id:layout_dropdown id:layout_dropdown
anchors{ anchors{
top: parent.top top: parent.top
topMargin: 20
} }
FluText{ FluText{
text:"orientation:" text:"orientation:"

View File

@ -27,7 +27,6 @@ FluContentPage{
Flickable{ Flickable{
id: scroll id: scroll
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 20
boundsBehavior:Flickable.StopAtBounds boundsBehavior:Flickable.StopAtBounds
contentHeight: staggered_view.implicitHeight contentHeight: staggered_view.implicitHeight
clip: true clip: true
@ -43,8 +42,7 @@ FluContentPage{
FluText{ FluText{
color:"#FFFFFF" color:"#FFFFFF"
text:model.index text:model.index
font.bold: true font: FluTextStyle.Title
font.pixelSize: 18
anchors.centerIn: parent anchors.centerIn: parent
} }
} }

View File

@ -9,12 +9,11 @@ FluScrollablePage{
title: qsTr("StatusLayout") title: qsTr("StatusLayout")
FluArea{ FluFrame{
id:layout_actions id:layout_actions
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 50
height: 50 padding: 10
paddings: 10
RowLayout{ RowLayout{
spacing: 14 spacing: 14
FluDropDownButton{ FluDropDownButton{
@ -53,11 +52,11 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 10 Layout.topMargin: 10
height: 380 Layout.preferredHeight: 380
paddings: 10 padding: 10
FluStatusLayout{ FluStatusLayout{
id:status_view id:status_view
anchors.fill: parent anchors.fill: parent
@ -76,7 +75,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluStatusLayout{ code:'FluStatusLayout{
anchors.fill: parent anchors.fill: parent
statusMode: FluStatusLayoutType.Loading statusMode: FluStatusLayoutType.Loading

View File

@ -29,11 +29,10 @@ FluScrollablePage{
newTab() newTab()
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 50
height: 50 padding: 10
paddings: 10
RowLayout{ RowLayout{
spacing: 14 spacing: 14
FluDropDownButton{ FluDropDownButton{
@ -91,11 +90,11 @@ FluScrollablePage{
} }
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 15 Layout.topMargin: 15
height: 400 Layout.preferredHeight: 400
paddings: 10 padding: 10
FluTabView{ FluTabView{
id:tab_view id:tab_view
onNewPressed:{ onNewPressed:{
@ -105,7 +104,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluTabView{ code:'FluTabView{
anchors.fill: parent anchors.fill: parent
Component.onCompleted: { Component.onCompleted: {

View File

@ -159,7 +159,7 @@ FluContentPage{
FluCheckBox{ FluCheckBox{
anchors.centerIn: parent anchors.centerIn: parent
checked: true === options.checked checked: true === options.checked
enableAnimation: false animationEnabled: false
clickListener: function(){ clickListener: function(){
var obj = table_view.getRow(row) var obj = table_view.getRow(row)
obj.checkbox = table_view.customItem(com_checbox,{checked:!options.checked}) obj.checkbox = table_view.customItem(com_checbox,{checked:!options.checked})
@ -239,7 +239,7 @@ FluContentPage{
} }
FluCheckBox{ FluCheckBox{
checked: true === root.seletedAll checked: true === root.seletedAll
enableAnimation: false animationEnabled: false
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
clickListener: function(){ clickListener: function(){
root.seletedAll = !root.seletedAll root.seletedAll = !root.seletedAll
@ -390,7 +390,7 @@ FluContentPage{
} }
} }
FluArea{ FluFrame{
id:layout_controls id:layout_controls
anchors{ anchors{
left: parent.left left: parent.left

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("Text") title: qsTr("Text")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 60
height: 60 padding: 10
paddings: 10
FluCopyableText{ FluCopyableText{
text: qsTr("This is a text that can be copied") text: qsTr("This is a text that can be copied")
@ -23,7 +22,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluCopyableText{ code:'FluCopyableText{
text: qsTr("This is a text that can be copied") text: qsTr("This is a text that can be copied")
}' }'

View File

@ -4,30 +4,20 @@ import QtQuick.Layouts 1.15
import QtQuick.Window 2.15 import QtQuick.Window 2.15
import FluentUI 1.0 import FluentUI 1.0
import "../component" import "../component"
import "../viewmodel"
FluScrollablePage{ FluScrollablePage{
title: qsTr("TextBox") title: qsTr("TextBox")
TextBoxViewModel{ FluFrame{
id:viewModel
}
FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20
FluTextBox{ FluTextBox{
placeholderText: qsTr("Single-line Input Box") placeholderText: qsTr("Single-line Input Box")
disabled: text_box_switch.checked disabled: text_box_switch.checked
cleanEnabled: true cleanEnabled: true
text: viewModel.text1
onTextChanged: {
viewModel.text1 = text
}
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
@ -45,16 +35,16 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluTextBox{ code:'FluTextBox{
placeholderText: qsTr("Single-line Input Box") placeholderText: qsTr("Single-line Input Box")
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluPasswordBox{ FluPasswordBox{
@ -76,26 +66,21 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluPasswordBox{ code:'FluPasswordBox{
placeholderText: qsTr("Please enter your password") placeholderText: qsTr("Please enter your password")
}' }'
} }
FluFrame{
FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 36+multiine_textbox.height Layout.preferredHeight: 36+multiine_textbox.height
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluMultilineTextBox{ FluMultilineTextBox{
id: multiine_textbox id: multiine_textbox
placeholderText: qsTr("Multi-line Input Box") placeholderText: qsTr("Multi-line Input Box")
text:viewModel.text2
onTextChanged: {
viewModel.text2 = text
}
disabled: text_box_multi_switch.checked disabled: text_box_multi_switch.checked
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -114,16 +99,16 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluMultilineTextBox{ code:'FluMultilineTextBox{
placeholderText: qsTr("Multi-line Input Box") placeholderText: qsTr("Multi-line Input Box")
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluAutoSuggestBox{ FluAutoSuggestBox{
placeholderText: qsTr("AutoSuggestBox") placeholderText: qsTr("AutoSuggestBox")
@ -145,16 +130,16 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluAutoSuggestBox{ code:'FluAutoSuggestBox{
placeholderText: qsTr("AutoSuggestBox") placeholderText: qsTr("AutoSuggestBox")
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluSpinBox{ FluSpinBox{
disabled: spin_box_switch.checked disabled: spin_box_switch.checked
@ -174,7 +159,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluSpinBox{ code:'FluSpinBox{
}' }'

View File

@ -11,11 +11,10 @@ FluScrollablePage{
id: root id: root
title: qsTr("Theme") title: qsTr("Theme")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 400
Layout.preferredHeight: 340 padding: 10
paddings: 10
ColumnLayout{ ColumnLayout{
spacing:0 spacing:0
@ -115,16 +114,27 @@ FluScrollablePage{
} }
FluToggleSwitch{ FluToggleSwitch{
Layout.topMargin: 5 Layout.topMargin: 5
checked: FluTheme.enableAnimation checked: FluTheme.animationEnabled
onClicked: { onClicked: {
FluTheme.enableAnimation = !FluTheme.enableAnimation FluTheme.animationEnabled = !FluTheme.animationEnabled
}
}
FluText{
text: qsTr("Open Blur Window")
Layout.topMargin: 20
}
FluToggleSwitch{
Layout.topMargin: 5
checked: FluTheme.blurBehindWindowEnabled
onClicked: {
FluTheme.blurBehindWindowEnabled = !FluTheme.blurBehindWindowEnabled
} }
} }
} }
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluTheme.accentColor = FluColors.Orange code:'FluTheme.accentColor = FluColors.Orange
FluTheme.dark = true FluTheme.dark = true

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("TimePicker") title: qsTr("TimePicker")
launchMode: FluPageType.SingleInstance launchMode: FluPageType.SingleInstance
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.preferredHeight: 80
height: 80 padding: 10
paddings: 10
ColumnLayout{ ColumnLayout{
@ -43,17 +42,17 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluTimePicker{ code:'FluTimePicker{
}' }'
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 80 Layout.preferredHeight: 80
paddings: 10 padding: 10
ColumnLayout{ ColumnLayout{
@ -83,7 +82,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluTimePicker{ code:'FluTimePicker{
hourFormat:FluTimePickerType.HH hourFormat:FluTimePickerType.HH
}' }'

View File

@ -106,7 +106,6 @@ FluScrollablePage{
RowLayout{ RowLayout{
spacing: 20 spacing: 20
Layout.topMargin: 20
FluTextBox{ FluTextBox{
id: text_box id: text_box
text: "Technical testing 2015-09-01" text: "Technical testing 2015-09-01"

View File

@ -9,11 +9,10 @@ FluScrollablePage{
title: qsTr("ToggleSwitch") title: qsTr("ToggleSwitch")
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Layout.topMargin: 20
Row{ Row{
spacing: 30 spacing: 30
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -41,7 +40,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluToggleSwitch{ code:'FluToggleSwitch{
text:"Text" text:"Text"
}' }'

View File

@ -10,15 +10,14 @@ FluScrollablePage{
title: qsTr("Tooltip") title: qsTr("Tooltip")
FluText{ FluText{
Layout.topMargin: 20
text: qsTr("Hover over Tultip and it pops up") text: qsTr("Hover over Tultip and it pops up")
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Column{ Column{
spacing: 5 spacing: 5
@ -41,7 +40,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluIconButton{ code:'FluIconButton{
iconSource:FluentIcons.ChromeCloseContrast iconSource:FluentIcons.ChromeCloseContrast
iconSize: 15 iconSize: 15
@ -53,11 +52,11 @@ FluScrollablePage{
' '
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 68 Layout.preferredHeight: 68
paddings: 10 padding: 10
Column{ Column{
spacing: 5 spacing: 5
@ -84,7 +83,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluButton{ code:'FluButton{
id: button_1 id: button_1
text: qsTr("Delete") text: qsTr("Delete")

View File

@ -18,11 +18,10 @@ FluScrollablePage{
] ]
} }
FluArea{ FluFrame{
Layout.fillWidth: true Layout.fillWidth: true
height: 130 Layout.preferredHeight: 130
paddings: 10 padding: 10
Layout.topMargin: 20
FluFilledButton{ FluFilledButton{
anchors{ anchors{
@ -66,7 +65,7 @@ FluScrollablePage{
} }
CodeExpander{ CodeExpander{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -1 Layout.topMargin: -6
code:'FluTour{ code:'FluTour{
id:tour id:tour
steps:[ steps:[

View File

@ -9,14 +9,34 @@ FluContentPage {
title: qsTr("TreeView") title: qsTr("TreeView")
function treeData(){ function treeData(){
const dig = (path = '0', level = 4) => { const names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"]
function getRandomName(){
var randomIndex = Math.floor(Math.random() * names.length)
return names[randomIndex]
}
const addresses = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
function getRandomAddresses(){
var randomIndex = Math.floor(Math.random() * addresses.length)
return addresses[randomIndex]
}
const avatars = ["qrc:/example/res/svg/avatar_1.svg", "qrc:/example/res/svg/avatar_2.svg", "qrc:/example/res/svg/avatar_3.svg", "qrc:/example/res/svg/avatar_4.svg","qrc:/example/res/svg/avatar_5.svg","qrc:/example/res/svg/avatar_6.svg","qrc:/example/res/svg/avatar_7.svg","qrc:/example/res/svg/avatar_8.svg","qrc:/example/res/svg/avatar_9.svg","qrc:/example/res/svg/avatar_10.svg","qrc:/example/res/svg/avatar_11.svg","qrc:/example/res/svg/avatar_12.svg"]
function getRandomAvatar(){
var randomIndex = Math.floor(Math.random() * avatars.length);
return avatars[randomIndex];
}
const dig = (path = '0', level = 5) => {
const list = []; const list = [];
for (let i = 0; i < 6; i += 1) { for (let i = 0; i < 5; i += 1) {
const key = `${path}-${i}`; const key = `${path}-${i}`;
const treeNode = { const treeNode = {
title: key, title: key,
key, _key: key,
name: getRandomName(),
avatar:tree_view.customItem(com_avatar,{avatar:getRandomAvatar()}),
address: getRandomAddresses()
}; };
if (level > 0) { if (level > 0) {
treeNode.children = dig(key, level - 1); treeNode.children = dig(key, level - 1);
@ -28,100 +48,202 @@ FluContentPage {
return dig(); return dig();
} }
Column{ // Row{
id: layout_column // id: layout_column
spacing: 12 // spacing: 12
width: 300 // width: 340
anchors{ // anchors{
topMargin: 20 // top:parent.top
top:parent.top // left: parent.left
left: parent.left // leftMargin: 10
leftMargin: 10 // bottom:parent.bottom
bottom:parent.bottom // bottomMargin: 20
bottomMargin: 20 // }
} // RowLayout{
// spacing: 10
// FluText{
// text: "cellHeight:"
// Layout.alignment: Qt.AlignVCenter
// }
// FluSlider{
// id: slider_cell_height
// value: 30
// from: 30
// to:100
// }
// }
// RowLayout{
// spacing: 10
// FluText{
// text: "depthPadding:"
// Layout.alignment: Qt.AlignVCenter
// }
// FluSlider{
// id: slider_depth_padding
// value: 15
// from: 15
// to:100
// }
// }
// FluToggleSwitch{
// id: switch_showline
// text:"showLine"
// checked: false
// }
// FluToggleSwitch{
// id: switch_checkable
// text:"checkable"
// checked: false
// }
// FluButton{
// text: "all expand"
// onClicked: {
// tree_view.allExpand()
// }
// }
// FluButton{
// text: "all collapse"
// onClicked: {
// tree_view.allCollapse()
// }
// }
// }
FluText{ Component{
text: qsTr("Total %1 data, %2 data currently displayed").arg(tree_view.count()).arg(tree_view.visibleCount()) id:com_avatar
} Item{
FluClip{
FluText{ anchors.centerIn: parent
text: qsTr("A total of %1 data items are selected").arg(tree_view.selectionModel().length) width: height
} height: parent.height/3*2
radius: [height/2,height/2,height/2,height/2]
RowLayout{ Image{
spacing: 10 anchors.fill: parent
FluText{ source: {
text: "cellHeight:" if(options && options.avatar){
Layout.alignment: Qt.AlignVCenter return options.avatar
} }
FluSlider{ return ""
id: slider_cell_height }
value: 30 sourceSize: Qt.size(80,80)
from: 30 }
to:100
}
}
RowLayout{
spacing: 10
FluText{
text: "depthPadding:"
Layout.alignment: Qt.AlignVCenter
}
FluSlider{
id: slider_depth_padding
value: 30
from: 30
to:100
}
}
FluToggleSwitch{
id: switch_showline
text:"showLine"
checked: false
}
FluToggleSwitch{
id: switch_draggable
text:"draggable"
checked: false
}
FluToggleSwitch{
id: switch_checkable
text:"checkable"
checked: false
}
FluButton{
text: "all expand"
onClicked: {
tree_view.allExpand()
}
}
FluButton{
text: "all collapse"
onClicked: {
tree_view.allCollapse()
} }
} }
} }
FluArea{ FluFrame{
id:layout_controls
anchors{ anchors{
left: layout_column.right left: parent.left
right: parent.right
top: parent.top top: parent.top
topMargin: 10
}
height: 80
clip: true
Row{
spacing: 12
anchors{
left: parent.left
leftMargin: 10
verticalCenter: parent.verticalCenter
}
Column{
anchors.verticalCenter: parent.verticalCenter
RowLayout{
spacing: 10
FluText{
text: "cellHeight:"
Layout.alignment: Qt.AlignVCenter
}
FluSlider{
id: slider_cell_height
value: 38
from: 38
to:100
}
}
RowLayout{
spacing: 10
FluText{
text: "depthPadding:"
Layout.alignment: Qt.AlignVCenter
}
FluSlider{
id: slider_depth_padding
value: 15
from: 15
to:100
}
}
}
Column{
spacing: 8
anchors.verticalCenter: parent.verticalCenter
FluToggleSwitch{
id: switch_showline
text:"showLine"
checked: false
}
FluToggleSwitch{
id: switch_checkable
text:"checkable"
checked: false
}
}
Column{
spacing: 8
anchors.verticalCenter: parent.verticalCenter
FluButton{
text: "all expand"
onClicked: {
tree_view.allExpand()
}
}
FluButton{
text: "all collapse"
onClicked: {
tree_view.allCollapse()
}
}
}
}
}
FluFrame{
anchors{
left: parent.left
top: layout_controls.bottom
topMargin: 10
bottom: parent.bottom bottom: parent.bottom
right: parent.right right: parent.right
rightMargin: 5
topMargin: 5
bottomMargin: 5
} }
FluShadow{}
FluTreeView{ FluTreeView{
id:tree_view id:tree_view
anchors.fill: parent anchors.fill: parent
cellHeight: slider_cell_height.value cellHeight: slider_cell_height.value
draggable:switch_draggable.checked
showLine: switch_showline.checked showLine: switch_showline.checked
checkable:switch_checkable.checked checkable:switch_checkable.checked
depthPadding: slider_depth_padding.value depthPadding: slider_depth_padding.value
columnSource:[
{
title: qsTr("Title"),
dataIndex: 'title',
width: 300
},{
title: qsTr("Name"),
dataIndex: 'name',
width: 100
},{
title: qsTr("Avatar"),
dataIndex: 'avatar',
width: 100
},{
title: qsTr("Address"),
dataIndex: 'address',
width: 200
},
]
Component.onCompleted: { Component.onCompleted: {
var data = treeData() var data = treeData()
dataSource = data dataSource = data

View File

@ -10,15 +10,14 @@ FluContentPage {
title: qsTr("Typography") title: qsTr("Typography")
rightPadding: 10 rightPadding: 10
FluArea{ FluFrame{
anchors{ anchors{
top:parent.top top:parent.top
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
topMargin: 20
} }
paddings: 10 padding: 10
ColumnLayout{ ColumnLayout{
spacing: 0 spacing: 0
scale: textScale scale: textScale

View File

@ -9,9 +9,8 @@ FluContentPage{
title: qsTr("Watermark") title: qsTr("Watermark")
FluArea{ FluFrame{
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 20
ColumnLayout{ ColumnLayout{
anchors{ anchors{

View File

@ -1,14 +0,0 @@
import QtQuick 2.15
import FluentUI 1.0
FluViewModel{
objectName: "SettingsViewModel"
scope: FluViewModelType.Application
property int displayMode
onInitData: {
displayMode = FluNavigationViewType.Auto
}
}

View File

@ -1,8 +0,0 @@
import QtQuick 2.15
import FluentUI 1.0
FluViewModel {
objectName: "TextBoxView"
property string text1
property string text2
}

View File

@ -31,7 +31,7 @@ FluWindow {
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
FluApp.navigate("/") FluRouter.navigate("/")
} }
} }
} }

View File

@ -71,7 +71,7 @@ FluWindow {
FluFilledButton{ FluFilledButton{
text: qsTr("Restart Program") text: qsTr("Restart Program")
onClicked: { onClicked: {
FluApp.exit(931) FluRouter.exit(931)
} }
} }
} }

View File

@ -8,14 +8,14 @@ import "../component"
FluWindowDialog { FluWindowDialog {
id:window id:window
title:qsTr("FluentUI Initalizr") title:qsTr("FluentUI Initializr")
width: 600 width: 600
height: 400 height: 400
contentDelegate:Component{ contentDelegate:Component{
Item{ Item{
Connections{ Connections{
target: InitalizrHelper target: InitializrHelper
function onError(message){ function onError(message){
showError(message) showError(message)
} }
@ -27,7 +27,7 @@ FluWindowDialog {
FluText{ FluText{
id:text_title id:text_title
text:qsTr("FluentUI Initalizr") text:qsTr("FluentUI Initializr")
font: FluTextStyle.Title font: FluTextStyle.Title
anchors{ anchors{
left: parent.left left: parent.left
@ -102,7 +102,7 @@ FluWindowDialog {
width: 120 width: 120
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: { onClicked: {
InitalizrHelper.generate(text_box_name.text,text_box_path.text) InitializrHelper.generate(text_box_name.text,text_box_path.text)
} }
} }
} }

View File

@ -20,7 +20,7 @@ FluWindow {
loader.reload() loader.reload()
} }
} }
FluArea{ FluFrame{
anchors.fill: parent anchors.fill: parent
FluRemoteLoader{ FluRemoteLoader{
id:loader id:loader
@ -41,7 +41,7 @@ FluWindow {
} }
FluText{ FluText{
text: qsTr("Drag in a qml file") text: qsTr("Drag in a qml file")
font.pixelSize: 26 font: FluTextStyle.Title
anchors.centerIn: parent anchors.centerIn: parent
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusLayoutType.Success visible: !loader.itemLodaer().item && loader.statusMode === FluStatusLayoutType.Success
} }

View File

@ -51,7 +51,7 @@ FluWindow {
showError(qsTr("Please feel free to enter a password")) showError(qsTr("Please feel free to enter a password"))
return return
} }
onResult({password:textbox_password.text}) setResult({password:textbox_password.text})
window.close() window.close()
} }
} }

View File

@ -7,7 +7,6 @@ import Qt.labs.platform 1.1
import FluentUI 1.0 import FluentUI 1.0
import example 1.0 import example 1.0
import "../component" import "../component"
import "../viewmodel"
import "../global" import "../global"
FluWindow { FluWindow {
@ -29,37 +28,23 @@ FluWindow {
z:7 z:7
} }
SettingsViewModel{
id:viewmodel_settings
}
FluEvent{ FluEvent{
id:event_checkupdate
name: "checkUpdate" name: "checkUpdate"
onTriggered: { onTriggered: {
checkUpdate(false) checkUpdate(false)
} }
} }
onFirstVisible: { onLazyLoad: {
timer_tour_delay.restart() tour.open()
}
Timer{
id:timer_tour_delay
interval: 200
onTriggered: {
tour.open()
}
} }
Component.onCompleted: { Component.onCompleted: {
checkUpdate(true) checkUpdate(true)
FluEventBus.registerEvent(event_checkupdate)
} }
Component.onDestruction: { Component.onDestruction: {
FluEventBus.unRegisterEvent(event_checkupdate) FluRouter.exit()
} }
SystemTrayIcon { SystemTrayIcon {
@ -71,7 +56,7 @@ FluWindow {
MenuItem { MenuItem {
text: "退出" text: "退出"
onTriggered: { onTriggered: {
FluApp.exit() FluRouter.exit()
} }
} }
} }
@ -106,7 +91,7 @@ FluWindow {
positiveText: qsTr("Quit") positiveText: qsTr("Quit")
neutralText: qsTr("Cancel") neutralText: qsTr("Cancel")
onPositiveClicked:{ onPositiveClicked:{
FluApp.exit(0) FluRouter.exit(0)
} }
} }
@ -116,9 +101,9 @@ FluWindow {
width: 186 width: 186
FluMenuItem{ FluMenuItem{
text: qsTr("Open in Separate Window") text: qsTr("Open in Separate Window")
font.pixelSize: 12 font: FluTextStyle.Caption
onClicked: { onClicked: {
FluApp.navigate("/pageWindow",{title:modelData.title,url:modelData.url}) FluRouter.navigate("/pageWindow",{title:modelData.title,url:modelData.url})
} }
} }
} }
@ -175,14 +160,14 @@ FluWindow {
} }
} }
Component.onCompleted: { Component.onCompleted: {
appBar.setHitTestVisible(layout_back_buttons) window.setHitTestVisible(layout_back_buttons)
} }
} }
FluRemoteLoader{ FluRemoteLoader{
id:loader id:loader
lazy: true lazy: true
anchors.fill: parent anchors.fill: parent
source: "https://zhu-zichu.gitee.io/Qt_168_LieflatPage.qml" source: "https://zhu-zichu.gitee.io/Qt_174_LieflatPage.qml"
} }
} }
front: Item{ front: Item{
@ -197,7 +182,7 @@ FluWindow {
z:999 z:999
//Stack模式每次切换都会将页面压入栈中随着栈的页面增多消耗的内存也越多内存消耗多就会卡顿这时候就需要按返回将页面pop掉释放内存。该模式可以配合FluPage中的launchMode属性设置页面的启动模式 //Stack模式每次切换都会将页面压入栈中随着栈的页面增多消耗的内存也越多内存消耗多就会卡顿这时候就需要按返回将页面pop掉释放内存。该模式可以配合FluPage中的launchMode属性设置页面的启动模式
// pageMode: FluNavigationViewType.Stack // pageMode: FluNavigationViewType.Stack
//NoStack模式每次切换都会销毁之前的页面然后创建一个新的页面只需消耗少量内存可以配合FluViewModel保存页面数据推荐 //NoStack模式每次切换都会销毁之前的页面然后创建一个新的页面只需消耗少量内存
pageMode: FluNavigationViewType.NoStack pageMode: FluNavigationViewType.NoStack
items: ItemsOriginal items: ItemsOriginal
footerItems:ItemsFooter footerItems:ItemsFooter
@ -207,7 +192,7 @@ FluWindow {
} }
return FluTools.isMacos() ? 20 : 0 return FluTools.isMacos() ? 20 : 0
} }
displayMode:viewmodel_settings.displayMode displayMode: GlobalModel.displayMode
logo: "qrc:/example/res/image/favicon.ico" logo: "qrc:/example/res/image/favicon.ico"
title:"FluentUI" title:"FluentUI"
onLogoClicked:{ onLogoClicked:{
@ -233,9 +218,9 @@ FluWindow {
ItemsOriginal.paneItemMenu = nav_item_right_menu ItemsOriginal.paneItemMenu = nav_item_right_menu
ItemsFooter.navigationView = nav_view ItemsFooter.navigationView = nav_view
ItemsFooter.paneItemMenu = nav_item_right_menu ItemsFooter.paneItemMenu = nav_item_right_menu
appBar.setHitTestVisible(nav_view.buttonMenu) window.setHitTestVisible(nav_view.buttonMenu)
appBar.setHitTestVisible(nav_view.buttonBack) window.setHitTestVisible(nav_view.buttonBack)
appBar.setHitTestVisible(nav_view.imageLogo) window.setHitTestVisible(nav_view.imageLogo)
setCurrentIndex(0) setCurrentIndex(0)
} }
} }
@ -268,7 +253,7 @@ FluWindow {
} }
function handleDarkChanged(button){ function handleDarkChanged(button){
if(!FluTheme.enableAnimation || window.fitsAppBarWindows === false){ if(!FluTheme.animationEnabled || window.fitsAppBarWindows === false){
changeDark() changeDark()
}else{ }else{
if(loader_reveal.sourceComponent){ if(loader_reveal.sourceComponent){
@ -355,11 +340,11 @@ FluWindow {
} }
} }
FluNetworkCallable{ NetworkCallable{
id:callable id:callable
property bool silent: true property bool silent: true
onStart: { onStart: {
console.debug("satrt check update...") console.debug("start check update...")
} }
onFinish: { onFinish: {
console.debug("check update finish") console.debug("check update finish")
@ -391,7 +376,7 @@ FluWindow {
function checkUpdate(silent){ function checkUpdate(silent){
callable.silent = silent callable.silent = silent
FluNetwork.get("https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest") Network.get("https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest")
.go(callable) .go(callable)
} }
} }

View File

@ -16,7 +16,7 @@ FluWindow {
onInitArgument: onInitArgument:
(arg)=>{ (arg)=>{
window.title = arg.title window.title = arg.title
loader.setSource( arg.url,{animDisabled:true}) loader.setSource(arg.url,{animationEnabled:false})
} }
FluLoader{ FluLoader{
id: loader id: loader

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 MiB

View File

@ -4,14 +4,14 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import FluentUI 1.0 import FluentUI 1.0
Item { FluLauncher {
id: app id: app
Component.onCompleted: { Component.onCompleted: {
FluApp.init(app) FluApp.init(app)
FluApp.windowIcon = "qrc:/logo.ico" FluApp.windowIcon = "qrc:/logo.ico"
FluApp.routes = { FluRouter.routes = {
"/":"qrc:/main.qml", "/":"qrc:/main.qml",
} }
FluApp.navigate("/") FluRouter.navigate("/")
} }
} }

View File

@ -98,7 +98,7 @@ if (CMAKE_BUILD_TYPE MATCHES "Release")
add_custom_target(Script-DeployRelease add_custom_target(Script-DeployRelease
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.exe -qmldir=${CMAKE_CURRENT_LIST_DIR} COMMAND ${QT_DEPLOY_QT} --qmldir=${CMAKE_CURRENT_LIST_DIR} --plugindir ${CMAKE_SOURCE_DIR}/dist/plugins --no-translations --compiler-runtime ${CMAKE_SOURCE_DIR}/dist/${PROJECT_NAME}.exe
COMMENT "Windows Deploying Qt Dependencies After Build........." COMMENT "Windows Deploying Qt Dependencies After Build........."
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}

View File

@ -1,17 +1,15 @@
#include "AppInfo.h" #include "AppInfo.h"
#include <QQmlContext> #include <QQmlContext>
#include <QDebug>
#include <QGuiApplication> #include <QGuiApplication>
#include "Version.h" #include "Version.h"
AppInfo::AppInfo(QObject *parent) AppInfo::AppInfo(QObject *parent)
: QObject{parent} : QObject{parent} {
{
version(APPLICATION_VERSION); version(APPLICATION_VERSION);
} }
void AppInfo::testCrash(){ [[maybe_unused]] void AppInfo::testCrash() {
auto *crash = reinterpret_cast<volatile int *>(0); auto *crash = reinterpret_cast<volatile int *>(0);
*crash = 0; *crash = 0;
} }

View File

@ -1,20 +1,18 @@
#ifndef APPINFO_H #pragma once
#define APPINFO_H
#include <QObject> #include <QObject>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include "stdafx.h" #include "stdafx.h"
#include "singleton.h" #include "singleton.h"
class AppInfo : public QObject class AppInfo : public QObject {
{ Q_OBJECT
Q_OBJECT Q_PROPERTY_AUTO(QString, version)
Q_PROPERTY_AUTO(QString,version)
private: private:
explicit AppInfo(QObject *parent = nullptr); explicit AppInfo(QObject *parent = nullptr);
public:
SINGLETON(AppInfo)
Q_INVOKABLE void testCrash();
};
#endif // APPINFO_H public:
SINGLETON(AppInfo)
[[maybe_unused]] Q_INVOKABLE void testCrash();
};

View File

@ -1,5 +1,4 @@
#ifndef APP_DUMP_H #pragma once
#define APP_DUMP_H
#include <Windows.h> #include <Windows.h>
#include <DbgHelp.h> #include <DbgHelp.h>
@ -12,71 +11,69 @@
#pragma comment(lib, "Dbghelp.lib") #pragma comment(lib, "Dbghelp.lib")
static void miniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam){ static void
typedef HRESULT (WINAPI* MiniDumpWriteDumpPtr)(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam); miniDumpWriteDump(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam) {
typedef HRESULT (WINAPI *MiniDumpWriteDumpPtr)(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
HMODULE module = LoadLibraryW(L"Dbghelp.dll"); HMODULE module = LoadLibraryW(L"Dbghelp.dll");
if (module) if (module) {
{
MiniDumpWriteDumpPtr mini_dump_write_dump; MiniDumpWriteDumpPtr mini_dump_write_dump;
mini_dump_write_dump= reinterpret_cast<MiniDumpWriteDumpPtr>(GetProcAddress(module, "MiniDumpWriteDump")); mini_dump_write_dump = reinterpret_cast<MiniDumpWriteDumpPtr>(GetProcAddress(module, "MiniDumpWriteDump"));
if (mini_dump_write_dump) if (mini_dump_write_dump) {
{ mini_dump_write_dump(hProcess, ProcessId, hFile, static_cast<MINIDUMP_TYPE>(80), ExceptionParam, nullptr, CallbackParam);
mini_dump_write_dump(hProcess,ProcessId,hFile,DumpType,ExceptionParam,UserStreamParam,CallbackParam);
} }
} }
} }
BOOL CALLBACK MyMiniDumpCallback(PVOID, const PMINIDUMP_CALLBACK_INPUT input, PMINIDUMP_CALLBACK_OUTPUT output) { BOOL CALLBACK MyMiniDumpCallback(PVOID, const PMINIDUMP_CALLBACK_INPUT input, PMINIDUMP_CALLBACK_OUTPUT output) {
if (input == NULL || output == NULL) if (input == nullptr || output == nullptr)
return FALSE; return FALSE;
BOOL ret = FALSE; BOOL ret = FALSE;
switch (input->CallbackType) { switch (input->CallbackType) {
case IncludeModuleCallback: case IncludeModuleCallback:
case IncludeThreadCallback: case IncludeThreadCallback:
case ThreadCallback: case ThreadCallback:
case ThreadExCallback: case ThreadExCallback:
ret = TRUE; ret = TRUE;
break; break;
case ModuleCallback: { case ModuleCallback: {
if (!(output->ModuleWriteFlags & ModuleReferencedByMemory)) { if (!(output->ModuleWriteFlags & ModuleReferencedByMemory)) {
output->ModuleWriteFlags &= ~ModuleWriteModule; output->ModuleWriteFlags &= ~ModuleWriteModule;
}
ret = TRUE;
} }
ret = TRUE; break;
} break; default:
default: break;
break;
} }
return ret; return ret;
} }
void WriteDump(EXCEPTION_POINTERS* exp, const std::wstring& path) { void WriteDump(EXCEPTION_POINTERS *exp, const std::wstring &path) {
HANDLE h = ::CreateFileW(path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE h = ::CreateFileW(path.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
MINIDUMP_EXCEPTION_INFORMATION info; MINIDUMP_EXCEPTION_INFORMATION info;
info.ThreadId = ::GetCurrentThreadId(); info.ThreadId = ::GetCurrentThreadId();
info.ExceptionPointers = exp; info.ExceptionPointers = exp;
info.ClientPointers = FALSE; info.ClientPointers = FALSE;
MINIDUMP_CALLBACK_INFORMATION mci; MINIDUMP_CALLBACK_INFORMATION mci;
mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MyMiniDumpCallback; mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE) MyMiniDumpCallback;
mci.CallbackParam = 0; mci.CallbackParam = nullptr;
MINIDUMP_TYPE mdt = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory); miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, &info, &mci);
miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), h, mdt, &info, NULL, &mci);
::CloseHandle(h); ::CloseHandle(h);
} }
LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS* exp) { LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS *exp) {
const QString dumpFileName = QString("%1_%2.dmp").arg("crash",QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss")); const QString dumpFileName = QString("%1_%2.dmp").arg("crash", QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss"));
const QString dumpDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)+"/dmp"; const QString dumpDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/dmp";
const QDir dumpDir(dumpDirPath); const QDir dumpDir(dumpDirPath);
if(!dumpDir.exists()){ if (!dumpDir.exists()) {
dumpDir.mkpath(dumpDirPath); dumpDir.mkpath(dumpDirPath);
} }
QString dumpFilePath = dumpDir.filePath(dumpFileName); QString dumpFilePath = dumpDir.filePath(dumpFileName);
WriteDump(exp, dumpFilePath.toStdWString()); WriteDump(exp, dumpFilePath.toStdWString());
QStringList arguments; QStringList arguments;
arguments << "-crashed=" + dumpFilePath; arguments << "-crashed=" + dumpFilePath;
QProcess::startDetached(qApp->applicationFilePath(), arguments); QProcess::startDetached(QGuiApplication::applicationFilePath(), arguments);
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }
#endif // APP_DUMP_H

View File

@ -3,43 +3,43 @@
#include <QQuickItemGrabResult> #include <QQuickItemGrabResult>
#include <QPainterPath> #include <QPainterPath>
CircularReveal::CircularReveal(QQuickItem* parent) : QQuickPaintedItem(parent) CircularReveal::CircularReveal(QQuickItem *parent) : QQuickPaintedItem(parent) {
{ _target = nullptr;
_radius = 0;
_anim = new QPropertyAnimation(this, "radius", this); _anim = new QPropertyAnimation(this, "radius", this);
setVisible(false);
_anim->setDuration(333); _anim->setDuration(333);
_anim->setEasingCurve(QEasingCurve::OutCubic); _anim->setEasingCurve(QEasingCurve::OutCubic);
connect(_anim, &QPropertyAnimation::finished,this,[=](){ setVisible(false);
connect(_anim, &QPropertyAnimation::finished, this, [=]() {
update(); update();
setVisible(false); setVisible(false);
Q_EMIT animationFinished(); Q_EMIT animationFinished();
}); });
connect(this,&CircularReveal::radiusChanged,this,[=](){ connect(this, &CircularReveal::radiusChanged, this, [=]() {
update(); update();
}); });
} }
void CircularReveal::paint(QPainter* painter) void CircularReveal::paint(QPainter *painter) {
{
painter->save(); painter->save();
painter->drawImage(QRect(0, 0, static_cast<int>(width()), static_cast<int>(height())), _source); painter->drawImage(QRect(0, 0, static_cast<int>(width()), static_cast<int>(height())), _source);
QPainterPath path; QPainterPath path;
path.moveTo(_center.x(),_center.y()); path.moveTo(_center.x(), _center.y());
path.addEllipse(QPointF(_center.x(),_center.y()), _radius, _radius); path.addEllipse(QPointF(_center.x(), _center.y()), _radius, _radius);
painter->setCompositionMode(QPainter::CompositionMode_Clear); painter->setCompositionMode(QPainter::CompositionMode_Clear);
painter->fillPath(path, Qt::black); painter->fillPath(path, Qt::black);
painter->restore(); painter->restore();
} }
void CircularReveal::start(int w,int h,const QPoint& center,int radius){ [[maybe_unused]] void CircularReveal::start(int w, int h, const QPoint &center, int radius) {
_anim->setStartValue(0); _anim->setStartValue(0);
_anim->setEndValue(radius); _anim->setEndValue(radius);
_center = center; _center = center;
_grabResult = _target->grabToImage(QSize(w,h)); _grabResult = _target->grabToImage(QSize(w, h));
connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &CircularReveal::handleGrabResult); connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &CircularReveal::handleGrabResult);
} }
void CircularReveal::handleGrabResult(){ void CircularReveal::handleGrabResult() {
_grabResult.data()->image().swap(_source); _grabResult.data()->image().swap(_source);
update(); update();
setVisible(true); setVisible(true);

View File

@ -1,5 +1,4 @@
#ifndef CIRCULARREVEAL_H #pragma once
#define CIRCULARREVEAL_H
#include <QQuickItem> #include <QQuickItem>
#include <QQuickPaintedItem> #include <QQuickPaintedItem>
@ -7,23 +6,26 @@
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include "src/stdafx.h" #include "src/stdafx.h"
class CircularReveal : public QQuickPaintedItem class CircularReveal : public QQuickPaintedItem {
{ Q_OBJECT
Q_OBJECT Q_PROPERTY_AUTO_P(QQuickItem*, target)
Q_PROPERTY_AUTO(QQuickItem*,target) Q_PROPERTY_AUTO(int, radius)
Q_PROPERTY_AUTO(int,radius)
public: public:
CircularReveal(QQuickItem* parent = nullptr); explicit CircularReveal(QQuickItem *parent = nullptr);
void paint(QPainter* painter) override;
Q_INVOKABLE void start(int w,int h,const QPoint& center,int radius); void paint(QPainter *painter) override;
Q_INVOKABLE [[maybe_unused]] void start(int w, int h, const QPoint &center, int radius);
Q_SIGNAL void imageChanged(); Q_SIGNAL void imageChanged();
Q_SIGNAL void animationFinished(); Q_SIGNAL void animationFinished();
Q_SLOT void handleGrabResult(); Q_SLOT void handleGrabResult();
private: private:
QPropertyAnimation* _anim = nullptr; QPropertyAnimation *_anim = nullptr;
QImage _source; QImage _source;
QPoint _center; QPoint _center;
QSharedPointer<QQuickItemGrabResult> _grabResult; QSharedPointer<QQuickItemGrabResult> _grabResult;
}; };
#endif // CIRCULARREVEAL_H

View File

@ -1,24 +1,23 @@
#include "FileWatcher.h" #include "FileWatcher.h"
FileWatcher::FileWatcher(QObject *parent) FileWatcher::FileWatcher(QObject *parent) : QObject{parent} {
: QObject{parent} connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path) {
{
connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){
Q_EMIT fileChanged(); Q_EMIT fileChanged();
clean(); clean();
_watcher.addPath(_path); _watcher.addPath(_path);
}); });
connect(this,&FileWatcher::pathChanged,this,[=](){ connect(this, &FileWatcher::pathChanged, this, [=]() {
clean(); clean();
_watcher.addPath(_path.replace("file:///","")); _watcher.addPath(_path.replace("file:///", ""));
}); });
if(!_path.isEmpty()){ if (!_path.isEmpty()) {
_watcher.addPath(_path); _watcher.addPath(_path);
} }
} }
void FileWatcher::clean(){ void FileWatcher::clean() {
foreach (const QString &item, _watcher.files()) { for (int i = 0; i <= _watcher.files().size() - 1; ++i) {
auto item = _watcher.files().at(i);
_watcher.removePath(item); _watcher.removePath(item);
} }
} }

View File

@ -1,22 +1,21 @@
#ifndef FILEWATCHER_H #pragma once
#define FILEWATCHER_H
#include <QObject> #include <QObject>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QtQml/qqml.h> #include <QtQml/qqml.h>
#include "src/stdafx.h" #include "src/stdafx.h"
class FileWatcher : public QObject class FileWatcher : public QObject {
{ Q_OBJECT
Q_OBJECT Q_PROPERTY_AUTO(QString, path);
Q_PROPERTY_AUTO(QString,path);
public: public:
explicit FileWatcher(QObject *parent = nullptr); explicit FileWatcher(QObject *parent = nullptr);
Q_SIGNAL void fileChanged(); Q_SIGNAL void fileChanged();
private: private:
void clean(); void clean();
private: private:
QFileSystemWatcher _watcher; QFileSystemWatcher _watcher;
}; };
#endif // FILEWATCHER_H

View File

@ -3,16 +3,16 @@
#include <QTimer> #include <QTimer>
#include <QQuickWindow> #include <QQuickWindow>
FpsItem::FpsItem() FpsItem::FpsItem() {
{ _fps = 0;
QTimer *timer = new QTimer(this); auto *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [this]{ connect(timer, &QTimer::timeout, this, [this] {
fps(_frameCount); fps(_frameCount);
_frameCount = 0; _frameCount = 0;
}); });
connect(this, &QQuickItem::windowChanged, this, [this]{ connect(this, &QQuickItem::windowChanged, this, [this] {
if (window()){ if (window()) {
connect(window(), &QQuickWindow::afterRendering, this, [this]{ _frameCount++; }, Qt::DirectConnection); connect(window(), &QQuickWindow::afterRendering, this, [this] { _frameCount++; }, Qt::DirectConnection);
} }
}); });
timer->start(1000); timer->start(1000);

View File

@ -1,19 +1,15 @@
#ifndef FPSITEM_H #pragma once
#define FPSITEM_H
#include <QQuickItem> #include <QQuickItem>
#include "src/stdafx.h" #include "src/stdafx.h"
class FpsItem : public QQuickItem class FpsItem : public QQuickItem {
{ Q_OBJECT
Q_OBJECT Q_PROPERTY_AUTO(int, fps)
Q_PROPERTY_AUTO(int,fps)
public: public:
FpsItem(); FpsItem();
private: private:
int _frameCount = 0; int _frameCount = 0;
}; };
#endif // FPSITEM_H

View File

@ -0,0 +1,93 @@
#include "OpenGLItem.h"
#include <QOpenGLFramebufferObjectFormat>
#include <QOpenGLShaderProgram>
class FBORenderer : public QQuickFramebufferObject::Renderer, protected QOpenGLFunctions {
public:
explicit FBORenderer(const OpenGLItem *item);
void render() override;
QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override;
QOpenGLShaderProgram program;
const OpenGLItem *item = nullptr;
};
FBORenderer::FBORenderer(const OpenGLItem *item) {
this->item = item;
initializeOpenGLFunctions();
program.addCacheableShaderFromSourceCode(QOpenGLShader::Vertex,
"attribute highp vec4 vertices;"
"varying highp vec2 coords;"
"void main() {"
" gl_Position = vertices;"
" coords = vertices.xy;"
"}");
program.addCacheableShaderFromSourceCode(QOpenGLShader::Fragment,
"uniform lowp float t;"
"varying highp vec2 coords;"
"void main() {"
" lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));"
" i = smoothstep(t - 0.8, t + 0.8, i);"
" i = floor(i * 20.) / 20.;"
" gl_FragColor = vec4(coords * .5 + .5, i, i);"
"}");
program.bindAttributeLocation("vertices", 0);
program.link();
}
QOpenGLFramebufferObject *FBORenderer::createFramebufferObject(const QSize &size) {
QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setSamples(4);
return new QOpenGLFramebufferObject(size, format);
}
void FBORenderer::render() {
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
program.bind();
program.enableAttributeArray(0);
float values[] = {
-1, -1,
1, -1,
-1, 1,
1, 1
};
glBindBuffer(GL_ARRAY_BUFFER, 0);
program.setAttributeArray(0, GL_FLOAT, values, 2);
program.setUniformValue("t", (float) item->t());
glViewport(0, 0, qRound(item->width()), qRound(item->height()));
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
program.disableAttributeArray(0);
program.release();
}
OpenGLItem::OpenGLItem(QQuickItem *parent) : QQuickFramebufferObject(parent) {
setMirrorVertically(true);
startTimer(1);
}
void OpenGLItem::timerEvent(QTimerEvent *) {
update();
}
void OpenGLItem::setT(qreal t) {
if (t == m_t)
return;
m_t = t;
emit tChanged();
}
QQuickFramebufferObject::Renderer *OpenGLItem::createRenderer() const {
return new FBORenderer(this);
}

View File

@ -0,0 +1,29 @@
#pragma once
#include <QtQuick/QQuickItem>
#include <QOpenGLFunctions>
#include <QQuickFramebufferObject>
class FBORenderer;
class OpenGLItem : public QQuickFramebufferObject, protected QOpenGLFunctions {
Q_OBJECT
Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged)
public:
explicit OpenGLItem(QQuickItem *parent = nullptr);
[[nodiscard]] QQuickFramebufferObject::Renderer *createRenderer() const override;
void timerEvent(QTimerEvent *) override;
[[nodiscard]] qreal t() const { return m_t; }
void setT(qreal t);
signals:
void tChanged();
private:
qreal m_t{};
};

View File

@ -1,109 +0,0 @@
#include "InitalizrHelper.h"
#include <QDir>
#include <QGuiApplication>
InitalizrHelper::InitalizrHelper(QObject *parent) : QObject(parent)
{
}
InitalizrHelper::~InitalizrHelper() = default;
bool InitalizrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists){
QDir _formDir = fromDir;
QDir _toDir = toDir;
if(!_toDir.exists())
{
if(!_toDir.mkdir(toDir.absolutePath()))
return false;
}
QFileInfoList fileInfoList = _formDir.entryInfoList();
foreach(QFileInfo fileInfo, fileInfoList)
{
if(fileInfo.fileName() == "." || fileInfo.fileName() == "..")
continue;
if(fileInfo.isDir())
{
if(!copyDir(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName()),true))
return false;
}
else
{
if(coverIfFileExists && _toDir.exists(fileInfo.fileName()))
{
_toDir.remove(fileInfo.fileName());
}
if(!QFile::copy(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName())))
{
return false;
}
}
}
return true;
}
template <typename...Args>
void InitalizrHelper::templateToFile(const QString& source,const QString& dest,Args &&...args){
QFile file(source);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file);
QString content = in.readAll().arg(std::forward<Args>(args)...);
file.close();
QDir outputDir = QFileInfo(dest).absoluteDir();
if(!outputDir.exists()){
outputDir.mkpath(outputDir.absolutePath());
}
QFile outputFile(dest);
if (outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&outputFile);
out << content;
outputFile.close();
} else {
qDebug() << "Failed to open output file.";
}
} else {
qDebug() << "Failed to open resource file.";
}
}
void InitalizrHelper::copyFile(const QString& source,const QString& dest){
QFile::copy(source,dest);
QFile::setPermissions(dest, QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther);
}
void InitalizrHelper::generate(const QString& name,const QString& path){
if(name.isEmpty()){
error(tr("The name cannot be empty"));
return;
}
if(path.isEmpty()){
error(tr("The creation path cannot be empty"));
return;
}
QDir projectRootDir(path);
if(!projectRootDir.exists()){
error(tr("The path does not exist"));
return;
}
QString projectPath = projectRootDir.filePath(name);
QDir projectDir(projectPath);
if(projectDir.exists()){
error(tr("%1 folder already exists").arg(name));
return;
}
projectDir.mkpath(projectPath);
QDir fluentDir(projectDir.filePath("FluentUI"));
copyDir(QDir(QGuiApplication::applicationDirPath()+"/source"),fluentDir);
templateToFile(":/example/res/template/CMakeLists.txt.in",projectDir.filePath("CMakeLists.txt"),name);
templateToFile(":/example/res/template/src/CMakeLists.txt.in",projectDir.filePath("src/CMakeLists.txt"),name);
templateToFile(":/example/res/template/src/main.cpp.in",projectDir.filePath("src/main.cpp"),name);
templateToFile(":/example/res/template/src/main.qml.in",projectDir.filePath("src/main.qml"),name);
templateToFile(":/example/res/template/src/en_US.ts.in",projectDir.filePath("src/"+name+"_en_US.ts"),name);
templateToFile(":/example/res/template/src/zh_CN.ts.in",projectDir.filePath("src/"+name+"_zh_CN.ts"),name);
copyFile(":/example/res/template/src/App.qml.in",projectDir.filePath("src/App.qml"));
copyFile(":/example/res/template/src/qml.qrc.in",projectDir.filePath("src/qml.qrc"));
copyFile(":/example/res/template/src/logo.ico.in",projectDir.filePath("src/logo.ico"));
copyFile(":/example/res/template/src/README.md.in",projectDir.filePath("src/README.md"));
return this->success(projectPath);
}

View File

@ -1,26 +0,0 @@
#ifndef INITALIZRHELPER_H
#define INITALIZRHELPER_H
#include <QObject>
#include <QtQml/qqml.h>
#include <QDir>
#include "src/singleton.h"
class InitalizrHelper : public QObject
{
Q_OBJECT
private:
explicit InitalizrHelper(QObject* parent = nullptr);
bool copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists = true);
void copyFile(const QString& source,const QString& dest);
template <typename...Args>
void templateToFile(const QString& source,const QString& dest,Args &&...args);
public:
SINGLETON(InitalizrHelper)
~InitalizrHelper() override;
Q_INVOKABLE void generate(const QString& name,const QString& path);
Q_SIGNAL void error(const QString& message);
Q_SIGNAL void success(const QString& path);
};
#endif // INITALIZRHELPER_H

View File

@ -0,0 +1,101 @@
#include "InitializrHelper.h"
#include <QDir>
#include <QGuiApplication>
[[maybe_unused]] InitializrHelper::InitializrHelper(QObject *parent) : QObject(parent) {
}
InitializrHelper::~InitializrHelper() = default;
bool InitializrHelper::copyDir(const QDir &fromDir, const QDir &toDir, bool coverIfFileExists) {
const QDir &_formDir = fromDir;
QDir _toDir = toDir;
if (!_toDir.exists()) {
if (!_toDir.mkdir(toDir.absolutePath()))
return false;
}
QFileInfoList fileInfoList = _formDir.entryInfoList();
foreach(QFileInfo fileInfo, fileInfoList) {
if (fileInfo.fileName() == "." || fileInfo.fileName() == "..")
continue;
if (fileInfo.isDir()) {
if (!copyDir(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName()), true))
return false;
} else {
if (coverIfFileExists && _toDir.exists(fileInfo.fileName())) {
_toDir.remove(fileInfo.fileName());
}
if (!QFile::copy(fileInfo.filePath(), _toDir.filePath(fileInfo.fileName()))) {
return false;
}
}
}
return true;
}
template<typename...Args>
void InitializrHelper::templateToFile(const QString &source, const QString &dest, Args &&...args) {
QFile file(source);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file);
QString content = in.readAll().arg(std::forward<Args>(args)...);
file.close();
QDir outputDir = QFileInfo(dest).absoluteDir();
if (!outputDir.exists()) {
outputDir.mkpath(outputDir.absolutePath());
}
QFile outputFile(dest);
if (outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&outputFile);
out << content;
outputFile.close();
} else {
qDebug() << "Failed to open output file.";
}
} else {
qDebug() << "Failed to open resource file.";
}
}
void InitializrHelper::copyFile(const QString &source, const QString &dest) {
QFile::copy(source, dest);
QFile::setPermissions(dest, QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther);
}
[[maybe_unused]] void InitializrHelper::generate(const QString &name, const QString &path) {
if (name.isEmpty()) {
error(tr("The name cannot be empty"));
return;
}
if (path.isEmpty()) {
error(tr("The creation path cannot be empty"));
return;
}
QDir projectRootDir(path);
if (!projectRootDir.exists()) {
error(tr("The path does not exist"));
return;
}
QString projectPath = projectRootDir.filePath(name);
QDir projectDir(projectPath);
if (projectDir.exists()) {
error(tr("%1 folder already exists").arg(name));
return;
}
projectDir.mkpath(projectPath);
QDir fluentDir(projectDir.filePath("FluentUI"));
copyDir(QDir(QGuiApplication::applicationDirPath() + "/source"), fluentDir);
templateToFile(":/example/res/template/CMakeLists.txt.in", projectDir.filePath("CMakeLists.txt"), name);
templateToFile(":/example/res/template/src/CMakeLists.txt.in", projectDir.filePath("src/CMakeLists.txt"), name);
templateToFile(":/example/res/template/src/main.cpp.in", projectDir.filePath("src/main.cpp"), name);
templateToFile(":/example/res/template/src/main.qml.in", projectDir.filePath("src/main.qml"), name);
templateToFile(":/example/res/template/src/en_US.ts.in", projectDir.filePath("src/" + name + "_en_US.ts"), name);
templateToFile(":/example/res/template/src/zh_CN.ts.in", projectDir.filePath("src/" + name + "_zh_CN.ts"), name);
copyFile(":/example/res/template/src/App.qml.in", projectDir.filePath("src/App.qml"));
copyFile(":/example/res/template/src/qml.qrc.in", projectDir.filePath("src/qml.qrc"));
copyFile(":/example/res/template/src/logo.ico.in", projectDir.filePath("src/logo.ico"));
copyFile(":/example/res/template/src/README.md.in", projectDir.filePath("src/README.md"));
return this->success(projectPath);
}

View File

@ -0,0 +1,30 @@
#pragma once
#include <QObject>
#include <QtQml/qqml.h>
#include <QDir>
#include "src/singleton.h"
class InitializrHelper : public QObject {
Q_OBJECT
private:
[[maybe_unused]] explicit InitializrHelper(QObject *parent = nullptr);
bool copyDir(const QDir &fromDir, const QDir &toDir, bool coverIfFileExists = true);
static void copyFile(const QString &source, const QString &dest);
template<typename...Args>
void templateToFile(const QString &source, const QString &dest, Args &&...args);
public:
SINGLETON(InitializrHelper)
~InitializrHelper() override;
Q_INVOKABLE [[maybe_unused]] void generate(const QString &name, const QString &path);
Q_SIGNAL void error(const QString &message);
Q_SIGNAL void success(const QString &path);
};

View File

@ -11,8 +11,11 @@
#include <QSettings> #include <QSettings>
#include <QRegularExpression> #include <QRegularExpression>
#include "Version.h" #include "Version.h"
#ifdef WIN32 #ifdef WIN32
#include <process.h> #include <process.h>
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -26,7 +29,7 @@
#endif #endif
static QString g_app = {}; static QString g_app = {};
static QString g_file_path= {}; static QString g_file_path = {};
static bool g_logError = false; static bool g_logError = false;
static std::unique_ptr<QFile> g_logFile = nullptr; static std::unique_ptr<QFile> g_logFile = nullptr;
@ -35,15 +38,14 @@ static std::unique_ptr<QTextStream> g_logStream = nullptr;
static int g_logLevel = 4; static int g_logLevel = 4;
std::map<QtMsgType, int> logLevelMap = { std::map<QtMsgType, int> logLevelMap = {
{QtFatalMsg,0}, {QtFatalMsg, 0},
{QtCriticalMsg,1}, {QtCriticalMsg, 1},
{QtWarningMsg,2}, {QtWarningMsg, 2},
{QtInfoMsg,3}, {QtInfoMsg, 3},
{QtDebugMsg,4} {QtDebugMsg, 4}
}; };
QString Log::prettyProductInfoWrapper() QString Log::prettyProductInfoWrapper() {
{
auto productName = QSysInfo::prettyProductName(); auto productName = QSysInfo::prettyProductName();
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
@ -70,20 +72,17 @@ QString Log::prettyProductInfoWrapper()
#endif #endif
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QSettings regKey {QString::fromUtf8("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), QSettings::NativeFormat}; QSettings regKey{QString::fromUtf8(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion)"), QSettings::NativeFormat};
if (regKey.contains(QString::fromUtf8("CurrentBuildNumber"))) { if (regKey.contains(QString::fromUtf8("CurrentBuildNumber"))) {
auto buildNumber = regKey.value(QString::fromUtf8("CurrentBuildNumber")).toInt(); auto buildNumber = regKey.value(QString::fromUtf8("CurrentBuildNumber")).toInt();
if (buildNumber > 0) { if (buildNumber > 0) {
if (buildNumber < 9200) { if (buildNumber < 9200) {
productName = QString::fromUtf8("Windows 7 build %1").arg(buildNumber); productName = QString::fromUtf8("Windows 7 build %1").arg(buildNumber);
} } else if (buildNumber < 10240) {
else if (buildNumber < 10240) {
productName = QString::fromUtf8("Windows 8 build %1").arg(buildNumber); productName = QString::fromUtf8("Windows 8 build %1").arg(buildNumber);
} } else if (buildNumber < 22000) {
else if (buildNumber < 22000) {
productName = QString::fromUtf8("Windows 10 build %1").arg(buildNumber); productName = QString::fromUtf8("Windows 10 build %1").arg(buildNumber);
} } else {
else {
productName = QString::fromUtf8("Windows 11 build %1").arg(buildNumber); productName = QString::fromUtf8("Windows 11 build %1").arg(buildNumber);
} }
} }
@ -92,56 +91,55 @@ QString Log::prettyProductInfoWrapper()
return productName; return productName;
} }
static inline void messageHandler(const QtMsgType type, const QMessageLogContext &context, const QString &message) static inline void messageHandler(const QtMsgType type, const QMessageLogContext &context, const QString &message) {
{ if (message == "Could not get the INetworkConnection instance for the adapter GUID.") {
if(message == "Could not get the INetworkConnection instance for the adapter GUID."){
return; return;
} }
if(logLevelMap[type]>g_logLevel){ if (logLevelMap[type] > g_logLevel) {
return; return;
} }
if (!message.isEmpty()) { if (!message.isEmpty()) {
QString levelName; QString levelName;
switch (type) { switch (type) {
case QtDebugMsg: case QtDebugMsg:
levelName = QStringLiteral("Debug"); levelName = QStringLiteral("Debug");
break; break;
case QtInfoMsg: case QtInfoMsg:
levelName = QStringLiteral("Info"); levelName = QStringLiteral("Info");
break; break;
case QtWarningMsg: case QtWarningMsg:
levelName = QStringLiteral("Warning"); levelName = QStringLiteral("Warning");
break; break;
case QtCriticalMsg: case QtCriticalMsg:
levelName = QStringLiteral("Critical"); levelName = QStringLiteral("Critical");
break; break;
case QtFatalMsg: case QtFatalMsg:
levelName = QStringLiteral("Fatal"); levelName = QStringLiteral("Fatal");
break; break;
} }
QString fileAndLineLogStr; QString fileAndLineLogStr;
if(context.file){ if (context.file) {
std::string strFileTmp = context.file; std::string strFileTmp = context.file;
const char* ptr = strrchr(strFileTmp.c_str(), '/'); const char *ptr = strrchr(strFileTmp.c_str(), '/');
if (nullptr != ptr) { if (nullptr != ptr) {
char fn[512] = {0}; char fn[512] = {0};
sprintf(fn, "%s", ptr + 1); sprintf(fn, "%s", ptr + 1);
strFileTmp = fn; strFileTmp = fn;
} }
const char* ptrTmp = strrchr(strFileTmp.c_str(), '\\'); const char *ptrTmp = strrchr(strFileTmp.c_str(), '\\');
if (nullptr != ptrTmp) { if (nullptr != ptrTmp) {
char fn[512] = {0}; char fn[512] = {0};
sprintf(fn, "%s", ptrTmp + 1); sprintf(fn, "%s", ptrTmp + 1);
strFileTmp = fn; strFileTmp = fn;
} }
fileAndLineLogStr = QString::fromStdString("[%1:%2]").arg(QString::fromStdString(strFileTmp),QString::number(context.line)); fileAndLineLogStr = QString::fromStdString("[%1:%2]").arg(QString::fromStdString(strFileTmp), QString::number(context.line));
} }
const QString finalMessage = QString::fromStdString("%1[%2]%3[%4]:%5").arg( const QString finalMessage = QString::fromStdString("%1[%2]%3[%4]:%5").arg(
QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss.zzz"), QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss.zzz"),
levelName, levelName,
fileAndLineLogStr, fileAndLineLogStr,
QString::number(reinterpret_cast<quintptr>(QThread::currentThreadId())), QString::number(reinterpret_cast<quintptr>(QThread::currentThreadId())),
message); message);
if ((type == QtInfoMsg) || (type == QtDebugMsg)) { if ((type == QtInfoMsg) || (type == QtDebugMsg)) {
std::cout << qPrintable(finalMessage) << std::endl; std::cout << qPrintable(finalMessage) << std::endl;
} else { } else {
@ -168,8 +166,7 @@ static inline void messageHandler(const QtMsgType type, const QMessageLogContext
} }
} }
void Log::setup(char *argv[],const QString &app,int level) void Log::setup(char *argv[], const QString &app, int level) {
{
Q_ASSERT(!app.isEmpty()); Q_ASSERT(!app.isEmpty());
if (app.isEmpty()) { if (app.isEmpty()) {
return; return;
@ -182,30 +179,30 @@ void Log::setup(char *argv[],const QString &app,int level)
QString applicationPath = QString::fromStdString(argv[0]); QString applicationPath = QString::fromStdString(argv[0]);
once = true; once = true;
g_app = app; g_app = app;
const QString logFileName = QString("%1_%2.log").arg(g_app,QDateTime::currentDateTime().toString("yyyyMMdd")); const QString logFileName = QString("%1_%2.log").arg(g_app, QDateTime::currentDateTime().toString("yyyyMMdd"));
const QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)+"/log"; const QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/log";
const QDir logDir(logDirPath); const QDir logDir(logDirPath);
if(!logDir.exists()){ if (!logDir.exists()) {
logDir.mkpath(logDirPath); logDir.mkpath(logDirPath);
} }
g_file_path = logDir.filePath(logFileName); g_file_path = logDir.filePath(logFileName);
qInstallMessageHandler(messageHandler); qInstallMessageHandler(messageHandler);
qInfo()<<"==================================================="; qInfo() << "===================================================";
qInfo()<<"[AppName]"<<g_app; qInfo() << "[AppName]" << g_app;
qInfo()<<"[AppVersion]"<<APPLICATION_VERSION; qInfo() << "[AppVersion]" << APPLICATION_VERSION;
qInfo()<<"[AppPath]"<<applicationPath; qInfo() << "[AppPath]" << applicationPath;
qInfo()<<"[QtVersion]"<<QT_VERSION_STR; qInfo() << "[QtVersion]" << QT_VERSION_STR;
#ifdef WIN32 #ifdef WIN32
qInfo()<<"[ProcessId]"<<QString::number(_getpid()); qInfo() << "[ProcessId]" << QString::number(_getpid());
#else #else
qInfo()<<"[ProcessId]"<<QString::number(getpid()); qInfo()<<"[ProcessId]"<<QString::number(getpid());
#endif #endif
qInfo()<<"[GitHashCode]"<<COMMIT_HASH; qInfo() << "[GitHashCode]" << COMMIT_HASH;
qInfo()<<"[DeviceInfo]"; qInfo() << "[DeviceInfo]";
qInfo()<<" [DeviceId]"<<QSysInfo::machineUniqueId(); qInfo() << " [DeviceId]" << QSysInfo::machineUniqueId();
qInfo()<<" [Manufacturer]"<<prettyProductInfoWrapper(); qInfo() << " [Manufacturer]" << prettyProductInfoWrapper();
qInfo()<<" [CPU_ABI]"<<QSysInfo::currentCpuArchitecture(); qInfo() << " [CPU_ABI]" << QSysInfo::currentCpuArchitecture();
qInfo()<<"[LOG_LEVEL]"<<g_logLevel; qInfo() << "[LOG_LEVEL]" << g_logLevel;
qInfo()<<"[LOG_PATH]"<<g_file_path; qInfo() << "[LOG_PATH]" << g_file_path;
qInfo()<<"==================================================="; qInfo() << "===================================================";
} }

View File

@ -1,11 +1,9 @@
#ifndef LOG_H #pragma once
#define LOG_H
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
namespace Log namespace Log {
{
QString prettyProductInfoWrapper(); QString prettyProductInfoWrapper();
void setup(char *argv[], const QString &app,int level = 4);
}
#endif // LOG_H void setup(char *argv[], const QString &app, int level = 4);
}

Some files were not shown because too many files have changed in this diff Show More