You can derive from QFileIconProvider and override the icon() method to add larger / smaller pixmaps to the set of default sizes. You could add these either by scaling existing pixmaps up / down or by creating your own.
You can derive from QFileIconProvider and override the icon() method to add larger / smaller pixmaps to the set of default sizes. You could add these either by scaling existing pixmaps up / down or by creating your own.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
You are right, I can provide my own icons that way, but then they do not reflect the software situation on my user's machine.
But shouldn't QFileIconProvider return bigger icons by default? I've tried to find the answer in the Qt sources, but I don't understand too much of the code there.
The actual work seems to be done in qwindowstheme.cpp, and at least I've found this snippet here:
Qt Code:
enum { // Shell image list ids sHIL_EXTRALARGE = 0x2, // 48x48 or user-defined sHIL_JUMBO = 0x4 // 256x256 (Vista or later) };To copy to clipboard, switch view to plain text mode
So it doesn't seem to be a deliberate omission after all.
The QIcon documentation says that if you ask for an pixmap that is -smaller- than the available sizes and no pixmap of that size has been set, then it will scale a larger pixmap down. However, it will not scale a smaller pixmap into a larger one. So if 32 x 32 is the largest size available, then you'll have to supply your own if you want something larger. If you derive from QFileIconProvider, then you can always do this scaling up yourself instead of having to invent new pixmaps and put them into resources.
You're not the only one with that problem...the Qt sources, but I don't understand too much of the code there.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks