[Qt-interest] How to: Accept only alphabets

Malyushytsky, Alex alex at wai.com
Tue Feb 9 06:02:17 CET 2010


All known alphabets? :)

I guess you meant allow only letters to be entered.

In your case setInputMask("aaaaaaaaaaa"), where number of 'a' should be equal to the maxLength() might be sufficient.

For more complex cases you might need to use QLineEdit::setValidator(), check QValidator, QRegExpValidator in documentation.


Regards,
     Alex

From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Mohammed Imran B
Sent: Monday, February 08, 2010 8:03 PM
To: qt-interest at trolltech.com
Subject: [Qt-interest] How to: Accept only alphabets

Hi,

Hi I want to make a QLineEdit accept only alphabets, i.e if any other key is pressed I should alert the user to enter only alphabets.

Thank you.


Regards,
Imran


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”

“Please consider our environment before printing this email.”




More information about the Qt-interest-old mailing list