Qt has rather indirect way to control input type. “setInputMethodHints” is available, but QLine Widget ignores it.
We need to use QReqExp class for defining “Regular Expressions” , below is example of regular expression where QLineEdit only takes input in numbers only!
QRegExp rx("\\d+"); QLineEdit *edit = new QLineEdit(); edit->setValidator(validator); this->setCentralWidget(edit);
Thank you, this is works perfectly.