Problem with reenabling QPushbutton that launches several expensive processes.
-
Hello.
I have a QPushbutton which starts several QtConcurrent::run() operations. These operations take various amount of time to complete, depending on the amount of data to process.
I'm disabling the QPushbutton at the start of the operations, which I do using the isEnabled property.
The problem is that I would like to reenable the QPushbutton after all of my QtConcurrent::run() are finished. So I've made a slot to which I connect the finished signal of these operations, but obviously some of the operations are finished earlier than the others and my QPushbutton is enabled too early.
Just looking for an idea on how to approach that.
Thanks!
-
Since you know the count of run() operations you start, you can count how much are finished.
-
@Christian-Ehrlicher said in Problem with reenabling QPushbutton that launches several expensive processes.:
Since you know the count of run() operations you start, you can count how much are finished.
Brilliant, thanks! Sorry for such a basic question. I'm dealing with a major brainfart.
So probably something like this shall do?
finished_slot() { count++; if(count==num_of_runs){ button.setEnabled(true); count=0; } }
-
I would say yes.