Results 1 to 3 of 3

Thread: QListView Icons with uniform sizes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2008
    Posts
    71
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default QListView Icons with uniform sizes

    Hi

    I implemented my own model and I'm trying to dislay it with QListView in the Icon mode. I want. The models' DecorationData returns pixmap which is not of the same size for all the items. some are larger, some smaller.

    Now I want them to be laid out on a grid with the same space per item, so I set uniformItemSizes to true.. this resizes all the items to the smallest item size (see the screenshot)

    The I tries setting grid Size to the size of the biggest item, but I cant find a good way to calculate the size for the text below the item, it's sometime quite long. so sometimes the text would get trimmed..

    The i tried to make all the pixmaps returned by the model of the same size by scaling them:
    Qt Code:
    1. return pixmap.scaled(size, Qt::KeepAspectRatio);
    To copy to clipboard, switch view to plain text mode 
    but nothing changed - the size of the smallest icon did not change...

    So basically I tried a few approaches to layout differently sized icons with text on a QListView...Could you please suggest me a solution?

    Thanks
    Attached Images Attached Images

Similar Threads

  1. Replies: 6
    Last Post: 30th December 2010, 11:19
  2. QT QListView (as icons)
    By Majdi in forum Newbie
    Replies: 10
    Last Post: 2nd March 2010, 23:22
  3. QListView with icons on top of the text, not at the left
    By vfernandez in forum Qt Programming
    Replies: 7
    Last Post: 19th February 2009, 04:19

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.