PDA

View Full Version : Qwt date and time problem



CassioTC
25th August 2011, 13:39
6795Hello,

I'm trying to show date and time in the axis scale getting the values from datadase and seting to a double like this:


xData->push_back( QString(dt.date().toString("yyyyMMdd") + dt.time().toString("hhmmss")).toDouble() );

xData will receive a double like this 20110825093005, but in the graph show me: 2,01108e+13.

I tried use this:


class TimeScaleDraw: public QwtScaleDraw
{
public:
TimeScaleDraw(QString fmt):
format(fmt)
{
}
virtual QwtText label(double v) const
{
QDateTime t;
QString data, hora;

data = QString::number(v, 'f', 0).left(8);
hora = QString::number(v, 'f', 0).right(6);

t.setDate( QDate::fromString( data, "yyyyMMdd"));
t.setTime( QTime::fromString( hora, "hhmmss"));

return t.toString(format);
}
private:
QString format;
};


But the double v value that i receive ignores time value, something like this: 20110825000000. Works for the data, but not for the time.