PDA

View Full Version : problem with connecting signals with slots"



impeteperry
27th September 2007, 05:49
I've been programming with signals and slots for several years with no problems, but now!!
I am trying to put togather a standered user interface for several of my programs.
I want to use both pushbuttons and the function keys
See attachement (i hope it is there );

connect( Pb1, SIGNAL( clicked() ), this, SLOT( slotPb1() ) );
connect( Pb2, SIGNAL( clicked() ), this, SLOT( slotPb2() ) );
connect( Pb3, SIGNAL( clicked() ), this, SLOT( slotPb3() ) ); and i have

public slots:
void slotPb1();
void slotPb2();
void slotPb3();
in the headerfile.The program compiles without a wimper, but when I run it I get the "image" ok, but no signal slot connection
pete@myComputer:~/Desktop/straight/baseform/test$ ./test
Object::connect: No such slot QWidget::slotPb1()
Object::connect: No such slot QWidget::slotPb2()
Object::connect: No such slot QWidget::slotPb3() the "keyPressEvent" won't even compile of course. I have compared it with a similar program that runs fine and can't find any descrepcies. I am at a total loss.

any help would be most appreciated.
thanks

mchara
27th September 2007, 06:40
Hi, Have you inserted Q_OBJECT macro in your classes declarations?
Classes have to be derrived from QObject and have this macro defined to be able to work on signals/slots.

impeteperry
27th September 2007, 16:44
Thanks
I feel very stupid