QT 隐藏qdockwidget标题栏 偏方 的确没有正确的方法,不过这个非常凑效

 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 p_w_picpath 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.