There is a set of buttons, when clicked, the slot will be executed:
void uRent::s1(const QString &i) { QString line = ui->lineEdit->text(); index = line.indexOf('_'); line.replace(index, 1, i); ui->lineEdit->setText(line); QTimer* btimer = new QTimer(this); btimer->setSingleShot(true); btimer->setInterval(200); connect(btimer, &QTimer::timeout, [this, btimer](){ QString line = ui->lineEdit->text(); line.replace(index, 1, '*'); ui->lineEdit->setText(line); btimer->deleteLater(); }); btimer->start(); } As you can see when the slot is executed, a timer signal is generated and that calls another function (slot) to perform. In general, everything works well, but when you quickly press the buttons, the timer signal does not have time to be processed and, as it were, skips. Apparently the signal received from pressing the button becomes in the signal queue before the timer signal. How can I clear the queue or put a block of signals before the timer slot runs?