From 1e512176ec811c5c97c616d4d56a5eaf3c02672e Mon Sep 17 00:00:00 2001
From: Mentalflow <312902918@qq.com>
Date: Mon, 27 May 2024 16:46:26 +0800
Subject: [PATCH] Project: Add Qt5QMLPlugin and optimize CMakeLists.

---
 .cmake/version_exe.rc.in                      |   2 +-
 .gitmodules                                   |   3 +
 3rdparty/Qt5QMLPlugin                         |   1 +
 CMakeLists.txt                                |   1 +
 example/CMakeLists.txt                        |  17 +-
 example/src/helper/TranslateHelper.h          |   2 +-
 example/src/main.cpp                          |   6 +-
 example/src/singleton.h                       |   5 +-
 src/.cmake/QmlPlugin.cmake                    | 128 ------------
 src/.cmake/version_dll.rc.in                  |  15 +-
 src/CMakeLists.txt                            | 139 ++++++-------
 src/FluentUI.cpp                              | 184 ------------------
 .../imports/FluentUI/Controls/FluAcrylic.qml  |   2 +-
 src/Qt5/imports/FluentUI/Controls/FluIcon.qml |   2 +-
 src/Qt5/imports/FluentUI/Controls/qmldir      |   2 -
 src/Qt5/imports/FluentUI/qmldir               | 102 ----------
 src/Qt5/imports/fluentui.qrc                  | 114 -----------
 .../imports/FluentUI/Controls/FluAcrylic.qml  |   2 +-
 src/Qt6/imports/FluentUI/Controls/FluIcon.qml |   2 +-
 src/Qt6/imports/FluentUI/Controls/qmldir      |   2 -
 src/fluentui.cpp                              |  87 +++++++++
 src/{FluentUI.h => fluentui.h}                |   4 +-
 src/fluentuiplugin.cpp                        |  13 --
 src/fluentuiplugin.h                          |  18 --
 src/singleton.h                               |   5 +-
 25 files changed, 182 insertions(+), 676 deletions(-)
 create mode 160000 3rdparty/Qt5QMLPlugin
 delete mode 100644 src/.cmake/QmlPlugin.cmake
 delete mode 100644 src/FluentUI.cpp
 delete mode 100644 src/Qt5/imports/FluentUI/Controls/qmldir
 delete mode 100644 src/Qt5/imports/FluentUI/qmldir
 delete mode 100644 src/Qt5/imports/fluentui.qrc
 delete mode 100644 src/Qt6/imports/FluentUI/Controls/qmldir
 create mode 100644 src/fluentui.cpp
 rename src/{FluentUI.h => fluentui.h} (88%)
 delete mode 100644 src/fluentuiplugin.cpp
 delete mode 100644 src/fluentuiplugin.h

diff --git a/.cmake/version_exe.rc.in b/.cmake/version_exe.rc.in
index 9dbe5048..b9f8ef8e 100644
--- a/.cmake/version_exe.rc.in
+++ b/.cmake/version_exe.rc.in
@@ -1,4 +1,4 @@
-1 VERSIONINFO
+ VS_VERSION_INFO VERSIONINFO
  FILEVERSION ${GIT_TAG_WITH_COMMA},${GIT_COMMIT_COUNT}
  PRODUCTVERSION ${GIT_TAG_WITH_COMMA},${GIT_COMMIT_COUNT}
  FILEFLAGSMASK 0x3fL
diff --git a/.gitmodules b/.gitmodules
index e69de29b..39e0ed0e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "3rdparty/Qt5QMLPlugin"]
+	path = 3rdparty/Qt5QMLPlugin
+	url = https://github.com/mentalfl0w/Qt5QMLPlugin.git
diff --git a/3rdparty/Qt5QMLPlugin b/3rdparty/Qt5QMLPlugin
new file mode 160000
index 00000000..414c8c36
--- /dev/null
+++ b/3rdparty/Qt5QMLPlugin
@@ -0,0 +1 @@
+Subproject commit 414c8c3696e2db036a58b8929a69f6e63a1fe8dc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9863d2ca..9193fb2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,7 @@ if (MSVC)
 endif ()
 
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake/)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/3rdparty/Qt5QMLPlugin)
 
 include(GetGitRevisionDescription)
 
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 24592b5e..a291fc04 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -83,16 +83,13 @@ list(APPEND sources_files ${QRC_RESOURCES})
 if (WIN32)
     list(APPEND sources_files ${EXAMPLE_VERSION_RC_PATH})
 endif ()
-if (${QT_VERSION_MAJOR} GREATER_EQUAL 6)
-    qt_add_executable(${PROJECT_NAME}
-            MANUAL_FINALIZATION
-            ${sources_files}
-    )
-else ()
-    add_executable(${PROJECT_NAME}
-            ${sources_files}
-    )
-endif ()
+
+if (${QT_VERSION_MAJOR} LESS 6)
+    include(Qt5QMLPlugin)
+endif()
+qt_add_executable(${PROJECT_NAME}
+        ${sources_files}
+)
 add_dependencies(${PROJECT_NAME} Script-UpdateTranslations)
 
 #复制程序运行所需要的动态库
diff --git a/example/src/helper/TranslateHelper.h b/example/src/helper/TranslateHelper.h
index 1476871a..d70f2d85 100644
--- a/example/src/helper/TranslateHelper.h
+++ b/example/src/helper/TranslateHelper.h
@@ -23,4 +23,4 @@ SINGLETON(TranslateHelper)
 private:
     QQmlEngine *_engine = nullptr;
     QTranslator *_translator = nullptr;
-};
\ No newline at end of file
+};
diff --git a/example/src/main.cpp b/example/src/main.cpp
index bd80267c..53857464 100644
--- a/example/src/main.cpp
+++ b/example/src/main.cpp
@@ -23,8 +23,10 @@
 #ifdef FLUENTUI_BUILD_STATIC_LIB
 #if (QT_VERSION > QT_VERSION_CHECK(6, 2, 0))
 Q_IMPORT_QML_PLUGIN(FluentUIPlugin)
+#elif(QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+#include "fluentuiplugin.h"
 #endif
-#include <FluentUI.h>
+#include <fluentui.h>
 #endif
 
 #ifdef WIN32
@@ -87,7 +89,7 @@ int main(int argc, char *argv[])
     engine.rootContext()->setContextProperty("TranslateHelper",TranslateHelper::getInstance());
     engine.rootContext()->setContextProperty("Network",Network::getInstance());
 #ifdef FLUENTUI_BUILD_STATIC_LIB
-    FluentUI::getInstance()->registerTypes(&engine);
+    FluentUI::getInstance()->registerTypes("FluentUI");
 #endif
     const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
     QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
diff --git a/example/src/singleton.h b/example/src/singleton.h
index 9583c687..2c659b39 100644
--- a/example/src/singleton.h
+++ b/example/src/singleton.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef SINGLETON_H
+#define SINGLETON_H
 
 /**
  * @brief The Singleton class
@@ -22,3 +23,5 @@ private:                                        \
     static Class* getInstance() {               \
         return Singleton<Class>::getInstance(); \
 }
+
+#endif
diff --git a/src/.cmake/QmlPlugin.cmake b/src/.cmake/QmlPlugin.cmake
deleted file mode 100644
index b7193718..00000000
--- a/src/.cmake/QmlPlugin.cmake
+++ /dev/null
@@ -1,128 +0,0 @@
-include(CMakeParseArguments)
-find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
-find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
-function(FindQmlPluginDump)
-    get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
-    execute_process(
-        COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_BINS
-        OUTPUT_VARIABLE QT_BIN_DIR
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-    )
-endfunction()
-function(FindQtInstallQml)
-    execute_process(
-        COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_QML
-        OUTPUT_VARIABLE PROC_RESULT
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-    )
-set(QT_INSTALL_QML ${PROC_RESULT} PARENT_SCOPE)
-endfunction()
-function(add_qmlplugin TARGET)
-    set(options NO_AUTORCC NO_AUTOMOC)
-    set(oneValueArgs URI VERSION BINARY_DIR QMLDIR LIBTYPE)
-    set(multiValueArgs SOURCES QMLFILES QMLFILESALIAS)
-    cmake_parse_arguments(QMLPLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-    if(NOT QMLPLUGIN_URI OR NOT QMLPLUGIN_VERSION OR NOT QMLPLUGIN_QMLDIR OR NOT QMLPLUGIN_LIBTYPE)
-        message(WARNING "TARGET,URI,VERSION,qmldir and LIBTYPE must be set, no files generated")
-        return()
-    endif()
-    if(NOT QMLPLUGIN_BINARY_DIR)
-        set(QMLPLUGIN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${QMLPLUGIN_URI})
-    endif()
-    add_library(${TARGET} ${QMLPLUGIN_LIBTYPE}
-        ${QMLPLUGIN_SOURCES}
-    )
-set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
-if(QMLPLUGIN_NO_AUTORCC)
-    set_target_properties(${TARGET} PROPERTIES AUTOMOC OFF)
-else()
-    set_target_properties(${TARGET} PROPERTIES AUTOMOC ON)
-endif()
-if(QMLPLUGIN_NO_AUTOMOC)
-    set_target_properties(${TARGET} PROPERTIES AUTOMOC OFF)
-else()
-    set_target_properties(${TARGET} PROPERTIES AUTOMOC ON)
-endif()
-if (${QMLPLUGIN_LIBTYPE} MATCHES "SHARED")
-    FindQmlPluginDump()
-    FindQtInstallQml()
-    if(QMLPLUGIN_BINARY_DIR)
-        set(MAKE_QMLPLUGINDIR_COMMAND ${CMAKE_COMMAND} -E make_directory ${QMLPLUGIN_BINARY_DIR})
-    endif()
-    set(COPY_QMLDIR_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/qmldir $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI}/qmldir)
-    set(INSTALL_QMLDIR_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/qmldir ${QMLPLUGIN_BINARY_DIR}/qmldir)
-    set(COPY_QMLTYPES_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/plugins.qmltypes $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI}/plugins.qmltypes)
-    set(INSTALL_QMLTYPES_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/plugins.qmltypes ${QMLPLUGIN_BINARY_DIR}/plugins.qmltypes)
-    set(COPY_LIBRARY_COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${TARGET}>/$<TARGET_FILE_NAME:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI})
-    set(INSTALL_LIBRARY_COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${TARGET}>/$<TARGET_FILE_NAME:${TARGET}> ${QMLPLUGIN_BINARY_DIR})
-    if(QMLPLUGIN_QMLDIR)
-        set(COPY_QMLFILES_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR} $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI})
-    else()
-        set(COPY_QMLFILES_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${QMLPLUGIN_QMLFILES} $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI})
-    endif()
-    set(INSTALL_QMLFILES_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR} ${QMLPLUGIN_BINARY_DIR})
-    if(QMLPLUGIN_BINARY_DIR)
-        add_custom_command(
-            TARGET ${TARGET}
-            POST_BUILD
-            COMMAND ${MAKE_QMLPLUGINDIR_COMMAND}
-            COMMAND ${COPY_QMLDIR_COMMAND}
-            COMMENT "Copying qmldir to binary directory"
-        )
-else()
-    add_custom_command(
-        TARGET ${TARGET}
-        POST_BUILD
-        COMMAND ${COPY_QMLDIR_COMMAND}
-        COMMENT "Copying qmldir to binary directory"
-    )
-endif()
-if(QMLPLUGIN_BINARY_DIR)
-    add_custom_command(
-        TARGET ${TARGET}
-        POST_BUILD
-        COMMAND ${MAKE_QMLPLUGINDIR_COMMAND}
-        COMMAND ${COPY_QMLTYPES_COMMAND}
-        COMMENT "Copying qmltypes to binary directory"
-    )
-else()
-    add_custom_command(
-        TARGET ${TARGET}
-        POST_BUILD
-        COMMAND ${COPY_QMLTYPES_COMMAND}
-        COMMENT "Copying qmltypes to binary directory"
-    )
-endif()
-add_custom_command(
-    TARGET ${TARGET}
-    POST_BUILD
-    COMMAND ${COPY_LIBRARY_COMMAND}
-    COMMENT "Copying Lib to binary plugin directory"
-)
-if(QMLPLUGIN_QMLFILES)
-    add_custom_command(
-        TARGET ${TARGET}
-        POST_BUILD
-        COMMAND ${COPY_QMLFILES_COMMAND}
-        COMMENT "Copying QML files to binary directory"
-    )
-endif()
-add_custom_command(
-    TARGET ${TARGET}
-    POST_BUILD
-    COMMAND ${GENERATE_QMLTYPES_COMMAND}
-    COMMENT "Generating plugin.qmltypes"
-)
-string(REPLACE "." "/" QMLPLUGIN_INSTALL_URI ${QMLPLUGIN_URI})
-add_custom_command(
-    TARGET ${TARGET}
-    POST_BUILD
-    COMMAND ${INSTALL_QMLTYPES_COMMAND}
-    COMMAND ${INSTALL_QMLDIR_COMMAND}
-    COMMAND ${INSTALL_LIBRARY_COMMAND}
-    COMMAND ${INSTALL_QMLFILES_COMMAND}
-    COMMAND ${INSTALL_QMLTYPES_COMMAND}
-    COMMENT "Install library and aditional files"
-)
-endif()
-endfunction()
diff --git a/src/.cmake/version_dll.rc.in b/src/.cmake/version_dll.rc.in
index a84e0db0..3a380c40 100644
--- a/src/.cmake/version_dll.rc.in
+++ b/src/.cmake/version_dll.rc.in
@@ -1,13 +1,8 @@
 #include <windows.h>
 
-#define STR(x) #x
-#define VER_JOIN(a,b,c,d) STR(a.b.c.d)
-#define VER_JOIN_(x) VER_JOIN x
-#define VER_STR VER_JOIN_((FLUENTUI_VERSION))
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION FLUENTUI_VERSION
- PRODUCTVERSION FLUENTUI_VERSION
+ VS_VERSION_INFO VERSIONINFO
+ FILEVERSION ${FLUENTUI_VERSION}
+ PRODUCTVERSION ${FLUENTUI_VERSION}
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -24,12 +19,12 @@ BEGIN
         BEGIN
             VALUE "CompanyName", "ZhuZiChu"
             VALUE "FileDescription", "https://github.com/zhuzichu520/FluentUI"
-            VALUE "FileVersion", VER_STR
+            VALUE "FileVersion", "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}"
             VALUE "InternalName", "${PROJECT_NAME}.dll"
             VALUE "LegalCopyright", "Copyright (C) 2023 ZhuZiChu. All rights reserved."
             VALUE "OriginalFilename", "${PROJECT_NAME}.dll"
             VALUE "ProductName", "${PROJECT_NAME}"
-            VALUE "ProductVersion", VER_STR
+            VALUE "ProductVersion", "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 591a0eb9..cb24df31 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,9 +1,9 @@
 cmake_minimum_required(VERSION 3.20)
 
 if (FLUENTUI_BUILD_STATIC_LIB AND (QT_VERSION VERSION_GREATER_EQUAL "6.2"))
-    project(fluentui VERSION 1.0)
+    project(fluentui VERSION 1.7.5.0)
 else ()
-    project(fluentuiplugin VERSION 1.0)
+    project(fluentuiplugin VERSION 1.7.5.0)
 endif ()
 
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/)
@@ -20,10 +20,12 @@ else ()
 endif ()
 
 #设置版本号
-add_definitions(-DFLUENTUI_VERSION=1,7,5,0)
+set(FLUENTUI_VERSION "${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},${PROJECT_VERSION_TWEAK}")
 
-if (FLUENTUI_BUILD_STATIC_LIB)
-    add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
+if (FLUENTUI_BUILD_STATIC_LIB AND ${QT_VERSION_MAJOR} GREATER_EQUAL 6)
+    target_compile_definitions(${PROJECT_NAME}
+            PUBLIC
+            FLUENTUI_BUILD_STATIC_LIB)
 endif ()
 
 #编译参数设置
@@ -83,41 +85,34 @@ if (WIN32)
     )
 endif ()
 
-if (QT_VERSION VERSION_GREATER_EQUAL "6.2")
-    #删除fluentuiplugin.cpp与fluentuiplugin.h,这些只要Qt5使用,Qt6不需要
-    list(REMOVE_ITEM sources_files fluentuiplugin.h fluentuiplugin.cpp)
-    if (NOT FLUENTUI_BUILD_STATIC_LIB)
-        list(REMOVE_ITEM sources_files FluentUI.h FluentUI.cpp)
+#遍历所有qml文件
+set(SINGLETON_QML "FluRouter.qml" "FluEventBus.qml")
+file(GLOB_RECURSE QML_PATHS *.qml)
+foreach (filepath ${QML_PATHS})
+    if (${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/")
+        string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
+        list(APPEND qml_files ${filename})
     endif ()
+endforeach (filepath)
 
-    #遍历所有qml文件
-    file(GLOB_RECURSE QML_PATHS *.qml qmldir)
-    foreach (filepath ${QML_PATHS})
-        if (${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/")
-            string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
-            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 *.js *.qm)
-    foreach (filepath ${RES_PATHS})
-        if (${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/")
-            string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
-            list(APPEND resource_files ${filename})
-        endif ()
-    endforeach (filepath)
-
-    #修改资源文件导出路径
-    foreach (filepath IN LISTS qml_files resource_files)
-        string(REPLACE "Qt${QT_VERSION_MAJOR}/imports/FluentUI/" "" filename ${filepath})
-        set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
-    endforeach ()
-endif ()
+#遍历所有资源文件
+file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.js *.qm *.qmltypes)
+foreach (filepath ${RES_PATHS})
+    if (${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/")
+        string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
+        list(APPEND resource_files ${filename})
+    endif ()
+endforeach (filepath)
+#修改资源文件导出路径和QML单例
+foreach (filepath IN LISTS qml_files resource_files)
+    string(REPLACE "Qt${QT_VERSION_MAJOR}/imports/FluentUI/" "" filename ${filepath})
+    set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
+    foreach(singleton_qml ${SINGLETON_QML})
+        if (${filepath} MATCHES ${singleton_qml})
+            set_source_files_properties(${filepath} PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
+        endif()
+    endforeach()
+endforeach ()
 
 if (FLUENTUI_BUILD_STATIC_LIB)
     set(LIB_TYPE "STATIC")
@@ -142,41 +137,29 @@ 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_CURRENT_SOURCE_DIR}/FluentUI)
-    endif ()
-    qt_add_library(${PROJECT_NAME} ${LIB_TYPE})
-    qt_add_qml_module(${PROJECT_NAME}
-            PLUGIN_TARGET ${PLUGIN_TARGET_NAME}
-            OUTPUT_DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY}
-            VERSION 1.0
-            URI "FluentUI"
-            #修改qmltypes文件名称。默认fluentuiplugin.qmltypes,使用默认名称有时候import FluentUI 1.0会爆红,所以修改成plugins.qmltypes
-            TYPEINFO "plugins.qmltypes"
-            SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH}
-            QML_FILES ${qml_files}
-            RESOURCES ${resource_files}
-            RESOURCE_PREFIX "/qt/qml"
-    )
-else ()
-    qt_add_resources(QRC_RESOURCES Qt5/imports/fluentui.qrc)
-    #如果是Qt6.2版本以下,则使用add_qmlplugin函数添加资源文件,这是个自定义的函数,详情见.cmake/QmlPlugin.cmake
-    include(QmlPlugin)
-    add_qmlplugin(${PROJECT_NAME}
-            URI "FluentUI"
-            VERSION 1.0
-            SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH} ${QRC_RESOURCES}
-            QMLFILES ${qml_files}
-            QMLDIR imports/FluentUI
-            BINARY_DIR ${FLUENTUI_QML_PLUGIN_DIRECTORY}
-            LIBTYPE ${LIB_TYPE}
-    )
+if (${QT_VERSION_MAJOR} LESS 6)
+    set(__qml_plugin_no_generate_typeinfo ON)
+    include(Qt5QMLPlugin)
+endif()
+if (FLUENTUI_BUILD_STATIC_LIB)
+    set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FluentUI)
 endif ()
+qt_add_library(${PROJECT_NAME} ${LIB_TYPE})
+qt_add_qml_module(${PROJECT_NAME}
+        PLUGIN_TARGET ${PLUGIN_TARGET_NAME}
+        OUTPUT_DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY}
+        VERSION 1.0
+        URI "FluentUI"
+        #修改qmltypes文件名称。默认fluentuiplugin.qmltypes,使用默认名称有时候import FluentUI 1.0会爆红,所以修改成plugins.qmltypes
+        TYPEINFO "plugins.qmltypes"
+        SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH}
+        QML_FILES ${qml_files}
+        RESOURCES ${resource_files}
+        RESOURCE_PREFIX "/qt-project.org/imports/"
+)
 
 target_compile_definitions(${PROJECT_NAME}
-        PRIVATE
+        PUBLIC
         #导入qrcode配置文件
         HAVE_CONFIG_H
 )
@@ -199,9 +182,9 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
 )
 if(APPLE)
     find_library(CARBON_LIBRARY Carbon)
-    target_link_libraries(${PROJECT_NAME} PRIVATE ${CARBON_LIBRARY})
+    target_link_libraries(${PROJECT_NAME} PUBLIC ${CARBON_LIBRARY})
 elseif(WIN32)
-    target_link_libraries(${PROJECT_NAME} PRIVATE user32)
+    target_link_libraries(${PROJECT_NAME} PUBLIC user32)
 elseif(UNIX)
     if(QT_VERSION_MAJOR STREQUAL "6")
         if(QT_VERSION VERSION_LESS "6.2.0")
@@ -216,15 +199,7 @@ elseif(UNIX)
     target_link_libraries(${PROJECT_NAME} PRIVATE X11)
 endif()
 
-if ((${QT_VERSION_MAJOR} LESS_EQUAL 6) AND (CMAKE_BUILD_TYPE MATCHES "Release"))
-    find_program(QML_PLUGIN_DUMP NAMES qmlplugindump)
-    add_custom_target(Script-Generate-QmlTypes
-            COMMAND ${QML_PLUGIN_DUMP} -nonrelocatable  FluentUI 1.0 ${CMAKE_CURRENT_BINARY_DIR} > ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/imports/FluentUI/plugins.qmltypes
-            COMMENT "Generate qmltypes........."
-            SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/imports/FluentUI/plugins.qmltypes
-            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    )
-endif()
-    
+target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
 #安装
 install(DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY} DESTINATION ${CMAKE_INSTALL_PREFIX}/imports)
diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp
deleted file mode 100644
index 28a97aca..00000000
--- a/src/FluentUI.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-#include "FluentUI.h"
-
-#include <QGuiApplication>
-#include "Def.h"
-#include "FluentIconDef.h"
-#include "FluApp.h"
-#include "FluColors.h"
-#include "FluTheme.h"
-#include "FluTools.h"
-#include "FluTextStyle.h"
-#include "FluWatermark.h"
-#include "FluCaptcha.h"
-#include "FluTreeModel.h"
-#include "FluRectangle.h"
-#include "FluQrCodeItem.h"
-#include "FluTableSortProxyModel.h"
-#include "FluFrameless.h"
-#include "FluTableModel.h"
-#include "FluHotkey.h"
-
-void FluentUI::registerTypes(QQmlEngine *engine) {
-    initializeEngine(engine, _uri);
-    registerTypes(_uri);
-}
-
-void FluentUI::registerTypes(const char *uri) const {
-#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
-    Q_INIT_RESOURCE(fluentui);
-    int major = _major;
-    int minor = _minor;
-    //@uri FluentUI
-    qmlRegisterType<FluQrCodeItem>(uri, major, minor, "FluQrCodeItem");
-    qmlRegisterType<FluCaptcha>(uri, major, minor, "FluCaptcha");
-    qmlRegisterType<FluWatermark>(uri, major, minor, "FluWatermark");
-    qmlRegisterType<FluAccentColor>(uri, major, minor, "FluAccentColor");
-    qmlRegisterType<FluTreeModel>(uri, major, minor, "FluTreeModel");
-    qmlRegisterType<FluTableModel>(uri, major, minor, "FluTableModel");
-    qmlRegisterType<FluRectangle>(uri, major, minor, "FluRectangle");
-    qmlRegisterType<FluFrameless>(uri, major, minor, "FluFrameless");
-    qmlRegisterType<FluHotkey>(uri, major, minor, "FluHotkey");
-    qmlRegisterType<FluTableSortProxyModel>(uri, major, minor, "FluTableSortProxyModel");
-
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAcrylic.qml"), uri, major, minor, "FluAcrylic");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAppBar.qml"), uri, major, minor, "FluAppBar");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFrame.qml"), uri, major, minor, "FluFrame");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluAutoSuggestBox.qml"), uri, major, minor, "FluAutoSuggestBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluBadge.qml"), uri, major, minor, "FluBadge");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluBreadcrumbBar.qml"), uri, major, minor, "FluBreadcrumbBar");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluButton.qml"), uri, major, minor, "FluButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCalendarPicker.qml"), uri, major, minor, "FluCalendarPicker");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCarousel.qml"), uri, major, minor, "FluCarousel");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluChart.qml"), uri, major, minor, "FluChart");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCheckBox.qml"), uri, major, minor, "FluCheckBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluColorPicker.qml"), uri, major, minor, "FluColorPicker");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluComboBox.qml"), uri, major, minor, "FluComboBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluContentDialog.qml"), uri, major, minor, "FluContentDialog");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluContentPage.qml"), uri, major, minor, "FluContentPage");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluControl.qml"), uri, major, minor, "FluControl");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluCopyableText.qml"), uri, major, minor, "FluCopyableText");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDatePicker.qml"), uri, major, minor, "FluDatePicker");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDivider.qml"), uri, major, minor, "FluDivider");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluDropDownButton.qml"), uri, major, minor, "FluDropDownButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluExpander.qml"), uri, major, minor, "FluExpander");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFilledButton.qml"), uri, major, minor, "FluFilledButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFlipView.qml"), uri, major, minor, "FluFlipView");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluFocusRectangle.qml"), uri, major, minor, "FluFocusRectangle");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIcon.qml"), uri, major, minor, "FluIcon");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIconButton.qml"), uri, major, minor, "FluIconButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImage.qml"), uri, major, minor, "FluImage");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImageButton.qml"), uri, major, minor, "FluImageButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluInfoBar.qml"), uri, major, minor, "FluInfoBar");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluItemDelegate.qml"), uri, major, minor, "FluItemDelegate");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenu.qml"), uri, major, minor, "FluMenu");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuBar.qml"), uri, major, minor, "FluMenuBar");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuBarItem.qml"), uri, major, minor, "FluMenuBarItem");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuItem.qml"), uri, major, minor, "FluMenuItem");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenuSeparator.qml"), uri, major, minor, "FluMenuSeparator");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMultilineTextBox.qml"), uri, major, minor, "FluMultilineTextBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluNavigationView.qml"), uri, major, minor, "FluNavigationView");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluObject.qml"), uri, major, minor, "FluObject");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPage.qml"), uri, major, minor, "FluPage");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPagination.qml"), uri, major, minor, "FluPagination");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItem.qml"), uri, major, minor, "FluPaneItem");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemEmpty.qml"), uri, major, minor, "FluPaneItemEmpty");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemExpander.qml"), uri, major, minor, "FluPaneItemExpander");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemHeader.qml"), uri, major, minor, "FluPaneItemHeader");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPaneItemSeparator.qml"), uri, major, minor, "FluPaneItemSeparator");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPasswordBox.qml"), uri, major, minor, "FluPasswordBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPivot.qml"), uri, major, minor, "FluPivot");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPivotItem.qml"), uri, major, minor, "FluPivotItem");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluPopup.qml"), uri, major, minor, "FluPopup");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressBar.qml"), uri, major, minor, "FluProgressBar");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressRing.qml"), uri, major, minor, "FluProgressRing");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluQRCode.qml"), uri, major, minor, "FluQRCode");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRadioButton.qml"), uri, major, minor, "FluRadioButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRadioButtons.qml"), uri, major, minor, "FluRadioButtons");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRatingControl.qml"), uri, major, minor, "FluRatingControl");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRemoteLoader.qml"), uri, major, minor, "FluRemoteLoader");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollBar.qml"), uri, major, minor, "FluScrollBar");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollIndicator.qml"), uri, major, minor, "FluScrollIndicator");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluScrollablePage.qml"), uri, major, minor, "FluScrollablePage");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShadow.qml"), uri, major, minor, "FluShadow");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSlider.qml"), uri, major, minor, "FluSlider");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSpinBox.qml"), uri, major, minor, "FluSpinBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStatusLayout.qml"), uri, major, minor, "FluStatusLayout");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTabView.qml"), uri, major, minor, "FluTabView");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTableView.qml"), uri, major, minor, "FluTableView");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluText.qml"), uri, major, minor, "FluText");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBox.qml"), uri, major, minor, "FluTextBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBoxBackground.qml"), uri, major, minor, "FluTextBoxBackground");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextBoxMenu.qml"), uri, major, minor, "FluTextBoxMenu");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTextButton.qml"), uri, major, minor, "FluTextButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTimePicker.qml"), uri, major, minor, "FluTimePicker");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTimeline.qml"), uri, major, minor, "FluTimeline");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluToggleButton.qml"), uri, major, minor, "FluToggleButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluToggleSwitch.qml"), uri, major, minor, "FluToggleSwitch");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTooltip.qml"), uri, major, minor, "FluTooltip");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTour.qml"), uri, major, minor, "FluTour");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTreeView.qml"), uri, major, minor, "FluTreeView");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindow.qml"), uri, major, minor, "FluWindow");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowDialog.qml"), uri, major, minor, "FluWindowDialog");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRangeSlider.qml"), uri, major, minor, "FluRangeSlider");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStaggeredLayout.qml"), uri, major, minor, "FluStaggeredLayout");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressButton.qml"), uri, major, minor, "FluProgressButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoadingButton.qml"), uri, major, minor, "FluLoadingButton");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluClip.qml"), uri, major, minor, "FluClip");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoader.qml"), uri, major, minor, "FluLoader");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShortcutPicker.qml"), uri, major, minor, "FluShortcutPicker");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSplitLayout.qml"), uri, major, minor, "FluSplitLayout");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowResultLauncher.qml"), uri, major, minor, "FluWindowResultLauncher");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLauncher.qml"), uri, major, minor, "FluLauncher");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEvent.qml"), uri, major, minor, "FluEvent");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSheet.qml"), uri, major, minor, "FluSheet");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluGroupBox.qml"), uri, major, minor, "FluGroupBox");
-    qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluControlBackground.qml"), uri, major, minor, "FluControlBackground");
-    qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRouter.qml"), uri, major, minor, "FluRouter");
-    qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEventBus.qml"), uri, major, minor, "FluEventBus");
-
-    qmlRegisterUncreatableMetaObject(FluentIcons::staticMetaObject, uri, major, minor, "FluentIcons", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri, major, minor, "FluThemeType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluPageType::staticMetaObject, uri, major, minor, "FluPageType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluWindowType::staticMetaObject, uri, major, minor, "FluWindowType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluTreeViewType::staticMetaObject, uri, major, minor, "FluTreeViewType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluStatusLayoutType::staticMetaObject, uri, major, minor, "FluStatusLayoutType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluContentDialogType::staticMetaObject, uri, major, minor, "FluContentDialogType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluTimePickerType::staticMetaObject, uri, major, minor, "FluTimePickerType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluCalendarViewType::staticMetaObject, uri, major, minor, "FluCalendarViewType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri, major, minor, "FluTabViewType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri, major, minor, "FluNavigationViewType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri, major, minor, "FluTimelineType", "Access to enums & flags only");
-    qmlRegisterUncreatableMetaObject(FluSheetType::staticMetaObject, uri, major, minor, "FluSheetType", "Access to enums & flags only");
-
-    qmlRegisterSingletonType(uri, major, minor, "FluApp", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
-        Q_UNUSED(engine)
-        return scriptEngine->newQObject(FluApp::getInstance());
-    });
-    qmlRegisterSingletonType(uri, major, minor, "FluColors", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
-        Q_UNUSED(engine)
-        return scriptEngine->newQObject(FluColors::getInstance());
-    });
-    qmlRegisterSingletonType(uri, major, minor, "FluTheme", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
-        Q_UNUSED(engine)
-        return scriptEngine->newQObject(FluTheme::getInstance());
-    });
-    qmlRegisterSingletonType(uri, major, minor, "FluTools", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
-        Q_UNUSED(engine)
-        return scriptEngine->newQObject(FluTools::getInstance());
-    });
-    qmlRegisterSingletonType(uri, major, minor, "FluTextStyle", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
-        Q_UNUSED(engine)
-        return scriptEngine->newQObject(FluTextStyle::getInstance());
-    });
-//    qmlRegisterSingletonInstance(uri, major, minor, "FluApp", FluApp::getInstance());
-//    qmlRegisterSingletonInstance(uri, major, minor, "FluColors", FluColors::getInstance());
-//    qmlRegisterSingletonInstance(uri, major, minor, "FluTheme", FluTheme::getInstance());
-//    qmlRegisterSingletonInstance(uri, major, minor, "FluTools", FluTools::getInstance());
-//    qmlRegisterSingletonInstance(uri, major, minor, "FluTextStyle", FluTextStyle::getInstance());
-    qmlRegisterModule(uri, major, minor);
-#endif
-}
-
-void FluentUI::initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri) {
-    Q_UNUSED(engine)
-}
diff --git a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml
index a432c32c..7c2a8494 100644
--- a/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml
+++ b/src/Qt5/imports/FluentUI/Controls/FluAcrylic.qml
@@ -33,7 +33,7 @@ Item {
     }
     Image {
         anchors.fill: parent
-        source: "qrc:/qt/qml/FluentUI/Image/noise.png"
+        source: "qrc:/qt-project.org/imports/FluentUI/Image/noise.png"
         fillMode: Image.Tile
         opacity: control.noiseOpacity
     }
diff --git a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml
index 7b1f6098..705fae6b 100644
--- a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml
+++ b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml
@@ -16,6 +16,6 @@ Text {
     opacity: iconSource>0
     FontLoader{
         id: font_loader
-        source: "qrc:/qt/qml/FluentUI/Font/FluentIcons.ttf"
+        source: "qrc:/qt-project.org/imports/FluentUI/Font/FluentIcons.ttf"
     }
 }
diff --git a/src/Qt5/imports/FluentUI/Controls/qmldir b/src/Qt5/imports/FluentUI/Controls/qmldir
deleted file mode 100644
index a4b6cc13..00000000
--- a/src/Qt5/imports/FluentUI/Controls/qmldir
+++ /dev/null
@@ -1,2 +0,0 @@
-singleton FluRouter 1.0 FluRouter.qml
-singleton FluEventBus 1.0 FluEventBus.qml
diff --git a/src/Qt5/imports/FluentUI/qmldir b/src/Qt5/imports/FluentUI/qmldir
deleted file mode 100644
index fc12b266..00000000
--- a/src/Qt5/imports/FluentUI/qmldir
+++ /dev/null
@@ -1,102 +0,0 @@
-module FluentUI
-classname FluentUIPlugin
-designersupported
-typeinfo plugins.qmltypes
-
-FluAcrylic 1.0 Controls/FluAcrylic.qml
-FluAppBar 1.0 Controls/FluAppBar.qml
-FluAutoSuggestBox 1.0 Controls/FluAutoSuggestBox.qml
-FluBadge 1.0 Controls/FluBadge.qml
-FluBreadcrumbBar 1.0 Controls/FluBreadcrumbBar.qml
-FluButton 1.0 Controls/FluButton.qml
-FluCalendarPicker 1.0 Controls/FluCalendarPicker.qml
-FluCarousel 1.0 Controls/FluCarousel.qml
-FluChart 1.0 Controls/FluChart.qml
-FluCheckBox 1.0 Controls/FluCheckBox.qml
-FluClip 1.0 Controls/FluClip.qml
-FluColorPicker 1.0 Controls/FluColorPicker.qml
-FluComboBox 1.0 Controls/FluComboBox.qml
-FluContentDialog 1.0 Controls/FluContentDialog.qml
-FluContentPage 1.0 Controls/FluContentPage.qml
-FluControl 1.0 Controls/FluControl.qml
-FluControlBackground 1.0 Controls/FluControlBackground.qml
-FluCopyableText 1.0 Controls/FluCopyableText.qml
-FluDatePicker 1.0 Controls/FluDatePicker.qml
-FluDivider 1.0 Controls/FluDivider.qml
-FluDropDownButton 1.0 Controls/FluDropDownButton.qml
-FluEvent 1.0 Controls/FluEvent.qml
-FluEventBus 1.0 Controls/FluEventBus.qml
-FluExpander 1.0 Controls/FluExpander.qml
-FluFilledButton 1.0 Controls/FluFilledButton.qml
-FluFlipView 1.0 Controls/FluFlipView.qml
-FluFocusRectangle 1.0 Controls/FluFocusRectangle.qml
-FluFrame 1.0 Controls/FluFrame.qml
-FluGroupBox 1.0 Controls/FluGroupBox.qml
-FluIcon 1.0 Controls/FluIcon.qml
-FluIconButton 1.0 Controls/FluIconButton.qml
-FluImage 1.0 Controls/FluImage.qml
-FluImageButton 1.0 Controls/FluImageButton.qml
-FluInfoBar 1.0 Controls/FluInfoBar.qml
-FluItemDelegate 1.0 Controls/FluItemDelegate.qml
-FluLauncher 1.0 Controls/FluLauncher.qml
-FluLoader 1.0 Controls/FluLoader.qml
-FluLoadingButton 1.0 Controls/FluLoadingButton.qml
-FluMenu 1.0 Controls/FluMenu.qml
-FluMenuBar 1.0 Controls/FluMenuBar.qml
-FluMenuBarItem 1.0 Controls/FluMenuBarItem.qml
-FluMenuItem 1.0 Controls/FluMenuItem.qml
-FluMenuSeparator 1.0 Controls/FluMenuSeparator.qml
-FluMultilineTextBox 1.0 Controls/FluMultilineTextBox.qml
-FluNavigationView 1.0 Controls/FluNavigationView.qml
-FluObject 1.0 Controls/FluObject.qml
-FluPage 1.0 Controls/FluPage.qml
-FluPagination 1.0 Controls/FluPagination.qml
-FluPaneItem 1.0 Controls/FluPaneItem.qml
-FluPaneItemEmpty 1.0 Controls/FluPaneItemEmpty.qml
-FluPaneItemExpander 1.0 Controls/FluPaneItemExpander.qml
-FluPaneItemHeader 1.0 Controls/FluPaneItemHeader.qml
-FluPaneItemSeparator 1.0 Controls/FluPaneItemSeparator.qml
-FluPasswordBox 1.0 Controls/FluPasswordBox.qml
-FluPivot 1.0 Controls/FluPivot.qml
-FluPivotItem 1.0 Controls/FluPivotItem.qml
-FluPopup 1.0 Controls/FluPopup.qml
-FluProgressBar 1.0 Controls/FluProgressBar.qml
-FluProgressButton 1.0 Controls/FluProgressButton.qml
-FluProgressRing 1.0 Controls/FluProgressRing.qml
-FluQRCode 1.0 Controls/FluQRCode.qml
-FluRadioButton 1.0 Controls/FluRadioButton.qml
-FluRadioButtons 1.0 Controls/FluRadioButtons.qml
-FluRangeSlider 1.0 Controls/FluRangeSlider.qml
-FluRatingControl 1.0 Controls/FluRatingControl.qml
-FluRemoteLoader 1.0 Controls/FluRemoteLoader.qml
-FluRouter 1.0 Controls/FluRouter.qml
-FluScrollBar 1.0 Controls/FluScrollBar.qml
-FluScrollIndicator 1.0 Controls/FluScrollIndicator.qml
-FluScrollablePage 1.0 Controls/FluScrollablePage.qml
-FluShadow 1.0 Controls/FluShadow.qml
-FluSheet 1.0 Controls/FluSheet.qml
-FluShortcutPicker 1.0 Controls/FluShortcutPicker.qml
-FluSlider 1.0 Controls/FluSlider.qml
-FluSpinBox 1.0 Controls/FluSpinBox.qml
-FluSplitLayout 1.0 Controls/FluSplitLayout.qml
-FluStaggeredLayout 1.0 Controls/FluStaggeredLayout.qml
-FluStatusLayout 1.0 Controls/FluStatusLayout.qml
-FluTabView 1.0 Controls/FluTabView.qml
-FluTableView 1.0 Controls/FluTableView.qml
-FluText 1.0 Controls/FluText.qml
-FluTextBox 1.0 Controls/FluTextBox.qml
-FluTextBoxBackground 1.0 Controls/FluTextBoxBackground.qml
-FluTextBoxMenu 1.0 Controls/FluTextBoxMenu.qml
-FluTextButton 1.0 Controls/FluTextButton.qml
-FluTimePicker 1.0 Controls/FluTimePicker.qml
-FluTimeline 1.0 Controls/FluTimeline.qml
-FluToggleButton 1.0 Controls/FluToggleButton.qml
-FluToggleSwitch 1.0 Controls/FluToggleSwitch.qml
-FluTooltip 1.0 Controls/FluTooltip.qml
-FluTour 1.0 Controls/FluTour.qml
-FluTreeView 1.0 Controls/FluTreeView.qml
-FluWindow 1.0 Controls/FluWindow.qml
-FluWindowDialog 1.0 Controls/FluWindowDialog.qml
-FluWindowResultLauncher 1.0 Controls/FluWindowResultLauncher.qml
-
-plugin fluentuiplugin
diff --git a/src/Qt5/imports/fluentui.qrc b/src/Qt5/imports/fluentui.qrc
deleted file mode 100644
index e27840cc..00000000
--- a/src/Qt5/imports/fluentui.qrc
+++ /dev/null
@@ -1,114 +0,0 @@
-<RCC>
-    <qresource prefix="/qt/qml">
-        <file>FluentUI/JS/Chart.js</file>
-        <file>FluentUI/Image/noise.png</file>
-        <file>FluentUI/Controls/FluAcrylic.qml</file>
-        <file>FluentUI/Controls/FluAppBar.qml</file>
-        <file>FluentUI/Controls/FluAutoSuggestBox.qml</file>
-        <file>FluentUI/Controls/FluBadge.qml</file>
-        <file>FluentUI/Controls/FluBreadcrumbBar.qml</file>
-        <file>FluentUI/Controls/FluButton.qml</file>
-        <file>FluentUI/Controls/FluCalendarPicker.qml</file>
-        <file>FluentUI/Controls/FluCarousel.qml</file>
-        <file>FluentUI/Controls/FluChart.qml</file>
-        <file>FluentUI/Controls/FluCheckBox.qml</file>
-        <file>FluentUI/Controls/FluColorPicker.qml</file>
-        <file>FluentUI/Controls/FluComboBox.qml</file>
-        <file>FluentUI/Controls/FluContentDialog.qml</file>
-        <file>FluentUI/Controls/FluContentPage.qml</file>
-        <file>FluentUI/Controls/FluControl.qml</file>
-        <file>FluentUI/Controls/FluCopyableText.qml</file>
-        <file>FluentUI/Controls/FluDatePicker.qml</file>
-        <file>FluentUI/Controls/FluDivider.qml</file>
-        <file>FluentUI/Controls/FluDropDownButton.qml</file>
-        <file>FluentUI/Controls/FluExpander.qml</file>
-        <file>FluentUI/Controls/FluFilledButton.qml</file>
-        <file>FluentUI/Controls/FluFlipView.qml</file>
-        <file>FluentUI/Controls/FluFocusRectangle.qml</file>
-        <file>FluentUI/Controls/FluIcon.qml</file>
-        <file>FluentUI/Controls/FluIconButton.qml</file>
-        <file>FluentUI/Controls/FluImage.qml</file>
-        <file>FluentUI/Controls/FluInfoBar.qml</file>
-        <file>FluentUI/Controls/FluItemDelegate.qml</file>
-        <file>FluentUI/Controls/FluMenu.qml</file>
-        <file>FluentUI/Controls/FluMenuBar.qml</file>
-        <file>FluentUI/Controls/FluMenuBarItem.qml</file>
-        <file>FluentUI/Controls/FluMenuItem.qml</file>
-        <file>FluentUI/Controls/FluMenuSeparator.qml</file>
-        <file>FluentUI/Controls/FluMultilineTextBox.qml</file>
-        <file>FluentUI/Controls/FluNavigationView.qml</file>
-        <file>FluentUI/Controls/FluObject.qml</file>
-        <file>FluentUI/Controls/FluPage.qml</file>
-        <file>FluentUI/Controls/FluPagination.qml</file>
-        <file>FluentUI/Controls/FluPaneItem.qml</file>
-        <file>FluentUI/Controls/FluPaneItemEmpty.qml</file>
-        <file>FluentUI/Controls/FluPaneItemExpander.qml</file>
-        <file>FluentUI/Controls/FluPaneItemHeader.qml</file>
-        <file>FluentUI/Controls/FluPaneItemSeparator.qml</file>
-        <file>FluentUI/Controls/FluPasswordBox.qml</file>
-        <file>FluentUI/Controls/FluPivot.qml</file>
-        <file>FluentUI/Controls/FluPivotItem.qml</file>
-        <file>FluentUI/Controls/FluPopup.qml</file>
-        <file>FluentUI/Controls/FluProgressBar.qml</file>
-        <file>FluentUI/Controls/FluProgressButton.qml</file>
-        <file>FluentUI/Controls/FluProgressRing.qml</file>
-        <file>FluentUI/Controls/FluQRCode.qml</file>
-        <file>FluentUI/Controls/FluRadioButton.qml</file>
-        <file>FluentUI/Controls/FluRadioButtons.qml</file>
-        <file>FluentUI/Controls/FluRangeSlider.qml</file>
-        <file>FluentUI/Controls/FluRatingControl.qml</file>
-        <file>FluentUI/Controls/FluRemoteLoader.qml</file>
-        <file>FluentUI/Controls/FluScrollablePage.qml</file>
-        <file>FluentUI/Controls/FluScrollBar.qml</file>
-        <file>FluentUI/Controls/FluScrollIndicator.qml</file>
-        <file>FluentUI/Controls/FluShadow.qml</file>
-        <file>FluentUI/Controls/FluSlider.qml</file>
-        <file>FluentUI/Controls/FluSpinBox.qml</file>
-        <file>FluentUI/Controls/FluStaggeredLayout.qml</file>
-        <file>FluentUI/Controls/FluStatusLayout.qml</file>
-        <file>FluentUI/Controls/FluTableView.qml</file>
-        <file>FluentUI/Controls/FluTabView.qml</file>
-        <file>FluentUI/Controls/FluText.qml</file>
-        <file>FluentUI/Controls/FluTextBox.qml</file>
-        <file>FluentUI/Controls/FluTextBoxBackground.qml</file>
-        <file>FluentUI/Controls/FluTextBoxMenu.qml</file>
-        <file>FluentUI/Controls/FluTextButton.qml</file>
-        <file>FluentUI/Controls/FluTimeline.qml</file>
-        <file>FluentUI/Controls/FluTimePicker.qml</file>
-        <file>FluentUI/Controls/FluToggleButton.qml</file>
-        <file>FluentUI/Controls/FluToggleSwitch.qml</file>
-        <file>FluentUI/Controls/FluTooltip.qml</file>
-        <file>FluentUI/Controls/FluTour.qml</file>
-        <file>FluentUI/Controls/FluTreeView.qml</file>
-        <file>FluentUI/Controls/FluWindow.qml</file>
-        <file>FluentUI/Controls/FluLoadingButton.qml</file>
-        <file>FluentUI/Controls/FluClip.qml</file>
-        <file>FluentUI/Controls/FluLoader.qml</file>
-        <file>FluentUI/Controls/FluShortcutPicker.qml</file>
-        <file>FluentUI/Image/btn_close_hovered.png</file>
-        <file>FluentUI/Image/btn_close_normal.png</file>
-        <file>FluentUI/Image/btn_close_pushed.png</file>
-        <file>FluentUI/Image/btn_max_hovered.png</file>
-        <file>FluentUI/Image/btn_max_normal.png</file>
-        <file>FluentUI/Image/btn_max_pushed.png</file>
-        <file>FluentUI/Image/btn_min_hovered.png</file>
-        <file>FluentUI/Image/btn_min_normal.png</file>
-        <file>FluentUI/Image/btn_min_pushed.png</file>
-        <file>FluentUI/Controls/FluImageButton.qml</file>
-        <file>FluentUI/Controls/FluSplitLayout.qml</file>
-        <file>FluentUI/Controls/FluWindowDialog.qml</file>
-        <file>FluentUI/i18n/fluentui_en_US.qm</file>
-        <file>FluentUI/i18n/fluentui_zh_CN.qm</file>
-        <file>FluentUI/Controls/FluLauncher.qml</file>
-        <file>FluentUI/Controls/FluRouter.qml</file>
-        <file>FluentUI/Controls/FluWindowResultLauncher.qml</file>
-        <file>FluentUI/Controls/qmldir</file>
-        <file>FluentUI/Controls/FluEvent.qml</file>
-        <file>FluentUI/Controls/FluEventBus.qml</file>
-        <file>FluentUI/Controls/FluFrame.qml</file>
-        <file>FluentUI/Controls/FluSheet.qml</file>
-        <file>FluentUI/Controls/FluGroupBox.qml</file>
-        <file>FluentUI/Controls/FluControlBackground.qml</file>
-        <file>FluentUI/Font/FluentIcons.ttf</file>
-    </qresource>
-</RCC>
diff --git a/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml b/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml
index 9dd417e7..8d5f512c 100644
--- a/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml
+++ b/src/Qt6/imports/FluentUI/Controls/FluAcrylic.qml
@@ -34,7 +34,7 @@ Item {
     }
     Image {
         anchors.fill: parent
-        source: "qrc:/qt/qml/FluentUI/Image/noise.png"
+        source: "qrc:/qt-project.org/imports/FluentUI/Image/noise.png"
         fillMode: Image.Tile
         opacity: control.noiseOpacity
     }
diff --git a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml
index a8bb3b2a..d7659131 100644
--- a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml
+++ b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml
@@ -16,6 +16,6 @@ Text {
     opacity: iconSource>0
     FontLoader{
         id: font_loader
-        source: "qrc:/qt/qml/FluentUI/Font/FluentIcons.ttf"
+        source: "qrc:/qt-project.org/imports/FluentUI/Font/FluentIcons.ttf"
     }
 }
diff --git a/src/Qt6/imports/FluentUI/Controls/qmldir b/src/Qt6/imports/FluentUI/Controls/qmldir
deleted file mode 100644
index 24e4704e..00000000
--- a/src/Qt6/imports/FluentUI/Controls/qmldir
+++ /dev/null
@@ -1,2 +0,0 @@
-singleton FluRouter FluRouter.qml
-singleton FluEventBus FluEventBus.qml
diff --git a/src/fluentui.cpp b/src/fluentui.cpp
new file mode 100644
index 00000000..4cea2d0f
--- /dev/null
+++ b/src/fluentui.cpp
@@ -0,0 +1,87 @@
+#include "fluentui.h"
+
+#include <QGuiApplication>
+#include "Def.h"
+#include "FluentIconDef.h"
+#include "FluApp.h"
+#include "FluColors.h"
+#include "FluTheme.h"
+#include "FluTools.h"
+#include "FluTextStyle.h"
+#include "FluWatermark.h"
+#include "FluCaptcha.h"
+#include "FluTreeModel.h"
+#include "FluRectangle.h"
+#include "FluQrCodeItem.h"
+#include "FluTableSortProxyModel.h"
+#include "FluFrameless.h"
+#include "FluTableModel.h"
+#include "FluHotkey.h"
+
+void FluentUI::registerTypes(QQmlEngine *engine) {
+    initializeEngine(engine, _uri);
+    registerTypes(_uri);
+}
+
+void FluentUI::registerTypes(const char *uri) const {
+#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
+    int major = _major;
+    int minor = _minor;
+    //@uri FluentUI
+
+    qmlRegisterType<FluQrCodeItem>(uri, major, minor, "FluQrCodeItem");
+    qmlRegisterType<FluCaptcha>(uri, major, minor, "FluCaptcha");
+    qmlRegisterType<FluWatermark>(uri, major, minor, "FluWatermark");
+    qmlRegisterType<FluAccentColor>(uri, major, minor, "FluAccentColor");
+    qmlRegisterType<FluTreeModel>(uri, major, minor, "FluTreeModel");
+    qmlRegisterType<FluTableModel>(uri, major, minor, "FluTableModel");
+    qmlRegisterType<FluRectangle>(uri, major, minor, "FluRectangle");
+    qmlRegisterType<FluFrameless>(uri, major, minor, "FluFrameless");
+    qmlRegisterType<FluHotkey>(uri, major, minor, "FluHotkey");
+    qmlRegisterType<FluTableSortProxyModel>(uri, major, minor, "FluTableSortProxyModel");
+
+    qmlRegisterUncreatableMetaObject(FluentIcons::staticMetaObject, uri, major, minor, "FluentIcons", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri, major, minor, "FluThemeType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluPageType::staticMetaObject, uri, major, minor, "FluPageType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluWindowType::staticMetaObject, uri, major, minor, "FluWindowType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluTreeViewType::staticMetaObject, uri, major, minor, "FluTreeViewType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluStatusLayoutType::staticMetaObject, uri, major, minor, "FluStatusLayoutType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluContentDialogType::staticMetaObject, uri, major, minor, "FluContentDialogType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluTimePickerType::staticMetaObject, uri, major, minor, "FluTimePickerType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluCalendarViewType::staticMetaObject, uri, major, minor, "FluCalendarViewType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri, major, minor, "FluTabViewType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri, major, minor, "FluNavigationViewType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri, major, minor, "FluTimelineType", "Access to enums & flags only");
+    qmlRegisterUncreatableMetaObject(FluSheetType::staticMetaObject, uri, major, minor, "FluSheetType", "Access to enums & flags only");
+
+    qmlRegisterSingletonType(uri, major, minor, "FluApp", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
+        Q_UNUSED(engine)
+        return scriptEngine->newQObject(FluApp::getInstance());
+    });
+    qmlRegisterSingletonType(uri, major, minor, "FluColors", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
+        Q_UNUSED(engine)
+        return scriptEngine->newQObject(FluColors::getInstance());
+    });
+    qmlRegisterSingletonType(uri, major, minor, "FluTheme", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
+        Q_UNUSED(engine)
+        return scriptEngine->newQObject(FluTheme::getInstance());
+    });
+    qmlRegisterSingletonType(uri, major, minor, "FluTools", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
+        Q_UNUSED(engine)
+        return scriptEngine->newQObject(FluTools::getInstance());
+    });
+    qmlRegisterSingletonType(uri, major, minor, "FluTextStyle", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue {
+        Q_UNUSED(engine)
+        return scriptEngine->newQObject(FluTextStyle::getInstance());
+    });
+//    qmlRegisterSingletonInstance(uri, major, minor, "FluApp", FluApp::getInstance());
+//    qmlRegisterSingletonInstance(uri, major, minor, "FluColors", FluColors::getInstance());
+//    qmlRegisterSingletonInstance(uri, major, minor, "FluTheme", FluTheme::getInstance());
+//    qmlRegisterSingletonInstance(uri, major, minor, "FluTools", FluTools::getInstance());
+//    qmlRegisterSingletonInstance(uri, major, minor, "FluTextStyle", FluTextStyle::getInstance());
+#endif
+}
+
+void FluentUI::initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri) {
+    Q_UNUSED(engine)
+}
diff --git a/src/FluentUI.h b/src/fluentui.h
similarity index 88%
rename from src/FluentUI.h
rename to src/fluentui.h
index eb454741..b5e6d276 100644
--- a/src/FluentUI.h
+++ b/src/fluentui.h
@@ -19,8 +19,10 @@ SINGLETON(FluentUI)
 
     void initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri);
 
+    static FluentUI* instance(){return getInstance();}
+
 private:
     const int _major = 1;
     const int _minor = 0;
     const char *_uri = "FluentUI";
-};
\ No newline at end of file
+};
diff --git a/src/fluentuiplugin.cpp b/src/fluentuiplugin.cpp
deleted file mode 100644
index 55d865c5..00000000
--- a/src/fluentuiplugin.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "fluentuiplugin.h"
-
-#include "FluentUI.h"
-
-FluentUIPlugin::FluentUIPlugin() = default;
-
-void FluentUIPlugin::registerTypes(const char *uri) {
-    FluentUI::getInstance()->registerTypes(uri);
-}
-
-void FluentUIPlugin::initializeEngine(QQmlEngine *engine, const char *uri) {
-    FluentUI::getInstance()->initializeEngine(engine, uri);
-}
diff --git a/src/fluentuiplugin.h b/src/fluentuiplugin.h
deleted file mode 100644
index bc609baa..00000000
--- a/src/fluentuiplugin.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-
-#include <QQmlExtensionPlugin>
-
-/**
- * @brief The FluentUIPlugin class
- */
-class FluentUIPlugin : public QQmlExtensionPlugin {
-Q_OBJECT
-
-    Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-public:
-    FluentUIPlugin();
-
-    void registerTypes(const char *uri) Q_DECL_OVERRIDE;
-
-    void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE;
-};
\ No newline at end of file
diff --git a/src/singleton.h b/src/singleton.h
index 9583c687..2c659b39 100644
--- a/src/singleton.h
+++ b/src/singleton.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef SINGLETON_H
+#define SINGLETON_H
 
 /**
  * @brief The Singleton class
@@ -22,3 +23,5 @@ private:                                        \
     static Class* getInstance() {               \
         return Singleton<Class>::getInstance(); \
 }
+
+#endif