Skip to content

Don't rely on QPixmap to figure out extension but probe manually for png/bmp[/xyz] #94

@Ghabry

Description

@Ghabry

The current editor code relies on an undocumented QPixmap feature for loading the graphics:

It requests QPixmap to load e.g. ChipSet/Basis and then QPixmap tries to open (in this order according to strace):
Basis, Basis.bmp, Basis.cur, Basis.gif, Basic.ico, Basic.jpeg, Basis.jpg, Basis.pbm, Basis.pgm, Basis.png

Imo this is bad style because it loads file formats the Player does not support and bmp is prefered over png 👎

I have no idea why this is even happening the documentation says:
"Constructs a pixmap from the file with the given fileName. If the file does not exist or is of an unknown format, the pixmap becomes a null pixmap. The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format."

It only states "the loader probes for a header", not "the loader probes by appending all supported image extensions".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions