PDA

View Full Version : creating treeWidgetItem using emitted signal from thread class



santosh.kumar
25th June 2007, 07:49
hi

i m facing some problem when i m emitting signal from thread and connect the slot from other class...this slot will add every time new treeWidgetItem....but when thread class emit the signal ,it is adding second time 2 same treewidgetItem in treeWidget, third time 3 same treeWidgetItem and so on...

some part of the code is...

thread class.....
emit createLog();
Gui class
connect(&thread,SIGNAL(createLog()),this,SLOT(CreateLogFile ()));
///definitoion
void class::CreateLogFile()
{
QTreeWidgetItem *pItem = NULL;
pItem = new QTreeWidgetItem(treeWidget);
pItem->setText(0,"text");

///close

If anybody know this ...help me...

guilugi
25th June 2007, 08:37
I think you have this behaviour because your 'connect' line is not in the constructor, or any other function that is called at initialization only !

Check you don't have this connect in a method that is being called several times...