Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Need assistance from QT programmer

    Reply
    Page 5 of 18 | Prev |   3     4   5   6     7   15 | Next | Last
    d-iivil | # 41 | 2010-07-16, 19:34 | Report

    Originally Posted by Diph View Post
    Did you try the dialog.exec()? It should block until user closes it.
    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

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Diph | # 42 | 2010-07-16, 19:39 | Report

    Code:
    progress.setCancelButton(0);
    Originally Posted by D-Iivil View Post
    Just show him a message that something is being done and all he can do is wait
    I would hate this, but maybe the script will mess up something if you don't let it finish?

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by Diph; 2010-07-16 at 19:43.

     
    d-iivil | # 43 | 2010-07-16, 19:56 | Report

    Originally Posted by Diph View Post
    Code:
    progress.setCancelButton(0);

    I would hate this, but maybe the script will mess up something if you don't let it finish?
    Yep, it will lead to broken theme and I have no idea how Hildon will handle it if there's some partly copied broken png -file in theme's folder :P

    dialog.exec() won't work because the script isn't ran in the background. It's launched only after user closes the dialog :-/

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to d-iivil For This Useful Post:
    Venemo

     
    d-iivil | # 44 | 2010-07-16, 20:09 | Report

    Now I got it

    I didn't realize I had to separately create also QProgressBar, the QProgressDialog wasn't enough all by itself :-P

    Edit: no, I didn't get it. Still not seeing a progress bar in the dialog :-(

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by d-iivil; 2010-07-16 at 20:20.

     
    Nathraiben | # 45 | 2010-07-16, 20:11 | Report

    Originally Posted by Venemo View Post
    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.
    Shiny!
    Finding out the hard way was good for getting the hang of how it works, but knowing that there's a hasslefree way to do it made my day...

    Thanks a lot, Venemo!

    Originally Posted by D-Iivil View Post
    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
    From a user's point of view, I'd advise against unclosable progress bars.

    In maemo, that thing will completely take away the ability to close that application, so in case anything goes wrong with either your C++ code or your shell script, the user is stuck with an unclosable application until they either reboot or manage to issue a successful kill command (which, btw, didn't work for me - the application was completely locked).

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Nathraiben For This Useful Post:
    Venemo

     
    Joorin | # 46 | 2010-07-16, 20:37 | Report

    Originally Posted by Nathraiben View Post
    the user is stuck with an unclosable application until they either reboot or manage to issue a successful kill command
    Can't you press the power button and pick "End current task"?

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Joorin For This Useful Post:
    Venemo

     
    Nathraiben | # 47 | 2010-07-16, 20:48 | Report

    Originally Posted by Joorin View Post
    Can't you press the power button and pick "End current task"?
    It didn't give me the option - I don't know the inner workings of the OS enough to do more than speculate, but so far from looking at when I get the option and when not, it seems like it only shows when there's a close button showing on top of the screen - which isn't the case when a progress bar takes over.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 48 | 2010-07-16, 20:48 | Report

    Originally Posted by Nathraiben View Post
    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.
    Yeah... you're right about that. Well, I guess I first need to figure out how to bring the cancell -button and progress bar visible in the first place :-D

    With code like this:
    Code:
    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);
    
    }
    It works as it's supposed to work (the script is being ran at the background), but user cannot cancell nor the progress bar is shown...

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Images
     

     
    Nathraiben | # 49 | 2010-07-16, 21:05 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 50 | 2010-07-17, 05:24 | Report

    Originally Posted by Nathraiben View Post
    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.
    Did't work :/ No bar, no cancell-button.

    But while I coulnd't figure out the bar -issue I optimized the script instead (which I should have done already...) and now it's taking only like 30 secs to complete and user is informed what's happening by notifications sent via DBUS.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 5 of 18 | Prev |   3     4   5   6     7   15 | Next | Last
vBulletin® Version 3.8.8
Normal Logout