Results 1 to 5 of 5

Thread: QThread?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question QThread?

    Hi All,

    I m using QT 4.2.2 on my Intel Mac.

    I have some code in which I make making a tree of Dir and file.
    I select a Path and then add the Item in tree Structure in QTreeWidget as I have File under dir and the Tree Structure is as file and dir stored on my Hard Disk.


    Now If there are Lots of File and Dir then the Application is taking a lot of time to add them and Its Looking like the Application is get hanged for a time Period.

    Now I want to this thing by Using thread and I donot know how to use the Thread?

    If any one Knows then plz Help.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QThread?

    Now I want to this thing by Using thread and I donot know how to use the Thread?
    You will have to start by reading the docs.
    Then if you have specific questions, feel free to ask.

    But I am not sure a thread is a good solution to your problem.
    If the only thing you want to acheave is to have the GUI responsive while waiting for some operation to finish, you can just show a progress bar.
    This way the user will konw that the application has not hang up, and he will know in which state of progrees the operation is.
    A thread makes sense only when you want to allow the user to do something else while this operation is taking place.

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: QThread?

    Quote Originally Posted by high_flyer View Post
    You will have to start by reading the docs.
    Where will I get the document Related to that.
    I want simple Examples of Qt of Threads to start with if U know Where I can get then then plz help me Out.

    Thanks.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QThread?

    Quote Originally Posted by vishal.chauhan View Post
    Where will I get the document Related to that.
    I want simple Examples of Qt of Threads to start with if U know Where I can get then then plz help me Out.
    J-P Nurmi

  5. #5
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QThread?

    Quote Originally Posted by vishal.chauhan View Post
    I have some code in which I make making a tree of Dir and file.
    I select a Path and then add the Item in tree Structure in QTreeWidget as I have File under dir and the Tree Structure is as file and dir stored on my Hard Disk.

    Now If there are Lots of File and Dir then the Application is taking a lot of time to add them and Its Looking like the Application is get hanged for a time Period.
    I think you got a design problem here. Or at least room for huge improvements... Convinience views such as QTreeView and QListView are not suited for display of many items (when many gets to many...) especially when :
    1. the item are added one by one
    2. the view is visible while adding items
    The best way here would probably be to fill a model with proper data and then display it in a view. Bonus hint : QDirModel should do very well as far as you're concerned...
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. QThread: Destroyed while thread is still running
    By Shuchi Agrawal in forum Newbie
    Replies: 8
    Last Post: 3rd April 2007, 06:27
  2. QGraphicsScene and QThread
    By tts80 in forum Qt Programming
    Replies: 5
    Last Post: 10th January 2007, 09:32
  3. QThread call-once semantics?
    By brcain in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2006, 21:25
  4. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19
  5. Is it possible to create a QThread without inheriting ?
    By probine in forum Qt Programming
    Replies: 6
    Last Post: 23rd March 2006, 22:51

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.