Results 1 to 2 of 2

Thread: Forcing a minimum list widget width

  1. #1
    Join Date
    Mar 2007
    Posts
    74
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Forcing a minimum list widget width

    Hi,

    I have a very simple main application, done in entirely in QT Designer.

    On the left I have a List widget. On the right a stacked widget.
    As items in the list are selected the stacked widget changes pages appropriately.

    I want the list widget to be only about as wide as the max text it contains, ie "Page 1".

    No matter what I seem to do with the layout and size policy, the list widget always expands horizontally to occupy about 1/3 of the application window. I cannot seem to get it force it to be a narrower width.

    Everything resizes correctly, but I don't want or need the list widget taking up so much real estate.

    How do I do this with QT designer?

    Thanks!

    Mark
    Attached Images Attached Images
    Last edited by MrGarbage; 9th July 2007 at 21:55. Reason: updated contents

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Forcing a minimum list widget width

    Not that easy.
    My solution is to use QListView instead. Create a custom item delegate and reimplement sizeHint and minimumSize for it. Next you must set it to the list view.
    This way you will get your minimum size.

    But this also means you will have to actually write some code .
    Designer is just a tool of Qt, it is not meant to "create" fully functional applications with it.

    Regards

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.