Opened 22 months ago

Closed 6 weeks ago

#306 closed defect (wontfix)

PNG-format application icon renders badly

Reported by: ataylor 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 ataylor 22 months ago.
Correct rendering of 20x20 and 40x40 PNG images (in about box).
png_full.png (2.8 KB) - added by ataylor 22 months ago.
Ugly rendering of PNG image as application icon.
png_mini.png (1.8 KB) - added by ataylor 22 months ago.
Ugly rendering of PNG image as application mini-icon (in system menu).

Download all attachments as: .zip

Change History (7)

Changed 22 months ago by ataylor

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

Changed 22 months ago by ataylor

Ugly rendering of PNG image as application icon.

Changed 22 months ago by ataylor

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

comment:1 Changed 22 months ago by ataylor

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 22 months ago by ataylor

  • Priority changed from major to minor

comment:3 Changed 11 months ago by diver

  • Milestone changed from Qt4 4.7.3 rerelease to Qt 5

Ticket retargeted after milestone closed

comment:4 Changed 6 weeks ago by diver

  • Resolution set to wontfix
  • Status changed from new to closed

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.