Results 1 to 20 of 22

Thread: thread problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: thread problem

    for some reason

    Qt Code:
    1. connect(&m_timer, SIGNAL(timeout()), SLOT(updateEvents()));
    To copy to clipboard, switch view to plain text mode 

    isnt getting connected..

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: thread problem

    I've updated code and also tested it. a slot is called normal.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. The following user says thank you to spirit for this useful post:

    talk2amulya (18th February 2009)

  4. #3
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: thread problem

    yeh, i made those changes too but still updateEvents() is only getting called once, until whole of the processing is done..so no help from this either..thanks though, spirit...

  5. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: thread problem

    actually there is only one function call(which makes further calls) that is doing all the heavy processing..and that function call is in main()..perhaps the control isnt going back to the other objects or timers cuz of it..could that be true? just cuz one particular function has to execute, the control will go nowhere else?

  6. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: thread problem

    yes this is possible. so, try to call processEvents in that "havy" function.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #6
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: thread problem

    Hi,

    Calling "processEvents" is not a good idea. I think if you call it many times it ignore some of them.

    Have you ported your heavy computation inside the thread? You will not need to call "processEvents" then. You emit SIGNALs and let the main thread do its work.
    Òscar Llarch i Galán

  8. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: thread problem

    maybe this can help you Keeping the GUI Responsive
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  9. #8
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: thread problem

    that is EXACTLY what i did sm days back..and the icon animates cuz of it as desired..although intermittently ..but i had to place like 30 calls to processEvents() here and there inside it..and if i want it to be done smoothly i might need more..so thats why i was wondering there should be a better way to do it in QT..so i went with using timers and on timeout, calling processEvents(), but evidently it also has no effect..which i find really surprising...anyone has anymore info about processEvents()??or smth else that could resolve this issue?

  10. #9
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: thread problem

    i have already read that link..and i have tried sm of the ways that fits my needs..but none of them worked..

  11. #10
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: thread problem

    hi oscar,

    the heavy processing code contains some GUI calls, so i cant put that in another thread.. even if it was to be done..it'd be a lot of work..i m looking for a solution that bypasses me having to change anything in the way the things are done currently

Similar Threads

  1. thread - right approach?
    By heinz32 in forum Qt Programming
    Replies: 3
    Last Post: 17th June 2008, 17:39
  2. GUI thread and Working thread comunication
    By FasTTo in forum Qt Programming
    Replies: 2
    Last Post: 13th September 2007, 15:31
  3. Terminating a thread.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 9th July 2007, 11:14
  4. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  5. Thread Problem
    By qball2k5 in forum Qt Programming
    Replies: 2
    Last Post: 12th April 2006, 17:31

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.