![]() |
2010-07-16
, 19:39
|
Posts: 180 |
Thanked: 76 times |
Joined on May 2010
|
#42
|
progress.setCancelButton(0);
Just show him a message that something is being done and all he can do is wait
![]() |
2010-07-16
, 19:56
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#43
|
Code:progress.setCancelButton(0);
I would hate this, but maybe the script will mess up something if you don't let it finish?
The Following User Says Thank You to d-iivil For This Useful Post: | ||
![]() |
2010-07-16
, 20:09
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#44
|
![]() |
2010-07-16
, 20:11
|
|
Posts: 267 |
Thanked: 408 times |
Joined on May 2010
@ Austria
|
#45
|
The easiest way:
In Qt Creator's UI designer, right-click a widget, click "Go to slot...", select a slot (eg. clicked() for a button), and it generates what you need where it needs to be.
I did, but the whole point is that user must not close it, I mean I don't want to give user opportunity to close it. Just show him a message that something is being done and all he can do is wait
The Following User Says Thank You to Nathraiben For This Useful Post: | ||
![]() |
2010-07-16
, 20:37
|
Posts: 726 |
Thanked: 345 times |
Joined on Apr 2010
@ Sweden
|
#46
|
The Following User Says Thank You to Joorin For This Useful Post: | ||
![]() |
2010-07-16
, 20:48
|
|
Posts: 267 |
Thanked: 408 times |
Joined on May 2010
@ Austria
|
#47
|
![]() |
2010-07-16
, 20:48
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#48
|
Instead, issue a warning in your progress bar that this might take a couple of minutes and should not be canceled. Warn the user, but don't take away control over their own system.
void MainWindow::on_pushButton_clicked() { QString varattu; varattu = "Setting up the theme, please wait."; QProgressDialog progress; progress.setWindowModality(Qt::WindowModal); progress.setWindowTitle(varattu); progress.show(); progress.setValue(0); QStringList arguments; arguments << ui->Transition->currentText() << ui->Font->currentText() << ui->Color->currentText() << ui->Activate->currentText(); QProcess::execute("/sbin/launchblack", arguments); progress.setValue(1); }
![]() |
2010-07-16
, 21:05
|
|
Posts: 267 |
Thanked: 408 times |
Joined on May 2010
@ Austria
|
#49
|
![]() |
2010-07-17
, 05:24
|
|
Posts: 2,154 |
Thanked: 2,186 times |
Joined on Dec 2009
@ Hellsinki, Finland
|
#50
|
Not sure whether they work the same in PyQt and Qt, but I had to set the value to something > 0 in order for the bar to show, since 0% more or less indicates that you didn't yet start.
With my rather short waiting times I simply set it to 50%, as I didn't really need a true progress bar but just an indication that the user will have to wait for for a short while.
With a script running for that long, a working progress bar would be rather helpful, though. Normally, you would just increment the value each time a part of your script is finished, but with just one large script I guess that would be hard.
Is there a way to split the script into smaller portions, so after each successful execute you can increment the value? Then, just set the value to 1% right before the first execute and the bar SHOULD show.
If you're rich and you think I deserve a cold beer, you may donate one or two :-P
80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE