c++ - QT slots and inheritance: why is my program trying to connect to the parent instead of the child class? -


in qt program, have qwidget class superclass of class declared so:

class renderer : public qglwidget {     q_object     .... }  class : public renderer { .... } 

now have slot class not present in renderer, when try run program, fails make connections class a:

object::connect: <sender name: 'push_button'> object::connect: <receiver name: 'a'> object::connect: no such slot renderer::loaddialog() in <file path> 

why trying connect renderer , not a? supposed have slot in renderer of same name?

thanks

edit:

here's declaration of slot in a:

public slots:     void loaddialog(); 

and connections, i'm relying on qt creator mostly, here's in ui_windows.h file:

qobject::connect(pushbutton, signal(clicked()), a, slot(loaddialog())); 

hope clears things bit :)

can show code connect signal , slot? maybe helpful see slot declaration in class a.

edit:

try add q_object macro in subclass a. thing slot not virtual (but according read shouldn't make difference).

these guesses, code posted looks ok me. don't have qt available on computer can't try out :(.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -