Results 1 to 3 of 3

Thread: How To know the QlistView width to reimplement sizeHint in delegate

  1. #1
    Join Date
    Aug 2010
    Posts
    20
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default How To know the QlistView width to reimplement sizeHint in delegate

    Hi,
    I want to reimplement sizeHint in my delegate, to make the item size to:
    item width = list width
    item height = list width * 0.16
    for example, is that correct? this size is for all items,

    Is there any other way to set the item height?

    Regards

    Juan M.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How To know the QlistView width to reimplement sizeHint in delegate

    I would probably rather subclass the view and reimplement visualRect() and indexAt().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How To know the QlistView width to reimplement sizeHint in delegate

    With the size hint function an option is delivered. The rect variable holds the actual with of your view. So you can work with that. At least that is what I remember right now.

    If all your items have the same size, also have a look at setUniformItemSizes().

Similar Threads

  1. Replies: 15
    Last Post: 11th December 2012, 20:10
  2. Replies: 0
    Last Post: 30th August 2010, 19:08
  3. Item width in QListView
    By bepaald in forum Qt Programming
    Replies: 0
    Last Post: 17th August 2010, 13:42
  4. How to reimplement sizeHint()?
    By Septi in forum Qt Programming
    Replies: 0
    Last Post: 6th July 2010, 13:07
  5. QListView and delegate to display data
    By T4ng10r in forum Qt Programming
    Replies: 5
    Last Post: 30th May 2007, 09:25

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.