Fix the bug of static resources didn't imported by engine.
This commit is contained in:
parent
6fdbea6a03
commit
ad41a5a3ec
|
@ -17,6 +17,11 @@ file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,7,3)
|
add_definitions(-DVERSION=1,3,7,3)
|
||||||
|
|
||||||
|
#判断FluentUI库类型
|
||||||
|
if(FLUENTUI_BUILD_STATIC_LIB)
|
||||||
|
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(Qt5 REQUIRED COMPONENTS Quick)
|
find_package(Qt5 REQUIRED COMPONENTS Quick)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
||||||
|
Q_IMPORT_PLUGIN(FluentUIPlugin)
|
||||||
|
#endif
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
//将样式设置为Basic,不然会导致组件显示异常
|
//将样式设置为Basic,不然会导致组件显示异常
|
||||||
|
@ -38,6 +40,10 @@ int main(int argc, char *argv[])
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
FramelessHelper::Quick::registerTypes(&engine);
|
FramelessHelper::Quick::registerTypes(&engine);
|
||||||
|
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
||||||
|
qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_FluentUIPlugin().instance())->initializeEngine(&engine, "FluentUI"); // 让静态资源可以被QML引擎搜索到
|
||||||
|
//qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_FluentUIPlugin().instance())->registerTypes("FluentUI");
|
||||||
|
#endif
|
||||||
qmlRegisterType<CircularReveal>("example", 1, 0, "CircularReveal");
|
qmlRegisterType<CircularReveal>("example", 1, 0, "CircularReveal");
|
||||||
appInfo->init(&engine);
|
appInfo->init(&engine);
|
||||||
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
|
|
Loading…
Reference in New Issue