views:

145

answers:

2

acctualy i want when i click a pushbutton then it will connect to another window. But i am unable to declare my own slot in Ui_example.h file. so what i do?

A: 

You've got the order of things wrong. You should first connect the pushbutton signal to a slot on the other window. Then, when the click event is emitted by the pushbutton, it's sent to your slot. You're too late if you try to connect after the event.

MSalters
+1  A: 

To declare slots, you need to write its signature in the header file like this:

// ...
public slots:
    void slotName();
// ...

Then write the implementation in the source file:

// ...
void YourGUIClaass::slotName()
{
    // Here your code to execute when slot is called
}
// ...

This is explained in the QT docs : http://doc.trolltech.com/3.3/signalsandslots.html.

And please add information in your question if you want better help!

Patrice Bernassola