Results 1 to 3 of 3

Thread: calling Gui treeWidget in Thread class

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

    Default calling Gui treeWidget in Thread class

    hi
    i m not getting correct solution.
    I m writing coding like this....

    Qt Code:
    1. ////first class
    2. void DirThread::run()
    3. {
    4. if(!bAbort)
    5. {
    6. showDir();
    7. }
    8. }
    9. void DirThread ::showDir()
    10. {
    11. QTreeWidgetItem *pItem = NULL;
    12. pItem = new QTreeWidgetItem(///treeWidget from Gui class);
    13.  
    14. showDirView(pItem, strPath);
    15. }
    16. void DirThread ::showDirView(QTreeWidgetItem *pItem,QString strPath)
    17. {
    18. //loop up to size of dir
    19. //Recursivly showing dir
    20. for(///loop)
    21. {
    22. if(//dir)
    23. {
    24. showDirView(//treeItem,//path)
    25. }
    26. else
    27. {
    28. //file show
    29. }
    30. }
    31. }
    32.  
    33.  
    34. /////Gui class
    35. GuiClass::GuiClass(QWidget *parent):QDialog(parent)
    36. {
    37. setupUi(this);
    38. treeWidget->setColumnCount(1);
    39. }
    To copy to clipboard, switch view to plain text mode 


    ///I m using this treeWidget Dialog to show recursivly showing dir view
    using thread,,,how i call use treeWidget in Thread Method...
    please correct this one...
    Last edited by wysota; 16th May 2007 at 09:13.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: calling Gui treeWidget in Thread class

    The answer is that you don't.
    This is like the 10th thread on this issue.

    In the worker thread use only QFile, QDir, QFileInfo, etc, and build the directory structure ( you have many choices ). Pass then to the GUI thread the dir structure to the GUI thread and let it update the model.

    Or use a QDirModel.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: calling Gui treeWidget in Thread class

    Please start no more threads on the same subject.

Similar Threads

  1. How i will use treeWidget of GUI class in thread class
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2007, 15:31
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

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
  •  
Qt is a trademark of The Qt Company.