diff --git a/example/T_Home.qml b/example/T_Home.qml index 6c275be..3325822 100644 --- a/example/T_Home.qml +++ b/example/T_Home.qml @@ -142,20 +142,6 @@ FluScrollablePage{ } } - ListModel{ - id:model_added - Component.onCompleted: { - append(ItemsOriginal.getRecentlyAddedData()) - } - } - - ListModel{ - id:model_update - Component.onCompleted: { - append(ItemsOriginal.getRecentlyUpdatedData()) - } - } - Component{ id:com_item Item{ @@ -187,7 +173,7 @@ FluScrollablePage{ id:item_icon height: 40 width: 40 - source: model.image + source: modelData.image anchors{ left: parent.left leftMargin: 20 @@ -197,7 +183,7 @@ FluScrollablePage{ FluText{ id:item_title - text:model.title + text:modelData.title fontStyle: FluText.BodyStrong anchors{ left: item_icon.right @@ -208,7 +194,7 @@ FluScrollablePage{ FluText{ id:item_desc - text:model.desc + text:modelData.desc color:FluColors.Grey120 wrapMode: Text.WrapAnywhere elide: Text.ElideRight @@ -241,7 +227,7 @@ FluScrollablePage{ anchors.fill: parent hoverEnabled: true onClicked: { - ItemsOriginal.startPageByItem(model) + ItemsOriginal.startPageByItem(modelData) } } } @@ -260,7 +246,7 @@ FluScrollablePage{ implicitHeight: contentHeight cellHeight: 120 cellWidth: 320 - model:model_added + model:ItemsOriginal.getRecentlyAddedData() interactive: false delegate: com_item } @@ -278,7 +264,7 @@ FluScrollablePage{ cellHeight: 120 cellWidth: 320 interactive: false - model: model_update + model: ItemsOriginal.getRecentlyUpdatedData() delegate: com_item } diff --git a/example/global/ItemsOriginal.qml b/example/global/ItemsOriginal.qml index c3d4261..295b93c 100644 --- a/example/global/ItemsOriginal.qml +++ b/example/global/ItemsOriginal.qml @@ -16,224 +16,222 @@ FluObject{ } } - FluPaneItemHeader{ - title:"Inputs" - } + FluPaneItemExpander{ + title:"Basic input" + icon:FluentIcons.CheckboxComposite - FluPaneItem{ - title:"Buttons" - image:"qrc:/res/image/control/Button.png" - recentlyUpdated:true - desc:"A control that responds to user input and raisesa Click event." - onTap:{ - navigationView.push("qrc:/T_Buttons.qml") + FluPaneItem{ + title:"Buttons" + image:"qrc:/res/image/control/Button.png" + recentlyUpdated:true + desc:"A control that responds to user input and raisesa Click event." + onTap:{ + navigationView.push("qrc:/T_Buttons.qml") + } + } + FluPaneItem{ + title:"Slider" + image:"qrc:/res/image/control/Slider.png" + recentlyUpdated:true + desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack." + onTap:{ + navigationView.push("qrc:/T_Slider.qml") + } + } + + FluPaneItem{ + title:"CheckBox" + image:"qrc:/res/image/control/Checkbox.png" + recentlyUpdated:true + desc:"A control that a user can select or clear." + onTap:{ + navigationView.push("qrc:/T_CheckBox.qml") + } + } + + FluPaneItem{ + title:"ToggleSwitch" + onTap:{ + navigationView.push("qrc:/T_ToggleSwitch.qml") + } } } - FluPaneItem{ - title:"Slider" - image:"qrc:/res/image/control/Slider.png" - recentlyUpdated:true - desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack." - onTap:{ - navigationView.push("qrc:/T_Slider.qml") - } - } - - FluPaneItem{ - title:"CheckBox" - image:"qrc:/res/image/control/Checkbox.png" - recentlyUpdated:true - desc:"A control that a user can select or clear." - onTap:{ - navigationView.push("qrc:/T_CheckBox.qml") - } - } - - FluPaneItem{ - title:"ToggleSwitch" - onTap:{ - navigationView.push("qrc:/T_ToggleSwitch.qml") - } - } - - FluPaneItemHeader{ + FluPaneItemExpander{ title:"Form" - } - - FluPaneItem{ - title:"TextBox" - onTap:{ - navigationView.push("qrc:/T_TextBox.qml") + icon:FluentIcons.GridView + FluPaneItem{ + title:"TextBox" + onTap:{ + navigationView.push("qrc:/T_TextBox.qml") + } + } + FluPaneItem{ + title:"TimePicker" + onTap:{ + navigationView.push("qrc:/T_TimePicker.qml") + } + } + FluPaneItem{ + title:"DatePicker" + onTap:{ + navigationView.push("qrc:/T_DatePicker.qml") + } + } + FluPaneItem{ + title:"CalendarPicker" + onTap:{ + navigationView.push("qrc:/T_CalendarPicker.qml") + } + } + FluPaneItem{ + title:"ColorPicker" + onTap:{ + navigationView.push("qrc:/T_ColorPicker.qml") + } } } - FluPaneItem{ - title:"TimePicker" - onTap:{ - navigationView.push("qrc:/T_TimePicker.qml") - } - } - FluPaneItem{ - title:"DatePicker" - onTap:{ - navigationView.push("qrc:/T_DatePicker.qml") - } - } - - FluPaneItem{ - title:"CalendarPicker" - onTap:{ - navigationView.push("qrc:/T_CalendarPicker.qml") - } - } - - FluPaneItem{ - title:"ColorPicker" - onTap:{ - navigationView.push("qrc:/T_ColorPicker.qml") - } - } - - FluPaneItemHeader{ + FluPaneItemExpander{ title:"Surface" - } + icon:FluentIcons.SurfaceHub - FluPaneItem{ - title:"InfoBar" - image:"qrc:/res/image/control/InfoBar.png" - recentlyUpdated:true - desc:"An inline message to display app-wide statuschange information." - onTap:{ - navigationView.push("qrc:/T_InfoBar.qml") + FluPaneItem{ + title:"InfoBar" + image:"qrc:/res/image/control/InfoBar.png" + recentlyUpdated:true + desc:"An inline message to display app-wide statuschange information." + onTap:{ + navigationView.push("qrc:/T_InfoBar.qml") + } } - } - FluPaneItem{ - title:"Progress" - onTap:{ - navigationView.push("qrc:/T_Progress.qml") + FluPaneItem{ + title:"Progress" + onTap:{ + navigationView.push("qrc:/T_Progress.qml") + } } - } - FluPaneItem{ - title:"Badge" - onTap:{ - navigationView.push("qrc:/T_Badge.qml") + FluPaneItem{ + title:"Badge" + onTap:{ + navigationView.push("qrc:/T_Badge.qml") + } } - } - FluPaneItem{ - title:"Rectangle" - onTap:{ - navigationView.push("qrc:/T_Rectangle.qml") + FluPaneItem{ + title:"Rectangle" + onTap:{ + navigationView.push("qrc:/T_Rectangle.qml") + } } - } - FluPaneItem{ - title:"Carousel" - onTap:{ - navigationView.push("qrc:/T_Carousel.qml") + FluPaneItem{ + title:"Carousel" + onTap:{ + navigationView.push("qrc:/T_Carousel.qml") + } } - } - FluPaneItem{ - title:"Expander" - onTap:{ - navigationView.push("qrc:/T_Expander.qml") + FluPaneItem{ + title:"Expander" + onTap:{ + navigationView.push("qrc:/T_Expander.qml") + } } + } - FluPaneItemHeader{ + FluPaneItemExpander{ title:"Popus" - } + icon:FluentIcons.ButtonMenu + FluPaneItem{ + title:"Dialog" + onTap:{ + navigationView.push("qrc:/T_Dialog.qml") + } + } - FluPaneItem{ - title:"Dialog" - onTap:{ - navigationView.push("qrc:/T_Dialog.qml") + FluPaneItem{ + title:"Tooltip" + onTap:{ + navigationView.push("qrc:/T_Tooltip.qml") + } + } + + FluPaneItem{ + title:"Menu" + onTap:{ + navigationView.push("qrc:/T_Menu.qml") + } } } - FluPaneItem{ - title:"Tooltip" - onTap:{ - navigationView.push("qrc:/T_Tooltip.qml") - } - } - - FluPaneItem{ - title:"Menu" - onTap:{ - navigationView.push("qrc:/T_Menu.qml") - } - } - - FluPaneItemHeader{ + FluPaneItemExpander{ title:"Navigation" - } - - FluPaneItem{ - title:"TabView" - image:"qrc:/res/image/control/TabView.png" - recentlyAdded:true - desc:"A control that displays a collection of tabs thatcan be used to display several documents." - onTap:{ - navigationView.push("qrc:/T_TabView.qml") + icon:FluentIcons.AllApps + FluPaneItem{ + title:"TabView" + image:"qrc:/res/image/control/TabView.png" + recentlyAdded:true + desc:"A control that displays a collection of tabs thatcan be used to display several documents." + onTap:{ + navigationView.push("qrc:/T_TabView.qml") + } + } + FluPaneItem{ + title:"TreeView" + onTap:{ + navigationView.push("qrc:/T_TreeView.qml") + } } - } - FluPaneItem{ - title:"TreeView" - onTap:{ - navigationView.push("qrc:/T_TreeView.qml") + FluPaneItem{ + title:"MultiWindow" + onTap:{ + navigationView.push("qrc:/T_MultiWindow.qml") + } } } - FluPaneItem{ - title:"MultiWindow" - onTap:{ - navigationView.push("qrc:/T_MultiWindow.qml") - } - } - - FluPaneItemHeader{ + FluPaneItemExpander{ title:"Theming" - } + icon:FluentIcons.Brightness + FluPaneItem{ + title:"Theme" + onTap:{ + navigationView.push("qrc:/T_Theme.qml") + } + } - FluPaneItem{ - title:"Theme" - onTap:{ - navigationView.push("qrc:/T_Theme.qml") + FluPaneItem{ + title:"Awesome" + onTap:{ + navigationView.push("qrc:/T_Awesome.qml") + } + } + FluPaneItem{ + title:"Typography" + onTap:{ + navigationView.push("qrc:/T_Typography.qml") + } } } - FluPaneItem{ - title:"Awesome" - onTap:{ - navigationView.push("qrc:/T_Awesome.qml") - } - } - FluPaneItem{ - title:"Typography" - onTap:{ - navigationView.push("qrc:/T_Typography.qml") - } - } - - FluPaneItemHeader{ + FluPaneItemExpander{ title:"Media" - } - - FluPaneItem{ - title:"MediaPlayer" - image:"qrc:/res/image/control/MediaPlayerElement.png" - recentlyAdded:true - desc:"A control to display video and image content." - onTap:{ - navigationView.push("qrc:/T_MediaPlayer.qml") + icon:FluentIcons.Media + FluPaneItem{ + title:"MediaPlayer" + image:"qrc:/res/image/control/MediaPlayerElement.png" + recentlyAdded:true + desc:"A control to display video and image content." + onTap:{ + navigationView.push("qrc:/T_MediaPlayer.qml") + } } } @@ -244,14 +242,23 @@ FluObject{ if(item instanceof FluPaneItem && item.recentlyAdded){ arr.push(item) } + if(item instanceof FluPaneItemExpander){ + for(var j=0;j(uri,major,minor,"WindowHelper"); qmlRegisterType(uri,major,minor,"FluColorSet"); + + qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemExpander.qml"),uri,major,minor,"FluPaneItemExpander"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTabView.qml"),uri,major,minor,"FluTabView"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluArea.qml"),uri,major,minor,"FluArea"); qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluBadge.qml"),uri,major,minor,"FluBadge"); diff --git a/src/controls/FluNavigationView.qml b/src/controls/FluNavigationView.qml index 1ab93f8..749b148 100644 --- a/src/controls/FluNavigationView.qml +++ b/src/controls/FluNavigationView.qml @@ -48,14 +48,34 @@ Item { id:com_panel_item_separatorr FluDivider{ width: nav_list.width - height: 1 + height: { + if(model.parent){ + return model.parent.isExpand ? 1 : 0 + } + return 1 + } + Behavior on height { + NumberAnimation{ + duration: 150 + } + } } } Component{ id:com_panel_item_header Item{ - height: 30 + height: { + if(model.parent){ + return model.parent.isExpand ? 30 : 0 + } + return 30 + } + Behavior on height { + NumberAnimation{ + duration: 150 + } + } width: nav_list.width FluText{ text:model.title @@ -70,11 +90,131 @@ Item { } Component{ - id:com_panel_item + id:com_panel_item_expander Item{ height: 38 width: nav_list.width + Rectangle{ + radius: 4 + anchors{ + top: parent.top + bottom: parent.bottom + left: parent.left + right: parent.right + topMargin: 2 + bottomMargin: 2 + leftMargin: 6 + rightMargin: 6 + } + Rectangle{ + width: 3 + height: 18 + radius: 1.5 + color: FluTheme.primaryColor.dark + visible: { + for(var i=0;icontrols/FluMediaPlayer.qml controls/FluTabView.qml controls/FluItem.qml + controls/FluPaneItemExpander.qml