[Interest] Suppress titlebar of dock widget?

Matthew Woehlke mwoehlke.floss at gmail.com
Tue Sep 8 22:08:48 CEST 2020


On 08/09/2020 15.41, Sérgio Martins wrote:
> On 2020-09-08 19:46, Matthew Woehlke wrote:
>> I have a dock widget that cannot be moved, closed or floated
>> (essentially, I need something that takes up the dock corner
>> preferentially), but I want it to *not* have a titlebar. Is there a
>> way to accomplish this?
>>
>> Note: I am also implementing my own QStyle. My initial idea was to
>> tweak the QStyle to detect this widget and fiddle with the
>> size/metrics (I don't need exactly zero pixels; if I can make the
>> titlebar 1-2 pixels tall, that is good enough), but my attempt to make
>> the titlebar smaller/hidden that way is not working... However, I'm
>> not sure if I know what to change. So far I have fiddles with the
>> pixel metrics and subcontrol rects, but I don't see anything else I
>> can affect?
> 
> https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qdockwidget.cpp.html#537 
> 
> It's using the height of the font, so no matter what you do, you can't.

Ah, well, answers that question anyway.; thanks.

> QDockWidget::setTitleBarWidget() sounds good for you, as long as you 
> never float it, as that brings other problems.

Not a problem; this particular "dock" isn't floatable either. The only 
reason I'm even using QDockWidget, really, is because I want this:

   ┌──┬────────────────┐
   │  │                │
   │  │                │
   │  ├────────────────┤
   │  │                │
   └──┴────────────────┘

...and not this:

   ┌──┬────────────────┐
   │  │                │
   │  │                │
   ├──┴────────────────┤
   │                   │
   └───────────────────┘

...where the bottom panel is (also) a QDockWidget. (In that case, one 
that *can* be floated or closed.) In all other respects, though, I want 
the side panel to be a fixed UI element.

-- 
Matthew


More information about the Interest mailing list