当我想使用私有(private)对象的信号来产生其父对象的信号时,我会执行以下操作:
1. I create a signal and a slot (named, let's say, ParentSignal, ParentSlot)
2. connect(private_objcet, SIGNAL(someSignal()), this, SLOT(ParentSlot()));
3. and define parent slot like this:
void ParentSlot() { emit ParentSignal(); }
有没有办法直接完成这个过程,即没有ParentSlot?
最佳答案
QObject::connect(private_object, SIGNAL(someSignal()), this, SIGNAL(ParentSignal()));
关于Qt 信号槽交互。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3131527/