Hi Felipe!

  This is not related to window manager as it's a separate process.
Simply changing
  attributes is done through event mechanism.

  Consider this application:

  #include <QtGui>

int main (int argc, char **argv)
{
    QApplication app(argc, argv);

    QMainWindow win;
    win.show();

    QMessageBox::StandardButton reply;
    reply = QMessageBox::warning(&win,
                                 QObject::tr("Title"), QObject::tr("Message"),
                                 QMessageBox::Yes | QMessageBox::No);
    if (reply == QMessageBox::Yes) {
        win.setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
        app.processEvents();
        sleep(5);
        win.setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
    }

    return app.exec();
}


Thanks, Daniil.

On Tue, Jun 8, 2010 at 12:37 AM, Felipe Crochik <fel...@crochik.com> wrote:
> The window manager has to get a chance to process the message queue in order
> to show the Progress Indicator. It works not because is outside the if but
> because it is before you show the dialog window.
>
> One possible approach is to set the progress indicator but start the
> "processing" using a QTimer::singleShot... this will give the window manager
> time to process the queue and show the progress indicator.
>
> To double check you can just remove the "
> QWidget::setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);" from your
> first example and you will notice that after the processing is done you will
> see the progress indicator.
>
>
> -----Original Message-----
> From: maemo-developers-boun...@maemo.org
> [mailto:maemo-developers-boun...@maemo.org] On Behalf Of Sascha Mäkelä
> Sent: Monday, June 07, 2010 5:25 PM
> To: maemo-developers
> Subject: Strange problem with Maemo5ShowProgressIndicator
>
> Hi,
> I'm having a strange problem with Maemo5ShowProgressIndicator. My code
> looks like this:
>
>    QMessageBox::StandardButton reply;
>    reply = QMessageBox::warning(this, tr("Warning!"),
>                                 QMessageBox::Yes | QMessageBox::No);
>    if (reply == QMessageBox::Yes) {
>        QWidget::setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
>        // do something...
>        QWidget::setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
>    }
>
> I get no progress indicator with the previous code. However, when I
> take it out from the IF statement, it does work. Looking like this:
>
>    QWidget::setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
>     QMessageBox::StandardButton reply;
>    reply = QMessageBox::warning(this, tr("Warning!"),
>                                 QMessageBox::Yes | QMessageBox::No);
>    if (reply == QMessageBox::Yes) {
>        // do something...
>        QWidget::setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
>    }
>
> But of course this way the indicator starts too early or shouldn't
> start at all. Am I doing something wrong?
>
> Cheers,
>
> Sascha
> _______________________________________________
> maemo-developers mailing list
> maemo-developers@maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers@maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to