Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Hightlight selected listview object with glow
Forum Updated to NodeBB v4.3 + New Features

Hightlight selected listview object with glow

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 460 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    niclaslind
    wrote on last edited by
    #1

    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
    Niclas

    DiracsbracketD 1 Reply Last reply
    0
    • N niclaslind

      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
      Niclas

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by
      #2

      @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.

      1 Reply Last reply
      1
      • N Offline
        N Offline
        niclaslind
        wrote on last edited by
        #3

        Ah, ok!

        Thank you!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved