From 3f7555d4e6be320cd1910529710ce021301df1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 15 Mar 2024 18:16:01 +0800 Subject: [PATCH] update --- example/qml-Qt6/App.qml | 1 - example/qml-Qt6/page/T_Home.qml | 11 +- .../qml-Qt6/window/FluentInitalizrWindow.qml | 181 +++++------ example/qml/App.qml | 1 - example/qml/page/T_Home.qml | 9 +- example/qml/window/FluentInitalizrWindow.qml | 181 +++++------ src/FluFramelessHelper.cpp | 8 + src/FluWindowLifecycle.cpp | 11 +- src/FluentUI.cpp | 2 + .../imports/FluentUI/Controls/FluAppBar.qml | 6 +- .../FluentUI/Controls/FluWindowDialog.qml | 24 ++ src/Qt5/imports/FluentUI/plugins.qmltypes | 292 +++++++++++++++++- src/Qt5/imports/FluentUI/qmldir | 1 + src/Qt5/imports/fluentui.qrc | 1 + .../imports/FluentUI/Controls/FluAppBar.qml | 6 +- .../FluentUI/Controls/FluWindowDialog.qml | 24 ++ 16 files changed, 559 insertions(+), 200 deletions(-) create mode 100644 src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml create mode 100644 src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml diff --git a/example/qml-Qt6/App.qml b/example/qml-Qt6/App.qml index a36f4961..93f293fb 100644 --- a/example/qml-Qt6/App.qml +++ b/example/qml-Qt6/App.qml @@ -44,7 +44,6 @@ Item { "/login":"qrc:/example/qml/window/LoginWindow.qml", "/hotload":"qrc:/example/qml/window/HotloadWindow.qml", "/crash":"qrc:/example/qml/window/CrashWindow.qml", - "/fluentInitalizr":"qrc:/example/qml/window/FluentInitalizrWindow.qml", "/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml", "/standardWindow":"qrc:/example/qml/window/StandardWindow.qml", "/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml", diff --git a/example/qml-Qt6/page/T_Home.qml b/example/qml-Qt6/page/T_Home.qml index d226fbf4..3437c4ea 100644 --- a/example/qml-Qt6/page/T_Home.qml +++ b/example/qml-Qt6/page/T_Home.qml @@ -4,12 +4,18 @@ import QtQuick.Window import QtQuick.Controls import FluentUI import "../global" +import "../window" + FluScrollablePage{ launchMode: FluPageType.SingleTask animDisabled: true + FluentInitalizrWindow{ + id:fluent_initalizr + } + ListModel{ id: model_header ListElement{ @@ -27,11 +33,10 @@ FluScrollablePage{ desc: qsTr("FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options.") url: "https://github.com/zhuzichu520/FluentUI" clicked: function(model){ - FluApp.navigate("/fluentInitalizr") + fluent_initalizr.showDialog() } } } - Item{ Layout.fillWidth: true Layout.preferredHeight: 320 @@ -60,7 +65,6 @@ FluScrollablePage{ leftMargin: 20 } } - Component{ id:com_grallery Item{ @@ -287,3 +291,4 @@ FluScrollablePage{ } } + diff --git a/example/qml-Qt6/window/FluentInitalizrWindow.qml b/example/qml-Qt6/window/FluentInitalizrWindow.qml index aec5039c..e679ba88 100644 --- a/example/qml-Qt6/window/FluentInitalizrWindow.qml +++ b/example/qml-Qt6/window/FluentInitalizrWindow.qml @@ -5,108 +5,109 @@ import FluentUI import Qt.labs.platform import "../component" -FluWindow { +FluWindowDialog { id:window title:qsTr("FluentUI Initalizr") width: 600 height: 400 - fixSize: true - modality: Qt.ApplicationModal - launchMode: FluWindowType.SingleTask - showStayTop: false - Connections{ - target: InitalizrHelper - function onError(message){ - showError(message) - } - function onSuccess(path){ - FluTools.showFileInFolder(path+"/CMakeLists.txt") - window.close() - } - } - - FluText{ - id:text_title - text:qsTr("FluentUI Initalizr") - font: FluTextStyle.Title - anchors{ - left: parent.left - top: parent.top - leftMargin: 20 - topMargin: 20 - } - } - - Column{ - spacing: 14 - anchors{ - left: parent.left - top: text_title.bottom - leftMargin: 20 - topMargin: 20 - } - FluTextBox{ - id:text_box_name - width: 180 - placeholderText: qsTr("Name") - focus: true - } - Row{ - spacing: 8 - FluTextBox{ - id:text_box_path - width: 300 - placeholderText: qsTr("Create In") - anchors.verticalCenter: parent.verticalCenter - } - FluButton{ - text:qsTr("Browse") - anchors.verticalCenter: parent.verticalCenter - onClicked: { - folder_dialog.open() + contentDelegate:Component{ + Item{ + Connections{ + target: InitalizrHelper + function onError(message){ + showError(message) } - } - } - } - - FolderDialog{ - id:folder_dialog - onAccepted: { - text_box_path.text = FluTools.toLocalPath(currentFolder) - } - } - - Rectangle{ - id:layout_actions - width: parent.width - height: 60 - anchors.bottom: parent.bottom - color: FluTheme.backgroundColor - Row{ - height: parent.height - spacing: 20 - anchors{ - right: parent.right - rightMargin: 20 - } - FluButton{ - text:qsTr("Cancel") - width: 120 - anchors.verticalCenter: parent.verticalCenter - onClicked: { + function onSuccess(path){ + FluTools.showFileInFolder(path+"/CMakeLists.txt") window.close() } } - FluFilledButton{ - text:qsTr("Create") - width: 120 - anchors.verticalCenter: parent.verticalCenter - onClicked: { - InitalizrHelper.generate(text_box_name.text,text_box_path.text) + + FluText{ + id:text_title + text:qsTr("FluentUI Initalizr") + font: FluTextStyle.Title + anchors{ + left: parent.left + top: parent.top + leftMargin: 20 + topMargin: 20 + } + } + + Column{ + spacing: 14 + anchors{ + left: parent.left + top: text_title.bottom + leftMargin: 20 + topMargin: 20 + } + FluTextBox{ + id:text_box_name + width: 180 + placeholderText: qsTr("Name") + focus: true + } + Row{ + spacing: 8 + FluTextBox{ + id:text_box_path + width: 300 + placeholderText: qsTr("Create In") + anchors.verticalCenter: parent.verticalCenter + } + FluButton{ + text:qsTr("Browse") + anchors.verticalCenter: parent.verticalCenter + onClicked: { + folder_dialog.open() + } + } + } + } + + FolderDialog{ + id:folder_dialog + onAccepted: { + text_box_path.text = FluTools.toLocalPath(currentFolder) + } + } + + Rectangle{ + id:layout_actions + width: parent.width + height: 60 + anchors.bottom: parent.bottom + color: FluTheme.backgroundColor + Row{ + height: parent.height + spacing: 20 + anchors{ + right: parent.right + rightMargin: 20 + } + FluButton{ + text:qsTr("Cancel") + width: 120 + anchors.verticalCenter: parent.verticalCenter + onClicked: { + window.close() + } + } + FluFilledButton{ + text:qsTr("Create") + width: 120 + anchors.verticalCenter: parent.verticalCenter + onClicked: { + InitalizrHelper.generate(text_box_name.text,text_box_path.text) + } + } } } } } + } diff --git a/example/qml/App.qml b/example/qml/App.qml index 3f8be19d..afd57f81 100644 --- a/example/qml/App.qml +++ b/example/qml/App.qml @@ -44,7 +44,6 @@ Item { "/login":"qrc:/example/qml/window/LoginWindow.qml", "/hotload":"qrc:/example/qml/window/HotloadWindow.qml", "/crash":"qrc:/example/qml/window/CrashWindow.qml", - "/fluentInitalizr":"qrc:/example/qml/window/FluentInitalizrWindow.qml", "/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml", "/standardWindow":"qrc:/example/qml/window/StandardWindow.qml", "/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml", diff --git a/example/qml/page/T_Home.qml b/example/qml/page/T_Home.qml index 7f9cde08..ba399fea 100644 --- a/example/qml/page/T_Home.qml +++ b/example/qml/page/T_Home.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts 1.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import FluentUI 1.0 +import "../window" import "../global" FluScrollablePage{ @@ -10,6 +11,10 @@ FluScrollablePage{ launchMode: FluPageType.SingleTask animDisabled: true + FluentInitalizrWindow{ + id:fluent_initalizr + } + ListModel{ id: model_header ListElement{ @@ -27,11 +32,10 @@ FluScrollablePage{ desc: qsTr("FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options.") url: "https://github.com/zhuzichu520/FluentUI" clicked: function(model){ - FluApp.navigate("/fluentInitalizr") + fluent_initalizr.showDialog() } } } - Item{ Layout.fillWidth: true Layout.preferredHeight: 320 @@ -60,7 +64,6 @@ FluScrollablePage{ leftMargin: 20 } } - Component{ id:com_grallery Item{ diff --git a/example/qml/window/FluentInitalizrWindow.qml b/example/qml/window/FluentInitalizrWindow.qml index 0364822c..99e1118d 100644 --- a/example/qml/window/FluentInitalizrWindow.qml +++ b/example/qml/window/FluentInitalizrWindow.qml @@ -5,108 +5,109 @@ import FluentUI 1.0 import Qt.labs.platform 1.1 import "../component" -FluWindow { +FluWindowDialog { id:window title:qsTr("FluentUI Initalizr") width: 600 height: 400 - fixSize: true - modality: Qt.ApplicationModal - launchMode: FluWindowType.SingleTask - showStayTop: false - Connections{ - target: InitalizrHelper - function onError(message){ - showError(message) - } - function onSuccess(path){ - FluTools.showFileInFolder(path+"/CMakeLists.txt") - window.close() - } - } - - FluText{ - id:text_title - text:qsTr("FluentUI Initalizr") - font: FluTextStyle.Title - anchors{ - left: parent.left - top: parent.top - leftMargin: 20 - topMargin: 20 - } - } - - Column{ - spacing: 14 - anchors{ - left: parent.left - top: text_title.bottom - leftMargin: 20 - topMargin: 20 - } - FluTextBox{ - id:text_box_name - width: 180 - placeholderText: qsTr("Name") - focus: true - } - Row{ - spacing: 8 - FluTextBox{ - id:text_box_path - width: 300 - placeholderText: qsTr("Create In") - anchors.verticalCenter: parent.verticalCenter - } - FluButton{ - text:qsTr("Browse") - anchors.verticalCenter: parent.verticalCenter - onClicked: { - folder_dialog.open() + contentDelegate:Component{ + Item{ + Connections{ + target: InitalizrHelper + function onError(message){ + showError(message) } - } - } - } - - FolderDialog{ - id:folder_dialog - onAccepted: { - text_box_path.text = FluTools.toLocalPath(currentFolder) - } - } - - Rectangle{ - id:layout_actions - width: parent.width - height: 60 - anchors.bottom: parent.bottom - color: FluTheme.backgroundColor - Row{ - height: parent.height - spacing: 20 - anchors{ - right: parent.right - rightMargin: 20 - } - FluButton{ - text:qsTr("Cancel") - width: 120 - anchors.verticalCenter: parent.verticalCenter - onClicked: { + function onSuccess(path){ + FluTools.showFileInFolder(path+"/CMakeLists.txt") window.close() } } - FluFilledButton{ - text:qsTr("Create") - width: 120 - anchors.verticalCenter: parent.verticalCenter - onClicked: { - InitalizrHelper.generate(text_box_name.text,text_box_path.text) + + FluText{ + id:text_title + text:qsTr("FluentUI Initalizr") + font: FluTextStyle.Title + anchors{ + left: parent.left + top: parent.top + leftMargin: 20 + topMargin: 20 + } + } + + Column{ + spacing: 14 + anchors{ + left: parent.left + top: text_title.bottom + leftMargin: 20 + topMargin: 20 + } + FluTextBox{ + id:text_box_name + width: 180 + placeholderText: qsTr("Name") + focus: true + } + Row{ + spacing: 8 + FluTextBox{ + id:text_box_path + width: 300 + placeholderText: qsTr("Create In") + anchors.verticalCenter: parent.verticalCenter + } + FluButton{ + text:qsTr("Browse") + anchors.verticalCenter: parent.verticalCenter + onClicked: { + folder_dialog.open() + } + } + } + } + + FolderDialog{ + id:folder_dialog + onAccepted: { + text_box_path.text = FluTools.toLocalPath(currentFolder) + } + } + + Rectangle{ + id:layout_actions + width: parent.width + height: 60 + anchors.bottom: parent.bottom + color: FluTheme.backgroundColor + Row{ + height: parent.height + spacing: 20 + anchors{ + right: parent.right + rightMargin: 20 + } + FluButton{ + text:qsTr("Cancel") + width: 120 + anchors.verticalCenter: parent.verticalCenter + onClicked: { + window.close() + } + } + FluFilledButton{ + text:qsTr("Create") + width: 120 + anchors.verticalCenter: parent.verticalCenter + onClicked: { + InitalizrHelper.generate(text_box_name.text,text_box_path.text) + } + } } } } } + } diff --git a/src/FluFramelessHelper.cpp b/src/FluFramelessHelper.cpp index bbea1621..cabe659e 100644 --- a/src/FluFramelessHelper.cpp +++ b/src/FluFramelessHelper.cpp @@ -194,6 +194,14 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void * auto pos = _helper->window->position(); _helper->showSystemMenu(QPoint(pos.x(),pos.y()+_helper->getAppBarHeight())); } + }else if(uMsg == WM_SYSCOMMAND){ + if(wParam == SC_MINIMIZE){ + if(_helper->window->transientParent()){ + _helper->window->transientParent()->showMinimized(); + } + return true; + } + return false; } return false; #endif diff --git a/src/FluWindowLifecycle.cpp b/src/FluWindowLifecycle.cpp index e2d87167..1e16e119 100644 --- a/src/FluWindowLifecycle.cpp +++ b/src/FluWindowLifecycle.cpp @@ -7,18 +7,21 @@ FluWindowLifecycle::FluWindowLifecycle(QObject *parent):QObject{parent}{ } void FluWindowLifecycle::onCompleted(QQuickWindow* window){ - this->_window = window; - FluApp::getInstance()->addWindow(this->_window); + _window = window; + if(_window && _window->transientParent() == nullptr){ + FluApp::getInstance()->addWindow(_window); + } } void FluWindowLifecycle::onDestoryOnClose(){ - if(_window){ - FluApp::getInstance()->removeWindow(this->_window); + if(_window && _window->transientParent() == nullptr){ + FluApp::getInstance()->removeWindow(_window); _window = nullptr; } } void FluWindowLifecycle::onDestruction(){ + } void FluWindowLifecycle::onVisible(bool visible){ diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp index 6eba010b..a5427fa6 100644 --- a/src/FluentUI.cpp +++ b/src/FluentUI.cpp @@ -68,6 +68,7 @@ void FluentUI::registerTypes(const char *uri){ qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIcon.qml"),uri,major,minor,"FluIcon"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluIconButton.qml"),uri,major,minor,"FluIconButton"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImage.qml"),uri,major,minor,"FluImage"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluImageButton.qml"),uri,major,minor,"FluImageButton"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluInfoBar.qml"),uri,major,minor,"FluInfoBar"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluItemDelegate.qml"),uri,major,minor,"FluItemDelegate"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluMenu.qml"),uri,major,minor,"FluMenu"); @@ -118,6 +119,7 @@ void FluentUI::registerTypes(const char *uri){ qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTour.qml"),uri,major,minor,"FluTour"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluTreeView.qml"),uri,major,minor,"FluTreeView"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindow.qml"),uri,major,minor,"FluWindow"); + qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowDialog.qml"),uri,major,minor,"FluWindowDialog"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRangeSlider.qml"),uri,major,minor,"FluRangeSlider"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluStaggeredLayout.qml"),uri,major,minor,"FluStaggeredLayout"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluProgressButton.qml"),uri,major,minor,"FluProgressButton"); diff --git a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml index f3831a41..a6a074b5 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml @@ -50,7 +50,11 @@ Rectangle{ } } property var minClickListener: function(){ - d.win.showMinimized() + if(d.win.transientParent != null){ + d.win.transientParent.showMinimized() + }else{ + d.win.showMinimized() + } } property var closeClickListener : function(){ d.win.close() diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml b/src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml new file mode 100644 index 00000000..0e14060d --- /dev/null +++ b/src/Qt5/imports/FluentUI/Controls/FluWindowDialog.qml @@ -0,0 +1,24 @@ +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 +import FluentUI 1.0 + +FluWindow { + id:control + property Component contentDelegate + autoVisible: false + autoCenter: false + autoDestory: false + fixSize: true + Loader{ + anchors.fill: parent + sourceComponent: control.visible ? control.contentDelegate : undefined + } + function showDialog(){ + var x = transientParent.x + (transientParent.width - width)/2 + var y = transientParent.y + (transientParent.height - height)/2 + setGeometry(x,y,width,height) + visible = true + } +} diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes index 7c00c2c9..984fc776 100644 --- a/src/Qt5/imports/FluentUI/plugins.qmltypes +++ b/src/Qt5/imports/FluentUI/plugins.qmltypes @@ -2313,6 +2313,87 @@ Module { Property { name: "targetRect"; type: "QRectF" } Property { name: "target"; type: "QQuickItem"; isPointer: true } } + Component { + prototype: "QQuickRectangle" + name: "FluentUI/FluAppBar 1.0" + exports: ["FluentUI/FluAppBar 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "title"; type: "string" } + Property { name: "darkText"; type: "string" } + Property { name: "lightText"; type: "string" } + Property { name: "minimizeText"; type: "string" } + Property { name: "restoreText"; type: "string" } + Property { name: "maximizeText"; type: "string" } + Property { name: "closeText"; type: "string" } + Property { name: "stayTopText"; type: "string" } + Property { name: "stayTopCancelText"; type: "string" } + Property { name: "textColor"; type: "QColor" } + Property { name: "minimizeNormalColor"; type: "QColor" } + Property { name: "minimizeHoverColor"; type: "QColor" } + Property { name: "minimizePressColor"; type: "QColor" } + Property { name: "maximizeNormalColor"; type: "QColor" } + Property { name: "maximizeHoverColor"; type: "QColor" } + Property { name: "maximizePressColor"; type: "QColor" } + Property { name: "closeNormalColor"; type: "QColor" } + Property { name: "closeHoverColor"; type: "QColor" } + Property { name: "closePressColor"; type: "QColor" } + Property { name: "showDark"; type: "bool" } + Property { name: "showClose"; type: "bool" } + Property { name: "showMinimize"; type: "bool" } + Property { name: "showMaximize"; type: "bool" } + Property { name: "showStayTop"; type: "bool" } + Property { name: "titleVisible"; type: "bool" } + Property { name: "icon"; type: "QUrl" } + Property { name: "iconSize"; type: "int" } + Property { name: "isMac"; type: "bool" } + Property { name: "borerlessColor"; type: "QColor" } + Property { name: "systemMoveEnable"; type: "bool" } + Property { name: "maxClickListener"; type: "QVariant" } + Property { name: "minClickListener"; type: "QVariant" } + Property { name: "closeClickListener"; type: "QVariant" } + Property { name: "stayTopClickListener"; type: "QVariant" } + Property { name: "darkClickListener"; type: "QVariant" } + Property { name: "systemMenuListener"; type: "QVariant" } + Property { + name: "buttonStayTop" + type: "FluIconButton_QMLTYPE_18" + isReadonly: true + isPointer: true + } + Property { + name: "buttonMinimize" + type: "FluIconButton_QMLTYPE_18" + isReadonly: true + isPointer: true + } + Property { + name: "buttonMaximize" + type: "FluIconButton_QMLTYPE_18" + isReadonly: true + isPointer: true + } + Property { + name: "buttonClose" + type: "FluIconButton_QMLTYPE_18" + isReadonly: true + isPointer: true + } + Property { + name: "buttonDark" + type: "FluIconButton_QMLTYPE_18" + isReadonly: true + isPointer: true + } + Method { name: "_maximizeButtonHover"; type: "QVariant" } + Method { name: "_appBarHover"; type: "QVariant" } + Method { + name: "setHitTestVisible" + type: "QVariant" + Parameter { name: "id"; type: "QVariant" } + } + } Component { prototype: "QQuickRectangle" name: "FluentUI/FluArea 1.0" @@ -2415,6 +2496,8 @@ Module { Property { name: "hoverColor"; type: "QColor" } Property { name: "normalColor"; type: "QColor" } Property { name: "text"; type: "string" } + Property { name: "from"; type: "QDateTime" } + Property { name: "to"; type: "QDateTime" } Property { name: "current"; type: "QVariant" } Signal { name: "accepted" } } @@ -2756,6 +2839,17 @@ Module { Property { name: "errorItem"; type: "QQmlComponent"; isPointer: true } Property { name: "loadingItem"; type: "QQmlComponent"; isPointer: true } } + Component { + prototype: "QQuickButton" + name: "FluentUI/FluImageButton 1.0" + exports: ["FluentUI/FluImageButton 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "data" + Property { name: "normalImage"; type: "string" } + Property { name: "hoveredImage"; type: "string" } + Property { name: "pushedImage"; type: "string" } + } Component { prototype: "QObject" name: "FluentUI/FluInfoBar 1.0" @@ -2908,15 +3002,15 @@ Module { defaultProperty: "data" Property { name: "logo"; type: "QUrl" } Property { name: "title"; type: "string" } - Property { name: "items"; type: "FluObject_QMLTYPE_139"; isPointer: true } - Property { name: "footerItems"; type: "FluObject_QMLTYPE_139"; isPointer: true } + Property { name: "items"; type: "FluObject_QMLTYPE_166"; isPointer: true } + Property { name: "footerItems"; type: "FluObject_QMLTYPE_166"; 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_35"; isPointer: true } - Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_35"; isPointer: true } + Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_40"; isPointer: true } + Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_40"; isPointer: true } Property { name: "navCompactWidth"; type: "int" } Property { name: "navTopMargin"; type: "int" } Property { name: "cellHeight"; type: "int" } @@ -2924,13 +3018,13 @@ Module { Property { name: "hideNavAppBar"; type: "bool" } Property { name: "buttonMenu" - type: "FluIconButton_QMLTYPE_17" + type: "FluIconButton_QMLTYPE_18" isReadonly: true isPointer: true } Property { name: "buttonBack" - type: "FluIconButton_QMLTYPE_17" + type: "FluIconButton_QMLTYPE_18" isReadonly: true isPointer: true } @@ -3724,4 +3818,190 @@ Module { Method { name: "allExpand"; type: "QVariant" } Method { name: "allCollapse"; type: "QVariant" } } + Component { + prototype: "QQuickWindowQmlImpl" + name: "FluentUI/FluWindow 1.0" + exports: ["FluentUI/FluWindow 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "windowIcon"; type: "string" } + Property { name: "launchMode"; type: "int" } + Property { name: "argument"; type: "QVariant" } + Property { name: "background"; type: "QVariant" } + Property { name: "fixSize"; type: "bool" } + Property { name: "loadingItem"; type: "QQmlComponent"; isPointer: true } + Property { name: "fitsAppBarWindows"; type: "bool" } + Property { name: "appBar"; type: "QQuickItem"; isPointer: true } + Property { name: "backgroundColor"; type: "QColor" } + Property { name: "stayTop"; type: "bool" } + Property { name: "showDark"; type: "bool" } + Property { name: "showClose"; type: "bool" } + Property { name: "showMinimize"; type: "bool" } + Property { name: "showMaximize"; type: "bool" } + Property { name: "showStayTop"; type: "bool" } + Property { name: "autoMaximize"; type: "bool" } + Property { name: "autoVisible"; type: "bool" } + Property { name: "autoCenter"; type: "bool" } + Property { name: "autoDestory"; type: "bool" } + Property { name: "useSystemAppBar"; type: "bool" } + Property { name: "resizeBorderColor"; type: "QColor" } + Property { name: "resizeBorderWidth"; type: "int" } + Property { name: "closeListener"; type: "QVariant" } + Property { name: "_realHeight"; type: "int" } + Property { name: "_realWidth"; type: "int" } + Property { name: "_appBarHeight"; type: "int" } + Property { name: "_windowRegister"; type: "QVariant" } + Property { name: "_route"; type: "string" } + Signal { name: "showSystemMenu" } + Signal { + name: "initArgument" + Parameter { name: "argument"; type: "QVariant" } + } + Signal { name: "firstVisible" } + Method { name: "destoryOnClose"; type: "QVariant" } + Method { + name: "showLoading" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "cancel"; type: "QVariant" } + } + Method { name: "hideLoading"; type: "QVariant" } + Method { + name: "showSuccess" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { + name: "showInfo" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { + name: "showWarning" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { + name: "showError" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { name: "moveWindowToDesktopCenter"; type: "QVariant" } + Method { name: "fixWindowSize"; type: "QVariant" } + Method { + name: "registerForWindowResult" + type: "QVariant" + Parameter { name: "path"; type: "QVariant" } + } + Method { + name: "onResult" + type: "QVariant" + Parameter { name: "data"; type: "QVariant" } + } + Method { name: "showMaximized"; type: "QVariant" } + } + Component { + prototype: "QQuickWindowQmlImpl" + name: "FluentUI/FluWindowDialog 1.0" + exports: ["FluentUI/FluWindowDialog 1.0"] + exportMetaObjectRevisions: [0] + isComposite: true + defaultProperty: "contentData" + Property { name: "contentDelegate"; type: "QQmlComponent"; isPointer: true } + Method { name: "showDialog"; type: "QVariant" } + Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "windowIcon"; type: "string" } + Property { name: "launchMode"; type: "int" } + Property { name: "argument"; type: "QVariant" } + Property { name: "background"; type: "QVariant" } + Property { name: "fixSize"; type: "bool" } + Property { name: "loadingItem"; type: "QQmlComponent"; isPointer: true } + Property { name: "fitsAppBarWindows"; type: "bool" } + Property { name: "appBar"; type: "QQuickItem"; isPointer: true } + Property { name: "backgroundColor"; type: "QColor" } + Property { name: "stayTop"; type: "bool" } + Property { name: "showDark"; type: "bool" } + Property { name: "showClose"; type: "bool" } + Property { name: "showMinimize"; type: "bool" } + Property { name: "showMaximize"; type: "bool" } + Property { name: "showStayTop"; type: "bool" } + Property { name: "autoMaximize"; type: "bool" } + Property { name: "autoVisible"; type: "bool" } + Property { name: "autoCenter"; type: "bool" } + Property { name: "autoDestory"; type: "bool" } + Property { name: "useSystemAppBar"; type: "bool" } + Property { name: "resizeBorderColor"; type: "QColor" } + Property { name: "resizeBorderWidth"; type: "int" } + Property { name: "closeListener"; type: "QVariant" } + Property { name: "_realHeight"; type: "int" } + Property { name: "_realWidth"; type: "int" } + Property { name: "_appBarHeight"; type: "int" } + Property { name: "_windowRegister"; type: "QVariant" } + Property { name: "_route"; type: "string" } + Signal { name: "showSystemMenu" } + Signal { + name: "initArgument" + Parameter { name: "argument"; type: "QVariant" } + } + Signal { name: "firstVisible" } + Method { name: "destoryOnClose"; type: "QVariant" } + Method { + name: "showLoading" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "cancel"; type: "QVariant" } + } + Method { name: "hideLoading"; type: "QVariant" } + Method { + name: "showSuccess" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { + name: "showInfo" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { + name: "showWarning" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { + name: "showError" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + Parameter { name: "duration"; type: "QVariant" } + Parameter { name: "moremsg"; type: "QVariant" } + } + Method { name: "moveWindowToDesktopCenter"; type: "QVariant" } + Method { name: "fixWindowSize"; type: "QVariant" } + Method { + name: "registerForWindowResult" + type: "QVariant" + Parameter { name: "path"; type: "QVariant" } + } + Method { + name: "onResult" + type: "QVariant" + Parameter { name: "data"; type: "QVariant" } + } + Method { name: "showMaximized"; type: "QVariant" } + } } diff --git a/src/Qt5/imports/FluentUI/qmldir b/src/Qt5/imports/FluentUI/qmldir index 7d2bd41d..2fd994dc 100644 --- a/src/Qt5/imports/FluentUI/qmldir +++ b/src/Qt5/imports/FluentUI/qmldir @@ -89,5 +89,6 @@ FluTooltip 1.0 Controls/FluTooltip.qml FluTour 1.0 Controls/FluTour.qml FluTreeView 1.0 Controls/FluTreeView.qml FluWindow 1.0 Controls/FluWindow.qml +FluWindowDialog 1.0 Controls/FluWindowDialog.qml plugin fluentuiplugin diff --git a/src/Qt5/imports/fluentui.qrc b/src/Qt5/imports/fluentui.qrc index 21972b2a..10810130 100644 --- a/src/Qt5/imports/fluentui.qrc +++ b/src/Qt5/imports/fluentui.qrc @@ -100,5 +100,6 @@ FluentUI/Controls/FluSplitLayout.qml FluentUI/i18n/fluentuiplugin_en_US.qm FluentUI/i18n/fluentuiplugin_zh_CN.qm + FluentUI/Controls/FluWindowDialog.qml diff --git a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml index c181af20..8a62854b 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml @@ -50,7 +50,11 @@ Rectangle{ } } property var minClickListener: function(){ - d.win.showMinimized() + if(d.win.transientParent != null){ + d.win.transientParent.showMinimized() + }else{ + d.win.showMinimized() + } } property var closeClickListener : function(){ d.win.close() diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml b/src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml new file mode 100644 index 00000000..ff524536 --- /dev/null +++ b/src/Qt6/imports/FluentUI/Controls/FluWindowDialog.qml @@ -0,0 +1,24 @@ +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts +import FluentUI + +FluWindow { + id:control + property Component contentDelegate + autoVisible: false + autoCenter: false + autoDestory: false + fixSize: true + Loader{ + anchors.fill: parent + sourceComponent: control.visible ? control.contentDelegate : undefined + } + function showDialog(){ + var x = transientParent.x + (transientParent.width - width)/2 + var y = transientParent.y + (transientParent.height - height)/2 + setGeometry(x,y,width,height) + visible = true + } +}