PDA

View Full Version : Custom Widget Connections



pseudonym67
18th June 2007, 13:08
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.

wysota
18th June 2007, 14:30
Did you declare that slot in the class header?

high_flyer
18th June 2007, 14:35
Do you still get the error if you use:


QObject::connect( kSquareButtonTest, SIGNAL( clicked() ), this, SLOT( kSquareButtonTest_clicked() ) );

?

pseudonym67
18th June 2007, 17:53
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