使多个QGroupbox内的QFormLayouts具有相同的列宽

发布于 2024-09-28 17:33:45 字数 221 浏览 1 评论 0原文

我在 qt 中有一个对话框,它有多个组框,每个组框都使用表单布局。像这样的东西: https://dl.dropbox.com/u/4494367/Groupbox_Layouts.png

有没有办法让表单布局链接起来,以便它们具有相同的列宽?

I have a dialog in qt that has multiple groupboxes, each using a form layout. Something like this: https://dl.dropbox.com/u/4494367/Groupbox_Layouts.png

Is there a way to get the form layouts to link, so that the have the same column widths?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云仙小弟 2024-10-05 17:33:45

没有内置的方法可以做到这一点,但我想到了三种可能性:

  • 手动将所有标签上的最小宽度设置为可容纳所有标签中最长标签的值(不灵活)。建议此处类似的问题。
  • 上述方法的一种变体是尝试查询尺寸提示以找到最大的标签,然后据此设置所有标签的最小宽度。此建议来自另一个类似问题的答案此处< /a>.
  • 编写一个可能执行与上面类似的操作的自定义布局。

您可能想浏览链接的问题以获取其他信息,但我认为人们普遍认为这个目标可能并不完全值得付出努力:)

There is no built in way to do this but three possibilities come to mind:

  • Manually set the minimum width on all your labels to a value that will accommodate the longest of all of your labels (not flexible). Suggested here in a similar question.
  • A variation of the above would be to try to query the size hints to find the largest label and then set the minimum widths on all your labels based on that. This suggestion comes from an answer to another similar question here.
  • Write a custom layout that might do something similar to the above.

You may want to browse the linked questions for other info but I think it is generally agreed that this objective may not be entirely worth the effort :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文