mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-25 20:31:35 +08:00
update
This commit is contained in:
parent
83a66b3f15
commit
217ceabbaa
BIN
3rdparty/Win_x86/msvc/libcrypto-1_1.dll
vendored
BIN
3rdparty/Win_x86/msvc/libcrypto-1_1.dll
vendored
Binary file not shown.
BIN
3rdparty/Win_x86/msvc/libssl-1_1.dll
vendored
BIN
3rdparty/Win_x86/msvc/libssl-1_1.dll
vendored
Binary file not shown.
@ -26,6 +26,7 @@ endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
#Release也支持日志打印代码位置
|
||||
target_compile_definitions(fluentuiplugin
|
||||
PRIVATE
|
||||
QT_MESSAGELOGCONTEXT
|
||||
|
@ -24,6 +24,7 @@ endif()
|
||||
#获取文件路径分隔符(解决执行命令的时候有些平台会报错)
|
||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||
|
||||
#导入Qt相关依赖包
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick Svg Network)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Quick Svg Network)
|
||||
|
||||
@ -51,22 +52,28 @@ endforeach(filepath)
|
||||
|
||||
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||
#遍历所有qml文件
|
||||
file(GLOB_RECURSE QML_PATHS *.qml)
|
||||
file(GLOB_RECURSE QML_PATHS *.qml qmldir)
|
||||
foreach(filepath ${QML_PATHS})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||
if(${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/")
|
||||
string(REPLACE "qml-Qt${QT_VERSION_MAJOR}" "qml" filealias ${filename})
|
||||
if(${filepath} MATCHES "qml-Qt6")
|
||||
string(REPLACE "qml-Qt6" "qml" filealias ${filename})
|
||||
set_source_files_properties(${filename} PROPERTIES QT_RESOURCE_ALIAS ${filealias})
|
||||
if(${filename} MATCHES "qmldir")
|
||||
list(APPEND resource_files ${filename})
|
||||
else()
|
||||
list(APPEND qml_files ${filename})
|
||||
endif()
|
||||
endif()
|
||||
endforeach(filepath)
|
||||
|
||||
#遍历所有资源文件
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.obj qmldir)
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.obj)
|
||||
foreach(filepath ${RES_PATHS})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||
message(${filename})
|
||||
list(APPEND resource_files ${filename})
|
||||
endforeach(filepath)
|
||||
|
||||
endif()
|
||||
|
||||
#如果是Windows平台,则生成rc文件,还有inno setup脚本文件
|
||||
@ -95,20 +102,19 @@ else ()
|
||||
)
|
||||
endif ()
|
||||
|
||||
#复制程序运行所需要的动态库
|
||||
if(WIN32)
|
||||
#复制动态库到可执行文件同级目录下
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(3RDPARTY_ARCH_DIR ${CMAKE_SOURCE_DIR}/3rdparty/Win_x86)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(3RDPARTY_ARCH_DIR ${CMAKE_SOURCE_DIR}/3rdparty/Win_x64)
|
||||
endif()
|
||||
if(MSVC)
|
||||
set(DLLPATH ${3RDPARTY_ARCH_DIR}/msvc/*.dll)
|
||||
elseif(MINGW)
|
||||
set(DLLPATH ${3RDPARTY_ARCH_DIR}/mingw/*.dll)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x86/*.dll)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/msvc/x64/*.dll)
|
||||
endif()
|
||||
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
|
||||
file(GLOB DLL_FILES ${DLLPATH})
|
||||
elseif(MINGW)
|
||||
set(3RDPARTY_DLL_DIR ${CMAKE_SOURCE_DIR}/3rdparty/mingw/*.dll)
|
||||
endif()
|
||||
string(REPLACE "/" ${PATH_SEPARATOR} 3RDPARTY_DLL_DIR "${3RDPARTY_DLL_DIR}")
|
||||
file(GLOB DLL_FILES ${3RDPARTY_DLL_DIR})
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${DLL_FILES}
|
||||
@ -117,7 +123,7 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||
#添加qml模块
|
||||
#如果是Qt6.2以上,则使用qt_add_qml_module添加资源文件
|
||||
qt_add_qml_module(example
|
||||
URI "example"
|
||||
VERSION 1.0
|
||||
@ -126,6 +132,7 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||
RESOURCE_PREFIX "/"
|
||||
)
|
||||
else()
|
||||
#如果是Qt6.2以下,则使用qrc添加资源文件
|
||||
target_include_directories(example PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
@ -153,11 +160,13 @@ set_target_properties(example PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
)
|
||||
|
||||
#Release也支持日志打印代码位置
|
||||
target_compile_definitions(example
|
||||
PRIVATE
|
||||
QT_MESSAGELOGCONTEXT
|
||||
)
|
||||
|
||||
#目标文件链接库
|
||||
target_link_libraries(example PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Quick
|
||||
Qt${QT_VERSION_MAJOR}::Svg
|
||||
|
@ -14,6 +14,7 @@ if (FLUENTUI_BUILD_STATIC_LIB)
|
||||
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
|
||||
endif()
|
||||
|
||||
#导入Qt相关依赖包
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Qml)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Qml)
|
||||
|
||||
@ -89,6 +90,7 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||
#如果是Qt6.2版本以上,则使用qt_add_library,qt_add_qml_module函数添加资源文件
|
||||
if(FLUENTUI_BUILD_STATIC_LIB)
|
||||
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_BINARY_DIR}/FluentUI)
|
||||
endif()
|
||||
@ -106,6 +108,7 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||
RESOURCE_PREFIX "/qt/qml"
|
||||
)
|
||||
else()
|
||||
#如果是Qt6.2版本以下,则使用add_qmlplugin函数添加资源文件,这是个自定义的函数,详情见.cmake/QmlPlugin.cmake
|
||||
include(QmlPlugin)
|
||||
add_qmlplugin(${PROJECT_NAME}
|
||||
URI "FluentUI"
|
||||
@ -120,6 +123,7 @@ endif()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
#导入qrcode配置文件
|
||||
HAVE_CONFIG_H
|
||||
)
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
void removeWindow(QQuickWindow* window);
|
||||
private:
|
||||
QMap<quint64, QQuickWindow*> _windows;
|
||||
QObject* _application;
|
||||
QObject* _application = nullptr;
|
||||
};
|
||||
|
||||
#endif // FLUAPP_H
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "FluRegister.h"
|
||||
|
||||
WindowLifecycle::WindowLifecycle(QObject *parent):QObject{parent}{
|
||||
|
||||
}
|
||||
|
||||
void WindowLifecycle::onCompleted(QQuickWindow* window){
|
||||
@ -12,7 +13,10 @@ void WindowLifecycle::onCompleted(QQuickWindow* window){
|
||||
}
|
||||
|
||||
void WindowLifecycle::onDestoryOnClose(){
|
||||
if(_window){
|
||||
FluApp::getInstance()->removeWindow(this->_window);
|
||||
_window = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowLifecycle::onDestruction(){
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
Q_INVOKABLE void onDestoryOnClose();
|
||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||
private:
|
||||
QQuickWindow* _window;
|
||||
QQuickWindow* _window = nullptr;
|
||||
};
|
||||
|
||||
#endif // WINDOWLIFECYCLE_H
|
||||
|
Loading…
Reference in New Issue
Block a user