Opened 3 years ago

Closed 11 months ago

#306 closed defect (wontfix)

PNG-format application icon renders badly

Reported by: Alex Taylor Owned by:
Priority: minor Milestone: Qt 5
Component: QtGui Version: 4.7.3
Severity: low Keywords:
Cc:

Description

It's common to use an image (e.g. from Qt resources) of an internally-supported format such as PNG for the frame icon. Indeed, this seems to be the only way to be able to access the image in other contexts within the application (see ticket #305).

Unfortunately, it renders very badly in this case, with ugly scaling and broken alpha-blending.

In theory, it should be possible to avoid scaling by providing an icon of the exact size. For example:

QIcon icon;
icon.addFile(":/images/editor.png", QSize( 40, 40 ), QIcon::Normal, QIcon::On );
icon.addFile(":/images/editor_mini.png", QSize( 20, 20 ), QIcon::Normal, QIcon::On );
icon.addFile(":/images/editor_vga.png", QSize( 32, 32 ), QIcon::Normal, QIcon::On );
icon.addFile(":/images/editor_vga_mini.png", QSize( 16, 16 ), QIcon::Normal, QIcon::On );
setWindowIcon( icon );

This works (and looks) fine when rendering the image in an explicit context inside the program, such as via MessageBox::about().

However, when used as the application icon, either the wrong image size is being selected, or it's being re-scaled somehow (why or to what, I cannot tell).

Screenshots to be attached.

Attachments (3)

png_both_good.png (3.1 KB) - added by Alex Taylor 3 years ago.
Correct rendering of 20x20 and 40x40 PNG images (in about box).
png_full.png (2.8 KB) - added by Alex Taylor 3 years ago.
Ugly rendering of PNG image as application icon.
png_mini.png (1.8 KB) - added by Alex Taylor 3 years ago.
Ugly rendering of PNG image as application mini-icon (in system menu).

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by Alex Taylor

Attachment: png_both_good.png added

Correct rendering of 20x20 and 40x40 PNG images (in about box).

Changed 3 years ago by Alex Taylor

Attachment: png_full.png added

Ugly rendering of PNG image as application icon.

Changed 3 years ago by Alex Taylor

Attachment: png_mini.png added

Ugly rendering of PNG image as application mini-icon (in system menu).

comment:1 Changed 3 years ago by Alex Taylor

The first screenshot shows what the 40x40 and 20x20 PNG images actually look like. Here they are rendered (via MessageBox::about()) as they should be.

The second and third screenshots show how the exact same (QIcon) images are rendered as the application full-size and mini-icon, respectively. As can be seen, they look terrible.

comment:2 Changed 3 years ago by Alex Taylor

Priority: majorminor

comment:3 Changed 20 months ago by Silvan Scherrer

Milestone: Qt4 4.7.3 rereleaseQt 5

Ticket retargeted after milestone closed

comment:4 Changed 11 months ago by Silvan Scherrer

Resolution: wontfix
Status: newclosed

please test with Qt 5 and open a ticket at https://github.com/bitwiseworks/qtbase-os2 if it's not good enough.

Note: See TracTickets for help on using tickets.