mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
update
This commit is contained in:
parent
4efb91084a
commit
82f606dd65
@ -17,7 +17,6 @@ FluScrollablePage{
|
||||
desc:"The latest FluentUI controls and styles for your applications."
|
||||
url:"https://github.com/zhuzichu520/FluentUI"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Item{
|
||||
|
@ -7,8 +7,9 @@ import "qrc:///example/qml/component"
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"TextBox"
|
||||
pageMode: FluNavigationView.SingleInstance
|
||||
|
||||
title:"TextBox"
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 68
|
||||
|
@ -4,15 +4,13 @@ import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
FluPage {
|
||||
property alias title: text_title.text
|
||||
default property alias content: container.data
|
||||
property int leftPadding: 10
|
||||
property int topPadding: 0
|
||||
property int rightPadding: 10
|
||||
property int bottomPadding: 10
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
id:control
|
||||
FluText{
|
||||
id:text_title
|
||||
|
@ -15,7 +15,8 @@ Item {
|
||||
enum PageModeFlag{
|
||||
Standard = 0,
|
||||
SingleTask = 1,
|
||||
SingleTop = 2
|
||||
SingleTop = 2,
|
||||
SingleInstance = 3
|
||||
}
|
||||
property url logo
|
||||
property string title: ""
|
||||
@ -30,6 +31,7 @@ Item {
|
||||
id:control
|
||||
QtObject{
|
||||
id:d
|
||||
property var pageMap: ({})
|
||||
property var stackItems: []
|
||||
property int displayMode: FluNavigationView.Open
|
||||
property bool enableNavigationPanel: false
|
||||
@ -532,6 +534,20 @@ Item {
|
||||
layout_footer.currentIndex = item.idx-(nav_list.count-layout_footer.count)
|
||||
}
|
||||
nav_list.currentIndex = item.idx
|
||||
if(nav_swipe.currentItem.pageMode === FluNavigationView.SingleInstance){
|
||||
var url = nav_swipe.currentItem.url
|
||||
var pageIndex = -1
|
||||
for(var i=0;i<nav_swipe2.children.length;i++){
|
||||
var obj = nav_swipe2.children[i]
|
||||
if(obj.url === url){
|
||||
pageIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if(pageIndex !== -1){
|
||||
nav_swipe2.currentIndex = pageIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
@ -630,31 +646,20 @@ Item {
|
||||
id:nav_swipe
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
visible: !nav_swipe2.visible
|
||||
popEnter : Transition{}
|
||||
popExit : Transition {
|
||||
NumberAnimation {
|
||||
properties: "y"
|
||||
from: 0
|
||||
to: nav_swipe.height
|
||||
duration: dontPageAnimation ? 0 : 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
pushEnter: Transition {
|
||||
NumberAnimation {
|
||||
properties: "y";
|
||||
from: nav_swipe.height;
|
||||
to: 0
|
||||
duration: dontPageAnimation ? 0 : 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
popExit : Transition {}
|
||||
pushEnter: Transition {}
|
||||
pushExit : Transition{}
|
||||
replaceEnter : Transition{}
|
||||
replaceExit : Transition{}
|
||||
}
|
||||
StackLayout{
|
||||
id:nav_swipe2
|
||||
anchors.fill: nav_swipe
|
||||
clip: true
|
||||
visible: nav_swipe.currentItem.pageMode === FluNavigationView.SingleInstance
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
@ -976,6 +981,16 @@ Item {
|
||||
function getItems(){
|
||||
return nav_list.model
|
||||
}
|
||||
|
||||
|
||||
Component{
|
||||
id:com_placeholder
|
||||
Item{
|
||||
property int pageMode: FluNavigationView.SingleInstance
|
||||
property string url
|
||||
}
|
||||
}
|
||||
|
||||
function push(url,argument={}){
|
||||
let page = nav_swipe.find(function(item) {
|
||||
return item.url === url;
|
||||
@ -999,8 +1014,35 @@ Item {
|
||||
default:
|
||||
}
|
||||
}
|
||||
nav_swipe.push(url,Object.assign(argument,{url:url}))
|
||||
var comp = Qt.createComponent(url)
|
||||
if (comp.status === Component.Ready) {
|
||||
//先判断nav_swipe2中是否有当前url数据
|
||||
var pageIndex = -1
|
||||
for(var i=0;i<nav_swipe2.children.length;i++){
|
||||
var item = nav_swipe2.children[i]
|
||||
if(item.url === url){
|
||||
pageIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
var options = Object.assign(argument,{url:url})
|
||||
if(pageIndex!==-1){
|
||||
nav_swipe2.currentIndex = pageIndex
|
||||
nav_swipe.push(com_placeholder,options)
|
||||
}else{
|
||||
var obj = comp.createObject(nav_swipe,options)
|
||||
if(obj.pageMode === FluNavigationView.SingleInstance){
|
||||
nav_swipe.push(com_placeholder,options)
|
||||
nav_swipe2.children.push(obj)
|
||||
nav_swipe2.currentIndex = nav_swipe2.count - 1
|
||||
}else{
|
||||
nav_swipe.push(obj)
|
||||
}
|
||||
}
|
||||
d.stackItems.push(nav_list.model[nav_list.currentIndex])
|
||||
}else{
|
||||
console.error(comp.errorString())
|
||||
}
|
||||
}
|
||||
function getCurrentIndex(){
|
||||
return nav_list.currentIndex
|
||||
|
18
src/imports/FluentUI/Controls/FluPage.qml
Normal file
18
src/imports/FluentUI/Controls/FluPage.qml
Normal file
@ -0,0 +1,18 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Window
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url
|
||||
id: control
|
||||
visible: false
|
||||
opacity: visible
|
||||
Behavior on opacity {
|
||||
NumberAnimation{
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
FluPage {
|
||||
property alias title: text_title.text
|
||||
default property alias content: container.data
|
||||
property int spacing : 0
|
||||
@ -12,8 +12,6 @@ Item {
|
||||
property int topPadding: 0
|
||||
property int rightPadding: 10
|
||||
property int bottomPadding: 10
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
id:control
|
||||
FluText{
|
||||
id:text_title
|
||||
|
@ -5,13 +5,10 @@ import QtQuick.Layouts
|
||||
import Qt.labs.qmlmodels
|
||||
import FluentUI
|
||||
|
||||
|
||||
Rectangle {
|
||||
|
||||
id:control
|
||||
|
||||
property var columnSource
|
||||
property var dataSource
|
||||
id:control
|
||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||
onColumnSourceChanged: {
|
||||
if(columnSource.length!==0){
|
||||
@ -26,18 +23,15 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TableModel {
|
||||
id:table_model
|
||||
}
|
||||
|
||||
onDataSourceChanged: {
|
||||
table_model.clear()
|
||||
dataSource.forEach(function(item){
|
||||
table_model.appendRow(item)
|
||||
})
|
||||
}
|
||||
|
||||
TableModel {
|
||||
id:table_model
|
||||
}
|
||||
Component{
|
||||
id:com_edit
|
||||
FluTextBox {
|
||||
@ -50,7 +44,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView{
|
||||
id:scroll_table
|
||||
anchors.left: header_vertical.right
|
||||
@ -116,7 +109,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_handle
|
||||
FluControl {
|
||||
@ -145,14 +137,11 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SelectionRectangle {
|
||||
target: table_view
|
||||
bottomRightHandle:com_handle
|
||||
topLeftHandle: com_handle
|
||||
}
|
||||
|
||||
|
||||
FluHorizontalHeaderView {
|
||||
id: header_horizontal
|
||||
textRole: "title"
|
||||
@ -163,7 +152,6 @@ Rectangle {
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
clip: true
|
||||
}
|
||||
|
||||
FluVerticalHeaderView {
|
||||
id: header_vertical
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
@ -172,7 +160,5 @@ Rectangle {
|
||||
syncView: table_view
|
||||
clip: true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user