TomASS
29th May 2009, 16:09
Hello, I would like to display a double number into a MessageBox:
if I write:
double d = 0.75;
QString str = QString("delta: %1").arg(d, 0, 'g', 6);
QMessageBox::information(0,"Time","Value: "+str+".\n");
i's display ok: Value: 0.75.
But if I write:
double d = 3/4;
QString str = QString("delta: %1").arg(d, 0, 'g', 6);
QMessageBox::information(0,"Time","Value: "+str+".\n");
i's display wrong: Value: 0.. Why and what I should write to display Value: 0.75?
if I write:
double d = 0.75;
QString str = QString("delta: %1").arg(d, 0, 'g', 6);
QMessageBox::information(0,"Time","Value: "+str+".\n");
i's display ok: Value: 0.75.
But if I write:
double d = 3/4;
QString str = QString("delta: %1").arg(d, 0, 'g', 6);
QMessageBox::information(0,"Time","Value: "+str+".\n");
i's display wrong: Value: 0.. Why and what I should write to display Value: 0.75?