diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml index db47e6c..bd83b5f 100644 --- a/example/qml/page/T_TableView.qml +++ b/example/qml/page/T_TableView.qml @@ -34,7 +34,7 @@ FluScrollablePage{ { title: '操作', dataIndex: 'action', - width:100 + width:120 }, ]; table_view.columns = columns @@ -62,12 +62,14 @@ FluScrollablePage{ spacing: 10 FluFilledButton{ text:"编辑" + horizontalPadding: 6 onClicked:{ showSuccess(JSON.stringify(dataObject)) } } FluFilledButton{ text:"删除" + horizontalPadding: 6 onClicked:{ showError(JSON.stringify(dataObject)) } @@ -76,20 +78,6 @@ FluScrollablePage{ } } - function loadData(page,count){ - const dataSource = [] - for(var i=0;ipos.y+root.height+container.height){ popup.y = root.height @@ -382,7 +352,6 @@ Rectangle { } popup.open() } - onClosed: { if(changeFlag){ text_year.text = rowData[0] @@ -391,7 +360,6 @@ Rectangle { } } } - function generateYearArray(startYear, endYear) { const yearArray = []; for (let year = startYear; year <= endYear; year++) { @@ -399,7 +367,6 @@ Rectangle { } return yearArray; } - function generateMonthArray(startMonth, endMonth) { const monthArray = []; for (let month = startMonth; month <= endMonth; month++) { @@ -407,7 +374,6 @@ Rectangle { } return monthArray; } - function generateMonthDaysArray(year, month) { const monthDaysArray = []; const lastDayOfMonth = new Date(year, month, 0).getDate(); @@ -416,6 +382,4 @@ Rectangle { } return monthDaysArray; } - - } diff --git a/src/imports/FluentUI/Controls/FluDivider.qml b/src/imports/FluentUI/Controls/FluDivider.qml index e129e16..b1fd5aa 100644 --- a/src/imports/FluentUI/Controls/FluDivider.qml +++ b/src/imports/FluentUI/Controls/FluDivider.qml @@ -3,13 +3,10 @@ import QtQuick.Window import FluentUI Rectangle { - color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1) - Behavior on color{ ColorAnimation { duration: 300 } } - } diff --git a/src/imports/FluentUI/Controls/FluDropDownButton.qml b/src/imports/FluentUI/Controls/FluDropDownButton.qml index 9112e0e..1a7e3cc 100644 --- a/src/imports/FluentUI/Controls/FluDropDownButton.qml +++ b/src/imports/FluentUI/Controls/FluDropDownButton.qml @@ -5,14 +5,12 @@ import QtQuick.Window import FluentUI Button { - property bool disabled: false property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1) property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1) property var window : Window.window property alias items: menu.content - id: control rightPadding:35 enabled: !disabled @@ -45,7 +43,6 @@ Button { } iconColor:title.color } - } contentItem: FluText { id:title @@ -72,7 +69,6 @@ Button { } } } - onClicked: { if(items && menu.getContainerCount()!==0){ var pos = control.mapToItem(null, 0, 0) @@ -87,10 +83,8 @@ Button { menu.open() } } - FluMenu{ id:menu width: control.width } - } diff --git a/src/imports/FluentUI/Controls/FluExpander.qml b/src/imports/FluentUI/Controls/FluExpander.qml index 46f21d8..b9fbef2 100644 --- a/src/imports/FluentUI/Controls/FluExpander.qml +++ b/src/imports/FluentUI/Controls/FluExpander.qml @@ -4,18 +4,15 @@ import QtQuick.Window import FluentUI Item { - property string headerText: "Titlte" property bool expand: false property int contentHeight : 300 default property alias content: container.data - - id:root + id:control height: layout_header.height + container.height width: 400 implicitWidth: width implicitHeight: height - Rectangle{ id:layout_header width: parent.width @@ -23,28 +20,24 @@ Item { radius: 4 color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) - Behavior on color{ ColorAnimation { duration: 300 } } - Behavior on border.color{ ColorAnimation { duration: 300 } } - MouseArea{ - id:root_mouse + id:control_mouse anchors.fill: parent hoverEnabled: true onClicked: { expand = !expand } } - FluText{ text: headerText anchors{ @@ -53,7 +46,6 @@ Item { leftMargin: 15 } } - FluIconButton{ anchors{ verticalCenter: parent.verticalCenter @@ -61,7 +53,7 @@ Item { rightMargin: 15 } color:{ - if(root_mouse.containsMouse || hovered){ + if(control_mouse.containsMouse || hovered){ return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(245/255,245/255,245/255,1) } return FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) @@ -81,8 +73,6 @@ Item { } } } - - Rectangle{ id:container width: parent.width @@ -104,5 +94,4 @@ Item { } } } - } diff --git a/src/imports/FluentUI/Controls/FluFilledButton.qml b/src/imports/FluentUI/Controls/FluFilledButton.qml index 9377a56..aad2d65 100644 --- a/src/imports/FluentUI/Controls/FluFilledButton.qml +++ b/src/imports/FluentUI/Controls/FluFilledButton.qml @@ -4,13 +4,11 @@ import QtQuick.Controls.Basic import FluentUI Button { - property bool disabled: false property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.1) : Qt.lighter(normalColor,1.1) property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1) property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2) - id: control enabled: !disabled Keys.onSpacePressed: control.visualFocus&&clicked() diff --git a/src/imports/FluentUI/Controls/FluFlipView.qml b/src/imports/FluentUI/Controls/FluFlipView.qml index cfad518..b219727 100644 --- a/src/imports/FluentUI/Controls/FluFlipView.qml +++ b/src/imports/FluentUI/Controls/FluFlipView.qml @@ -4,22 +4,18 @@ import QtQuick.Controls.Basic import FluentUI Item{ - property bool vertical: false default property alias content : swipe.contentData property alias currentIndex: swipe.currentIndex - id:control width: 400 height: 300 implicitWidth: width implicitHeight: height - QtObject{ id:d property bool flag: true } - MouseArea{ anchors.fill: parent preventStealing: true @@ -36,7 +32,6 @@ Item{ timer.restart() } } - Timer{ id:timer interval: 250 @@ -44,7 +39,6 @@ Item{ d.flag = true } } - SwipeView { id:swipe clip: true @@ -52,7 +46,6 @@ Item{ orientation:control.vertical ? Qt.Vertical : Qt.Horizontal anchors.fill: parent } - Button{ id:btn_start height: vertical ? 20 : 40 @@ -82,7 +75,6 @@ Item{ swipe.currentIndex = Math.max(swipe.currentIndex - 1, 0) } } - Button{ id:btn_end height: vertical ? 20 : 40 @@ -112,6 +104,4 @@ Item{ swipe.currentIndex = Math.min(swipe.currentIndex + 1,swipe.count-1) } } - } - diff --git a/src/imports/FluentUI/Controls/FluFocusRectangle.qml b/src/imports/FluentUI/Controls/FluFocusRectangle.qml index a565504..bc17eee 100644 --- a/src/imports/FluentUI/Controls/FluFocusRectangle.qml +++ b/src/imports/FluentUI/Controls/FluFocusRectangle.qml @@ -3,9 +3,7 @@ import QtQuick.Controls import FluentUI Item { - property int radius: 4 - id:root anchors.fill: parent anchors.margins: -3 @@ -19,5 +17,4 @@ Item { border.color: FluTheme.dark ? Qt.rgba(1,1,1,1) : Qt.rgba(0,0,0,1) z: 65535 } - } diff --git a/src/imports/FluentUI/Controls/FluIcon.qml b/src/imports/FluentUI/Controls/FluIcon.qml index 24ecfea..136f7b4 100644 --- a/src/imports/FluentUI/Controls/FluIcon.qml +++ b/src/imports/FluentUI/Controls/FluIcon.qml @@ -3,16 +3,14 @@ import QtQuick.Controls import FluentUI Text { - property int iconSource property int iconSize: 20 property color iconColor: FluTheme.dark ? "#FFFFFF" : "#000000" - id:text_icon font.family: "Segoe Fluent Icons" font.pixelSize: iconSize horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: iconColor - text: (String.fromCharCode(iconSource).toString(16)); + text: (String.fromCharCode(iconSource).toString(16)) } diff --git a/src/imports/FluentUI/Controls/FluIconButton.qml b/src/imports/FluentUI/Controls/FluIconButton.qml index 1d64359..bdbe4e0 100644 --- a/src/imports/FluentUI/Controls/FluIconButton.qml +++ b/src/imports/FluentUI/Controls/FluIconButton.qml @@ -4,7 +4,6 @@ import QtQuick.Controls.Basic import FluentUI Button { - property int iconSize: 20 property int iconSource property bool disabled: false @@ -35,7 +34,6 @@ Button { return Qt.rgba(0,0,0,1) } } - id:control width: 30 height: 30 diff --git a/src/imports/FluentUI/Controls/FluInfoBar.qml b/src/imports/FluentUI/Controls/FluInfoBar.qml index eb2fa41..023e024 100644 --- a/src/imports/FluentUI/Controls/FluInfoBar.qml +++ b/src/imports/FluentUI/Controls/FluInfoBar.qml @@ -3,21 +3,17 @@ import QtQuick.Controls import FluentUI FluObject { - id:infoBar - property var root; - property int layoutY: 75; - + property int layoutY: 75 + id:control FluObject{ id:mcontrol - property string const_success: "success"; property string const_info: "info"; property string const_warning: "warning"; property string const_error: "error"; property int maxWidth: 300; property var screenLayout: null; - function create(type,text,duration,moremsg){ if(screenLayout){ var last = screenLayout.getLastloader(); @@ -26,7 +22,6 @@ FluObject { return; } } - initScreenLayout(); contentComponent.createObject(screenLayout,{ type:type, @@ -35,22 +30,19 @@ FluObject { moremsg:moremsg, }); } - function createCustom(itemcomponent,duration){ initScreenLayout(); if(itemcomponent){ contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration}); } } - function initScreenLayout(){ if(screenLayout == null){ screenLayout = screenlayoutComponent.createObject(root); - screenLayout.y = infoBar.layoutY; + screenLayout.y = control.layoutY; screenLayout.z = 100000; } } - Component{ id:screenlayoutComponent Column{ @@ -59,9 +51,7 @@ FluObject { move: Transition { NumberAnimation { properties: "y"; easing.type: Easing.OutBack; duration: 300 } } - onChildrenChanged: if(children.length === 0) destroy(); - function getLastloader(){ if(children.length > 0){ return children[children.length - 1]; @@ -70,7 +60,6 @@ FluObject { } } } - Component{ id:contentComponent Item{ @@ -80,45 +69,35 @@ FluObject { property string type property string text property string moremsg - width: parent.width; height: loader.height; - function close(){ content.destroy(); } - function restart(){ delayTimer.restart(); } - Timer { id:delayTimer interval: duration; running: true; repeat: true onTriggered: content.close(); } - Loader{ id:loader; x:(parent.width - width) / 2; property var _super: content; - scale: item ? 1 : 0; asynchronous: true - Behavior on scale { NumberAnimation { easing.type: Easing.OutBack; duration: 100 } } - sourceComponent:itemcomponent ? itemcomponent : mcontrol.fluent_sytle; } - } } - property Component fluent_sytle: Rectangle{ width: rowlayout.width + (_super.moremsg ? 25 : 80); height: rowlayout.height + 20; @@ -208,26 +187,19 @@ FluObject { } } } - function showSuccess(text,duration=1000,moremsg){ mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : ""); } - function showInfo(text,duration=1000,moremsg){ mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : ""); } - function showWarning(text,duration=1000,moremsg){ mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : ""); } - function showError(text,duration=1000,moremsg){ mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : ""); } - function showCustom(itemcomponent,duration=1000){ mcontrol.createCustom(itemcomponent,duration); } - - } diff --git a/src/imports/FluentUI/Controls/FluItem.qml b/src/imports/FluentUI/Controls/FluItem.qml index 45e30bc..baa157e 100644 --- a/src/imports/FluentUI/Controls/FluItem.qml +++ b/src/imports/FluentUI/Controls/FluItem.qml @@ -3,29 +3,24 @@ import QtQuick.Controls import Qt5Compat.GraphicalEffects Item{ - id:control property var radius:[0,0,0,0] default property alias contentItem: container.data - + id:control Item{ id:container width: control.width height: control.height opacity: 0 } - onWidthChanged: { canvas.requestPaint() } - onHeightChanged: { canvas.requestPaint() } - onRadiusChanged: { canvas.requestPaint() } - Canvas { id: canvas anchors.fill: parent @@ -55,11 +50,9 @@ Item{ ctx.restore(); } } - OpacityMask { anchors.fill: container source: container maskSource: canvas } - } diff --git a/src/imports/FluentUI/Controls/FluMediaPlayer.qml b/src/imports/FluentUI/Controls/FluMediaPlayer.qml index b6cc145..077ad58 100644 --- a/src/imports/FluentUI/Controls/FluMediaPlayer.qml +++ b/src/imports/FluentUI/Controls/FluMediaPlayer.qml @@ -4,17 +4,14 @@ import QtMultimedia import FluentUI Rectangle { - property url source property bool showControl: false property real volume: 30 - id:control width: 480 height: 270 color: FluColors.Black clip: true - MouseArea{ anchors.fill: parent preventStealing: true @@ -22,7 +19,6 @@ Rectangle { showControl = !showControl } } - MediaPlayer { id: mediaplayer property bool autoSeek:true @@ -49,16 +45,13 @@ Rectangle { } } } - onSourceChanged: { slider.seek(0) } - VideoOutput { id:video_output anchors.fill: parent } - Item{ height: 100 y:showControl ? control.height - 110 : control.height @@ -110,7 +103,6 @@ Rectangle { mediaplayer.position = val*mediaplayer.duration/slider.maxValue } } - FluText{ id:start_time anchors{ @@ -120,7 +112,6 @@ Rectangle { } text: formatDuration(slider.value*mediaplayer.duration/slider.maxValue) } - FluText{ id:end_time anchors{ @@ -130,7 +121,6 @@ Rectangle { } text: formatDuration(mediaplayer.duration) } - Row{ spacing: 10 anchors{ @@ -164,7 +154,6 @@ Rectangle { } } } - FluIconButton{ id:btn_volume iconSize: 17 @@ -179,7 +168,6 @@ Rectangle { audio_output.muted = !audio_output.muted } } - FluSlider{ id:slider_volume size: 80 @@ -195,7 +183,6 @@ Rectangle { } } } - function formatDuration(duration) { const seconds = Math.floor(duration / 1000); const hours = Math.floor(seconds / 3600); @@ -203,18 +190,13 @@ Rectangle { const remainingSeconds = seconds % 60; return `${pad(hours)}:${pad(minutes)}:${pad(remainingSeconds)}`; } - function pad(value) { return value.toString().padStart(2, '0'); } - function pause(){ mediaplayer.pause() } - function play(){ mediaplayer.play() } - } - diff --git a/src/imports/FluentUI/Controls/FluMenu.qml b/src/imports/FluentUI/Controls/FluMenu.qml index e62d59d..a51fc2e 100644 --- a/src/imports/FluentUI/Controls/FluMenu.qml +++ b/src/imports/FluentUI/Controls/FluMenu.qml @@ -4,7 +4,6 @@ import QtQuick.Controls import FluentUI Menu { - default property alias content: container.data property bool enableAnimation: true id: popup @@ -21,7 +20,6 @@ Menu { duration: enableAnimation ? 83 : 0 } } - exit:Transition { NumberAnimation { property: "opacity" @@ -30,7 +28,6 @@ Menu { duration: enableAnimation ? 83 : 0 } } - background:Item{ FluShadow{ radius: 5 @@ -56,13 +53,10 @@ Menu { } } } - function getContainerHeight(){ return container.height } - function getContainerCount(){ return container.children.length } - } diff --git a/src/imports/FluentUI/Controls/FluMenuItem.qml b/src/imports/FluentUI/Controls/FluMenuItem.qml index 894008e..84f68df 100644 --- a/src/imports/FluentUI/Controls/FluMenuItem.qml +++ b/src/imports/FluentUI/Controls/FluMenuItem.qml @@ -3,11 +3,9 @@ import QtQuick.Controls import FluentUI Item { - property string text: "MenuItem" property var onClickFunc signal clicked - id:control width: { if(control.parent){ @@ -16,7 +14,6 @@ Item { return 140 } height: 32 - Rectangle{ anchors.centerIn: parent width: control.width-40 @@ -35,12 +32,10 @@ Item { return Qt.rgba(0,0,0,0) } } - FluText{ text: control.text anchors.centerIn: parent } - MouseArea{ id:mouse_area hoverEnabled: true diff --git a/src/imports/FluentUI/Controls/FluMultilineTextBox.qml b/src/imports/FluentUI/Controls/FluMultilineTextBox.qml index d551834..ccf55b2 100644 --- a/src/imports/FluentUI/Controls/FluMultilineTextBox.qml +++ b/src/imports/FluentUI/Controls/FluMultilineTextBox.qml @@ -4,14 +4,12 @@ import QtQuick.Controls.Basic import FluentUI TextArea{ - property bool disabled: false property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1) property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1) property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) - id:control width: 300 enabled: !disabled @@ -44,5 +42,4 @@ TextArea{ id:menu inputItem: control } - } diff --git a/src/imports/FluentUI/Controls/FluNavigationView.qml b/src/imports/FluentUI/Controls/FluNavigationView.qml index 855d521..d43e869 100644 --- a/src/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/imports/FluentUI/Controls/FluNavigationView.qml @@ -6,14 +6,12 @@ import QtQuick.Layouts import FluentUI Item { - enum DisplayMode { Open, Compact, Minimal, Auto } - property url logo property string title: "" property FluObject items @@ -21,15 +19,12 @@ Item { property int displayMode: FluNavigationView.Auto property Component autoSuggestBox property Component actionItem - enum PageModeFlag{ Standard = 0, SingleTop = 1, SingleTask = 2 } - id:control - QtObject{ id:d property bool enableStack: true @@ -52,11 +47,9 @@ Item { property bool isCompactAndPanel: d.displayMode === FluNavigationView.Compact && d.enableNavigationPanel property bool isCompactAndNotPanel:d.displayMode === FluNavigationView.Compact && !d.enableNavigationPanel property bool isMinimalAndPanel: d.displayMode === FluNavigationView.Minimal && d.enableNavigationPanel - onIsCompactAndNotPanelChanged: { collapseAll() } - onDisplayModeChanged: { if(d.displayMode === FluNavigationView.Compact){ collapseAll() @@ -67,7 +60,6 @@ Item { timer_anim_x_enable.restart() } } - function handleItems(){ var idx = 0 var data = [] @@ -103,14 +95,12 @@ Item { return data } } - Component{ id:com_panel_item_empty Item{ visible: false } } - Component{ id:com_panel_item_separatorr FluDivider{ @@ -130,7 +120,6 @@ Item { } } } - Component{ id:com_panel_item_header Item{ @@ -159,7 +148,6 @@ Item { } } } - Component{ id:com_panel_item_expander Item{ @@ -265,7 +253,6 @@ Item { iconSize: 15 } } - Item{ id:item_icon width: 30 @@ -314,7 +301,6 @@ Item { } } } - Component{ id:com_panel_item Item{ @@ -418,7 +404,6 @@ Item { iconSize: 15 } } - Item{ id:item_icon width: 30 @@ -438,7 +423,6 @@ Item { } } } - FluText{ id:item_title text:model.title @@ -468,8 +452,6 @@ Item { } } } - - Item { id:nav_app_bar width: parent.width @@ -541,7 +523,6 @@ Item { font: FluTextStyle.Body } } - Item{ anchors.right: parent.right height: parent.height @@ -558,7 +539,6 @@ Item { } } } - Item{ anchors{ left: d.isMinimal || d.isCompactAndPanel ? parent.left : layout_list.right @@ -597,7 +577,6 @@ Item { replaceExit : Transition{} } } - MouseArea{ anchors.fill: parent visible: d.isMinimalAndPanel||d.isCompactAndPanel @@ -605,7 +584,6 @@ Item { d.enableNavigationPanel = false } } - Rectangle{ id:layout_list width: { @@ -677,7 +655,6 @@ Item { } } } - FluIconButton{ visible:opacity opacity:d.isCompactAndNotPanel @@ -705,7 +682,6 @@ Item { } } } - ListView{ id:nav_list clip: true @@ -812,7 +788,6 @@ Item { } } } - Popup{ property var childModel id:control_popup @@ -878,7 +853,6 @@ Item { control_popup.open() } } - Timer{ id:timer_anim_x_enable interval: 150 @@ -886,7 +860,6 @@ Item { anim_layout_list_x.enabled = true } } - function collapseAll(){ for(var i=0;i0) { @@ -933,11 +903,9 @@ Item { } nav_swipe.push(url,{url:url}) } - function getCurrentIndex(){ return nav_list.currentIndex } - function startPageByItem(data){ var items = getItems(); for(var i=0;i children; + id:flu_object; } diff --git a/src/imports/FluentUI/Controls/FluPagination.qml b/src/imports/FluentUI/Controls/FluPagination.qml index c3ba495..20039fe 100644 --- a/src/imports/FluentUI/Controls/FluPagination.qml +++ b/src/imports/FluentUI/Controls/FluPagination.qml @@ -4,7 +4,6 @@ import QtQuick.Layouts import FluentUI Item { - id: control signal requestPage(int page,int count) property string previousText: "<上一页" property string nextText: "下一页>" @@ -14,17 +13,14 @@ Item { property int __itemPerPage: 10 property int pageButtonCount: 5 property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1 - - + id: control implicitHeight: 40 implicitWidth: content.width - Row{ id: content height: control.height spacing: 10 padding: 10 - FluToggleButton{ visible: control.pageCount>1 disabled: control.pageCurrent<=1 @@ -33,7 +29,6 @@ Item { control.calcNewPage(control.pageCurrent-1); } } - Row{ spacing: 5 FluToggleButton{ @@ -93,7 +88,6 @@ Item { } } } - function calcNewPage(page) { if(!page) @@ -104,6 +98,4 @@ Item { control.pageCurrent=page_num control.requestPage(page_num,control.__itemPerPage) } - - } diff --git a/src/imports/FluentUI/Controls/FluPasswordBox.qml b/src/imports/FluentUI/Controls/FluPasswordBox.qml index ab0335e..2da02c8 100644 --- a/src/imports/FluentUI/Controls/FluPasswordBox.qml +++ b/src/imports/FluentUI/Controls/FluPasswordBox.qml @@ -4,7 +4,6 @@ import QtQuick.Controls.Basic import FluentUI TextField{ - property bool disabled: false property int iconSource: 0 property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) @@ -12,7 +11,6 @@ TextField{ property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1) property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1) property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) - id:control width: 300 enabled: !disabled @@ -74,6 +72,4 @@ TextField{ id:menu inputItem: control } - } - diff --git a/src/imports/FluentUI/Controls/FluPivot.qml b/src/imports/FluentUI/Controls/FluPivot.qml index 4a92953..88e4014 100644 --- a/src/imports/FluentUI/Controls/FluPivot.qml +++ b/src/imports/FluentUI/Controls/FluPivot.qml @@ -3,27 +3,22 @@ import QtQuick.Controls import FluentUI Item { - default property alias content: d.children property alias currentIndex: nav_list.currentIndex property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black - id:control width: 400 height: 300 implicitHeight: height implicitWidth: width - MouseArea{ anchors.fill: parent preventStealing: true } - FluObject{ id:d } - ListView{ id:nav_list height: 40 @@ -77,7 +72,6 @@ Item { } } } - Item{ id:container anchors{ @@ -87,7 +81,6 @@ Item { right: parent.right bottom: parent.bottom } - Repeater{ model:d.children Loader{ @@ -98,6 +91,4 @@ Item { } } } - - } diff --git a/src/imports/FluentUI/Controls/FluProgressBar.qml b/src/imports/FluentUI/Controls/FluProgressBar.qml index 7a9685c..bb339c4 100644 --- a/src/imports/FluentUI/Controls/FluProgressBar.qml +++ b/src/imports/FluentUI/Controls/FluProgressBar.qml @@ -3,17 +3,14 @@ import QtQuick.Controls import FluentUI FluRectangle { - property real progress: 0.5 property bool indeterminate: true - id: control width: 150 height: 5 radius: [3,3,3,3] clip: true color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1) - Component.onCompleted: { if(indeterminate){ bar.x = -control.width*0.5 @@ -23,14 +20,12 @@ FluRectangle { bar.x = 0 } } - Rectangle{ id:bar radius: 3 width: control.width*progress height: control.height color:FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark - Behavior on x{ id:behavior enabled: false diff --git a/src/imports/FluentUI/Controls/FluProgressRing.qml b/src/imports/FluentUI/Controls/FluProgressRing.qml index 4e5b932..31621b9 100644 --- a/src/imports/FluentUI/Controls/FluProgressRing.qml +++ b/src/imports/FluentUI/Controls/FluProgressRing.qml @@ -3,13 +3,11 @@ import QtQuick.Controls import FluentUI Rectangle { - property real linWidth : width/8 property real progress: 0.25 property bool indeterminate: true readonly property real radius2 : radius - linWidth/2 property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark - id: control width: 44 height: 44 @@ -17,25 +15,21 @@ Rectangle { border.width: linWidth color: "#00000000" border.color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1) - onProgressChanged: { canvas.requestPaint() } - - Connections{ - target: FluTheme - function onDarkChanged(){ - canvas.requestPaint() - } - } - Component.onCompleted: { if(indeterminate){ behavior.enabled = true control.rotation = 360 } } - + Connections{ + target: FluTheme + function onDarkChanged(){ + canvas.requestPaint() + } + } Behavior on rotation{ id:behavior enabled: false @@ -53,7 +47,6 @@ Rectangle { } } } - Canvas { id:canvas anchors.fill: parent @@ -74,6 +67,4 @@ Rectangle { ctx.restore(); } } - - } diff --git a/src/imports/FluentUI/Controls/FluRadioButton.qml b/src/imports/FluentUI/Controls/FluRadioButton.qml index 7979cd0..d7252a8 100644 --- a/src/imports/FluentUI/Controls/FluRadioButton.qml +++ b/src/imports/FluentUI/Controls/FluRadioButton.qml @@ -5,10 +5,8 @@ import QtQuick.Layouts import FluentUI Button { - property bool selected: false property bool disabled: false - id:control enabled: !disabled focusPolicy:Qt.TabFocus @@ -102,4 +100,3 @@ Button { } } } - diff --git a/src/imports/FluentUI/Controls/FluRatingControl.qml b/src/imports/FluentUI/Controls/FluRatingControl.qml index f27f698..4c24e17 100644 --- a/src/imports/FluentUI/Controls/FluRatingControl.qml +++ b/src/imports/FluentUI/Controls/FluRatingControl.qml @@ -3,22 +3,18 @@ import QtQuick.Controls import FluentUI Item { - property int number: 5 property int spacing: 4 property int size: 18 property int value:0 - id:control implicitWidth: container.width implicitHeight: container.height - QtObject{ id:d property int mouseValue: 0 property int itemSize: control.size+spacing*2 } - Row{ id:container spacing: 0 @@ -42,7 +38,6 @@ Item { } } } - MouseArea{ anchors.fill: container hoverEnabled: true @@ -56,5 +51,4 @@ Item { control.value = Number(mouse.x / d.itemSize)+1 } } - } diff --git a/src/imports/FluentUI/Controls/FluRectangle.qml b/src/imports/FluentUI/Controls/FluRectangle.qml index b2c1e70..50a3a1e 100644 --- a/src/imports/FluentUI/Controls/FluRectangle.qml +++ b/src/imports/FluentUI/Controls/FluRectangle.qml @@ -4,12 +4,10 @@ import Qt5Compat.GraphicalEffects import FluentUI Item{ - property var radius:[0,0,0,0] property color color : "#FFFFFF" property bool shadow: true default property alias contentItem: container.data - id:control FluShadow{ anchors.fill: container @@ -21,7 +19,6 @@ Item{ return false } } - Rectangle{ id:container width: control.width @@ -29,7 +26,6 @@ Item{ opacity: 0 color:control.color } - Canvas { id: canvas anchors.fill: parent @@ -59,11 +55,9 @@ Item{ ctx.restore(); } } - OpacityMask { anchors.fill: container source: container maskSource: canvas } - } diff --git a/src/imports/FluentUI/Controls/FluScrollBar.qml b/src/imports/FluentUI/Controls/FluScrollBar.qml index a814b59..b7cc361 100644 --- a/src/imports/FluentUI/Controls/FluScrollBar.qml +++ b/src/imports/FluentUI/Controls/FluScrollBar.qml @@ -1,20 +1,17 @@ import QtQuick -import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI ScrollBar { - property color handleNormalColor: Qt.rgba(134/255,134/255,134/255,1) property color handleHoverColor: Qt.lighter(handleNormalColor) property color handlePressColor: Qt.darker(handleNormalColor) property bool expand: false - id: control implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) - visible: control.policy !== ScrollBar.AlwaysOff minimumSize: 0.3 topPadding:{ @@ -128,7 +125,6 @@ ScrollBar { duration: 150 } } - FluIconButton{ id:btn_top iconSource: FluentIcons.CaretSolidUp @@ -190,5 +186,4 @@ ScrollBar { increase() } } - } diff --git a/src/imports/FluentUI/Controls/FluScrollablePage.qml b/src/imports/FluentUI/Controls/FluScrollablePage.qml index 330af01..5354618 100644 --- a/src/imports/FluentUI/Controls/FluScrollablePage.qml +++ b/src/imports/FluentUI/Controls/FluScrollablePage.qml @@ -5,7 +5,6 @@ import QtQuick.Controls import FluentUI Item { - property alias title: text_title.text default property alias content: container.data property int spacing : 0 @@ -15,9 +14,7 @@ Item { property int bottomPadding: 10 property int pageMode: FluNavigationView.Standard property string url: '' - id:control - FluText{ id:text_title font: FluTextStyle.Title @@ -33,7 +30,6 @@ Item { rightMargin: control.rightPadding } } - Flickable{ id:flickview clip: true diff --git a/src/imports/FluentUI/Controls/FluShadow.qml b/src/imports/FluentUI/Controls/FluShadow.qml index 62d6a8e..07b4674 100644 --- a/src/imports/FluentUI/Controls/FluShadow.qml +++ b/src/imports/FluentUI/Controls/FluShadow.qml @@ -6,63 +6,61 @@ Item { property color color: FluTheme.dark ? "#FFFFFF" : "#999999" property int radius: 4 - - id:root + id:control anchors.fill: parent anchors.margins: -4 - Rectangle{ - width: root.width - height: root.height + width: control.width + height: control.height anchors.centerIn: parent color: "#00000000" opacity: 0.02 border.width: 1 - radius: root.radius - border.color: root.color + radius: control.radius + border.color: control.color } Rectangle{ - width: root.width - 2 - height: root.height - 2 + width: control.width - 2 + height: control.height - 2 anchors.centerIn: parent color: "#00000000" opacity: 0.04 border.width: 1 - radius: root.radius - border.color: root.color + radius: control.radius + border.color: control.color } Rectangle{ - width: root.width - 4 - height: root.height - 4 + width: control.width - 4 + height: control.height - 4 anchors.centerIn: parent color: "#00000000" opacity: 0.06 border.width: 1 - radius: root.radius - border.color: root.color + radius: control.radius + border.color: control.color } Rectangle{ - width: root.width - 6 - height: root.height - 6 + width: control.width - 6 + height: control.height - 6 anchors.centerIn: parent color: "#00000000" opacity: 0.08 border.width: 1 - radius: root.radius - border.color: root.color + radius: control.radius + border.color: control.color } Rectangle{ - width: root.width - 8 - height: root.height - 8 + width: control.width - 8 + height: control.height - 8 anchors.centerIn: parent opacity: 0.1 - radius: root.radius + radius: control.radius color: "#00000000" border.width: 1 - border.color: root.color + border.color: control.color } } diff --git a/src/imports/FluentUI/Controls/FluSlider.qml b/src/imports/FluentUI/Controls/FluSlider.qml index 1e4a152..f20f1b9 100644 --- a/src/imports/FluentUI/Controls/FluSlider.qml +++ b/src/imports/FluentUI/Controls/FluSlider.qml @@ -4,7 +4,6 @@ import Qt5Compat.GraphicalEffects import FluentUI Item{ - property int size: 180 property int dotSize: 24 property int value: 50 @@ -14,16 +13,13 @@ Item{ property var onLineClickFunc signal pressed signal released - id:root height: control.height width: control.width rotation: vertical ? 180 : 0 - Component.onCompleted: { seek(value) } - MouseArea{ id:mouse_line anchors.centerIn: control @@ -45,7 +41,6 @@ Item{ } } } - Rectangle { id: control width: vertical ? 4 :size @@ -61,7 +56,6 @@ Item{ color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark } } - Rectangle{ id:dot width: dotSize @@ -109,20 +103,17 @@ Item{ } root.pressed() } - onReleased: { tool_tip.visible = false root.released() } } - FluTooltip{ id:tool_tip text:String(root.value) y: vertical ? 32 : -40 } } - function seek(val){ if(vertical){ dot.y =val/maxValue*control.height - dotSize/2 diff --git a/src/imports/FluentUI/Controls/FluStatusView.qml b/src/imports/FluentUI/Controls/FluStatusView.qml index f56c703..c56a83d 100644 --- a/src/imports/FluentUI/Controls/FluStatusView.qml +++ b/src/imports/FluentUI/Controls/FluStatusView.qml @@ -4,7 +4,6 @@ import QtQuick.Layouts import FluentUI Item{ - enum StatusMode { Loading, Empty, @@ -14,13 +13,11 @@ Item{ default property alias content: container.data property int statusMode: FluStatusView.Loading signal errorClicked - Item{ id:container anchors.fill: parent visible: statusMode === FluStatusView.Success } - FluArea{ paddings: 0 border.width: 0 @@ -43,7 +40,6 @@ Item{ } } } - FluArea{ paddings: 0 border.width: 0 @@ -63,7 +59,6 @@ Item{ } } } - FluArea{ paddings: 0 border.width: 0 @@ -90,8 +85,6 @@ Item{ } } } - - function showSuccessView(){ statusMode = FluStatusView.Success } @@ -104,5 +97,4 @@ Item{ function showErrorView(){ statusMode = FluStatusView.Error } - } diff --git a/src/imports/FluentUI/Controls/FluTabView.qml b/src/imports/FluentUI/Controls/FluTabView.qml index 253189a..b55caf5 100644 --- a/src/imports/FluentUI/Controls/FluTabView.qml +++ b/src/imports/FluentUI/Controls/FluTabView.qml @@ -4,25 +4,21 @@ import QtQuick.Layouts import FluentUI Item { - enum TabWidthBehavior { Equal, SizeToContent, Compact } - enum CloseButtonVisibility{ Nerver, Always, OnHover } - property int tabWidthBehavior : FluTabView.Equal property int closeButtonVisibility : FluTabView.Always property int itemWidth: 146 property bool addButtonVisibility: true signal newPressed - id:control implicitHeight: height implicitWidth: width @@ -31,7 +27,6 @@ Item { return parent return undefined } - QtObject { id: d property int dragIndex: -1 @@ -39,16 +34,13 @@ Item { property bool itemPress: false property int maxEqualWidth: 240 } - MouseArea{ anchors.fill: parent preventStealing: true } - ListModel{ id:tab_model } - FluIconButton{ id:btn_new visible: addButtonVisibility @@ -61,7 +53,6 @@ Item { newPressed() } } - ListView{ id:tab_nav height: 34 @@ -88,21 +79,16 @@ Item { policy: ScrollBar.AlwaysOff } delegate: Item{ - width: item_layout.width height: item_container.height z: item_mouse_drag.pressed ? 1000 : 1 - Item{ id:item_layout width: item_container.width height: item_container.height - FluItem{ id:item_container - property real timestamp: new Date().getTime() - height: tab_nav.height width: { if(tabWidthBehavior === FluTabView.Equal){ @@ -119,24 +105,20 @@ Item { radius: [6,6,0,0] Behavior on x { enabled: d.dragBehavior; NumberAnimation { duration: 200 } } Behavior on y { enabled: d.dragBehavior; NumberAnimation { duration: 200 } } - MouseArea{ id:item_mouse_hove anchors.fill: parent hoverEnabled: true } - MouseArea{ id:item_mouse_drag anchors.fill: parent drag.target: item_container drag.axis: Drag.XAxis - onWheel: (wheel)=>{ if (wheel.angleDelta.y > 0) scroll_nav.decrease() else scroll_nav.increase() } - onPressed: { d.itemPress = true item_container.timestamp = new Date().getTime(); @@ -147,7 +129,6 @@ Item { item_container.x = pos.x item_container.y = pos.y } - onReleased: { d.itemPress = false timer.stop() @@ -164,7 +145,6 @@ Item { item_container.x = 0; item_container.y = 0; } - onPositionChanged: { var pos = tab_nav.mapFromItem(item_container, 0, 0) updatePosition(pos) @@ -211,7 +191,6 @@ Item { } } } - Rectangle{ anchors.fill: parent color: { @@ -234,7 +213,6 @@ Item { } } } - RowLayout{ spacing: 0 height: parent.height @@ -271,7 +249,6 @@ Item { } } } - FluIconButton{ id:item_btn_close iconSource: FluentIcons.ChromeClose @@ -294,7 +271,6 @@ Item { tab_model.remove(index) } } - FluDivider{ width: 1 height: 16 @@ -307,8 +283,6 @@ Item { } } } - - Item{ id:container anchors{ @@ -317,7 +291,6 @@ Item { right: parent.right bottom: parent.bottom } - Repeater{ model:tab_model Loader{ @@ -328,23 +301,17 @@ Item { } } } - - function createTab(icon,text,page,argument={}){ return {icon:icon,text:text,page:page,argument:argument} } - function appendTab(icon,text,page,argument){ tab_model.append(createTab(icon,text,page,argument)) } - function setTabList(list){ tab_model.clear() tab_model.append(list) } - function count(){ return tab_nav.count } - } diff --git a/src/imports/FluentUI/Controls/FluTableView.qml b/src/imports/FluentUI/Controls/FluTableView.qml index ff8df19..6ad923e 100644 --- a/src/imports/FluentUI/Controls/FluTableView.qml +++ b/src/imports/FluentUI/Controls/FluTableView.qml @@ -5,7 +5,6 @@ import QtQuick.Layouts import FluentUI Item { - property var columns : [] property var dataSource : [] property int pageCurrent: 1 @@ -14,28 +13,22 @@ Item { property int itemHeight: 56 property bool pageVisible: true signal requestPage(int page,int count) - id:control implicitHeight: layout_table.height - QtObject{ id:d property int coumnsWidth: parent.width } - MouseArea{ anchors.fill: parent preventStealing: true } - ListModel{ id:model_coumns } - ListModel{ id:model_data_source } - onColumnsChanged: { model_coumns.clear() model_coumns.append(columns) @@ -46,12 +39,10 @@ Item { } d.coumnsWidth = w } - onDataSourceChanged: { model_data_source.clear() model_data_source.append(dataSource) } - Flickable{ id:layout_flickable height: layout_table.height @@ -75,14 +66,12 @@ Item { width: Math.max(layout_flickable.width,d.coumnsWidth) clip:true interactive: false - header: FluRectangle{ id:layout_coumns height: control.itemHeight width: parent.width color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) radius: [5,5,0,0] - Row{ id:list_coumns spacing: 0 @@ -113,7 +102,6 @@ Item { } } } - footer: Item{ height: pageVisible ? 50 : 0 clip: true @@ -201,8 +189,6 @@ Item { } } } - - Component{ id:com_text Item{ @@ -232,11 +218,9 @@ Item { } } } - function getObject(index){ return model_data_source.get(index) } - function getObjectValues(index) { var obj = model_data_source.get(index) if(!obj) @@ -248,5 +232,4 @@ Item { } return data; } - } diff --git a/src/imports/FluentUI/Controls/FluText.qml b/src/imports/FluentUI/Controls/FluText.qml index f85aa90..4f9b9b5 100644 --- a/src/imports/FluentUI/Controls/FluText.qml +++ b/src/imports/FluentUI/Controls/FluText.qml @@ -3,12 +3,9 @@ import QtQuick.Controls import FluentUI Text { - property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220 - id:text color: textColor renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering font: FluTextStyle.Body - } diff --git a/src/imports/FluentUI/Controls/FluTextBox.qml b/src/imports/FluentUI/Controls/FluTextBox.qml index d049d0f..6b25d52 100644 --- a/src/imports/FluentUI/Controls/FluTextBox.qml +++ b/src/imports/FluentUI/Controls/FluTextBox.qml @@ -4,7 +4,6 @@ import QtQuick.Controls.Basic import FluentUI TextField{ - property bool disabled: false property int iconSource: 0 property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1) @@ -12,7 +11,6 @@ TextField{ property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1) property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1) property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) - id:control width: 300 enabled: !disabled diff --git a/src/imports/FluentUI/Controls/FluTextBoxBackground.qml b/src/imports/FluentUI/Controls/FluTextBoxBackground.qml index 24b0876..caf9160 100644 --- a/src/imports/FluentUI/Controls/FluTextBoxBackground.qml +++ b/src/imports/FluentUI/Controls/FluTextBoxBackground.qml @@ -4,9 +4,7 @@ import Qt5Compat.GraphicalEffects import FluentUI Rectangle{ - property Item inputItem - id:content radius: 4 layer.enabled: true diff --git a/src/imports/FluentUI/Controls/FluTextBoxMenu.qml b/src/imports/FluentUI/Controls/FluTextBoxMenu.qml index 707f22e..d92ac69 100644 --- a/src/imports/FluentUI/Controls/FluTextBoxMenu.qml +++ b/src/imports/FluentUI/Controls/FluTextBoxMenu.qml @@ -3,30 +3,25 @@ import QtQuick.Controls import FluentUI FluMenu{ - property string cutText : "剪切" property string copyText : "复制" property string pasteText : "粘贴" property string selectAllText : "全选" property var inputItem - id:menu focus:false enableAnimation:false - onVisibleChanged: { if(visible){ inputItem.forceActiveFocus() } } - Connections{ target: inputItem function onTextChanged() { menu.close() } } - FluMenuItem{ text: cutText visible: inputItem.selectedText !== "" && !inputItem.readOnly @@ -34,7 +29,6 @@ FluMenu{ inputItem.cut() } } - FluMenuItem{ text: copyText visible: inputItem.selectedText !== "" diff --git a/src/imports/FluentUI/Controls/FluTextButton.qml b/src/imports/FluentUI/Controls/FluTextButton.qml index e50d992..30b806b 100644 --- a/src/imports/FluentUI/Controls/FluTextButton.qml +++ b/src/imports/FluentUI/Controls/FluTextButton.qml @@ -4,14 +4,12 @@ import QtQuick.Controls.Basic import FluentUI Button { - property bool disabled: false property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.15) : Qt.lighter(normalColor,1.15) property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.3) : Qt.lighter(normalColor,1.3) property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1) property bool textBold: true - id: control topPadding:0 bottomPadding:0 @@ -19,9 +17,7 @@ Button { rightPadding:0 enabled: !disabled focusPolicy:Qt.TabFocus - Keys.onSpacePressed: control.visualFocus&&clicked() - background: Item{ FluFocusRectangle{ visible: control.visualFocus diff --git a/src/imports/FluentUI/Controls/FluTimePicker.qml b/src/imports/FluentUI/Controls/FluTimePicker.qml index 9339e05..542e8f1 100644 --- a/src/imports/FluentUI/Controls/FluTimePicker.qml +++ b/src/imports/FluentUI/Controls/FluTimePicker.qml @@ -38,7 +38,6 @@ Rectangle { popup.showPopup() } } - Rectangle{ id:divider_1 width: 1 @@ -46,8 +45,6 @@ Rectangle { height: parent.height color: dividerColor } - - Rectangle{ id:divider_2 width: 1 @@ -56,7 +53,6 @@ Rectangle { color: dividerColor visible: isH } - FluText{ id:text_hour anchors{ @@ -69,8 +65,6 @@ Rectangle { horizontalAlignment: Text.AlignHCenter text:"时" } - - FluText{ id:text_minute anchors{ @@ -83,8 +77,6 @@ Rectangle { horizontalAlignment: Text.AlignHCenter text:"分" } - - FluText{ id:text_ampm visible: isH @@ -98,7 +90,6 @@ Rectangle { horizontalAlignment: Text.AlignHCenter text:"AM/PM" } - Menu{ id:popup width: container.width @@ -114,7 +105,6 @@ Rectangle { duration: 83 } } - exit:Transition { NumberAnimation { property: "opacity" @@ -144,14 +134,11 @@ Rectangle { spacing: 0 width: parent.width height: 300 - Component{ id:list_delegate - Item{ height:38 width:getListView().width - function getListView(){ if(type === 0) return list_view_1 @@ -160,8 +147,6 @@ Rectangle { if(type === 2) return list_view_3 } - - Rectangle{ anchors.fill: parent anchors.topMargin: 2 @@ -217,7 +202,6 @@ Rectangle { } } } - ListView{ id:list_view_1 width: isH ? 100 : 150 @@ -286,14 +270,12 @@ Rectangle { } } } - Rectangle{ width: parent.width height: 1 anchors.top: layout_content.bottom color: dividerColor } - Rectangle{ id:layout_actions height: 40 @@ -304,14 +286,12 @@ Rectangle { left: parent.left right: parent.right } - Item { id:divider width: 1 height: parent.height anchors.centerIn: parent } - FluButton{ anchors{ left: parent.left @@ -325,7 +305,6 @@ Rectangle { popup.close() } } - FluFilledButton{ anchors{ right: parent.right @@ -388,7 +367,6 @@ Rectangle { } popup.open() } - onClosed: { if(changeFlag){ text_hour.text = rowData[0] @@ -396,13 +374,9 @@ Rectangle { text_ampm.text = rowData[2] } } - } - property bool changeFlag: true readonly property var rowData: ["","",""] - - function generateArray(start, n) { var arr = []; for (var i = start; i <= n; i++) { @@ -410,5 +384,4 @@ Rectangle { } return arr; } - } diff --git a/src/imports/FluentUI/Controls/FluToggleSwitch.qml b/src/imports/FluentUI/Controls/FluToggleSwitch.qml index 0e34e33..7f2e2d9 100644 --- a/src/imports/FluentUI/Controls/FluToggleSwitch.qml +++ b/src/imports/FluentUI/Controls/FluToggleSwitch.qml @@ -21,9 +21,7 @@ Button { } selected = !selected } - contentItem: Item{} - background : RowLayout{ spacing: 0 Rectangle { diff --git a/src/imports/FluentUI/Controls/FluTooltip.qml b/src/imports/FluentUI/Controls/FluTooltip.qml index e128057..7ea981d 100644 --- a/src/imports/FluentUI/Controls/FluTooltip.qml +++ b/src/imports/FluentUI/Controls/FluTooltip.qml @@ -3,18 +3,12 @@ import QtQuick.Controls import FluentUI ToolTip { - id:tool_tip - -// property var font: FluTextStyle.Body - contentItem: FluText { text: tool_tip.text -// font: tool_tip.font padding: 4 wrapMode: Text.WrapAnywhere } - background: Rectangle{ anchors.fill: parent color: FluTheme.dark ? Qt.rgba(50/255,49/255,48/255,1) : Qt.rgba(1,1,1,1) diff --git a/src/imports/FluentUI/Controls/FluTreeView.qml b/src/imports/FluentUI/Controls/FluTreeView.qml index 906381b..84ded7a 100644 --- a/src/imports/FluentUI/Controls/FluTreeView.qml +++ b/src/imports/FluentUI/Controls/FluTreeView.qml @@ -5,19 +5,16 @@ import QtQuick.Controls import FluentUI Item { - enum TreeViewSelectionMode { None, Single, Multiple } - property int selectionMode: FluTreeView.None property var currentElement property var currentParentElement property var rootModel: tree_model.get(0).items signal itemClicked(var item) - id:root ListModel{ id:tree_model @@ -31,7 +28,6 @@ Item { multipParentKey:"" } } - Component{ id: delegate_root Column{ @@ -54,13 +50,10 @@ Item { } } } - Component{ id:delegate_items - Column{ id:item_layout - property real level: (mapToItem(list_root,0,0).x+list_root.contentX)/0.001 property var text: model.text??"Item" property bool hasChild : (model.items !== undefined) && (model.items.count !== 0) @@ -69,7 +62,6 @@ Item { property int width_hint: calculateWidth() property bool singleSelected: currentElement === model property var itemModel: model - function calculateWidth(){ var w = Math.max(list_root.width, item_layout_row.implicitWidth + 10); if(expanded){ @@ -86,8 +78,6 @@ Item { id:item_layout_rect width: list_root.contentWidth height: item_layout_row.implicitHeight - - Rectangle{ anchors.fill: parent anchors.margins: 2 @@ -104,7 +94,6 @@ Item { return (item_layout_mouse.containsMouse || item_layout_expanded.hovered || item_layout_checkbox.hovered)?Qt.rgba(0,0,0,0.03):Qt.rgba(0,0,0,0) } } - Rectangle{ width: 3 color:FluTheme.primaryColor.dark @@ -126,8 +115,6 @@ Item { } } } - - function onClickItem(){ if(selectionMode === FluTreeView.None){ itemClicked(model) @@ -147,23 +134,19 @@ Item { } } - RowLayout{ id:item_layout_row anchors.verticalCenter: item_layout_rect.verticalCenter - Item{ width: 15*level Layout.alignment: Qt.AlignVCenter } - FluCheckBox{ id:item_layout_checkbox text:"" selected: itemModel.multipSelected visible: selectionMode === FluTreeView.Multiple Layout.leftMargin: 5 - function refreshCheckBox(){ const stack = [tree_model.get(0)]; const result = []; @@ -195,7 +178,6 @@ Item { } } } - clickFunc:function(){ if(hasChild){ const stack = [itemModel]; @@ -215,7 +197,6 @@ Item { } } } - FluIconButton{ id:item_layout_expanded color:"#00000000" @@ -230,7 +211,6 @@ Item { model.expanded = !model.expanded } } - FluText { text: item_layout.text Layout.alignment: Qt.AlignVCenter @@ -239,7 +219,6 @@ Item { } } } - Item{ id:item_sub visible: { @@ -263,7 +242,6 @@ Item { } } } - ListView { id: list_root anchors.fill: parent @@ -275,16 +253,13 @@ Item { ScrollBar.vertical: FluScrollBar {} ScrollBar.horizontal: FluScrollBar { } } - function updateData(items){ rootModel.clear() rootModel.append(items) } - function signleData(){ return currentElement } - function multipData(){ const stack = [tree_model.get(0)]; const result = []; @@ -300,11 +275,9 @@ Item { } return result } - function createItem(text="",expanded=true,items=[],data={}){ return {text:text,expanded:expanded,items:items,key:uniqueRandom(),multipSelected:false,multipIndex:0,multipParentKey:"",data:data}; } - function uniqueRandom() { var timestamp = Date.now(); var random = Math.floor(Math.random() * 1000000); diff --git a/src/imports/FluentUI/Controls/FluWindow.qml b/src/imports/FluentUI/Controls/FluWindow.qml index 2c8453e..e7f231d 100644 --- a/src/imports/FluentUI/Controls/FluWindow.qml +++ b/src/imports/FluentUI/Controls/FluWindow.qml @@ -5,13 +5,11 @@ import QtQuick.Layouts import FluentUI Window { - enum LaunchMode { Standard, SingleTask, SingleInstance } - default property alias content: container.data property bool closeDestory: true property int launchMode: FluWindow.Standard @@ -26,70 +24,58 @@ Window { event.accepted = false } } + property color backgroundColor: { + if(active){ + return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1) + } + return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) + } signal initArgument(var argument) - id:window + onClosing:(event)=>closeFunc(event) + Component.onCompleted: { + helper.initWindow(window) + initArgument(argument) + } Rectangle{ anchors.fill: parent - color: { - if(active){ - return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1) - } - return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1) - } + color: backgroundColor Behavior on color{ ColorAnimation { duration: 300 } } } - Item{ id:container anchors.fill: parent clip: true } - - onClosing:(event)=>closeFunc(event) - FluInfoBar{ id:infoBar root: window } - WindowHelper{ id:helper } - - Component.onCompleted: { - helper.initWindow(window) - initArgument(argument) - } - function showSuccess(text,duration,moremsg){ infoBar.showSuccess(text,duration,moremsg); } - function showInfo(text,duration,moremsg){ infoBar.showInfo(text,duration,moremsg); } - function showWarning(text,duration,moremsg){ infoBar.showWarning(text,duration,moremsg); } - function showError(text,duration,moremsg){ infoBar.showError(text,duration,moremsg); } - function registerForWindowResult(path){ return helper.createRegister(window,path) } - function deleteWindow(){ helper.deleteWindow() } - function onResult(data){ if(pageRegister){ pageRegister.onResult(data)