I set up my ListView like this:
ListView {
id: boatAlphaList
anchors.fill: parent
ListModel {
id: boatAlphaModel
ListElement {
boatAlphaName: "..."
boatAlphaID: "0"
}
}
Component {
id: boatAlphaDelegate
Item {
id: boatAlphaContainer
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
height: Funcs.pointHeight(14)
Column {
Text {
font.pixelSize: Funcs.fontHeight(12)
text: boatAlphaName
horizontalAlignment: Text.AlignHCenter
}
}
MouseArea {
id: boatAlphaMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
boatAlphaList.currentIndex = index
}
}
}
}
model: boatAlphaModel
delegate: boatAlphaDelegate
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
highlightFollowsCurrentItem: true
highlightMoveDuration: 250
highlightMoveVelocity: 50
focus: true
spacing: Funcs.fontHeight(8)
clip: true
currentIndex: -1
onCurrentItemChanged: {
appWin.myBoatAlpha = boatAlphaModel.get(boatAlphaList.currentIndex).boatAlphaName;
Funcs.loadSelectedBoats();
}
}
}
ListView {
id: boatAlphaList
anchors.fill: parent
ListModel {
id: boatAlphaModel
ListElement {
boatAlphaName: "..."
boatAlphaID: "0"
}
}
Component {
id: boatAlphaDelegate
Item {
id: boatAlphaContainer
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
height: Funcs.pointHeight(14)
Column {
Text {
font.pixelSize: Funcs.fontHeight(12)
text: boatAlphaName
horizontalAlignment: Text.AlignHCenter
}
}
MouseArea {
id: boatAlphaMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
boatAlphaList.currentIndex = index
}
}
}
}
model: boatAlphaModel
delegate: boatAlphaDelegate
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
highlightFollowsCurrentItem: true
highlightMoveDuration: 250
highlightMoveVelocity: 50
focus: true
spacing: Funcs.fontHeight(8)
clip: true
currentIndex: -1
onCurrentItemChanged: {
appWin.myBoatAlpha = boatAlphaModel.get(boatAlphaList.currentIndex).boatAlphaName;
Funcs.loadSelectedBoats();
}
}
}
To copy to clipboard, switch view to plain text mode
So, where and how do I set the alignment?
Bookmarks