Results 1 to 5 of 5

Thread: set QListWidget/QTreeWidget icon size

  1. #1
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default set QListWidget/QTreeWidget icon size

    hello,

    is there a way to increase the icon size of items in a QListWidget/QTreeWidget? I tried increasing the font point size, but that only affected the text.

    My QIcon images are quite large (eg 300x300), so they can afford to be larger than the default.

    Richard

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: set QListWidget/QTreeWidget icon size

    You can call QAbstractItemView::setIconSize .
    QListWidget/ QTreeWidget are inherited from QAbstractItemView

  3. The following 2 users say thank you to aamer4yu for this useful post:

    DIMEDROLL (26th November 2010), rbp (13th October 2009)

  4. #3
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: set QListWidget/QTreeWidget icon size

    thanks!

    I found increasing the icon size like this causes the item icons to touch. So is there a way to add padding?

  5. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: set QListWidget/QTreeWidget icon size

    And what do you mean by
    I found increasing the icon size like this causes the item icons to touch
    ??

    May be you try setting the margin with style sheet... else other alternatives include using a custom delegate.

  6. #5
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: set QListWidget/QTreeWidget icon size

    With the default icon size there is space between the icons in adjacent items, but when I increase the icon size this space is not maintained so that the icons appear joined. Hope that makes sense.

    I'll have a look into style sheets.

Similar Threads

  1. How to change Icon size in QMenu?
    By alex chpenst in forum Qt Programming
    Replies: 4
    Last Post: 3rd September 2008, 14:16
  2. Toolbar and icon size
    By MrGarbage in forum Qt Programming
    Replies: 0
    Last Post: 8th January 2008, 21:27
  3. Size of an Icon
    By LordQt in forum Qt Programming
    Replies: 7
    Last Post: 26th August 2007, 21:36
  4. QToolBar icon size
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 29th March 2007, 13:12
  5. tool bar icon size looking small???
    By darpan in forum Qt Tools
    Replies: 7
    Last Post: 31st March 2006, 16:38

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.