0

In Qt Designer 4.7, I am trying to add custom icons to a UI.

When editing the QPushButton or QLabel properties, I'll go to Icon -> Choose File and select my PNG.

I then get this popup error: "The pixmap file 'custom/icon.png' cannot be read."

I have no idea why it won't accept my PNGs. What's weird is there are other PNGs in our database that are accepted by Qt Designer, and I can't tell what properties they have that make them readable. Like, when I select my PNGs in the file browser, the working PNGs have an accurate thumbnail, but the one that doesn't work just has a blank file thumbnail.

What would cause a pixmap PNG to be unreadable by Qt Designer? The icon I'm trying to use is a 4KB 80×80 image made in Paint...

Valkyrian
  • 1
  • 1
  • What is your .png name? Do you have the "/" inside the icon's name? – eyllanesc Oct 17 '18 at 17:19
  • What is your DEV ENV ? – Redanium Oct 17 '18 at 18:07
  • 1
    Once, a collaborator tried to convince me that he managed to load JPEGs with transparency. I told him that JPEG does not support alpha and cannot have transparency. Finally, we found out that the "JPEG" files were simply mis-named PNG files. The loader was clever enough to ignore the wrong file extension and checked the magic code instead. - Some image viewers can check/tell this. Using a hex-dump tool would probably do as well. The magic code of PNG is [`89 50 4e 47 0d 0a 1a 0a`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) which have to occur at the beginning of file. – Scheff's Cat Oct 18 '18 at 13:41
  • Long story short: post that magic PNG somewhere public so we can inspect it and tell you what's wrong with it. Otherwise, we can make guesses all day long. – Jongware Oct 18 '18 at 13:46

0 Answers0