Qt Designer - 如何让小部件跨越列?

发布于 2024-09-06 15:47:08 字数 302 浏览 2 评论 0原文

我创建了一个简单的表单。我在右下角添加了一个 PushButton,然后在其上方添加了一个 TabWidget。我突出显示了主窗口,并选择了网格布局。按钮被拉伸,因此我在其左侧添加了一个垫片。

现在,我的选项卡小部件仅占据最左边的列。我希望它也能跨越 Column1。我查看了每个选项并尝试在任何地方右键单击,但无法让设计师创建跨度。

为了确保我没有遗漏任何内容,我直接修改了 .ui 文件,将 colspan="2" 添加到选项卡小部件的标签中,使用设计器重新加载它,并且它显示完美。但是,我想尽可能地使用设计器。

有什么想法如何让它跨越?

I created a simple form. I added a PushButton in the bottom right, and then a TabWidget above that. I highlighted the main window, and chose Grid Layout. The PushButton was stretched, so I added a spacer to the left of it.

Now, my Tab Widget only occupies the left most column. I want it to span into Column1 as well. I looked through every option and tried right-clicking anywhere, and can not get the designer to create the span.

Just to make sure I wasn't missing anything, I modified the .ui file directly, added colspan="2" to the tag for the Tab Widget, reloaded it with designer, and it is displaying perfectly. However, I want to use the designer as much as possible.

Any ideas how to get this to span?

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

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

发布评论

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

评论(3

提笔落墨 2024-09-13 15:47:08

嗯……就是简单的“拖拽操作”。只需抓住最接近您想要跨度的列的 TabWidget 边缘即可。现在只需在空列上“拉伸”TabWidget...它现在应该在两列上“跨越”

Well... It's simple "drag operation". Just grab edge of your TabWidget closest to column you want span. And now just simply "stretch" TabWidget on empty column... It should now "span" on both columns

拥有 2024-09-13 15:47:08

如果拉伸 TabWidget 时遇到问题(至少 4.6.2-4.7.3 中存在错误),您可以右键单击它,将其转换为 QToolBox,拉伸它,再次右键单击它,然后将其转换回 QTabWidget。

我用一个空的 QTabWidget 尝试了这个,不知道如果您已经向其中添加了一些子窗口小部件会发生什么。

If you have problems stretching the TabWidget (there is a bug in at least 4.6.2-4.7.3) you can right click it, convert it to a QToolBox, stretch it, right click it again and convert it back to a QTabWidget.

I tried this with an empty QTabWidget and do not know what happens if you already added some child widgets to it.

栖竹 2024-09-13 15:47:08

我发现在某些情况下手动编辑 *.ui 文件很有用!根据此处提供的 XML 架构
http://harmattan-dev.nokia .com/docs/library/html/qt4/designer-ui-file-format.html
您可以通过编辑标签并添加“colspan”和“rowspan”属性来跨越多列,例如:

<项目行=“0”列=“0”colspan=“3”>
...
< /项目>

I find it useful to edit *.ui file by hand in some cases! according to XML Schema provided here
http://harmattan-dev.nokia.com/docs/library/html/qt4/designer-ui-file-format.html
you can span multiple columns by editing tag, and adding "colspan" and "rowspan" attributes, forexample:

< item row="0" column="0" colspan="3">
...
< /item>

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