Namespaces
Variants
Actions

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

Jump to: navigation, search
Archived.png
Archived: 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

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 04:14.
237 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved