我应该使用哪些 Qt4 小部件以及如何近似功能区风格的界面?

发布于 2024-10-02 05:56:44 字数 388 浏览 2 评论 0原文

我正在尝试使用 Qt Designer 为我的应用程序创建一个界面。我希望它在顶部有一组选项卡式、功能区样式的控件,以及一个带有停靠窗口的 MDI 样式区域,我计划根据当前选择的功能区选项卡来显示和隐藏这些窗口。我刚刚开始使用 Qt Designer 以及 Qt4 本身,所以我不太确定如何设置窗口,我应该使用哪些小部件和布局等。

很明显,顶部应该有一个 QTabWidget,但是我不确定底部。我应该使用 QFrame 吗? QMdiArea?码头小部件?我可以使用什么布局来确保选项卡小部件具有固定的高度,始终占据窗口的整个宽度,并且底部区域随着窗口大小的调整而缩放?

我在手册中读到,拆分器布局允许手动调整它们包含的小部件的大小,但是将它们放入拆分器后,我无法拖动小部件的框大小。因此我无法设置功能区下方的区域。有人帮忙吗?

I am trying to create an interface for my application using Qt Designer. I want it to have a tabbed, ribbon-style set of controls at the top, and a MDI-style area with docked windows which I plan to show and hide depending on which tab of the ribbon is currently selected. I am just beginning with Qt Designer as well as Qt4 itself for that matter so I'm not quite sure how to setup the window, which widgets and layouts should I use etc.

It's quite obvious there should be a QTabWidget at the top, but I'm not sure about the bottom. Should I use a QFrame? A QMdiArea? A dock widget? What layouts can I use to make sure the tab widget has a fixed height, occupies the whole width of the window at all times and the bottom area scales as the window is resized?

I've read in the manual that splitter layouts allow for manual adjustment of the size of the widgets they contain, but I can't drag the box size of a widget after I place them inside a splitter. Thus I'm unable to setup the area below the ribbon. Anyone, help?

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

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

发布评论

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

评论(2

灰色世界里的红玫瑰 2024-10-09 05:56:44

您应该查看 QMainWindow 并检查它可以为您提供的多个实用程序(工具栏、状态栏、DockWidgets、CentralWidget 等)。

我理解你的情况的方式是,你将始终使 MDI 区域可见,并且选项卡栏仅用于更改dockWidgets。我就是这样做的。

mainWindow 的centralWidget 将是一个带有 QVBoxLayout 的 QWidget,其中包含 <首先是一个 href="http://doc.qt.nokia.com/4.6/qtabbar.html#details" rel="nofollow">QTabBar 小部件(向上),下面是一个 QMdiArea。应自动处理尺寸。

这将允许用户(或您)将小部件停靠在主窗口中央小部件的左侧、底部、顶部或右侧区域。将指针保留在dockWidgets 上,以便能够随意移动和显示/隐藏它们。

希望这有帮助。

You should look into the QMainWindow and check the multiple utilities it can provide you (Toolbar, StatusBar, DockWidgets, CentralWidget, etc...).

The way I understood your case is that you will always have the MDI Area visible, and that the tab bar will only be used to change the dockWidgets. Here's how I would do it.

The centralWidget of the mainWindow would be a QWidget with a QVBoxLayout containing a QTabBar widget first (up) and a QMdiArea under it. The sizes should be handled automatically.

This will allow the user (or you) to dock widgets on the left, bottom, top or right areas of the mainWindow's central widget. Keep pointers to the dockWidgets to be able to move and show/hide them at will.

Hope this helps.

如果没有你 2024-10-09 05:56:44

VTK Designer 基于 Qt 构建,具有功能区式界面。您可以查看源代码以供参考。

VTK Designer, which is built on Qt, has a Ribbon-ish interface. You might take a look at the source code for reference.

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