动态连接/断开信号和插槽 [英] Dynamic connecting/disconnecting signals and slots

查看:99
本文介绍了动态连接/断开信号和插槽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序有两个状态,由于某些原因它可以在两个状态之间切换.在这些状态下,程序需要接收不同的信号,这意味着它必须在运行期间连接和断开某些信号.

My program has two states and it can switch between them for some reasons. In these states the program needs to receive different signals, which means it has to connect and disconnect certain signals during the run.

这种方法有多糟糕?

推荐答案

这是一种很好的方法,我之前使用它时都没有出现问题.根据您的实际情况, QSignalMapper 可能是为您使用.

It's a fine approach, I've used it before without issues. Depending on what you're actually doing a QSignalMapper might be of use for you.

这篇关于动态连接/断开信号和插槽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆