Simplicity
Simplicity

Reputation: 48916

QIntValidator error in Qt

I have written the following part of a code that adds two numbers together and outputs the result:

QIntValidator *validator = new QIntValidator(0,50,this);
ui->firstNumber->setValidator(validator);
...
...

In this case, I get the following error:

CS2039:  'setValidator': is not a member of QTextEditor

How can I fix this problem?

Upvotes: 1

Views: 516

Answers (1)

Dan Milburn
Dan Milburn

Reputation: 5718

Use a text input class that supports validation. You probably want QLineEdit

Upvotes: 1

Related Questions