Commit bd2bdec9 authored by Ellen Dekkers's avatar Ellen Dekkers

bugfix: fixes format error when writing a snapshot image to disk

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10414 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1aa31b9f
......@@ -104,6 +104,8 @@
#include <QPainter>
#include <QPaintEngine>
#include <QImageWriter>
#ifdef max
# undef max
#endif
......@@ -2220,19 +2222,19 @@ void glViewer::snapshot( int _width, int _height, bool _alpha )
QFileInfo fi(properties_.snapshotName());
QString fname = fi.path() + QDir::separator() +fi.baseName() + "." + QString::number(properties_.snapshotCounter()) + "." + properties_.snapshotFileType();
bool rval=image.save(fname,properties_.snapshotFileType().toUpper().toLatin1());
QString fname = fi.path() + QDir::separator() +fi.baseName() + "." + QString::number(properties_.snapshotCounter()) + "." + properties_.snapshotFileType().toLower();
QImageWriter writer(fname);
writer.setFormat(properties_.snapshotFileType().simplified().toLatin1());
bool rval = writer.canWrite();
if (rval)
writer.write(image);
if (rval)
{
emit statusMessage (QString(tr("snapshot: "))+fname,5000);
}
emit statusMessage (QString(tr("Snapshot: "))+fname,5000);
else
{
emit statusMessage (QString(tr("could not save snapshot to "))+fname);
}
emit statusMessage (QString(tr("Could not save snapshot to ")) + fname + QString(tr(" Error: ")) + writer.errorString() );
}
void glViewer::slotHideWheels() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment