[Qt-interest] QMessageBox Auto Close
Thiago Macieira
thiago at kde.org
Fri Mar 19 13:56:46 CET 2010
Em Sexta-feira 19 Março 2010, às 13:45:34, Denis Akhmetzyanov escreveu:
> 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);
Hint:
QTimer *msgBoxCloseTimer = new QTimer(msgBox);
> msgBoxCloseTimer->setInterval(3000);
> msgBoxCloseTimer->setSingleShot(true);
> connect(msgBoxCloseTimer, SIGNAL(timeout()), msgBox, SLOT(reject()));
> // or accept()
> msgBoxCloseTimer->start();
>
> msgBox->exec();
This way, the timer gets deleted when you delete the message box.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100319/bf123bf3/attachment.bin
More information about the Qt-interest-old
mailing list