mammaiap
24th March 2011, 12:17
Hi Friends,
i wanted to save the QImage file into the desired directory....i have changed the directory and save the QImage... but it is not saving into the desired directory.....it saves into the application current directory....
here is my code snippet:
QDir *dir = new QDir(".");
if( dir->cd("LSWT_Report"));
if(dir->cd("Report"));
if(dir->cd("Plots"));
const double scaleFactor = 3.0;
const QSize sz(3543, 2362);
QImage image(sz, QImage::Format_ARGB32);
image.fill( QColor( Qt::white ).rgb() );
QPainter painter(&image);
painter.scale(scaleFactor, scaleFactor);
QwtPlotRenderer renderer;
QString saveFileName;
for(int j=0;j<plots.count();j++)
{
if(j==0)
{
saveFileName = "CdVsCl.png";
}
if(j==1)
{
saveFileName = "AOAVsCl.png";
}
if(j==2)
{
saveFileName = "AOAVsCm.png";
}
if(j==3)
{
saveFileName = "AOAVsCd.png";
}
if(j==4)
{
saveFileName = "ClVsClbyCd.png";
}
if(j==5)
{
saveFileName = "AOAVsClbyCd.png";
}
renderer.render(plots.at(j), &painter, QRectF( QPointF(0, 0), sz / scaleFactor ) );
image.save( saveFileName );
}
please anyone can help me.....
Thanks in Advance,
Muthu
i wanted to save the QImage file into the desired directory....i have changed the directory and save the QImage... but it is not saving into the desired directory.....it saves into the application current directory....
here is my code snippet:
QDir *dir = new QDir(".");
if( dir->cd("LSWT_Report"));
if(dir->cd("Report"));
if(dir->cd("Plots"));
const double scaleFactor = 3.0;
const QSize sz(3543, 2362);
QImage image(sz, QImage::Format_ARGB32);
image.fill( QColor( Qt::white ).rgb() );
QPainter painter(&image);
painter.scale(scaleFactor, scaleFactor);
QwtPlotRenderer renderer;
QString saveFileName;
for(int j=0;j<plots.count();j++)
{
if(j==0)
{
saveFileName = "CdVsCl.png";
}
if(j==1)
{
saveFileName = "AOAVsCl.png";
}
if(j==2)
{
saveFileName = "AOAVsCm.png";
}
if(j==3)
{
saveFileName = "AOAVsCd.png";
}
if(j==4)
{
saveFileName = "ClVsClbyCd.png";
}
if(j==5)
{
saveFileName = "AOAVsClbyCd.png";
}
renderer.render(plots.at(j), &painter, QRectF( QPointF(0, 0), sz / scaleFactor ) );
image.save( saveFileName );
}
please anyone can help me.....
Thanks in Advance,
Muthu