Results 1 to 4 of 4

Thread: need help in QThread()

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default need help in QThread()

    hi friend,
    i request you one help ... i need some good example programs which uses QThread() ... small program is enough because i rode your threads about QThread and i am now practicing some codes in QThread but i am unable to learn completely within threadfortuneserver example ..
    please send me any program ... how signal slot is working between the process and another thread ... small program rather than network socket program like doing inside widgets ...
    please help me

  2. #2
    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: need help in QThread()

    Fortune server is a networking example. What about the actual threading examples, have you checked them? Did you search the forum for QThread?
    J-P Nurmi

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: need help in QThread()

    thanks for reply

    i need some code to work on the gui part ..
    ex:
    if the user clicks a button the text of the QLable should change its text which i should run that slot for changing text in another parallel thread so i am searching something which run timely changing the GUI appearance ...

    i searched for that in this forum but cant get any example like that ...because i am new to Qt field
    i went through fortuneserver but its not updates or repaints the widgets so only i ask for experts

    please help me .. just send me any suitable link

  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: need help in QThread()

    Quote Originally Posted by wagmare View Post
    i need some code to work on the gui part ..
    Ok, before we start. Do NOT touch GUI in a worker thread. From Qt docs: "Although QObject is reentrant, the GUI classes, notably QWidget and all its subclasses, are not reentrant. They can only be used from the main thread."

    You can do some expensive calculation in worker threads, but you must deliver the results to the GUI thread where you can change the GUI to reflect the results. You can use signals and slots or custom events to deliver calculated results to the main GUI thread. Or perhaps you could even use the higher level threading API of Qt Concurrent.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    wagmare (18th December 2008)

Similar Threads

  1. QThread and QTcpSocket
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2008, 13:06
  2. Spawn a QThread in another QThread
    By david.corinex in forum Qt Programming
    Replies: 2
    Last Post: 19th December 2007, 12:54
  3. Problem with QTcpSocket in QThread
    By Raistlin in forum Qt Programming
    Replies: 8
    Last Post: 6th October 2007, 12:23
  4. QThread exec proplem to stop...
    By patrik08 in forum Qt Programming
    Replies: 29
    Last Post: 21st May 2007, 07:51
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.