There is the following code:
linedit ed;
ed.setValidator(new QIntValidator(0,3600,&ed));
qApp->connect(&ed,&linedit::inputRejected,&ed,&linedit::edited);
linedit:
#ifndef LINEDIT_H
#define LINEDIT_H
#include<QLineEdit>
#include<QWidget>
class linedit : public QLineEdit
{
Q_OBJECT
public:
linedit(QWidget *parent = nullptr);
public slots:
bool edited();
};
#endif // LINEDIT_H
edited:
bool linedit::edited(){
qDebug() << text();
return 0;
}
Why, when entering, for example, 4000, the inputRejected signal is not generated, but is generated when trying to enter “a” or “10000”
Holi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1