Results 1 to 2 of 2

Thread: Reacting on Signal on qml side

  1. #1
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Reacting on Signal on qml side

    Hello friends,

    just a questions. is it normal that when I generate signals like this

    Qt Code:
    1. //c++ side
    2. for(int i = 0; i < 1000000; ++i){
    3. emit testSignal(i);
    4. }
    5.  
    6. //on qml side
    7. ....
    8. onTestSignal:{
    9. console.log(count)// or any other binding
    10. .....
    11. }
    To copy to clipboard, switch view to plain text mode 

    that its blocks my qml gui? Its realy not reactive!

    How can I achieve nonblocking reaction to the signals?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,396
    Thanks
    37
    Thanked 1,542 Times in 1,493 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Reacting on Signal on qml side

    When you run a loop on the main thread, the main thread is busy with that loop.
    It if is busy with that loop, it can't do any event processing.

    There are a number of options on how to change that:

    1) Restructure the code to use a timer based iteration instead of a tight loop
    2) Run the loop in a secondary thread
    3) Call QCoreApplication:rocessEvents() in each loop iteration to do event processing before continuing with the loop.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 30th January 2015, 09:29
  2. Manifest / Side by Side configuration.
    By hickscorp in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2010, 05:22
  3. side-by-side configuration is incorrect
    By trueqt in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2009, 00:35
  4. Stack two QMenuBars instead of side by side?
    By killerwookie99 in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2008, 06:27
  5. Replies: 5
    Last Post: 15th February 2008, 02:54

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.