Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOlved] How to make a QIcon transparent ?
Qt 6.11 is out! See what's new in the release blog

[SOlved] How to make a QIcon transparent ?

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 9.5k 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.
  • P Offline
    P Offline
    pascal95abc
    wrote on last edited by
    #1

    Hello,

    I have a listview with icons how it's explained "here":http://www.developer.nokia.com/Community/Wiki/CS001339_-_QListView_with_icons .

    I want to make these icons transparent ?

    How can I achieve this ?

    Thank you

    Qt 4.7.3
    Symbian OS v9.4 / Symbian^1, S60 5th Edition
    on N97

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pascal95abc
      wrote on last edited by
      #2

      Now I know how to include resources with QRC file but howto make an QIcon transparent ?!

      Qt 4.7.3
      Symbian OS v9.4 / Symbian^1, S60 5th Edition
      on N97

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #3

        Just use a png with an alpha channel and make it transparent where needed. Nothing else required iirc.

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pascal95abc
          wrote on last edited by
          #4

          Oh, yeah, this was very simple, too simple for me to be thought at at first.
          Of course this works now, very well.

          Qt 4.7.3
          Symbian OS v9.4 / Symbian^1, S60 5th Edition
          on N97

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Albert_436
            wrote on last edited by
            #5

            A solution in code (event though it slightly misses the point of the question):
            @ QPixmap pixmap(16, 16);
            pixmap.fill(QColor("black"));
            pixmap.setAlphaChannel (pixmap);
            QIcon transparentIcon(pixmap);
            @

            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