Results 1 to 6 of 6

Thread: how to hide the title bar when a QDockWidget is docked?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Posts
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: how to hide the title bar when a QDockWidget is docked?

    I'm using Qt v4.3.2, and had the same problem and discovered that calling setTitleBarWidget(0) is NOT sufficient to remove the title bar and free up the client window space when the widget is DOCKED. This is because the class reverts to the internal default layout of reserving space for a title bar when the member is NULL(0).

    However, the following simple trick will work:

    // to hide the title bar completely must replace the default widget with a generic one
    QWidget* titleWidget = new QWidget(this); /* where this a QMainWindow object */
    dock->setTitleBarWidget( titleWidget );


    My situation is simple thought since I never need to worry about undocking or moving the DocWidget during run-time; it is controlled by global app settings at startup and only needs to hold a static bitmap image for product branding.

    I thought I should answer this thread question for completeness; since I was struggling with the same problem since i'm learning Qt and had to figure this one out on my own.

  2. The following 2 users say thank you to hholtmann for this useful post:

    Kryzon (30th December 2014), mclark (8th April 2010)

  3. #2
    Join Date
    Nov 2010
    Posts
    9
    Thanks
    1

    Default Re: how to hide the title bar when a QDockWidget is docked?

    Hi,

    I tried your trick with QtJambi but get the following warning all the time:

    Qt Code:
    1. QWidget::setMinimumSize: (dockNavigate/QDockWidget) Negative sizes (0,-1) are not possible
    To copy to clipboard, switch view to plain text mode 

    whereby dockNavigate is one of my fields.

    setting the size manually does not seem to help.

    Any ideas on this?

  4. #3
    Join Date
    Jan 2014
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to hide the title bar when a QDockWidget is docked?

    Hi,
    The warning QWidget::setMinimumSize: (dockNavigate/QDockWidget) Negative sizes (0,-1) are not possible occur because some Widgets are extending over the boundaries of the QDockWidget.
    I had the same warning, and all I did for clearing It was editing the frame with Design, making the QDockWidget large enough to cover all objects included.

Similar Threads

  1. Replies: 10
    Last Post: 20th April 2015, 22:24
  2. contextmenu in QDockWidget title
    By klipko in forum Newbie
    Replies: 4
    Last Post: 7th March 2008, 22:32
  3. No restore button in QDockWidget title bar
    By trskel in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2007, 09:59

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
  •  
Qt is a trademark of The Qt Company.