Results 1 to 4 of 4

Thread: initial size of docked window

  1. #1
    Join Date
    Mar 2010
    Posts
    107
    Thanks
    22
    Qt products
    Qt4
    Platforms
    Windows

    Default initial size of docked window

    Hi

    Can anyone please tell me how to set the initial size of a docked widget?

    TIA

    Graham

  2. #2
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: initial size of docked window

    As far as I know, you can't set an initial size, since the size of a docked widget is dependent on its contents. So, what you can do instead is to override the virtual sizeHint() function of any children widget. That's what I personally do and what allows me to 'control' the initial size of a docked widget.

  3. #3
    Join Date
    Mar 2010
    Posts
    107
    Thanks
    22
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: initial size of docked window

    Hi thanks for the reply
    I am using QDesigner and have docked widget with QListWidget child and have set up the list items in designer.
    When I run the application the docked widget is very narrow - it is not setting its size according to the contents.
    If I hand code the same scenario the docked widget has the required size i.e. it is resized to the largest list item
    Any idea why this would be the case?

  4. #4
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: initial size of docked window

    I imagine that it must have something to do with when exactly Qt determines the size of your docked widget. In the former case, it clearly determines the size before any item is added to the list, while in the latter case it does it after the items have been added. Interesting... and I am not sure how you could address that issue. (I am relatively new to Qt, sorry.)

Similar Threads

  1. initial size of widgets in a QSplitter
    By momesana in forum Newbie
    Replies: 3
    Last Post: 12th July 2012, 15:41
  2. Replies: 2
    Last Post: 16th April 2010, 23:55
  3. Adjust the initial size of a QTextEdit in a layout
    By hecinho in forum Qt Programming
    Replies: 0
    Last Post: 26th November 2009, 15:58
  4. Docked main window
    By ahmed963 in forum Qt Programming
    Replies: 2
    Last Post: 1st August 2008, 21:45
  5. How to set initial QDockWidget's size?
    By rajesh in forum Qt Programming
    Replies: 4
    Last Post: 16th November 2006, 15:49

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.