vishva
18th August 2006, 07:29
hai friends,
I am suffering the following problem in my application.
Code:
Header file:
class Sample: public QDialog
{
private slots:
void fun1();
void fun2();
};
cpp file:
Sample::Sample
{
connect(&object,SIGNAL(clicked()),this,SLOT(fun1()));
}
void Sample::fun1()
{
connect(&object,SIGNAL(clicked()),this,SLOT(fun2()));
}
void Sample::fun2()
{
//
// to run some instruction here
}
Ok, run this program,
First time,
Main widget( Clicked) -> fun1() -> clicked -> fun2() then return to main widget
Here ,its work fine.
Second time,
Main widget( Clicked) -> fun1() -> clicked -> fun2() then again call fun2() , then return to main widget
3rd time,
the function2 called 3 times.
Nth time ,
The function2 called n times.
i.e,
the last function ( fun2() ) called number of times automatically ( current + prev ).
Can you tell me ,what is the problem in nested signals and slots ?
I am suffering the following problem in my application.
Code:
Header file:
class Sample: public QDialog
{
private slots:
void fun1();
void fun2();
};
cpp file:
Sample::Sample
{
connect(&object,SIGNAL(clicked()),this,SLOT(fun1()));
}
void Sample::fun1()
{
connect(&object,SIGNAL(clicked()),this,SLOT(fun2()));
}
void Sample::fun2()
{
//
// to run some instruction here
}
Ok, run this program,
First time,
Main widget( Clicked) -> fun1() -> clicked -> fun2() then return to main widget
Here ,its work fine.
Second time,
Main widget( Clicked) -> fun1() -> clicked -> fun2() then again call fun2() , then return to main widget
3rd time,
the function2 called 3 times.
Nth time ,
The function2 called n times.
i.e,
the last function ( fun2() ) called number of times automatically ( current + prev ).
Can you tell me ,what is the problem in nested signals and slots ?