Results 1 to 4 of 4

Thread: How to execute a time-consuming task without UI pause?

  1. #1
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default How to execute a time-consuming task without UI pause?

    I create a button,and use
    connect(button, SIGNAL(clicked()),this, SLOT(process() )) ,
    In process(),there is a loop,for example,1...1000000.
    when I click the button,the UI pause.

    How to deal with it? thank you.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to execute a time-consuming task without UI pause?

    That depends on what the processing is and what level of control you have over it.

    For a fair sized discussion of this topic see Keeping the GUI Responsive. That was written a few years ago before Qt5 but all the same considerations apply.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,229
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to execute a time-consuming task without UI pause?

    Keeping the GUI Responsive.
    I hope the folks at Qt realize the value of Wysota's article and continue to keep it available in the archives. As do you, whenever I see a post like the above my first thought is, refer them to this article. I have a PDF version, so I guess if the archive post goes away, I can upload that when needed.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. #4
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to execute a time-consuming task without UI pause?

    Thank you very much.I'll read this article.

Similar Threads

  1. Execute a funcion at an exact time of day
    By KillGabio in forum Qt Programming
    Replies: 5
    Last Post: 28th May 2013, 09:08
  2. How time consuming is a d-pointer access?
    By pospiech in forum Qt Programming
    Replies: 3
    Last Post: 8th June 2010, 10:54
  3. Execute an action on regular time
    By valy12 in forum Qt Programming
    Replies: 2
    Last Post: 21st May 2010, 11:25
  4. Once again: buttons and time consuming tasks
    By pampo in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2009, 19:26
  5. Show progress of a time consuming operation
    By rainman110 in forum Newbie
    Replies: 7
    Last Post: 10th February 2008, 13:07

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.