Important: Please read the Qt Code of Conduct -

ListView's Highlight Rectangle Height

  • I have this listview:

    @ListView {
    id: list1
    x: -1
    y: 14
    width: modalList.width - 20
    height: modalList.height - 20
    anchors.horizontalCenter: parent.horizontalCenter
    clip: false
    z: 1
    visible: true
    anchors.bottom: parent.bottom
    highlight: Rectangle { color: "#b5b5b5"; radius: 5; height: 80; width: modalList.width; clip: false; anchors.horizontalCenter: parent.horizontalCenter }
    highlightMoveDuration: 250
    highlightMoveSpeed: 450
    focus: true
    spacing: 12
    snapMode: ListView.SnapToItem

         model: innerModel
         delegate: Text {
             clip: true
             text: name
             color: "#333333"
             verticalAlignment: Text.AlignVCenter
             horizontalAlignment: Text.AlignHCenter
             font.bold: true

    And despite the fact that I set my highlight rectangle to be 80 pixels tall it always just takes on the height of the letters being displayed in the list. Any ideas on why I cannot control this? I have full control over width.

  • Highlight is controlled by list, so if you want to have bigger highlight you need to have bigger list elements. As I see you don't set their height, maybe it will help?

  • How do I control the size of the list items?

  • list item=delegate

Log in to reply