不多说,直接上代码
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Item {
id:mylistmode
width: parent.width
height: parent.height
ListModel{
id:mytablemodel
}
TableView{
id:mytableview
width: mylistmode.width
height: mylistmode.height
model:mytablemodel
TableViewColumn {
role: "title"
title: "老大"
width: mytableview.width/6
movable:false
}
TableViewColumn {
role: "title1"
title: "老二"
width: mylistmode.width/6
movable:false
}
TableViewColumn {
role: "title2"
title: "老三"
width: mytableview.width/6
movable:false
}
TableViewColumn {
role: "title3"
title: "老四"
width: mytableview.width/6
movable:false
}
TableViewColumn {
role: "title4"

本文介绍如何在Qt QML中自定义TableView的属性,包括实现选中行后显示数据的功能,以及添加和修改表格内数据的代码示例,并提供了单击信号的演示。
最低0.47元/天 解锁文章
6655

被折叠的 条评论
为什么被折叠?



