Qt - 新的小部件显示不明显?

发布于 2024-10-03 04:35:59 字数 167 浏览 3 评论 0原文

我来自 Android 开发,他们从当前活动中打开新“活动”的方法似乎合乎逻辑,并且有记录。 Qt 没有。

假设我有确切的“QTabsExample”,并且其中一个选项卡中有一个按钮。单击按钮时,我想删除所有选项卡并打开不同的视图......比方说图像视图。为什么似乎没有一个例子可以说明这一点?请帮忙!

I'm coming from Android development, and their approach to opening a new "activity" from a current one seems logical, and documented. Qt's does not.

Let's say I have the exact "QTabsExample", and inside one of these tabs is a button. On button click, I want to get rid of all the tabs and open a different view...let's say an image view. Why does there not seem to be one example out there for this? Please help!

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

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

发布评论

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

评论(2

余生一个溪 2024-10-10 04:35:59

我相信在这种情况下您会想要使用 QStackedWidgetQStackedWidget 管理许多相同大小的“屏幕”,您可以在这些“屏幕”之间进行切换,每个屏幕都有自己的一组显示小部件和按钮。这是一个 S60 示例,希望它适用于您的情况,但您应该能够找到有关使用 QStackedWidget 的更多信息。

I believe you would want to use a QStackedWidget in this case. A QStackedWidget manages a number of same sized "screens" that you can switch between, each having its own set of display widgets and buttons. Here is an S60 example, hopefully it will apply to your situation but you should be able to find more info on using QStackedWidgets.

她比我温柔 2024-10-10 04:35:59

如果您想删除小部件的容器,更好的解决方案是向窗口发送信号,然后窗口将交换主容器,否则如果您尝试从子操作中删除/删除父对象,事情会变得很糟糕方法。

If you want to remove the container of the widget a better solution is to send a signal to the window and the window will then swap the main containers, otherwise things can get nasty if you try to delete / remove the parent object from the child action method.

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