[Qt-creator] Is there a Try and Catch method in QT
thorbjorn.lindeijer at nokia.com
thorbjorn.lindeijer at nokia.com
Thu Jul 1 14:21:35 CEST 2010
----- Original message -----
> On Thursday 01 July 2010 03:01:05 Diego Turcios wrote:
> > Hi guys
> > I thinks this is the right mailing list for my doubt.
> > I am working on a small application in QT. But right now I have the
> > following problem.
> > I have a line edit, and I want to manipulate the values so only
> numbers
> > (doubles) can be written on this line edit.
>
> The right way to do this in Qt is to use a validator. Just write this
> line in
> the constructor of your dialog (after setting up the ui).
> ui->LEPrecio->setValidator( new QDoubleValidator );
>
> This way you are sure the user can only type a double. No need to do
> any
> check.
Note that Qt also has a QDoubleSpinBox, which is a suitable widget for entering double values.
Regards,
Bjorn
More information about the Qt-creator-old
mailing list