Skip to content

Commit 92bce07

Browse files
author
g_j_m
committed
- replace a Qt3 class with its Qt4 version
- Fix up the list of valid file types - Make the 'do it' button say 'Save', instead of 'Open' - Have the current directory as the default statup directory git-svn-id: http://svn.osgeo.org/qgis/trunk@5320 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4bc9afb commit 92bce07

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/composer/qgscomposer.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
#include <QFileDialog>
2828
#include <QMatrix>
2929
#include <QMessageBox>
30-
#include <Q3PaintDeviceMetrics>
3130
#include <QPainter>
3231
#include <Q3Picture>
3332
#include <QPrinter>
3433
#include <QSettings>
3534
#include <QIcon>
3635
#include <QPixmap>
3736
#include <QToolBar>
37+
#include <QImageWriter>
3838
#include <iostream>
3939

4040

@@ -454,11 +454,9 @@ void QgsComposer::on_mActionPrint_activated(void)
454454
bool print = true;
455455

456456
// Check size
457-
Q3PaintDeviceMetrics pm(mPrinter);
458-
459-
std::cout << "Paper: " << pm.widthMM() << " x " << pm.heightMM() << std::endl;
460-
if ( mComposition->paperWidth() != pm.widthMM() ||
461-
mComposition->paperHeight() != pm.heightMM() )
457+
std::cout << "Paper: " << mPrinter->widthMM() << " x " << mPrinter->heightMM() << std::endl;
458+
if ( mComposition->paperWidth() != mPrinter->widthMM() ||
459+
mComposition->paperHeight() != mPrinter->heightMM() )
462460
{
463461
int answer = QMessageBox::warning ( 0, "Paper does not match",
464462
"The selected paper size does not match the composition size",
@@ -531,9 +529,9 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
531529
int myCounterInt=0;
532530
QString myFilters;
533531
QString myLastUsedFilter;
534-
for ( ; myCounterInt < QPictureIO::outputFormats().count(); myCounterInt++ )
532+
for ( ; myCounterInt < QImageWriter::supportedImageFormats().count(); myCounterInt++ )
535533
{
536-
QString myFormat=QString(QPictureIO::outputFormats().at( myCounterInt ));
534+
QString myFormat=QString(QImageWriter::supportedImageFormats().at( myCounterInt ));
537535
QString myFilter = myFormat + " format (*." + myFormat.lower() + " *." + myFormat.upper() + ")";
538536
if ( myCounterInt > 0 ) myFilters += ";;";
539537
myFilters += myFilter;
@@ -557,7 +555,7 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
557555
new QFileDialog(
558556
this,
559557
tr("Choose a filename to save the map image as"),
560-
"",
558+
".",
561559
myFilters
562560
)
563561
);
@@ -569,6 +567,9 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
569567
// set the filter to the last one used
570568
myQFileDialog->selectFilter(myLastUsedFilter);
571569

570+
// set the 'Open' button to something that makes more sense
571+
myQFileDialog->setLabelText(QFileDialog::Accept, tr("Save"));
572+
572573
//prompt the user for a filename
573574
QString myOutputFileNameQString; // = myQFileDialog->getSaveFileName(); //delete this
574575

0 commit comments

Comments
 (0)