Results 1 to 2 of 2

Thread: creating treeWidgetItem using emitted signal from thread class

  1. #1
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default creating treeWidgetItem using emitted signal from thread class

    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(Crea teLogFile()));
    ///definitoion
    void class::CreateLogFile()
    {
    QTreeWidgetItem *pItem = NULL;
    pItem = new QTreeWidgetItem(treeWidget);
    pItem->setText(0,"text");

    ///close

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

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: creating treeWidgetItem using emitted signal from thread class

    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...

Similar Threads

  1. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  2. Replies: 10
    Last Post: 20th March 2007, 22:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.