|
|
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
_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest
|
|