Results 1 to 6 of 6

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    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)

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.