Skip to content

Commit

Permalink
- replace a Qt3 class with its Qt4 version
Browse files Browse the repository at this point in the history
- 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/qgis@5320 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Apr 20, 2006
1 parent a3abd61 commit b7a4593
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/composer/qgscomposer.cpp
Expand Up @@ -27,14 +27,14 @@
#include <QFileDialog>
#include <QMatrix>
#include <QMessageBox>
#include <Q3PaintDeviceMetrics>
#include <QPainter>
#include <Q3Picture>
#include <QPrinter>
#include <QSettings>
#include <QIcon>
#include <QPixmap>
#include <QToolBar>
#include <QImageWriter>
#include <iostream>


Expand Down Expand Up @@ -454,11 +454,9 @@ void QgsComposer::on_mActionPrint_activated(void)
bool print = true;

// Check size
Q3PaintDeviceMetrics pm(mPrinter);

std::cout << "Paper: " << pm.widthMM() << " x " << pm.heightMM() << std::endl;
if ( mComposition->paperWidth() != pm.widthMM() ||
mComposition->paperHeight() != pm.heightMM() )
std::cout << "Paper: " << mPrinter->widthMM() << " x " << mPrinter->heightMM() << std::endl;
if ( mComposition->paperWidth() != mPrinter->widthMM() ||
mComposition->paperHeight() != mPrinter->heightMM() )
{
int answer = QMessageBox::warning ( 0, "Paper does not match",
"The selected paper size does not match the composition size",
Expand Down Expand Up @@ -531,9 +529,9 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
int myCounterInt=0;
QString myFilters;
QString myLastUsedFilter;
for ( ; myCounterInt < QPictureIO::outputFormats().count(); myCounterInt++ )
for ( ; myCounterInt < QImageWriter::supportedImageFormats().count(); myCounterInt++ )
{
QString myFormat=QString(QPictureIO::outputFormats().at( myCounterInt ));
QString myFormat=QString(QImageWriter::supportedImageFormats().at( myCounterInt ));
QString myFilter = myFormat + " format (*." + myFormat.lower() + " *." + myFormat.upper() + ")";
if ( myCounterInt > 0 ) myFilters += ";;";
myFilters += myFilter;
Expand All @@ -557,7 +555,7 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
new QFileDialog(
this,
tr("Choose a filename to save the map image as"),
"",
".",
myFilters
)
);
Expand All @@ -569,6 +567,9 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
// set the filter to the last one used
myQFileDialog->selectFilter(myLastUsedFilter);

// set the 'Open' button to something that makes more sense
myQFileDialog->setLabelText(QFileDialog::Accept, tr("Save"));

//prompt the user for a filename
QString myOutputFileNameQString; // = myQFileDialog->getSaveFileName(); //delete this

Expand Down

0 comments on commit b7a4593

Please sign in to comment.