From 0d61e33ef17b0bec2b47e36dd4f176b5da512cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 5 May 2024 15:52:46 +0800 Subject: [PATCH] update --- src/CMakeLists.txt | 10 ++ src/FluentUI.cpp | 6 ++ src/Qt5/imports/FluentUI/plugins.qmltypes | 113 ++++++++++++++++++---- 3 files changed, 112 insertions(+), 17 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 70040b5e..6e1b55e7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -180,5 +180,15 @@ target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Qml ) +if (${QT_VERSION_MAJOR} LESS_EQUAL 6) + find_program(QML_PLUGIN_DUMP NAMES qmlplugindump) + add_custom_target(Script-Generate-QmlTypes + COMMAND ${QML_PLUGIN_DUMP} -nonrelocatable FluentUI 1.0 ${CMAKE_CURRENT_BINARY_DIR} > ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/imports/FluentUI/plugins.qmltypes + COMMENT "Generate qmltypes........." + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/imports/FluentUI/plugins.qmltypes + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) +endif() + #安装 install(DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY} DESTINATION ${CMAKE_INSTALL_PREFIX}/imports) diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp index bf86380c..6ea903f0 100644 --- a/src/FluentUI.cpp +++ b/src/FluentUI.cpp @@ -148,6 +148,12 @@ void FluentUI::registerTypes(const char *uri) const { qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri, major, minor, "FluTimelineType", "Access to enums & flags only"); qmlRegisterUncreatableMetaObject(FluSheetType::staticMetaObject, uri, major, minor, "FluSheetType", "Access to enums & flags only"); +// qmlRegisterSingletonInstance(uri, major, minor, "FluApp", FluApp::getInstance()); +// qmlRegisterSingletonInstance(uri, major, minor, "FluColors", FluColors::getInstance()); +// qmlRegisterSingletonInstance(uri, major, minor, "FluTheme", FluTheme::getInstance()); +// qmlRegisterSingletonInstance(uri, major, minor, "FluTools", FluTools::getInstance()); +// qmlRegisterSingletonInstance(uri, major, minor, "FluTextStyle", FluTextStyle::getInstance()); + qmlRegisterModule(uri, major, minor); #endif } diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes index 92a7e970..b46cb55a 100644 --- a/src/Qt5/imports/FluentUI/plugins.qmltypes +++ b/src/Qt5/imports/FluentUI/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable FluentUI 1.0 D:\QtProjects\build-FluentUI-Desktop_Qt_5_15_2_MSVC2019_64bit-Release\src' +// 'qmlplugindump -nonrelocatable FluentUI 1.0 D:/QtProjects/build-FluentUI-Desktop_Qt_5_15_2_MSVC2019_64bit-Release/src' Module { dependencies: ["QtQuick 2.0"] @@ -25,6 +25,8 @@ Module { name: "FluApp" prototype: "QObject" exports: ["FluentUI/FluApp 1.0"] + isCreatable: false + isSingleton: true exportMetaObjectRevisions: [0] Property { name: "useSystemAppBar"; type: "bool" } Property { name: "windowIcon"; type: "string" } @@ -39,11 +41,11 @@ Module { Parameter { name: "target"; type: "QObject"; isPointer: true } } Method { - name: "iconDatas" + name: "iconData" type: "QJsonArray" Parameter { name: "keyword"; type: "string" } } - Method { name: "iconDatas"; type: "QJsonArray" } + Method { name: "iconData"; type: "QJsonArray" } } Component { name: "FluCalendarViewType" @@ -78,6 +80,8 @@ Module { name: "FluColors" prototype: "QObject" exports: ["FluentUI/FluColors 1.0"] + isCreatable: false + isSingleton: true exportMetaObjectRevisions: [0] Property { name: "Transparent"; type: "QColor" } Property { name: "Black"; type: "QColor" } @@ -265,11 +269,15 @@ Module { } } Component { - name: "FluTableSortProxyModel" - prototype: "QSortFilterProxyModel" - exports: ["FluentUI/FluTableSortProxyModel 1.0"] + name: "FluTableModel" + prototype: "QAbstractTableModel" + exports: ["FluentUI/FluTableModel 1.0"] exportMetaObjectRevisions: [0] - Property { name: "model"; type: "QAbstractTableModel"; isPointer: true } + Property { name: "dataSourceSize"; type: "int" } + Property { name: "columnSource"; type: "QList" } + Property { name: "rows"; type: "QList" } + Property { name: "rowCount"; type: "int"; isReadonly: true } + Method { name: "clear" } Method { name: "getRow" type: "QVariant" @@ -278,6 +286,46 @@ Module { Method { name: "setRow" Parameter { name: "rowIndex"; type: "int" } + Parameter { name: "row"; type: "QVariant" } + } + Method { + name: "insertRow" + Parameter { name: "rowIndex"; type: "int" } + Parameter { name: "row"; type: "QVariant" } + } + Method { + name: "removeRow" + Parameter { name: "rowIndex"; type: "int" } + Parameter { name: "rows"; type: "int" } + } + Method { + name: "removeRow" + Parameter { name: "rowIndex"; type: "int" } + } + Method { + name: "appendRow" + Parameter { name: "row"; type: "QVariant" } + } + } + Component { + name: "FluTableSortProxyModel" + prototype: "QSortFilterProxyModel" + exports: ["FluentUI/FluTableSortProxyModel 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "model"; type: "QVariant" } + Method { + name: "getRow" + type: "QVariant" + Parameter { name: "rowIndex"; type: "int" } + } + Method { + name: "setRow" + Parameter { name: "rowIndex"; type: "int" } + Parameter { name: "val"; type: "QVariant" } + } + Method { + name: "insertRow" + Parameter { name: "rowIndex"; type: "int" } Parameter { name: "val"; type: "QVariant" } } Method { @@ -298,6 +346,8 @@ Module { name: "FluTextStyle" prototype: "QObject" exports: ["FluentUI/FluTextStyle 1.0"] + isCreatable: false + isSingleton: true exportMetaObjectRevisions: [0] Property { name: "family"; type: "string" } Property { name: "Caption"; type: "QFont" } @@ -312,6 +362,8 @@ Module { name: "FluTheme" prototype: "QObject" exports: ["FluentUI/FluTheme 1.0"] + isCreatable: false + isSingleton: true exportMetaObjectRevisions: [0] Property { name: "dark"; type: "bool"; isReadonly: true } Property { name: "accentColor"; type: "FluAccentColor"; isPointer: true } @@ -380,6 +432,8 @@ Module { name: "FluTools" prototype: "QObject" exports: ["FluentUI/FluTools 1.0"] + isCreatable: false + isSingleton: true exportMetaObjectRevisions: [0] Method { name: "qtMajor"; type: "int" } Method { name: "qtMinor"; type: "int" } @@ -499,7 +553,7 @@ Module { } Component { name: "FluTreeModel" - prototype: "QAbstractItemModel" + prototype: "QAbstractTableModel" exports: ["FluentUI/FluTreeModel 1.0"] exportMetaObjectRevisions: [0] Property { name: "dataSourceSize"; type: "int" } @@ -2316,6 +2370,7 @@ Module { Parameter { name: "selection"; type: "QItemSelection" } } } + Component { name: "QAbstractTableModel"; prototype: "QAbstractItemModel" } Component { name: "QSortFilterProxyModel" prototype: "QAbstractProxyModel" @@ -2472,7 +2527,7 @@ Module { } Property { name: "layoutMacosButtons" - type: "FluLoader_QMLTYPE_14" + type: "FluLoader_QMLTYPE_13" isReadonly: true isPointer: true } @@ -2493,6 +2548,7 @@ Module { Property { name: "items"; type: "QVariant" } Property { name: "emptyText"; type: "string" } Property { name: "autoSuggestBoxReplacement"; type: "int" } + Property { name: "textRole"; type: "string" } Property { name: "filter"; type: "QVariant" } Signal { name: "itemClicked" @@ -2695,6 +2751,7 @@ Module { Property { name: "normalColor"; type: "QColor" } Property { name: "hoverColor"; type: "QColor" } Property { name: "disableColor"; type: "QColor" } + Property { name: "textBox"; type: "QQuickTextField"; isReadonly: true; isPointer: true } Signal { name: "commit" Parameter { name: "text"; type: "string" } @@ -3162,15 +3219,15 @@ Module { defaultProperty: "data" Property { name: "logo"; type: "QUrl" } Property { name: "title"; type: "string" } - Property { name: "items"; type: "FluObject_QMLTYPE_172"; isPointer: true } - Property { name: "footerItems"; type: "FluObject_QMLTYPE_172"; isPointer: true } + Property { name: "items"; type: "FluObject_QMLTYPE_173"; isPointer: true } + Property { name: "footerItems"; type: "FluObject_QMLTYPE_173"; isPointer: true } Property { name: "displayMode"; type: "int" } Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true } Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true } Property { name: "topPadding"; type: "int" } Property { name: "pageMode"; type: "int" } - Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } - Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } + Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_49"; isPointer: true } + Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_49"; isPointer: true } Property { name: "navCompactWidth"; type: "int" } Property { name: "navTopMargin"; type: "int" } Property { name: "cellHeight"; type: "int" } @@ -3246,6 +3303,8 @@ Module { Property { name: "pageCount"; type: "int" } Property { name: "__itemPerPage"; type: "int" } Property { name: "__pageButtonHalf"; type: "int" } + Property { name: "header"; type: "QQmlComponent"; isPointer: true } + Property { name: "footer"; type: "QQmlComponent"; isPointer: true } Signal { name: "requestPage" Parameter { name: "page"; type: "int" } @@ -3470,14 +3529,16 @@ Module { Property { name: "textColor"; type: "QColor" } } Component { - prototype: "QQuickColumnLayout" + prototype: "QQuickItem" name: "FluentUI/FluRadioButtons 1.0" exports: ["FluentUI/FluRadioButtons 1.0"] exportMetaObjectRevisions: [0] isComposite: true defaultProperty: "buttons" - Property { name: "currentIndex"; type: "int" } Property { name: "buttons"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "currentIndex"; type: "int" } + Property { name: "spacing"; type: "int" } + Property { name: "orientation"; type: "int" } } Component { prototype: "QQuickRangeSlider" @@ -3757,6 +3818,7 @@ Module { exportMetaObjectRevisions: [0] isComposite: true defaultProperty: "data" + Property { name: "sourceModel"; type: "QVariant" } Property { name: "columnSource"; type: "QVariant" } Property { name: "dataSource"; type: "QVariant" } Property { name: "borderColor"; type: "QColor" } @@ -3767,7 +3829,6 @@ Module { Property { name: "rows"; type: "int"; isReadonly: true } Property { name: "columns"; type: "int"; isReadonly: true } Property { name: "current"; type: "QVariant"; isReadonly: true } - Property { name: "sourceModel"; type: "QQmlTableModel"; isReadonly: true; isPointer: true } Method { name: "closeEditor"; type: "QVariant" } Method { name: "resetPosition"; type: "QVariant" } Method { @@ -3803,6 +3864,13 @@ Module { Parameter { name: "rowIndex"; type: "QVariant" } Parameter { name: "rows"; type: "QVariant" } } + Method { + name: "insertRow" + type: "QVariant" + Parameter { name: "rowIndex"; type: "QVariant" } + Parameter { name: "obj"; type: "QVariant" } + } + Method { name: "currentIndex"; type: "QVariant" } Method { name: "appendRow" type: "QVariant" @@ -4068,6 +4136,7 @@ Module { Property { name: "closeListener"; type: "QVariant" } Property { name: "_windowRegister"; type: "QVariant" } Property { name: "_route"; type: "string" } + Property { name: "_hideShadow"; type: "bool" } Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } Signal { name: "initArgument" @@ -4116,6 +4185,8 @@ Module { Parameter { name: "data"; type: "QVariant" } } Method { name: "showMaximized"; type: "QVariant" } + Method { name: "showMinimized"; type: "QVariant" } + Method { name: "showNormal"; type: "QVariant" } Method { name: "showLoading" type: "QVariant" @@ -4136,7 +4207,12 @@ Module { isComposite: true defaultProperty: "contentData" Property { name: "contentDelegate"; type: "QQmlComponent"; isPointer: true } - Method { name: "showDialog"; type: "QVariant" } + Method { + name: "showDialog" + type: "QVariant" + Parameter { name: "offsetX"; type: "QVariant" } + Parameter { name: "offsetY"; type: "QVariant" } + } Property { name: "windowIcon"; type: "string" } Property { name: "launchMode"; type: "int" } Property { name: "argument"; type: "QVariant" } @@ -4162,6 +4238,7 @@ Module { Property { name: "closeListener"; type: "QVariant" } Property { name: "_windowRegister"; type: "QVariant" } Property { name: "_route"; type: "string" } + Property { name: "_hideShadow"; type: "bool" } Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } Signal { name: "initArgument" @@ -4210,6 +4287,8 @@ Module { Parameter { name: "data"; type: "QVariant" } } Method { name: "showMaximized"; type: "QVariant" } + Method { name: "showMinimized"; type: "QVariant" } + Method { name: "showNormal"; type: "QVariant" } Method { name: "showLoading" type: "QVariant"