[Qt-interest] QMessageBox Auto Close

Denis Akhmetzyanov dakhmetzyanov at smartlabs.tv
Fri Mar 19 13:45:34 CET 2010


Hi,
It seems to me that QMessageBox has not timeout or auto close. But this code
works:

    QMessageBox *msgBox = new QMessageBox(QMessageBox::Information, "Info",
                                          "Some information for you",
QMessageBox::Ok);

    QTimer *msgBoxCloseTimer = new QTimer(this);
    msgBoxCloseTimer->setInterval(3000);
    msgBoxCloseTimer->setSingleShot(true);
    connect(msgBoxCloseTimer, SIGNAL(timeout()), msgBox, SLOT(reject())); //
or accept()
    msgBoxCloseTimer->start();

    msgBox->exec();

2010/3/19 Paolino Marmolaro <paolino.marmolaro at gmail.com>

>
> Hi,
>
> I need to show a MessageBox that closes itself after a number of seconds if
> the user does not choose any button.
> Searching the archives, I found some old messages without a positive
> response.
> there is something supported in the latest framework?
> thanks.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100319/a717b9fc/attachment.html 


More information about the Qt-interest-old mailing list