
Originally Posted by
anda_skoa
I think you'll need to describe your goal in more detail.
Do delegates for difference indexes have uniform or different height?
Do you want a certain number of delegates visible, or all, or a minimum or a maximum?
Cheers,
_
Thank you for your response anda_skoa
Yes, delegates have uniform heights and all items should be visible.
The buttons overlaps in listview item because no height being set on it, which I don't want to hard code the height.
Here's my code:
Item {
ColumnLayout
{
id: body
anchors.fill: parent
ListView
{
id: connDetails
anchors.fill: parent
interactive: false
model: connModel
delegate: connDelegate
}
Button {
text: "Ok"
}
Button {
text: "View"
}
Button {
text: "Cancel"
}
}
ListModel
{
id: connModel
ListElement
{
serverName: "connection1"
serverIp: "192.168.1.8"
}
ListElement
{
serverName: "connection2"
serverIp: "192.168.1.7"
}
}
Component
{
id: connDelegate
GridLayout
{
columns: 2
rows: 2
columnSpacing: 20
Text
{
text: qsTr("Server name:")
color: "white"
}
Text
{
text: qsTr(serverName)
color: "white"
}
Text
{
text: qsTr("Server IP:")
color: "white"
}
Text
{
text: qsTr(serverIp)
color: "white"
}
}
}
}
Item {
ColumnLayout
{
id: body
anchors.fill: parent
ListView
{
id: connDetails
anchors.fill: parent
interactive: false
model: connModel
delegate: connDelegate
}
Button {
text: "Ok"
}
Button {
text: "View"
}
Button {
text: "Cancel"
}
}
ListModel
{
id: connModel
ListElement
{
serverName: "connection1"
serverIp: "192.168.1.8"
}
ListElement
{
serverName: "connection2"
serverIp: "192.168.1.7"
}
}
Component
{
id: connDelegate
GridLayout
{
columns: 2
rows: 2
columnSpacing: 20
Text
{
text: qsTr("Server name:")
color: "white"
}
Text
{
text: qsTr(serverName)
color: "white"
}
Text
{
text: qsTr("Server IP:")
color: "white"
}
Text
{
text: qsTr(serverIp)
color: "white"
}
}
}
}
To copy to clipboard, switch view to plain text mode
Cheers!
Bookmarks