×
Namespaces

Variants
Actions

Archived:How to restrict input to a QLineEdit using a validator

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Qt Quick should be used for all UI development on mobile devices. The approach described in this article (using C++ for the Qt app UI) is deprecated.

This code snippet how to use validation filter to restrict the input into a QLineEdit using a "validator". There are a number of different validation filters including QIntValidator, QDoubleValidator, QRegExpValidator, and you can create your own as well.

Article Metadata
Tested with
Devices(s): Emulator / desktop / device
Compatibility
Platform(s): All Qt Supported
Symbian
Article
Keywords: QLineEdit
Created: skumar_rao (25 Nov 2010)
Last edited: hamishwillee (11 Oct 2012)
QLineEdit *le = new QLineEdit(this);
le->setValidator(new QIntValidator(this));
This page was last modified on 11 October 2012, at 01:14.
66 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×