Good day to all. Maybe someone faced a similar problem:

if (learn == QMessageBox::No) { Learning->show(); lineedit->show(); label->show(); right_b->show(); connect(right_b, SIGNAL(clicked()), this, SLOT(learning_slot())); } 

There is such a code. The fact is that the first time you press right_b slot learning_slot() is called once, at the second - twice, at 3 - three, etc. I just can not understand what's wrong. There are no cycles anywhere. It all depends on how often I click on this button. It feels like I clicked and performs exactly as many clicks.

  • one
    because with each click you add another listener. And the signal is sent to all listeners. Do you need it? - KoVadim

1 answer 1

Understood. It is necessary just to register right_b->disconnect(); in learning_slot() right_b->disconnect(); .