Important: Please read the Qt Code of Conduct -

Hightlight selected listview object with glow

  • Hello!

    I wonder if it is possible to use the Glow-property to highlight a Listview Object?

    This is my code for the listview, but I get error message: Invalid component body specification.

        ListView {
            id: buckItemListView
            model: buckitemModel
            spacing: itemSpacing
            anchors.fill: parent
            anchors.bottomMargin: itemSpacing
            orientation: Qt.Vertical
            snapMode: ListView.SnapToItem
            delegate: listViewDelegate
            focus: true
            highlight: highLightedRect
            highlightFollowsCurrentItem: false
        Component {
            id: listViewHighlight
            Glow {
                id: effect
                anchors.fill: hightLightRect
                spread: 0.2
                color: "white"
            Rectangle {
                id: hightLightRect
                anchors.fill: parent
                color: "black"
                radius: 5

    Anyone who knows if it's possible?

    Best regards

  • @niclaslind
    Component only accepts a single child object.

    Component {
        id: myComponent
        SomeType {

    So in your case you may need to wrap everything in an Item or so.

  • Ah, ok!

    Thank you!

Log in to reply