Hi all,
I have been trying to develop an application which need to plot graph from values present in the database..
This is the code which i used to generate graph from the values from the database...
[code]
void test_plotdb::draw()
{
m_sqlModel = new QSqlQueryModel(this);
QSqlQuery q("SELECT xval,yval FROM data_table1");
if (q.exec())
{
for(int i=q.first();i<q.last();i++)
{
*s_x=q.value(0).toDouble();
*s_y=q.value(1).toDouble();
m_curve = new QwtPlotCurve();
m_curve->setPen(QPen(Qt::red));
m_curve->setData((const double*)s_x, (const double*)s_y, 100);
m_curve->attach(myPlot);
myPlot->replot();
}
}
else
{
QMessageBox::critical(this, "Failure", "Query failure");
}
}
[/code]
i have cleared all the errors but i couldnt get any output(I mean i need to get output in the form of graph representing the values from the database..)
can any one solve my problem please....
thank in advance...