mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
Fix for ticket #291 (same as image not giving the choice of image
formats). The problem seems to with the list of formats that qt is supposed to provide, but doesn't. Hard-wired to provide jpg and png for the moment. git-svn-id: http://svn.osgeo.org/qgis/trunk@5868 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
0ce82d2fe2
commit
d12fb0e978
@ -2996,9 +2996,18 @@ void QgisApp::saveMapAsImage()
|
||||
// get a list of supported output image types
|
||||
int myCounterInt=0;
|
||||
QString myFilters;
|
||||
for ( ; myCounterInt < QPictureIO::outputFormats().count(); myCounterInt++ )
|
||||
QList<QByteArray> formats = QPictureIO::outputFormats();
|
||||
// Workaround for a problem with Qt4 - calls to outputFormats tend
|
||||
// to return nothing :(
|
||||
if (formats.count() == 0)
|
||||
{
|
||||
QString myFormat=QString(QPictureIO::outputFormats().at( myCounterInt ));
|
||||
formats.append("png");
|
||||
formats.append("jpg");
|
||||
}
|
||||
|
||||
for ( ; myCounterInt < formats.count(); myCounterInt++ )
|
||||
{
|
||||
QString myFormat=QString(formats.at( myCounterInt ));
|
||||
QString myFilter = createFileFilter_(myFormat + " format", "*."+myFormat);
|
||||
myFilters += myFilter;
|
||||
myFilterMap[myFilter] = myFormat;
|
||||
@ -3046,6 +3055,12 @@ void QgisApp::saveMapAsImage()
|
||||
std::cout << "Image type to be passed to mapcanvas: " << (myFilterMap[myFilterString]).toLocal8Bit().data() << std::endl;
|
||||
#endif
|
||||
|
||||
// Add the file type suffix to the filename if required
|
||||
if (!myOutputFileNameQString.endsWith(myFilterMap[myFilterString]))
|
||||
{
|
||||
myOutputFileNameQString += "." + myFilterMap[myFilterString];
|
||||
}
|
||||
|
||||
myQSettings.writeEntry("/UI/lastSaveAsImageFilter" , myFilterString);
|
||||
myQSettings.writeEntry("/UI/lastSaveAsImageDir", myQFileDialog->directory().absolutePath());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user