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.
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.
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.
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.Keeping the GUI Responsive.
<=== 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.
Thank you very much.I'll read this article.
Bookmarks