This commit is contained in:
zhuzichu 2023-04-22 19:25:10 +08:00
parent da17b31be7
commit 82d1edc43c
7 changed files with 24 additions and 1 deletions

View File

@ -52,3 +52,8 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
mac: { mac: {
QMAKE_INFO_PLIST = Info.plist QMAKE_INFO_PLIST = Info.plist
} }
#### 如果你正在使用静态库,请将将下面的配置注释取消掉
#DEFINES += STATICLIB
#INCLUDEPATH += $$OUT_PWD/../bin/FluentUI/
#LIBS += -L$$OUT_PWD/../bin/FluentUI/ -lFluentUI

View File

@ -8,6 +8,9 @@
#include "AppInfo.h" #include "AppInfo.h"
#include "controller/ChatController.h" #include "controller/ChatController.h"
#include "tool/IPC.h" #include "tool/IPC.h"
#if defined(STATICLIB)
#include <FluentUI.h>
#endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -38,6 +41,9 @@ int main(int argc, char *argv[])
} }
app.setQuitOnLastWindowClosed(false); app.setQuitOnLastWindowClosed(false);
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
#if defined(STATICLIB)
FluentUI::initialize(&engine);
#endif
qmlRegisterType<ChatController>("Controller",1,0,"ChatController"); qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
QQmlContext * context = engine.rootContext(); QQmlContext * context = engine.rootContext();
Lang* lang = appInfo->lang(); Lang* lang = appInfo->lang();

View File

@ -11,6 +11,8 @@
#include "Def.h" #include "Def.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#pragma comment(lib, "Dwmapi.lib")
#pragma comment(lib, "User32.lib")
#include <dwmapi.h> #include <dwmapi.h>
#include <Windows.h> #include <Windows.h>
#include <windowsx.h> #include <windowsx.h>

View File

@ -8,3 +8,8 @@ void FluentUI::registerTypes(const char *uri){
void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){ void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
Fluent::getInstance()->initializeEngine(engine,uri); Fluent::getInstance()->initializeEngine(engine,uri);
} }
void FluentUI::initialize(QQmlEngine *engine){
Fluent::getInstance()->registerTypes(URI_STR);
Fluent::getInstance()->initializeEngine(engine,URI_STR);
}

View File

@ -3,12 +3,13 @@
#include <QQmlEngine> #include <QQmlEngine>
class FluentUI class Q_DECL_EXPORT FluentUI
{ {
public: public:
static void registerTypes(const char *uri) ; static void registerTypes(const char *uri) ;
static void initializeEngine(QQmlEngine *engine, const char *uri); static void initializeEngine(QQmlEngine *engine, const char *uri);
static void initialize(QQmlEngine *engine);
}; };
#endif // FLUENTUI_H #endif // FLUENTUI_H

View File

@ -2,6 +2,8 @@
#include "FluTheme.h" #include "FluTheme.h"
#include "FluApp.h" #include "FluApp.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#pragma comment(lib, "Dwmapi.lib")
#pragma comment(lib, "User32.lib")
#include <Windows.h> #include <Windows.h>
#include <windowsx.h> #include <windowsx.h>
#endif #endif

View File

@ -5,6 +5,8 @@
#include "FluTheme.h" #include "FluTheme.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#pragma comment(lib, "Dwmapi.lib")
#pragma comment(lib, "User32.lib")
#include <dwmapi.h> #include <dwmapi.h>
#include <Windows.h> #include <Windows.h>
#include <windowsx.h> #include <windowsx.h>