【发布时间】:2015-08-31 08:17:41
【问题描述】:
我想为用户提供一个标签栏来选择其中一个元素进行过滤。
ColumnLayout
{
anchors.fill: parent
TabView
{
Layout.fillWidth: true
Tab { title: "all" }
Tab { title: "even" }
Tab { title: "odd" }
Tab { title: "multiple of 3" }
Tab { title: "prime" }
}
TableView
{
Layout.fillHeight: true
Layout.fillWidth: true
model: mymodel
TableViewColumn
{
role: "name"
title: "name"
}
TableViewColumn
{
role: "number"
title: "number"
}
}
}
不幸的是,TabBar 和 TableView 之间显示了大约 100px 的空白空间。
我不想创建 4 个 TableView - 我宁愿改变模型。我知道QtQuick.Controls.Private 中有TabBar,但我宁愿避免使用私有组件,因为它们可以随时更改。
有什么方法可以只显示 TabBar 而无需访问私有组件,例如隐藏那个空白区域?
我宁愿不覆盖样式,因为在 Android 上它会给我带来糟糕的、非原生的外观
【问题讨论】: