diff --git a/example/example.pro b/example/example.pro index f1942bc..0aca353 100644 --- a/example/example.pro +++ b/example/example.pro @@ -52,3 +52,8 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin mac: { QMAKE_INFO_PLIST = Info.plist } + +#### 如果你正在使用静态库,请将将下面的配置注释取消掉。 +#DEFINES += STATICLIB +#INCLUDEPATH += $$OUT_PWD/../bin/FluentUI/ +#LIBS += -L$$OUT_PWD/../bin/FluentUI/ -lFluentUI diff --git a/example/src/main.cpp b/example/src/main.cpp index c358098..1e587db 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -8,6 +8,9 @@ #include "AppInfo.h" #include "controller/ChatController.h" #include "tool/IPC.h" +#if defined(STATICLIB) +#include +#endif int main(int argc, char *argv[]) { @@ -38,6 +41,9 @@ int main(int argc, char *argv[]) } app.setQuitOnLastWindowClosed(false); QQmlApplicationEngine engine; +#if defined(STATICLIB) + FluentUI::initialize(&engine); +#endif qmlRegisterType("Controller",1,0,"ChatController"); QQmlContext * context = engine.rootContext(); Lang* lang = appInfo->lang(); diff --git a/src/FluApp.cpp b/src/FluApp.cpp index b7f8027..9995bc3 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -11,6 +11,8 @@ #include "Def.h" #ifdef Q_OS_WIN +#pragma comment(lib, "Dwmapi.lib") +#pragma comment(lib, "User32.lib") #include #include #include diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp index 5c22888..a4bae0f 100644 --- a/src/FluentUI.cpp +++ b/src/FluentUI.cpp @@ -8,3 +8,8 @@ void FluentUI::registerTypes(const char *uri){ void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){ Fluent::getInstance()->initializeEngine(engine,uri); } + +void FluentUI::initialize(QQmlEngine *engine){ + Fluent::getInstance()->registerTypes(URI_STR); + Fluent::getInstance()->initializeEngine(engine,URI_STR); +} diff --git a/src/FluentUI.h b/src/FluentUI.h index 1636630..bb74f12 100644 --- a/src/FluentUI.h +++ b/src/FluentUI.h @@ -3,12 +3,13 @@ #include -class FluentUI +class Q_DECL_EXPORT FluentUI { public: static void registerTypes(const char *uri) ; static void initializeEngine(QQmlEngine *engine, const char *uri); + static void initialize(QQmlEngine *engine); }; #endif // FLUENTUI_H diff --git a/src/NativeEventFilter.cpp b/src/NativeEventFilter.cpp index 440210d..6ab6fb6 100644 --- a/src/NativeEventFilter.cpp +++ b/src/NativeEventFilter.cpp @@ -2,6 +2,8 @@ #include "FluTheme.h" #include "FluApp.h" #ifdef Q_OS_WIN +#pragma comment(lib, "Dwmapi.lib") +#pragma comment(lib, "User32.lib") #include #include #endif diff --git a/src/WindowHelper.cpp b/src/WindowHelper.cpp index 964cc70..1ff5d4c 100644 --- a/src/WindowHelper.cpp +++ b/src/WindowHelper.cpp @@ -5,6 +5,8 @@ #include "FluTheme.h" #ifdef Q_OS_WIN +#pragma comment(lib, "Dwmapi.lib") +#pragma comment(lib, "User32.lib") #include #include #include