Results 1 to 2 of 2

Thread: Size of QTabWidget in DockWidget

  1. #1
    Join Date
    Mar 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Size of QTabWidget in DockWidget

    Hello

    i have a layout with 2 dockwidgets among each other, the first on has a list widget in it and the second one a tab widget.
    When i edit the size in the qtdesigner and make the first one´s size very small and start the program it ignores my changes and the first one takes most of the space in my layout.

    View in the editor:
    1.jpg

    View in the program:
    2.jpg


    It seems that it only happens if the second dock widget contains a tabwidget otherwise the sizes are equal.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Size of QTabWidget in DockWidget

    The default size policies of the two widgets appear to be set such that the tab widget will assume its minimum size if it has no content, while the list widget will expand to take up whatever room it is given. The layout negotiates with each of the widgets to determine how much space they need and divides it up accordingly. Once you start to add content (pages with widget contents) to the tab widget, you'll likely see it being given more room to accommodate the largest page.

    If you substitute a list widget for the tab widget, then both of them are arguing for as much space as possible, so the layout settles the argument by giving each one half.

    What you see in Qt Designer is not always what you see at runtime, because this layout negotiation does not take place there.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QTabWidget size set to content
    By Kaluss in forum Newbie
    Replies: 2
    Last Post: 17th November 2015, 15:08
  2. QDockWidget seperator with fixed size dockwidget
    By TheClassic in forum Qt Programming
    Replies: 1
    Last Post: 28th July 2011, 08:33
  3. How to get the size of a QWidget in QTabWidget
    By xiangxw in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2011, 00:45
  4. Replies: 3
    Last Post: 4th September 2009, 12:49
  5. Replies: 2
    Last Post: 29th May 2007, 13:55

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.