mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 19:20:59 +08:00
commit
4be2ad6ba0
@ -75,6 +75,7 @@ Rectangle {
|
|||||||
ScrollBar.vertical: FluScrollBar{}
|
ScrollBar.vertical: FluScrollBar{}
|
||||||
selectionModel: ItemSelectionModel {
|
selectionModel: ItemSelectionModel {
|
||||||
id:selection_model
|
id:selection_model
|
||||||
|
model: table_model
|
||||||
}
|
}
|
||||||
columnWidthProvider: function(column) {
|
columnWidthProvider: function(column) {
|
||||||
var w = columnSource[column].width
|
var w = columnSource[column].width
|
||||||
@ -108,7 +109,7 @@ Rectangle {
|
|||||||
clip: true
|
clip: true
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
required property bool selected
|
required property bool selected
|
||||||
required property bool current
|
property bool current: selection_model.currentIndex === table_model.index(row,column)
|
||||||
property var readOnly: columnSource[column].readOnly
|
property var readOnly: columnSource[column].readOnly
|
||||||
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
@ -116,11 +117,12 @@ Rectangle {
|
|||||||
TapHandler{
|
TapHandler{
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
onDoubleTapped: {
|
onDoubleTapped: {
|
||||||
|
selection_model.setCurrentIndex(table_model.index(row,column), ItemSelectionModel.Current)
|
||||||
if(readOnly){
|
if(readOnly){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
item_loader.sourceComponent = obtEditDelegate(column,row)
|
item_loader.sourceComponent = obtEditDelegate(column,row)
|
||||||
var index = table_view.index(row,column)
|
var index = table_model.index(row,column)
|
||||||
}
|
}
|
||||||
onTapped: {
|
onTapped: {
|
||||||
if(!current){
|
if(!current){
|
||||||
@ -145,13 +147,13 @@ Rectangle {
|
|||||||
property int row
|
property int row
|
||||||
property var tableView: control
|
property var tableView: control
|
||||||
onDisplayChanged: {
|
onDisplayChanged: {
|
||||||
table_model.setData(table_view.index(row,column),"display",display)
|
table_model.setData(table_model.index(row,column),"display",display)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function obtEditDelegate(column,row){
|
function obtEditDelegate(column,row){
|
||||||
var display = table_model.data(table_view.index(row,column),"display")
|
var display = table_model.data(table_model.index(row,column),"display")
|
||||||
var cellItem = table_view.itemAtCell(column, row)
|
var cellItem = table_view.itemAtCell(column, row)
|
||||||
var cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
var cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
||||||
item_loader.column = column
|
item_loader.column = column
|
||||||
|
Loading…
Reference in New Issue
Block a user