Add button to QDockWidget's title bar QT

130 views Asked by At

I would like to add a button to QDockWidget's title bar. I know there is a setTitleBarWidget() function but with it I need to rewrite all the style for the title bar. The default style (like "Dock 2" in the picture), with close button, colors, etc, suit me very well. How can I add a button without overriding the default QDockWidget's title bar style ?

QDockWidget's title bar

self.dockWidgetWord.setTitleBarWidget(widgetContainer)

style = ? # is the something I can put here ?
self.dockWidgetWord.setStyle(style)

I also tried to create a widget as child of the one returned by titleBarWidget() but it does not work either.

0

There are 0 answers