Results 1 to 2 of 2

Thread: Resizing QListWidget's dimensions to fit its contents

  1. #1
    Join Date
    Mar 2009
    Location
    delhi India
    Posts
    56
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Resizing QListWidget's dimensions to fit its contents

    Hi ,
    I have frameless QListWidget with some items added to it.I don't want to set the hard coded height and width for it .It should rezie itself depending upon the contents added .
    By default it doesn't resize itself to its contents.

    Any help would be appreciated.

    Thanks in advance .
    vaibhav.

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Resizing QListWidget's dimensions to fit its contents

    1. put list widget inside of layout
    2. subclass list and override QWidget::sizeHint (here you will provide preferred size of widget).
    3. every time you suspect that preffered size should be changed (new data added to data model presented by view) call updateGeometry();

  3. The following user says thank you to MarekR22 for this useful post:

    ntp (1st December 2011)

Similar Threads

  1. QTableView resizing to contents.
    By chris_helloworld in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2010, 13:43
  2. Replies: 4
    Last Post: 10th May 2010, 22:12
  3. QToolBox Resizing to contents??
    By kerwim in forum Qt Programming
    Replies: 1
    Last Post: 30th June 2008, 08:28
  4. Resizing screen dimensions using backbuffer in QT?
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 24th September 2007, 23:13
  5. 3 Dimensions using opengl
    By vermarajeev in forum Qt Programming
    Replies: 30
    Last Post: 23rd April 2007, 11:31

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.