Results 1 to 2 of 2

Thread: callback to gui from thread...

  1. #1
    Join Date
    Oct 2009
    Location
    Russia, South Ural, Chelyabinsk
    Posts
    42
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default callback to gui from thread...

    Hi, I'am begginer in Qt!

    I try to create template class for my projects, it will be do work in non gui thread (such as load file from www, get response from db and etc.)

    My class has some specification:
    - its must have 3 callback function (signals) using in gui thread
    on_begin(QVariant data) // singal catched in gui form
    on_progress(QVariant data) // singal catched in gui form
    on_end(QVariant data) // singal catched in gui form

    - and thread function. Here will be main work, for example loading file from www
    on_work(QVariant data) //calling direct in thread run method!

    Have you any ideas about it? How to make it?

    PS: Sorry for grammatic errors!

  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: callback to gui from thread...

    Well, as long as your application, or at least the part of it you specified in the points is all Qt, then you don't really need to use pure C++ callbacks, as you can use signals and slots, which makes things much easier.

    Make sure you read QThread documentation, and that you understand what thread affinity is, and what implications it has in Qt.

    However, I don't understand what is your question?
    You have the specification for your application - what it is you have problem with exactly?

    Ask specific questions about specific issues, it will be easier to help you then.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Advice needed regarding GUI and external thread cooperation
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 17th June 2009, 00:10
  2. Thread Ownership Problem
    By tntcoda in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2009, 00:18
  3. Non-Gui thread Callback API and Qt - how
    By The Storm in forum Qt Programming
    Replies: 9
    Last Post: 3rd November 2008, 19:24
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49

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.