带插槽的 QT 界面

发布于 2024-09-25 12:09:07 字数 313 浏览 2 评论 0原文

我按照本教程制作了界面和插件: http://doc.trolltech.com/4.6/plugins-howto.html 一切正常。

但知道我想将信号连接到插件的插槽。

尝试这样做时出现错误,该接口缺少 Q_OBJECT 宏。当我添加它时,我收到一个错误,现在接口和插件实现了它。 当我从插件中删除它时,插件就损坏了。

所以我的问题是,是否可以声明一个带有插槽的 qt 接口,所有继承该接口的类都实现它?

I made an interface and plugins by following this tutorial:
http://doc.trolltech.com/4.6/plugins-howto.html
and everything is working fine.

But know I would like to connect a Signal to a slot of the plugins.

Trying to do that I get an error, that the interface i lacking the Q_OBJECT Macro. When I Add it I get an error that now the Interface and the Plugin implement it.
When I remove it from the Plugin, the plugin is broken.

So my question is, is it possible to declare a qt interface with a slot all classes inheritating the interface implement it?

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

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

发布评论

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

评论(1

尸血腥色 2024-10-02 12:09:07

不,你的插件不能从你的插件接口和其他类或 QObject 本身继承 QObject。

No, your plugin cannot inherit QObject both from your plugin interface and from some other class or QObject itself.

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