Skip to content
Permalink
Browse files
Applied patch #2159 from ctimko
git-svn-id: http://svn.osgeo.org/qgis/trunk@13545 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 22, 2010
1 parent 4e751ff commit 63c6950c914cb373348dc57a16869737a0c2e244
Showing with 30 additions and 8 deletions.
  1. +17 −7 src/app/composer/qgscomposer.cpp
  2. +8 −1 src/app/composer/qgscomposer.h
  3. +5 −0 src/ui/qgscomposerbase.ui
@@ -52,9 +52,9 @@
#include <QMatrix>
#include <QMenuBar>
#include <QMessageBox>
#include <QPageSetupDialog>
#include <QPainter>

#include <QPrinter>
#include <QPrintDialog>
#include <QSettings>
#include <QIcon>
@@ -137,6 +137,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title ): QMainWindow(),
fileMenu->addAction( mActionExportAsPDF );
fileMenu->addAction( mActionExportAsSVG );
fileMenu->addSeparator();
fileMenu->addAction( mActionPageSetup );
fileMenu->addAction( mActionPrint );
fileMenu->addSeparator();
fileMenu->addAction( mActionQuit );
@@ -486,26 +487,26 @@ void QgsComposer::on_mActionExportAsPDF_triggered()

void QgsComposer::on_mActionPrint_triggered()
{
QPrinter printer;
//QPrinter printer;
if ( mComposition )
{
if ( mComposition->paperWidth() >= mComposition->paperHeight() )
{
printer.setOrientation( QPrinter::Landscape );
mPrinter.setOrientation( QPrinter::Landscape );
}
else
{
printer.setOrientation( QPrinter::Portrait );
mPrinter.setOrientation( QPrinter::Portrait );
}
}
printer.setPaperSize( QSizeF( mComposition->paperWidth(), mComposition->paperHeight() ), QPrinter::Millimeter );
QPrintDialog printDialog( &printer, 0 );
mPrinter.setPaperSize( QSizeF( mComposition->paperWidth(), mComposition->paperHeight() ), QPrinter::Millimeter );
QPrintDialog printDialog( &mPrinter, 0 );
if ( printDialog.exec() != QDialog::Accepted )
{
return;
}

print( printer );
print( mPrinter );
}

void QgsComposer::print( QPrinter &printer )
@@ -1498,4 +1499,13 @@ void QgsComposer::cleanupAfterTemplateRead()
}
}

void QgsComposer::on_mActionPageSetup_triggered()
{
if ( !mComposition )
{
return;
}

QPageSetupDialog pageSetupDialog( &mPrinter, this );
pageSetupDialog.exec();
}
@@ -20,6 +20,7 @@
#include "ui_qgscomposerbase.h"
#include "qgscomposeritem.h"
#include "qgscontexthelp.h"
#include <QPrinter>

class QgisApp;
class QgsComposerArrow;
@@ -118,6 +119,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Print the composition
void on_mActionPrint_triggered();

//! Page Setup for composition
void on_mActionPageSetup_triggered();

//! Print as image
void on_mActionExportAsImage_triggered();

@@ -201,7 +205,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Save window state
void saveWindowState();

/**Add a composer arrow to the item/widget map and crete a configuration widget for it*/
/**Add a composer arrow to the item/widget map and creates a configuration widget for it*/
void addComposerArrow( QgsComposerArrow* arrow );

/**Add a composer map to the item/widget map and creates a configuration widget for it*/
@@ -299,6 +303,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase

//! Window menu action to select this window
QAction *mWindowAction;

//! Page & Printer Setup
QPrinter mPrinter;
};

#endif
@@ -474,6 +474,11 @@
<string>Adds attribute table</string>
</property>
</action>
<action name="mActionPageSetup">
<property name="text">
<string>Page Setup</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>mCompositionNameComboBox</tabstop>

0 comments on commit 63c6950

Please sign in to comment.