In my program, QTableWidget used, which is connected to the slot by an itemChanged(QTableWidgetItem*) signal. The problem is that after the change, we are looking at whether the number from the table has increased the maximum possible value. If exceeded, then write the maximum possible value. So here. The problem is that after recording the signal is triggered and we execute this slot twice. The solution was found - QSignalBlocker , but it does not work on Android . Question: how to remake to work on Android ?

  • blockSignal (true) does not work at all in this case - vadrozh
  • Why not do a check before updating the value in the table? - Pavel Parshin
  • @PavelParshin in the sense? You did not understand? I explain once again: a person changes the value, a signal is triggered and we are looking at whether it has exceeded the maximum. If exceeded, then enter the maximum possible. And the problem is that when the program enters, the signal is triggered, which we do not need. - vadrozh
  • I understood everything perfectly. So I ask the question, why not do a check BEFORE writing the value to the model. - Pavel Parshin
  • @PavelParshin can not give an example of how to implement it? - vadrozh

1 answer 1

Take the input widget QLineEdit , screw the validator QIntValidator to it (well, or what kind of validator is needed), and install the widget in the table cell. Then, in principle, it will be impossible to enter more than the maximum number.

  • I will try, thanks - vadrozh