diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 6493a39c..c03a3c9e 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -43,6 +43,7 @@ Rectangle { var cellPosition = cellItem.mapToItem(scroll_table, 0, 0) item_loader.column = column item_loader.row = row + item_loader_layout.cellItem = cellItem item_loader_layout.x = table_view.contentX + cellPosition.x item_loader_layout.y = table_view.contentY + cellPosition.y item_loader_layout.width = table_view.columnWidthProvider(column) @@ -204,14 +205,13 @@ Rectangle { if(!w){ w = d.defaultItemWidth } - if(column === item_loader.column){ - item_loader.width = w - } - if(column === item_loader.column-1){ - let cellItem = table_view.itemAtCell(item_loader.column, item_loader.row) - if(cellItem){ - let cellPosition = cellItem.mapToItem(scroll_table, 0, 0) - item_loader.x = table_view.contentX + cellPosition.x + if(item_loader_layout.cellItem){ + if(column === item_loader.column){ + item_loader_layout.width = w + } + if(column === item_loader.column-1){ + let cellPosition = item_loader_layout.cellItem.mapToItem(scroll_table, 0, 0) + item_loader_layout.x = table_view.contentX + cellPosition.x } } return w @@ -225,16 +225,15 @@ Rectangle { h = table_model.getRow(row).minimumHeight } if(!h){ - return d.defaultItemHeight + h = d.defaultItemHeight } - if(row === item_loader.row){ - item_loader.height = h - } - if(row === item_loader.row-1){ - let cellItem = table_view.itemAtCell(item_loader.column, item_loader.row) - if(cellItem){ - let cellPosition = cellItem.mapToItem(scroll_table, 0, 0) - item_loader.y = table_view.contentY + cellPosition.y + if(item_loader_layout.cellItem){ + if(row === item_loader.row){ + item_loader_layout.height = h + } + if(row === item_loader.row-1){ + let cellPosition = item_loader_layout.cellItem.mapToItem(scroll_table, 0, 0) + item_loader_layout.y = table_view.contentY + cellPosition.y } } return h @@ -330,9 +329,15 @@ Rectangle { } MouseArea{ + property var cellItem id:item_loader_layout acceptedButtons: Qt.NoButton visible: item_loader.sourceComponent + onVisibleChanged: { + if(!visible){ + item_loader_layout.cellItem = undefined + } + } hoverEnabled: true z:2 onEntered: { diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index 0b95a07b..83534b5c 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -44,6 +44,7 @@ Rectangle { var cellPosition = cellItem.mapToItem(scroll_table, 0, 0) item_loader.column = column item_loader.row = row + item_loader_layout.cellItem = cellItem item_loader_layout.x = table_view.contentX + cellPosition.x item_loader_layout.y = table_view.contentY + cellPosition.y item_loader_layout.width = table_view.columnWidthProvider(column) @@ -205,14 +206,13 @@ Rectangle { if(!w){ w = d.defaultItemWidth } - if(column === item_loader.column){ - item_loader.width = w - } - if(column === item_loader.column-1){ - let cellItem = table_view.itemAtCell(item_loader.column, item_loader.row) - if(cellItem){ - let cellPosition = cellItem.mapToItem(scroll_table, 0, 0) - item_loader.x = table_view.contentX + cellPosition.x + if(item_loader_layout.cellItem){ + if(column === item_loader.column){ + item_loader_layout.width = w + } + if(column === item_loader.column-1){ + let cellPosition = item_loader_layout.cellItem.mapToItem(scroll_table, 0, 0) + item_loader_layout.x = table_view.contentX + cellPosition.x } } return w @@ -226,16 +226,15 @@ Rectangle { h = table_model.getRow(row).minimumHeight } if(!h){ - return d.defaultItemHeight + h = d.defaultItemHeight } - if(row === item_loader.row){ - item_loader.height = h - } - if(row === item_loader.row-1){ - let cellItem = table_view.itemAtCell(item_loader.column, item_loader.row) - if(cellItem){ - let cellPosition = cellItem.mapToItem(scroll_table, 0, 0) - item_loader.y = table_view.contentY + cellPosition.y + if(item_loader_layout.cellItem){ + if(row === item_loader.row){ + item_loader_layout.height = h + } + if(row === item_loader.row-1){ + let cellPosition = item_loader_layout.cellItem.mapToItem(scroll_table, 0, 0) + item_loader_layout.y = table_view.contentY + cellPosition.y } } return h @@ -331,9 +330,15 @@ Rectangle { } MouseArea{ + property var cellItem id:item_loader_layout acceptedButtons: Qt.NoButton visible: item_loader.sourceComponent + onVisibleChanged: { + if(!visible){ + item_loader_layout.cellItem = undefined + } + } hoverEnabled: true z:2 onEntered: {