Results 1 to 7 of 7

Thread: How to set proportion between dockwidget and central widget

  1. #1
    Join Date
    Feb 2009
    Posts
    38
    Thanks
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to set proportion between dockwidget and central widget

    Hi, i have encountered a problem that :
    i have set a treeWidget as central widget in a mainwindow, i use dockwidget as a display widget, and when i first start the application, the centralWidget is too large while the dockwidget is too small, but what i need is to make centralWidget size up less space, and more space for the dockWidget.
    Wish everyone's reply for this problem soon. very grateful for your help.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set proportion between dockwidget and central widget

    Did you try changing / setting size policy for dock widget / central widget ?

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

    christina123y (9th April 2009)

  4. #3
    Join Date
    Feb 2009
    Posts
    38
    Thanks
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set proportion between dockwidget and central widget

    Quote Originally Posted by aamer4yu View Post
    Did you try changing / setting size policy for dock widget / central widget ?
    yes ,i have tried. but it still didn't work, anyother solution? wish your reply again!

  5. #4
    Join Date
    Feb 2009
    Posts
    38
    Thanks
    29
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set proportion between dockwidget and central widget

    Quote Originally Posted by aamer4yu View Post
    Did you try changing / setting size policy for dock widget / central widget ?
    yes ,i have tried. but it still didn't work, anyother solution? wish your reply again!

  6. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to set proportion between dockwidget and central widget

    did you create mainwindow in Qt Designer?
    if yes, then you can add "Horizontal Spacer" to dockwidget.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #6
    Join Date
    Jul 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set proportion between dockwidget and central widget

    I have the same problem, and anywhere find solution. Some experiments i and have:
    We need class inherit QDockWidget.
    In constructor that class (or create time) use setMinimumSize(), setMinimumHeight() or setMinimumWidth() with required dockWidget size.
    Reimplement resizeEvent() and in that metod use again setMinimumSize() with zero or other value. First time apllication have appropriate size and proportion and next we might arbitraly resize widget.

  8. #7
    Join Date
    Jun 2008
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set proportion between dockwidget and central widget

    no size policies, max, minsizes should be set on the qdockwidget itself
    you must use setWidget(w) on dockwidget
    set your min sizes/max sizes on w not on dockwidget

    (qdockwidget just takes your w and puts in its layout)

Similar Threads

  1. sliding dock widget
    By manishkyl in forum Qt Programming
    Replies: 0
    Last Post: 28th July 2008, 14:04
  2. How to put a DockWidget or Widget over others??
    By dungsivn in forum Qt Programming
    Replies: 6
    Last Post: 25th October 2007, 06:12
  3. QDockWidgets without central widget
    By JoeMerchant in forum Qt Programming
    Replies: 17
    Last Post: 8th August 2007, 14:52

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.