Answer the question
In order to leave comments, you need to log in
Is it possible to override base class signals?
There is a class with a signal that provides an interface
class IA
{
signal: void sigA();
}
есть класс A реализация
class A
{
emit sigA();
}
IA* iterface = new A();
// тут подключаем сигнал
connect (interface, SIGNAL(sigA), this, SLOT(anySlot()));
Answer the question
In order to leave comments, you need to log in
Everything is quite simple (you can do the same with slots):
class IFoo
{
public:
virtual void signal1() = 0;
virtual void signal2() = 0;
}
class Bar : public QObject, public IFoo
{
// ...
signals:
void signal1();
void signal2();
}
If I understand you correctly:
You need to create a slot that will call the signal signA();
For example:
//Где то внутри какого-то класса
bublik slots:
void callSignA()
{ emit signA(); }
signal:
signA();
//Где-то в каком-то файле.cpp
QObject::connect(куПушБатон, SIGNAL(clicked), this, SLOT(signA()));
QObject::connect(this, SIGNAL(signA()), someWgt, SLOT(someSlot()));
General remark based on experience. On the plus side, the interface in the strict sense is rarely used; an abstract class is often needed.
To use signals in Qt, there is only one way described in the doc - to inherit from QObject
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question