mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-04-25 04:09:42 +08:00
fix: 修复FluTableView错位问题
This commit is contained in:
parent
b4a1eaa860
commit
023776dbe8
@ -266,30 +266,18 @@ Rectangle {
|
|||||||
d.rowHoverIndex = row
|
d.rowHoverIndex = row
|
||||||
}
|
}
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
if(editVisible){
|
updatePosition()
|
||||||
updateEditPosition()
|
|
||||||
}
|
|
||||||
if(isMainTable){
|
|
||||||
updateTableItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onHeightChanged: {
|
onHeightChanged: {
|
||||||
if(editVisible){
|
updatePosition()
|
||||||
updateEditPosition()
|
|
||||||
}
|
|
||||||
if(isMainTable){
|
|
||||||
updateTableItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onXChanged: {
|
onXChanged: {
|
||||||
if(editVisible){
|
updatePosition()
|
||||||
updateEditPosition()
|
|
||||||
}
|
|
||||||
if(isMainTable){
|
|
||||||
updateTableItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onYChanged: {
|
onYChanged: {
|
||||||
|
updatePosition()
|
||||||
|
}
|
||||||
|
function updatePosition(){
|
||||||
if(editVisible){
|
if(editVisible){
|
||||||
updateEditPosition()
|
updateEditPosition()
|
||||||
}
|
}
|
||||||
@ -310,10 +298,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
function updateTableItem(){
|
function updateTableItem(){
|
||||||
var columnModel = control.columnSource[column]
|
var columnModel = control.columnSource[column]
|
||||||
|
if(columnModel.x !== item_table_mouse.x || columnModel.y !== item_table_mouse.y){
|
||||||
columnModel.x = item_table_mouse.x
|
columnModel.x = item_table_mouse.x
|
||||||
columnModel.y = item_table_mouse.y
|
columnModel.y = item_table_mouse.y
|
||||||
d.tableItemLayout(column)
|
d.tableItemLayout(column)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color:{
|
color:{
|
||||||
@ -352,6 +342,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
FluLoader{
|
FluLoader{
|
||||||
id: item_table_loader
|
id: item_table_loader
|
||||||
|
property var tableView: control
|
||||||
property var model: item_table_mouse._model
|
property var model: item_table_mouse._model
|
||||||
property var display: rowModel[columnModel.dataIndex]
|
property var display: rowModel[columnModel.dataIndex]
|
||||||
property var rowModel : model.rowModel
|
property var rowModel : model.rowModel
|
||||||
@ -445,10 +436,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onWidthChanged:{
|
|
||||||
table_view.forceLayout()
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:layout_mouse_table
|
id:layout_mouse_table
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -479,6 +466,9 @@ Rectangle {
|
|||||||
table_view.flick(0,1)
|
table_view.flick(0,1)
|
||||||
}
|
}
|
||||||
delegate: com_table_delegate
|
delegate: com_table_delegate
|
||||||
|
onWidthChanged: {
|
||||||
|
Qt.callLater(forceLayout)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,18 +945,18 @@ Rectangle {
|
|||||||
target: d
|
target: d
|
||||||
function onTableItemLayout(column){
|
function onTableItemLayout(column){
|
||||||
if(item_layout_frozen._index === column){
|
if(item_layout_frozen._index === column){
|
||||||
updateLayout()
|
Qt.callLater(updateLayout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: table_view
|
target: table_view
|
||||||
function onContentXChanged(){
|
function onContentXChanged(){
|
||||||
updateLayout()
|
Qt.callLater(updateLayout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function updateLayout(){
|
function updateLayout(){
|
||||||
width = table_view.columnWidthProvider(_index)
|
width = Qt.binding(() => table_view.columnWidthProvider(_index))
|
||||||
x = Qt.binding(function(){
|
x = Qt.binding(function(){
|
||||||
var minX = 0
|
var minX = 0
|
||||||
var maxX = table_view.width-width
|
var maxX = table_view.width-width
|
||||||
|
@ -266,30 +266,18 @@ Rectangle {
|
|||||||
d.rowHoverIndex = row
|
d.rowHoverIndex = row
|
||||||
}
|
}
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
if(editVisible){
|
updatePosition()
|
||||||
updateEditPosition()
|
|
||||||
}
|
|
||||||
if(isMainTable){
|
|
||||||
updateTableItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onHeightChanged: {
|
onHeightChanged: {
|
||||||
if(editVisible){
|
updatePosition()
|
||||||
updateEditPosition()
|
|
||||||
}
|
|
||||||
if(isMainTable){
|
|
||||||
updateTableItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onXChanged: {
|
onXChanged: {
|
||||||
if(editVisible){
|
updatePosition()
|
||||||
updateEditPosition()
|
|
||||||
}
|
|
||||||
if(isMainTable){
|
|
||||||
updateTableItem()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onYChanged: {
|
onYChanged: {
|
||||||
|
updatePosition()
|
||||||
|
}
|
||||||
|
function updatePosition(){
|
||||||
if(editVisible){
|
if(editVisible){
|
||||||
updateEditPosition()
|
updateEditPosition()
|
||||||
}
|
}
|
||||||
@ -310,10 +298,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
function updateTableItem(){
|
function updateTableItem(){
|
||||||
var columnModel = control.columnSource[column]
|
var columnModel = control.columnSource[column]
|
||||||
|
if(columnModel.x !== item_table_mouse.x || columnModel.y !== item_table_mouse.y){
|
||||||
columnModel.x = item_table_mouse.x
|
columnModel.x = item_table_mouse.x
|
||||||
columnModel.y = item_table_mouse.y
|
columnModel.y = item_table_mouse.y
|
||||||
d.tableItemLayout(column)
|
d.tableItemLayout(column)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color:{
|
color:{
|
||||||
@ -352,6 +342,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
FluLoader{
|
FluLoader{
|
||||||
id: item_table_loader
|
id: item_table_loader
|
||||||
|
property var tableView: control
|
||||||
property var model: item_table_mouse._model
|
property var model: item_table_mouse._model
|
||||||
property var display: rowModel[columnModel.dataIndex]
|
property var display: rowModel[columnModel.dataIndex]
|
||||||
property var rowModel : model.rowModel
|
property var rowModel : model.rowModel
|
||||||
@ -445,10 +436,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onWidthChanged:{
|
|
||||||
table_view.forceLayout()
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:layout_mouse_table
|
id:layout_mouse_table
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -479,6 +466,9 @@ Rectangle {
|
|||||||
table_view.flick(0,1)
|
table_view.flick(0,1)
|
||||||
}
|
}
|
||||||
delegate: com_table_delegate
|
delegate: com_table_delegate
|
||||||
|
onWidthChanged: {
|
||||||
|
Qt.callLater(forceLayout)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,18 +945,18 @@ Rectangle {
|
|||||||
target: d
|
target: d
|
||||||
function onTableItemLayout(column){
|
function onTableItemLayout(column){
|
||||||
if(item_layout_frozen._index === column){
|
if(item_layout_frozen._index === column){
|
||||||
updateLayout()
|
Qt.callLater(updateLayout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: table_view
|
target: table_view
|
||||||
function onContentXChanged(){
|
function onContentXChanged(){
|
||||||
updateLayout()
|
Qt.callLater(updateLayout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function updateLayout(){
|
function updateLayout(){
|
||||||
width = table_view.columnWidthProvider(_index)
|
width = Qt.binding(() => table_view.columnWidthProvider(_index))
|
||||||
x = Qt.binding(function(){
|
x = Qt.binding(function(){
|
||||||
var minX = 0
|
var minX = 0
|
||||||
var maxX = table_view.width-width
|
var maxX = table_view.width-width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user