mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-05-13 00:13:29 +08:00
Compare commits
No commits in common. "9ac58a8ca76c11d4e9060e760f8857836952c343" and "1990203f3b37d7c2c7476586ce9f60d94f39cf0e" have entirely different histories.
9ac58a8ca7
...
1990203f3b
@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
|
|||||||
engine.rootContext()->setContextProperty("TranslateHelper", TranslateHelper::getInstance());
|
engine.rootContext()->setContextProperty("TranslateHelper", TranslateHelper::getInstance());
|
||||||
engine.rootContext()->setContextProperty("Network", Network::getInstance());
|
engine.rootContext()->setContextProperty("Network", Network::getInstance());
|
||||||
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
||||||
FluentUI::registerTypes(&engine);
|
FluentUI::getInstance()->registerTypes(&engine);
|
||||||
#endif
|
#endif
|
||||||
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
|
@ -145,7 +145,7 @@ 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函数添加资源文件
|
#如果是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_CURRENT_BINARY_DIR}/FluentUI)
|
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FluentUI)
|
||||||
endif ()
|
endif ()
|
||||||
qt_add_library(${PROJECT_NAME} ${LIB_TYPE})
|
qt_add_library(${PROJECT_NAME} ${LIB_TYPE})
|
||||||
qt_add_qml_module(${PROJECT_NAME}
|
qt_add_qml_module(${PROJECT_NAME}
|
||||||
|
@ -23,14 +23,12 @@
|
|||||||
#include "qmlcustomplot/ticker.h"
|
#include "qmlcustomplot/ticker.h"
|
||||||
#include "qmlcustomplot/grid.h"
|
#include "qmlcustomplot/grid.h"
|
||||||
|
|
||||||
const char* FluentUI::_uri = "FluentUI";
|
|
||||||
|
|
||||||
void FluentUI::registerTypes(QQmlEngine *engine) {
|
void FluentUI::registerTypes(QQmlEngine *engine) {
|
||||||
initializeEngine(engine, _uri);
|
initializeEngine(engine, _uri);
|
||||||
registerTypes(_uri);
|
registerTypes(_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluentUI::registerTypes(const char *uri) {
|
void FluentUI::registerTypes(const char *uri) const {
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
Q_INIT_RESOURCE(fluentui);
|
Q_INIT_RESOURCE(fluentui);
|
||||||
int major = _major;
|
int major = _major;
|
||||||
|
@ -2,22 +2,25 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include "singleton.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The FluentUI class
|
* @brief The FluentUI class
|
||||||
*/
|
*/
|
||||||
class FluentUI{
|
class FluentUI : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
SINGLETON(FluentUI)
|
||||||
|
|
||||||
static Q_DECL_EXPORT void registerTypes(QQmlEngine *engine);
|
Q_DECL_EXPORT void registerTypes(QQmlEngine *engine);
|
||||||
|
|
||||||
static void registerTypes(const char *uri);
|
void registerTypes(const char *uri) const;
|
||||||
|
|
||||||
static void initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri);
|
void initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int _major = 1;
|
const int _major = 1;
|
||||||
static const int _minor = 0;
|
const int _minor = 0;
|
||||||
static const char *_uri;
|
const char *_uri = "FluentUI";
|
||||||
};
|
};
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
FluentUIPlugin::FluentUIPlugin() = default;
|
FluentUIPlugin::FluentUIPlugin() = default;
|
||||||
|
|
||||||
void FluentUIPlugin::registerTypes(const char *uri) {
|
void FluentUIPlugin::registerTypes(const char *uri) {
|
||||||
FluentUI::registerTypes(uri);
|
FluentUI::getInstance()->registerTypes(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluentUIPlugin::initializeEngine(QQmlEngine *engine, const char *uri) {
|
void FluentUIPlugin::initializeEngine(QQmlEngine *engine, const char *uri) {
|
||||||
FluentUI::initializeEngine(engine, uri);
|
FluentUI::getInstance()->initializeEngine(engine, uri);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user