In a Qt program, I have a QWidget
class that is the superclass of another class declared so:
class Renderer : public QGLWidget
{
Q_OBJECT
....
}
class A : public Renderer
{ .... }
Now I have a slot for class A that is not present in Renderer
, but when I try to run the program, it fails to make connections to class A:
Object::connect: <sender name: 'push_button'>
Object::connect: <receiver name: 'A'>
Object::connect: No such slot Renderer::loadDialog() in <file path>
Why is it trying to connect to Renderer and not A? Am I supposed to have a slot in Renderer of the same name?
Thanks
edit:
here's the declaration of the slot in A:
public slots:
void loadDialog();
and as for the connections, I'm relying on Qt Creator mostly, but here's what was in the ui_windows.h file:
QObject::connect(pushButton, SIGNAL(clicked()), A, SLOT(loadDialog()));
Hope that clears things up a bit :)
Can you show the code where you connect the signal and slot? Maybe it would also be helpful to see the slot declaration in class A.
EDIT:
Try to add Q_OBJECT macro in subclass A. Another thing could be that the slot is not virtual (but according to what I read that shouldn't make a difference).
These are just guesses, the code you posted looks ok for me. I don't have Qt available on that computer so I can't try it out :(.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With