如何更改 QMainWindow 分隔符的宽度而不影响 QDockWidget
我有一个 QDockWidget 已添加到 QMainWindow 中。我将 DocWidget 的 sizeHint 设置为 260px,它的大小正是我想要的,因为没有其他东西可以提供大小。
但是现在我想增加 DockWidget - QMainWindow 分隔符的宽度。我发现这样做的唯一方法是通过样式表:
http://doc.qt.nokia.com/4.7-snapshot/stylesheet-examples.html#customizing-qmainwindow
但是,当我这样做时,DockWidget 缩小到 < 100px 并变得无法使用。您不能强制 QDockWidget 达到特定大小及其继承 MainWindows 样式表。
我也无法获得 QMainWindow::separator 上的任何其他句柄。
I have a QDockWidget which has been added to a QMainWindow. I set the sizeHint of the DocWidget to be 260px and its the size that I want it to be because nothing else is offering up a size.
However now I want to increase the width of the DockWidget - QMainWindow separator. The only way I have found of doing this is via a StyleSheet:
http://doc.qt.nokia.com/4.7-snapshot/stylesheet-examples.html#customizing-qmainwindow
However when I do this the DockWidget shrinks to < 100px and becomes unusable. You cannot force the QDockWidget to a certain size and its inheriting the MainWindows stylesheet.
I also cannot get any other handle on the QMainWindow::separator.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对 QPushButtons 也有类似的问题,当使用样式表渲染时,它们已减小到最小可能的大小。
和他们一起,我通过将最小尺寸设置为需要的来解决了这个问题。也许同样的解决方案适合你......
I had similar problems with QPushButtons, when rendering with stylesheets they has decreased to minimum possible size.
With them i cured that trouble by setting minimum size to needed. Maybe same solution will work for you...
你可以使用这样的代码:
you can use such code: