[Qt-interest] customised signals and slots in qt
Nikos Chantziaras
realnc at arcor.de
Fri Jul 8 02:52:22 CEST 2011
On 07/07/2011 04:22 PM, Sahana Bhaskar wrote:
> Hi all,
>
> I am trying to implement a customized signal and slot functionality. I
> have 2 classes say A and B. Now on some event (say when a certain method
> is called) I want object of A to send signals to object of B and other
> objects of A itself. I want to know the steps. My IDE is visual studio.
> Also B is derived from QFileDialog. So in essence I have to send a
> signal from object of class A to another class B(a filedialog object).
>
> I have done these things so far
>
> 1) In the header of A(a.h) I have declared the signals as
>
> Class A : public QObject, public<someotherclass>
>
> {
>
> Q_OBJECT
>
> ...
>
> Signal:
>
> *Void signal1( ); *
>
> }
The above should be:
signals:
void signal1();
> 2) written a connect statement in A.c as:
>
> Connect(object_a, SIGNAL( signal1()),object_b, SLOT(slot1()));
That should be:
connect(object_a, SIGNAL(signal1()), object_b, SLOT(slot1()));
> Void funct()
>
> {
>
> *Emit signal1(); *
>
> }
void funct()
{
emit signal1();
}
More information about the Qt-interest-old
mailing list