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 Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 380 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.
  • R Offline
    R Offline
    RogerD
    wrote on 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

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

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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
        0
        • SGaistS SGaist

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

          Christian EhrlicherC 1 Reply Last reply
          0
          • R RogerD

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

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 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 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
              • R RogerD has marked this topic as solved on

              • Login

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