PDA

View Full Version : Qt5 on Linux - Getting correct icon based on a file / mimetype from system icon theme



DoTheEvo
3rd January 2016, 18:34
If I have a path to a file.
Can Qt help somehow in getting the correct icon for that file type?

Example:
if I got ~/pictures/qt_logo.png with mimetype image/png
Could Qt figure out that set theme is Menda-Circle and path to corresponding icon would be /usr/share/icons/Menda-Circle/mimetypes/24x24/application-image-png.svg

anda_skoa
3rd January 2016, 22:35
See QMimeDatabase::mimeFromFile() and QIcon::fromTheme().

Cheers,
_