亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何隱藏 QML 中 TableView 中未使用的行?

如何隱藏 QML 中 TableView 中未使用的行?

藍山帝景 2023-09-21 16:55:26
下面的代碼顯示了表中未使用的行。我希望未使用的行消失。應顯示空白。import QtQuick 2.12import QtQuick.Window 2.12import QtQuick.Controls 1.4Window {    visible: true    width: 640    height: 480    TableView    {        height: 300; width: 300        TableViewColumn {                role: "title"                title: "Title"                width: 100            }            TableViewColumn {                role: "author"                title: "Author"                width: 200            }            model: libraryModel    }    ListModel {        id: libraryModel        ListElement {            title: "A Masterpiece"            author: "Gabriel"        }        ListElement {            title: "Brilliance"            author: "Jens"        }        ListElement {            title: "Outstanding"            author: "Frederik"        }    }}我有什么選擇?
查看完整描述

1 回答

?
蝴蝶刀刀

TA貢獻1801條經驗 獲得超8個贊

必須在rowDelegateTableView 中添加以下行:

readonly property int modelRow: styleData.row ? styleData.row : 0

????????rowDelegate:?Rectangle?
?????????????????????{
?????????????????????????????????????????????id:?rowDel
????????????????????????border.width:?1
????????????????????????height:??52
????????????????????????width:?2000

????????????????????????readonly?property?int?modelRow:?styleData.row???styleData.row?:?0
?????????????????????}


查看完整回答
反對 回復 2023-09-21
  • 1 回答
  • 0 關注
  • 163 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號