File tree Expand file tree Collapse file tree 5 files changed +13
-14
lines changed
Expand file tree Collapse file tree 5 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake/)
1313include (GetGitRevisionDescription)
1414
1515option (FLUENTUI_BUILD_EXAMPLES "Build FluentUI demo applications." ON )
16- option (FLUENTUI_BUILD_STATIC_LIB "Build static library." OFF )
16+ option (FLUENTUI_BUILD_STATIC_LIB "Build static library." ON )
1717
1818find_package (QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
1919find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
9090 engine.rootContext ()->setContextProperty (" TranslateHelper" , TranslateHelper::getInstance ());
9191 engine.rootContext ()->setContextProperty (" Network" , Network::getInstance ());
9292#ifdef FLUENTUI_BUILD_STATIC_LIB
93- FluentUI::getInstance ()-> registerTypes (&engine);
93+ FluentUI::registerTypes (&engine);
9494#endif
9595 const QUrl url (QStringLiteral (" qrc:/example/qml/App.qml" ));
9696 QObject::connect (
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ endif ()
145145if (QT_VERSION VERSION_GREATER_EQUAL "6.2" )
146146 #如果是Qt6.2版本以上,则使用qt_add_library,qt_add_qml_module函数添加资源文件
147147 if (FLUENTUI_BUILD_STATIC_LIB)
148- set (FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR } /FluentUI)
148+ set (FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR } /FluentUI)
149149 endif ()
150150 qt_add_library(${PROJECT_NAME} ${LIB_TYPE} )
151151 qt_add_qml_module(${PROJECT_NAME}
Original file line number Diff line number Diff line change 2323#include " qmlcustomplot/ticker.h"
2424#include " qmlcustomplot/grid.h"
2525
26+ const char * FluentUI::_uri = " FluentUI" ;
27+
2628void FluentUI::registerTypes (QQmlEngine *engine) {
2729 initializeEngine (engine, _uri);
2830 registerTypes (_uri);
2931}
3032
31- void FluentUI::registerTypes (const char *uri) const {
33+ void FluentUI::registerTypes (const char *uri) {
3234#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
3335 Q_INIT_RESOURCE (fluentui);
3436 int major = _major;
Original file line number Diff line number Diff line change 22
33#include < QObject>
44#include < QQmlEngine>
5- #include " singleton.h"
65
76/* *
87 * @brief The FluentUI class
98 */
10- class FluentUI : public QObject {
11- Q_OBJECT
9+ class FluentUI {
1210
1311public:
14- SINGLETON (FluentUI)
1512
16- Q_DECL_EXPORT void registerTypes (QQmlEngine *engine);
13+ static Q_DECL_EXPORT void registerTypes (QQmlEngine *engine);
1714
18- void registerTypes (const char *uri) const ;
15+ static void registerTypes (const char *uri);
1916
20- void initializeEngine (QQmlEngine *engine, [[maybe_unused]] const char *uri);
17+ static void initializeEngine (QQmlEngine *engine, [[maybe_unused]] const char *uri);
2118
2219private:
23- const int _major = 1 ;
24- const int _minor = 0 ;
25- const char *_uri = " FluentUI " ;
20+ static const int _major = 1 ;
21+ static const int _minor = 0 ;
22+ static const char *_uri;
2623};
You can’t perform that action at this time.
0 commit comments