This commit is contained in:
朱子楚\zhuzi 2024-05-11 22:21:11 +08:00
parent 6b941697b0
commit 2367c6978a
2 changed files with 34 additions and 24 deletions

View File

@ -483,7 +483,7 @@ Rectangle {
} }
Component{ Component{
id:com_column_header_delegate id: com_column_header_delegate
Rectangle{ Rectangle{
id: column_item_control id: column_item_control
property var currentTableView : TableView.view property var currentTableView : TableView.view
@ -516,13 +516,13 @@ Rectangle {
if(column_item_control.isHeaderHorizontal){ if(column_item_control.isHeaderHorizontal){
return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2) return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2)
} }
return TableView.view.width return Math.max(TableView.view.width,Number.MIN_VALUE)
} }
implicitHeight: { implicitHeight: {
if(column_item_control.isHeaderHorizontal){ if(column_item_control.isHeaderHorizontal){
return Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2)) return Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2))
} }
return TableView.view.height return Math.max(TableView.view.height,Number.MIN_VALUE)
} }
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
Rectangle{ Rectangle{
@ -924,12 +924,16 @@ Rectangle {
bottom: item_table_frozen.top bottom: item_table_frozen.top
} }
delegate: com_column_header_delegate delegate: com_column_header_delegate
Component.onCompleted: {
item_table_frozen_header.forceLayout()
}
} }
Connections{ Connections{
target: control target: table_view
function onWidthChanged() { function onWidthChanged() {
item_table_frozen_header.forceLayout() item_table_frozen_header.forceLayout()
} }
} }
} }
} }
@ -941,6 +945,12 @@ Rectangle {
id: item_layout_frozen id: item_layout_frozen
readonly property int _index : model.index readonly property int _index : model.index
readonly property var columnModel : control.columnSource[_index] readonly property var columnModel : control.columnSource[_index]
readonly property bool isHide:{
if(columnModel.frozen){
return false
}
return true
}
Connections{ Connections{
target: d target: d
function onTableItemLayout(column){ function onTableItemLayout(column){
@ -979,13 +989,8 @@ Rectangle {
updateLayout() updateLayout()
} }
height: control.height height: control.height
visible: { visible: !item_layout_frozen.isHide
if(item_layout_frozen.columnModel.frozen){ sourceComponent: item_layout_frozen.isHide ? undefined : com_table_frozen
return true
}
return false
}
sourceComponent: visible ? com_table_frozen : undefined
} }
} }
} }

View File

@ -483,7 +483,7 @@ Rectangle {
} }
Component{ Component{
id:com_column_header_delegate id: com_column_header_delegate
Rectangle{ Rectangle{
id: column_item_control id: column_item_control
property var currentTableView : TableView.view property var currentTableView : TableView.view
@ -516,13 +516,13 @@ Rectangle {
if(column_item_control.isHeaderHorizontal){ if(column_item_control.isHeaderHorizontal){
return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2) return (item_column_loader.item && item_column_loader.item.implicitWidth) + (cellPadding * 2)
} }
return TableView.view.width return Math.max(TableView.view.width,Number.MIN_VALUE)
} }
implicitHeight: { implicitHeight: {
if(column_item_control.isHeaderHorizontal){ if(column_item_control.isHeaderHorizontal){
return Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2)) return Math.max(36, (item_column_loader.item&&item_column_loader.item.implicitHeight) + (cellPadding * 2))
} }
return TableView.view.height return Math.max(TableView.view.height,Number.MIN_VALUE)
} }
color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1) color: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
Rectangle{ Rectangle{
@ -924,12 +924,16 @@ Rectangle {
bottom: item_table_frozen.top bottom: item_table_frozen.top
} }
delegate: com_column_header_delegate delegate: com_column_header_delegate
Component.onCompleted: {
item_table_frozen_header.forceLayout()
}
} }
Connections{ Connections{
target: control target: table_view
function onWidthChanged() { function onWidthChanged() {
item_table_frozen_header.forceLayout() item_table_frozen_header.forceLayout()
} }
} }
} }
} }
@ -941,6 +945,12 @@ Rectangle {
id: item_layout_frozen id: item_layout_frozen
readonly property int _index : model.index readonly property int _index : model.index
readonly property var columnModel : control.columnSource[_index] readonly property var columnModel : control.columnSource[_index]
readonly property bool isHide:{
if(columnModel.frozen){
return false
}
return true
}
Connections{ Connections{
target: d target: d
function onTableItemLayout(column){ function onTableItemLayout(column){
@ -979,13 +989,8 @@ Rectangle {
updateLayout() updateLayout()
} }
height: control.height height: control.height
visible: { visible: !item_layout_frozen.isHide
if(item_layout_frozen.columnModel.frozen){ sourceComponent: item_layout_frozen.isHide ? undefined : com_table_frozen
return true
}
return false
}
sourceComponent: visible ? com_table_frozen : undefined
} }
} }
} }