May this be a bug or something like this?
I tried also catching the input this way:
in .h:
public:
State validate(QString& input, int&) const override {
if (input=="0" or input=="1" or input=="2" or input=="3"
or input=="4" or input=="5" or input=="6" or input=="7" or
input=="8" or input=="9")
}
};
class MyValidator2: public QValidator {
public:
MyValidator2(QObject* parent=nullptr): QValidator(parent) {}
State validate(QString& input, int&) const override {
if (input=="0" or input=="1" or input=="2" or input=="3"
or input=="4" or input=="5" or input=="6" or input=="7" or
input=="8" or input=="9")
return QValidator::Acceptable;
}
};
To copy to clipboard, switch view to plain text mode
in constructor .cpp:
auto validator12 = new MyValidator2(parent);
le_Pwd->setValidator(validator12);
le_Pwd->setMaxLength(8);
auto validator12 = new MyValidator2(parent);
le_Pwd->setValidator(validator12);
le_Pwd->setMaxLength(8);
le_Pwd->setEchoMode(QLineEdit::Password);
To copy to clipboard, switch view to plain text mode
But if i write 1 and then 2, the first one is erased and it only allows me to write one number.... and I don't know if its the bug or if I did wrong the validator ...
Bookmarks