Auto close QMessageBox

前端 未结 5 2123
猫巷女王i
猫巷女王i 2020-12-31 19:20

I\'m building a Qt Symbian Project and I want to show a notification for the user that should auto close after some seconds. I have seen that Nokia uses this a lot in their

5条回答
  •  时光说笑
    2020-12-31 19:52

    With this code:

    QTimer *timer;
    QTimer::singleShot(10000, msgBox, SLOT(close()));
    

    you get:

    QObject::connect: Incompatible sender/receiver arguments
            QTimer::timeout() --> QMessageBox::
    

    Becouse msgBOx (the receiver) must be a QtCore object.. and QMessageBox subclassing QtGui. See https://srinikom.github.io/pyside-docs/PySide/QtCore/QTimer.html#PySide.QtCore.PySide.QtCore.QTimer.singleShot

提交回复
热议问题