Whether that used to be true I don't know, but it doesn't currently work.
The v5.1 documentation says:
Likewise, with addFile() it says:An icon is empty if it has neither a pixmap nor a filename.
Note: Even a non-null icon might not be able to create valid pixmaps, eg. if the file does not exist or cannot be read.
Not the ideal solution, but this seems to work:Note: When you add a non-empty filename to a QIcon, the icon becomes non-null, even if the file doesn't exist or points to a corrupt file.
Qt Code:
To copy to clipboard, switch view to plain text mode
It attempts to use the icon to retrieve or generate a pixmap of the size we're planning to use. It returns a null pixmap if the QIcon can't provide/generate such a image.
Looking at the Qt sourcecode, I can't see any other way to detect the a failure.
Bookmarks