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. QIcon background not showing as transparent on QToolButton with custom button background
Forum Update on Monday, May 27th 2025

QIcon background not showing as transparent on QToolButton with custom button background

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 354 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.
  • R Offline
    R Offline
    RogerD
    wrote on 20 May 2024, 10:30 last edited by
    #1

    Hi,

    I'm using QT 5.15.7 on an embedded system and I'm having a problem with an icon background on a QToolButton.

    I have my own button background images (for button up and down) and on top of that an icon with text beneath it (this is why I'm not using QPushButton btw). Unfortunately, the icon background isn't transparent so the icon is enclosed within a white box which doesn't look great with my custom button background. Does anyone know how to fix this short of me manipulating the icon background myself?

    For reference, the icon is a bitmap although I've tried a jpeg and the problem still occurs.

    Thanks in advance for any help!

    1 Reply Last reply
    0
    • R RogerD
      24 May 2024, 12:18

      Hi @SGaist , I'd already tried changing the image to a Jpeg with a transparent background and it didn't work. Thanks, Roger

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 24 May 2024, 12:28 last edited by
      #4

      @RogerD Jpeg has no transparency.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 20 May 2024, 19:06 last edited by
        #2

        Hi and welcome to devnet,

        The most simple is to update your image for it to have a transparent background.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        R 1 Reply Last reply 24 May 2024, 12:18
        0
        • S SGaist
          20 May 2024, 19:06

          Hi and welcome to devnet,

          The most simple is to update your image for it to have a transparent background.

          R Offline
          R Offline
          RogerD
          wrote on 24 May 2024, 12:18 last edited by
          #3

          Hi @SGaist , I'd already tried changing the image to a Jpeg with a transparent background and it didn't work. Thanks, Roger

          C 1 Reply Last reply 24 May 2024, 12:28
          0
          • R RogerD
            24 May 2024, 12:18

            Hi @SGaist , I'd already tried changing the image to a Jpeg with a transparent background and it didn't work. Thanks, Roger

            C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 24 May 2024, 12:28 last edited by
            #4

            @RogerD Jpeg has no transparency.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            2
            • R Offline
              R Offline
              RogerD
              wrote on 28 May 2024, 08:08 last edited by
              #5

              Oh dear, I feel really embarrassed now, for years I thought jpeg backgrounds were transparent (using the magic wand in paint.net) but I can see that isn't the case. I tried a PNG and the button icon is working correctly now, thanks for your help guys.

              1 Reply Last reply
              1
              • R RogerD has marked this topic as solved on 28 May 2024, 08:09
              • R RogerD has marked this topic as solved on 28 May 2024, 08:09

              1/5

              20 May 2024, 10:30

              • Login

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