This commit is contained in:
朱子楚\zhuzi 2024-03-15 18:16:01 +08:00
parent 9d5765eafe
commit 3f7555d4e6
16 changed files with 559 additions and 200 deletions

View File

@ -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",

View File

@ -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{
}
}

View File

@ -5,17 +5,15 @@ 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
contentDelegate:Component{
Item{
Connections{
target: InitalizrHelper
function onError(message){
@ -110,3 +108,6 @@ FluWindow {
}
}
}
}
}

View File

@ -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",

View File

@ -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{

View File

@ -5,17 +5,15 @@ 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
contentDelegate:Component{
Item{
Connections{
target: InitalizrHelper
function onError(message){
@ -110,3 +108,6 @@ FluWindow {
}
}
}
}
}

View File

@ -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

View File

@ -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){

View File

@ -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");

View File

@ -50,8 +50,12 @@ Rectangle{
}
}
property var minClickListener: function(){
if(d.win.transientParent != null){
d.win.transientParent.showMinimized()
}else{
d.win.showMinimized()
}
}
property var closeClickListener : function(){
d.win.close()
}

View File

@ -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
}
}

View File

@ -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" }
}
}

View File

@ -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

View File

@ -100,5 +100,6 @@
<file>FluentUI/Controls/FluSplitLayout.qml</file>
<file>FluentUI/i18n/fluentuiplugin_en_US.qm</file>
<file>FluentUI/i18n/fluentuiplugin_zh_CN.qm</file>
<file>FluentUI/Controls/FluWindowDialog.qml</file>
</qresource>
</RCC>

View File

@ -50,8 +50,12 @@ Rectangle{
}
}
property var minClickListener: function(){
if(d.win.transientParent != null){
d.win.transientParent.showMinimized()
}else{
d.win.showMinimized()
}
}
property var closeClickListener : function(){
d.win.close()
}

View File

@ -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
}
}