Results 1 to 8 of 8

Thread: QFileIconProvider: available sizes only up to 32x32?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFileIconProvider: available sizes only up to 32x32?

    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.

  2. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QFileIconProvider: available sizes only up to 32x32?

    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:
    1. enum { // Shell image list ids
    2. sHIL_EXTRALARGE = 0x2, // 48x48 or user-defined
    3. sHIL_JUMBO = 0x4 // 256x256 (Vista or later)
    4. };
    To copy to clipboard, switch view to plain text mode 

    So it doesn't seem to be a deliberate omission after all.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFileIconProvider: available sizes only up to 32x32?

    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.

    the Qt sources, but I don't understand too much of the code there.
    You're not the only one with that problem...
    <=== 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.

Similar Threads

  1. QFileIconProvider and QFileDialog
    By hakermania in forum Newbie
    Replies: 1
    Last Post: 27th October 2011, 18:45
  2. QFileIconProvider problem
    By rittchat in forum Qt Programming
    Replies: 5
    Last Post: 29th November 2010, 04:02
  3. Getting mulitiple size file icons with QFileIconProvider
    By gmat4321 in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2009, 13:41
  4. Replies: 4
    Last Post: 7th January 2009, 10:13
  5. Replies: 9
    Last Post: 29th March 2007, 13:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.