This commit is contained in:
朱子楚\zhuzi
2023-10-01 14:59:35 +08:00
parent 8127f7c3ed
commit 895332f867
6 changed files with 276 additions and 18 deletions

View File

@ -104,7 +104,7 @@ FluObject {
}
}
property Component fluent_sytle: Rectangle{
width: rowlayout.width + (_super.moremsg ? 25 : 80);
width: rowlayout.width + (btn_close.visible ? 30 : 48);
height: rowlayout.height + 20;
color: {
if(FluTheme.dark){
@ -154,7 +154,6 @@ FluObject {
x:20;
y:(parent.height - height) / 2;
spacing: 10
FluIcon{
iconSource:{
switch(_super.type){
@ -199,14 +198,15 @@ FluObject {
visible: _super.moremsg
wrapMode : Text.WordWrap
textColor: FluColors.Grey120
width: Math.min(implicitWidth,mcontrol.maxWidth)
}
}
FluIconButton{
id:btn_close
iconSource: FluentIcons.ChromeClose
iconSize: 10
y:5
x:parent.width-35
visible: _super.duration<=0
iconColor: {
if(FluTheme.dark){

View File

@ -57,9 +57,11 @@ Rectangle {
}
onDataSourceChanged: {
table_model.clear()
dataSource.forEach(function(item){
table_model.appendRow(item)
})
for(var i =0;i<dataSource.length;i++){
var row = dataSource[i]
row.__index= i
table_model.appendRow(row)
}
}
TableModel {
id:table_model
@ -570,4 +572,18 @@ Rectangle {
function updateRow(row,obj){
table_model.setRow(row,obj)
}
function sort(order){
let sortedArray = []
for(var i =0;i<table_model.rowCount;i++){
let row = table_model.getRow(i)
sortedArray.push(row)
}
if(order === undefined){
sortedArray.sort((a, b) => a.__index - b.__index)
}else{
sortedArray.sort(order)
}
table_model.clear()
table_model.rows = sortedArray
}
}