QDockWidget - window with no borders when floating

怎甘沉沦 提交于 2019-12-04 16:29:17

This is the expected behavior. See QDockWidget::setTitleBarWidget docs:

If a title bar widget is set, QDockWidget will not use native window decorations when it is floated.

The purpose of this behavior is to allow implementing fully customized title bar for dock widget.

A workaround is to connect to QDockWidget::topLevelChanged signal that is emitted when the widget becomes floating or docked, and set title bar widget to 0 as long as it's floating to restore default behavior.

Note that previous title bar widget is not deleted when default one is set, so you should either delete previously used QWidget or save a pointer to it and use it the next time.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!