mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
fix bug #418
This commit is contained in:
parent
3b1ab88b6d
commit
9bc5794db8
@ -59,24 +59,16 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
onDataSourceChanged: {
|
onDataSourceChanged: {
|
||||||
table_model.clear()
|
table_model.clear()
|
||||||
|
var rows = []
|
||||||
for(var i =0;i<dataSource.length;i++){
|
for(var i =0;i<dataSource.length;i++){
|
||||||
var row = dataSource[i]
|
var row = dataSource[i]
|
||||||
row.__index= i
|
row.__index= i
|
||||||
table_model.appendRow(row)
|
rows.push(row)
|
||||||
}
|
}
|
||||||
|
table_model.rows = rows
|
||||||
}
|
}
|
||||||
TableModel {
|
TableModel {
|
||||||
id:table_model
|
id:table_model
|
||||||
onRowCountChanged: {
|
|
||||||
timer_table_force_layout.restart()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Timer{
|
|
||||||
id:timer_table_force_layout
|
|
||||||
interval: 50
|
|
||||||
onTriggered: {
|
|
||||||
table_view.flick(0,1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_edit
|
id:com_edit
|
||||||
@ -271,7 +263,8 @@ Rectangle {
|
|||||||
id:item_table
|
id:item_table
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property point position: Qt.point(column,row)
|
property point position: Qt.point(column,row)
|
||||||
property bool isRowSelected: d.currentIndex === table_model.getRow(row).__index
|
property var rowObject : table_model.getRow(row)
|
||||||
|
property bool isRowSelected: d.currentIndex === rowObject.__index
|
||||||
color:{
|
color:{
|
||||||
if(d.rowHoverIndex === row || item_table.isRowSelected){
|
if(d.rowHoverIndex === row || item_table.isRowSelected){
|
||||||
return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
||||||
@ -540,10 +533,11 @@ Rectangle {
|
|||||||
clip: true
|
clip: true
|
||||||
model: TableModel{
|
model: TableModel{
|
||||||
TableModelColumn {}
|
TableModelColumn {}
|
||||||
rows: {
|
}
|
||||||
if(dataSource)
|
Connections{
|
||||||
return dataSource
|
target: table_model
|
||||||
return []
|
function onRowCountChanged(){
|
||||||
|
header_vertical.model.rows = table_model.rows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onContentYChanged:{
|
onContentYChanged:{
|
||||||
@ -619,15 +613,16 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
property point clickPos: "0,0"
|
property point clickPos: "0,0"
|
||||||
|
property bool isResize: {
|
||||||
|
var obj = table_model.getRow(row)
|
||||||
|
return !(obj.height === obj.minimumHeight && obj.height === obj.maximumHeight && obj.height)
|
||||||
|
}
|
||||||
height: 6
|
height: 6
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
cursorShape: Qt.SplitVCursor
|
cursorShape: Qt.SplitVCursor
|
||||||
visible: {
|
visible: isResize
|
||||||
var obj = table_model.getRow(row)
|
|
||||||
return !(obj.height === obj.minimumHeight && obj.height === obj.maximumHeight && obj.height)
|
|
||||||
}
|
|
||||||
onPressed :
|
onPressed :
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
header_vertical.interactive = false
|
header_vertical.interactive = false
|
||||||
|
@ -60,24 +60,16 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
onDataSourceChanged: {
|
onDataSourceChanged: {
|
||||||
table_model.clear()
|
table_model.clear()
|
||||||
|
var rows = []
|
||||||
for(var i =0;i<dataSource.length;i++){
|
for(var i =0;i<dataSource.length;i++){
|
||||||
var row = dataSource[i]
|
var row = dataSource[i]
|
||||||
row.__index= i
|
row.__index= i
|
||||||
table_model.appendRow(row)
|
rows.push(row)
|
||||||
}
|
}
|
||||||
|
table_model.rows = rows
|
||||||
}
|
}
|
||||||
TableModel {
|
TableModel {
|
||||||
id:table_model
|
id:table_model
|
||||||
onRowCountChanged: {
|
|
||||||
timer_table_force_layout.restart()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Timer{
|
|
||||||
id:timer_table_force_layout
|
|
||||||
interval: 50
|
|
||||||
onTriggered: {
|
|
||||||
table_view.flick(0,1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_edit
|
id:com_edit
|
||||||
@ -272,7 +264,8 @@ Rectangle {
|
|||||||
id:item_table
|
id:item_table
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property point position: Qt.point(column,row)
|
property point position: Qt.point(column,row)
|
||||||
property bool isRowSelected: d.currentIndex === table_model.getRow(row).__index
|
property var rowObject : table_model.getRow(row)
|
||||||
|
property bool isRowSelected: d.currentIndex === rowObject.__index
|
||||||
color:{
|
color:{
|
||||||
if(d.rowHoverIndex === row || item_table.isRowSelected){
|
if(d.rowHoverIndex === row || item_table.isRowSelected){
|
||||||
return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
return FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
||||||
@ -541,10 +534,11 @@ Rectangle {
|
|||||||
clip: true
|
clip: true
|
||||||
model: TableModel{
|
model: TableModel{
|
||||||
TableModelColumn {}
|
TableModelColumn {}
|
||||||
rows: {
|
}
|
||||||
if(dataSource)
|
Connections{
|
||||||
return dataSource
|
target: table_model
|
||||||
return []
|
function onRowCountChanged(){
|
||||||
|
header_vertical.model.rows = table_model.rows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onContentYChanged:{
|
onContentYChanged:{
|
||||||
@ -620,15 +614,16 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
property point clickPos: "0,0"
|
property point clickPos: "0,0"
|
||||||
|
property bool isResize: {
|
||||||
|
var obj = table_model.getRow(row)
|
||||||
|
return !(obj.height === obj.minimumHeight && obj.height === obj.maximumHeight && obj.height)
|
||||||
|
}
|
||||||
height: 6
|
height: 6
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
cursorShape: Qt.SplitVCursor
|
cursorShape: Qt.SplitVCursor
|
||||||
visible: {
|
visible: isResize
|
||||||
var obj = table_model.getRow(row)
|
|
||||||
return !(obj.height === obj.minimumHeight && obj.height === obj.maximumHeight && obj.height)
|
|
||||||
}
|
|
||||||
onPressed :
|
onPressed :
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
header_vertical.interactive = false
|
header_vertical.interactive = false
|
||||||
|
Loading…
Reference in New Issue
Block a user