[Qt-creator] Is there a Try and Catch method in QT

Diego Turcios diegoturciostc at gmail.com
Thu Jul 1 03:01:05 CEST 2010


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.
I was trying something like this


double quantity;
 try
    {
        quantity=ui->LEPrecio->text().toDouble();
     }
    catch(QString error)
    {
        QMessageBox msgBox;
        msgBox.setText(error);
        msgBox.exec();
    }
After doing this. I am planning to manipulate the double value, but this
doesn't work. If I write hello world on the line edit. Supposly it converts
it, and it doesn't work. Any idea ;)

Diego Turcios
DiegoTc
Ubuntu User  # 27518
-----------------------------------------------
Mis Blogs
http://diegoturcios.wordpress.com/
https://wiki.ubuntu.com/DiegoTurcios
----------------------------------------------------------
Recuerden Dios siempre esta presente:
http://sagradocorazondejesus-diegotc.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100630/30e7c7cd/attachment.html 


More information about the Qt-creator-old mailing list