Qt登录超时使用QTimer

时间:2015-03-08 14:17:12

标签: c++ qt login timer qtimer

我尝试在用户名/密码输入错误太多时间时实施登录超时。但我无法这样做。我的代码在

之下
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);

1 个答案:

答案 0 :(得分:0)

试试这个

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