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