简体   繁体   中英

Qt Login Timeout Using QTimer

I am trying to implement a login timeout when the username/password has been entered wrong too many time. But i am unable to do so. My code is below

ui->label->setText("Password entered wrong too many times, entered 10 minute cooldown period");
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(update())); 
    timer->start(6000);
    ui->pushButton->setVisible(false);
    if(!timer->isActive())
        ui->pushButton->setVisible(true);

Try this

ui->pushButton->hide();
QTimer::singleShot(5000, ui->pushButton, SLOT(show()));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM