tags:

views:

43

answers:

1

Hi,

I want to execute the slot of different class. When i execute this code its compiling without any error but not getting Output

pendrive1::pendrive1()
{
    UI_CDBurn Obj; 
connect( Obj.penDrive, SIGNAL(clicked()),&Obj , SLOT(caller()));
}

Here my slot is not working. Slot in UI_CDBurn is public. But when i called with a button in pendrive1 class its working fine

UI_CDBurn *Obj=new UI_CDBurn; 
connect( ui.pushButton, SIGNAL(clicked()),Obj , SLOT( caller())); // Working File
+1  A: 

First, What is pendrive? It must be a pointer to a QObject derived class with a signal named clicked.

I guess you have declared the clicked signal in the [pendrive] class but is the signal emitted? When the user click you need to emit the clicked signal with the following instruction:

emit clicked();

You can find how to use custom signals and slots here: http://doc.trolltech.com/4.5/signalsandslots.html.

Patrice Bernassola
Clicked() slot is of Obj class