Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. coloroverlay in QML
Forum Updated to NodeBB v4.3 + New Features

coloroverlay in QML

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 766 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.
  • A Offline
    A Offline
    Amulya D
    wrote on last edited by
    #1

    Hi sir,
    Good Evening,
    I'm working on App using QML,in that i want to use coloroverlay to change icon color(.svg image),so the icon color should be changed when ever i click the button ( In side onclicked:)kindly help me

    Thank you

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      There are a few ways to do it.

      • If you use QQuickControls 2, you can use Button's icon.color property: https://doc.qt.io/qt-5/qml-qtquick-controls2-abstractbutton.html#icon.color-prop
      • you can use Rectangle with a color and some transparency (opacity or alpha value) and place it over your icon
      • you can use ColorOverlay

      (Z(:^

      1 Reply Last reply
      3
      • A Offline
        A Offline
        Amulya D
        wrote on last edited by
        #3

        Thank you sir..

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Amulya D
          wrote on last edited by
          #4

          @sierdzio said in coloroverlay in QML:

          icon.color

          Good evening sir,
          I'm unable to change color of Icon when ever i click the button means i am unable access coloroverlay inside a function and can you kindly help with small example.
          Thank you

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Something like this should work:

            Button {
              icon.color: pressed? "#aaff0000" : "transparent"
            }
            

            (Z(:^

            1 Reply Last reply
            4
            • A Offline
              A Offline
              Amulya D
              wrote on last edited by
              #6

              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