Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

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

From 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
Platform(s): All Qt Supported
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.
80 page views in the last 30 days.