mobucl
17th May 2011, 10:20
Hi, this may be a simple question but i have looked arround and havent seen a direct answer. I have two situations, the first is:
QVector<float> test // contains a series of floating point numbers
BUT how can i convert these to QVector<double> easily. I was hoping for a simple test.toDouble() but this seems to not be the case.
Second - a bit more complex? can i convert a QList<Qlist<float> > in a similiar manner Here is some code:
QList<QList<float> > out; // create the variable discussed above
for (int i = 0; i< 10; i++) //create 10 Qlists to hold values
{
out << QList<float>();
}
for (int ii = 0; ii<10;ii++ // fill the Qlists with some values
{
out[ii] << somevalues[ii]
}
QVector<double> test;
test = out[1].toDouble // trying to take all the elements in the first Qlist of floats
// and ouput them to a QVector of doubles ->DOESNT WORK
Hope this makes sense!
Thanks
Matt
QVector<float> test // contains a series of floating point numbers
BUT how can i convert these to QVector<double> easily. I was hoping for a simple test.toDouble() but this seems to not be the case.
Second - a bit more complex? can i convert a QList<Qlist<float> > in a similiar manner Here is some code:
QList<QList<float> > out; // create the variable discussed above
for (int i = 0; i< 10; i++) //create 10 Qlists to hold values
{
out << QList<float>();
}
for (int ii = 0; ii<10;ii++ // fill the Qlists with some values
{
out[ii] << somevalues[ii]
}
QVector<double> test;
test = out[1].toDouble // trying to take all the elements in the first Qlist of floats
// and ouput them to a QVector of doubles ->DOESNT WORK
Hope this makes sense!
Thanks
Matt