自定义 QDockWidget 显示 [英] Custom QDockWidget display

查看:56
本文介绍了自定义 QDockWidget 显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你将如何获得dockwidgets/centralwidget 的显示,其中Qt::BottomDockWidgetAreaQt::TopDockWidgetArea 中的dockwidget 不带Qt::LeftDockWidgetAreaQt::RighDockWidgetArea 空间?

How would you get a display of dockwidgets/centralwidget in which the dockwidget in the Qt::BottomDockWidgetArea or Qt::TopDockWidgetArea doesn't take Qt::LeftDockWidgetArea nor Qt::RighDockWidgetArea space?

这是实际显示,有 2 个停靠小部件和右上角的中央小部件:

This is the actual display, with 2 dockwidgets and the central widget at the top right:

这将是首选显示:

推荐答案

你可能应该使用 QMainWindow 的角落功能以获得您想要的行为.

you probably should use the QMainWindow's corner functionality to get the behavior you wanted.

这样的事情可能会起作用(无法测试它是否编译,抱歉):

Something like this may work (can't test whether its compiles, sorry):

mainWindow->setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
mainWindow->setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
mainWindow->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
mainWindow->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);

见:* QMainWindow::setCorner(...)

这篇关于自定义 QDockWidget 显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆