Results 1 to 3 of 3

Thread: shrink QDockWidget

  1. #1
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Smile shrink QDockWidget

    Hey,

    when i want to shrink a widget i usualy call resize(0,0), which works on normal widgets, but not for QDockWidget (floating or not).
    Specifically, i have two QDockWidgets that are automatically docked onto the mainwindow:

    Qt Code:
    1. addDockWidget(Qt::TopDockWidgetArea, a);
    2. splitDockWidget(a, b, Qt::Horizontal);
    To copy to clipboard, switch view to plain text mode 

    Both of them can and will expand to any given size, but both also have a minimum size.
    I'd now like to shrink QDockWidget a to occupy as little space as possible, thus allowing b to grow.

    Calling

    Qt Code:
    1. a->show();
    2. a->resize(0,0);
    To copy to clipboard, switch view to plain text mode 

    before or after the docking doesnt work.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: shrink QDockWidget

    Try resizing the QDockWidget content widget.
    Qt Code:
    1. dw->widget()->resize(0, 0);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2012
    Posts
    244
    Thanks
    27
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: shrink QDockWidget

    tried it, wont work either.

Similar Threads

  1. Widget auto shrink
    By been_1990 in forum Qt Programming
    Replies: 9
    Last Post: 24th January 2013, 01:43
  2. How to shrink a dialog
    By lotek in forum Newbie
    Replies: 3
    Last Post: 11th June 2011, 09:49
  3. Shrink Text
    By lamp in forum Qt Programming
    Replies: 5
    Last Post: 30th November 2010, 06:30
  4. QListWidget shrink to fit size of items
    By woodtluk in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2010, 21:42
  5. Shrink QMainWindow to Minimum Size
    By kloffy in forum Qt Programming
    Replies: 4
    Last Post: 17th February 2008, 17:54

Tags for this Thread

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.