You define a SLOT 'enable' in your main window. But you try to connect this slot as if you did it in your pushbutton. Nope, pushbutton has no slot 'enable'. :-)
You define a SLOT 'enable' in your main window. But you try to connect this slot as if you did it in your pushbutton. Nope, pushbutton has no slot 'enable'. :-)
nthung (28th October 2011)
Ask yourself, "Which object contains the slot enable()?" It is this object you should be using in your connect() call.
nthung (28th October 2011)
Thanks for answers.
I understand the problem when it raises error. and I don't know how to fix it
But now, I want to know how do I add new slots to pushbutton.
Could you fix it for me
thanks
Added after 1 54 minutes:
it means that I can't add new Slot to pushbutton and the other widget, can be it?
Thanks
Last edited by nthung; 28th October 2011 at 04:31.
To add new slots to a QPushButton you must derive your own class from QPushButton. The new slot is available to all instances of that derived class. You have not done that for QPushButton, but you have added a slot to the base QMainWindow in exactly the same way.
The slot you have created in your MainWindow class manipulates a particular push button when called... the problem is that your connect() call does not connect to the MainWindow instance that contains the slot.
nthung (28th October 2011)
Bookmarks