Custom Widget Connections
Hi I'm currently working on book about programming kde
http://www.beginning-kdevelop-programming.co.uk/
if you want a look
I'm currently working custom widgets using a square button example and I'm having a problem understanding the connection logic.
Everything is fine and I add the custom widget to the environment and then add it to a form but when it comes to the connection if I put
connect( kSquareButtonTest, SIGNAL( clicked() ), this, SLOT( kSquareButtonTest_clicked() ) );
in the implementation class constructor the compiler complains that there's no matching function for the connect call. Yet if I add the signal/slot through the designer it writes
connect( kSquareButtonTest, SIGNAL( clicked() ), this, SLOT( kSquareButtonTest_clicked() ) );
in the widgetbase class and everything works fine. I suspect there's a bit of plumbing going on that I've missed and was wondering if someone could explain it to me.
Re: Custom Widget Connections
Did you declare that slot in the class header?
Re: Custom Widget Connections
Do you still get the error if you use:
Code:
QObject::connect( kSquareButtonTest,
SIGNAL( clicked
() ),
this,
SLOT( kSquareButtonTest_clicked
() ) );
?
Re: Custom Widget Connections
My bad
I hadn't included the header file for the custom widget in the implementation file so when the compiler was complaining about the connect function it sent me off in the wrong direction because it didn't tell me that the kSquareButtonTest object wasn't defined properly