[Interest] Suppress titlebar of dock widget?

Sérgio Martins sergio.martins at kdab.com
Tue Sep 8 21:41:25 CEST 2020


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?

Hi Matthew,


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.

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




Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts


More information about the Interest mailing list