PDA

View Full Version : Retrieving and converting values



jcoop
18th February 2009, 23:49
Say I've got a QLineEdit and I need to retrieve the text, then convert it to a float for processing. How would I do that? The ways I've been trying so far always end up throwing compilation errors.

wysota
19th February 2009, 00:55
QLineEdit::text() and QString::toDouble()

or

QDoubleSpinBox

jcoop
19th February 2009, 03:00
So would that be something like:

double d = myLineEditName->text()->toDouble();

It's the syntax that I'm not getting.

jogeshwarakundi
19th February 2009, 08:01
So would that be something like:

double d = myLineEditName->text()->toDouble();

It's the syntax that I'm not getting.

double d = myLineEdit->text().toDouble();
try breaking the operation sequence into series of steps...syntax evolves itself!

cheers!