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. How To Change Color in Listview Delegate ?
Forum Updated to NodeBB v4.3 + New Features

How To Change Color in Listview Delegate ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 385 Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello, I have a ListView. How can I change the properties of the elements in delegate? Like the rectangle color?

    MarkkyboyM 1 Reply Last reply
    0
    • ? A Former User

      Hello, I have a ListView. How can I change the properties of the elements in delegate? Like the rectangle color?

      MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by
      #2

      @NullByte

      this might help;

      https://stackoverflow.com/questions/13523701/how-to-set-alternate-colors-for-listview-items-in-qml

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        I thinks solution is Connections. It's work.

                        ColorOverlay {
                            id: favIconOverlay
                            anchors.fill: favIcon
                            source: favIcon
                            color: getColorCode(id)
                            transform: rotation
                            antialiasing: true
        
                            Connections {
                                target: favoriteModel
                                function onCountChanged(foo) {
                                    var newColor = getColorCode(id)
                                    if(newColor === '#ed670e') {
                                        favIcon.isFav = true
                                    } else {
                                        favIcon.isFav = false
                                    }
        
                                    favIconOverlay.color = newColor
                                }
                            }
                        }
        
        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