.ui 中的信号和槽连接

发布于 2024-07-11 03:23:43 字数 289 浏览 3 评论 0原文

我开始使用 Qt 4。然后我遇到了 Qt Designer 的问题。
信号/插槽编辑器中,我只能设置其中列出的连接,而不会列出所有插槽。

如果我尝试在 .ui 文件中手动添加它,连接将无法工作。
如果我将其添加到 ui_*.h 文件中,它可以正常工作,但是当我更改设计时,连接会被删除。

有人对我如何解决这个错误有什么好的建议吗? 或者以另一种方式询问:
如何让 Qt Designer 列出所有可用的插槽?

I have started to play a little with Qt 4. And then I have come across a problem with the Qt Designer.
In the Signal/Slots editor I can only setup the connections that are listed there, and not all the slots are listed.

If I try to add it manualy in the .ui file, the connection would not work.
If I add it in the ui_*.h file it works fine, but then the connection is deleted when I change the design.

Does anyone have any good tips to how I can get around this bug? Or to ask another way:
How can I make the Qt Designer list all the available slots?

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

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

发布评论

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

评论(2

小傻瓜 2024-07-18 03:23:43

默认情况下,并不显示所有信号/槽。 您可以尝试在尝试创建信号时出现的“配置连接”对话框的左下角选中“显示继承自...的信号和插槽”复选框。

除此之外,您可以按照 Marcin 所说的操作并使用 自动连接,或者在使用ui的对象的构造函数中手动编写连接语句。

By default not all signals/slots are shown. You could try checking the "show signals and slots inheritied from ...." checkbox in the lower left hand corder of the "Configure Connection" dialog that comes up when you try to create a signal.

Beyond that, you can either do what Marcin said and use auto-connections, or manually write connect statements in the constructor of the object that uses the ui.

傲世九天 2024-07-18 03:23:43

您可以尝试使用 uic 的 自动连接功能。

但是,您将无法看到所有可用的插槽,但如果您在设计器和代码中使用相同的名称 - 它们应该会自动连接。

You might try to use uic's autoconnecting feature.

However you won't be able to see all available slots but if you use the same name in both Designer and code - they should automatically be connected.

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