[QGIS Commit] r13545 - in trunk/qgis/src: app/composer ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat May 22 05:58:25 EDT 2010
Author: mhugent
Date: 2010-05-22 05:58:23 -0400 (Sat, 22 May 2010)
New Revision: 13545
Modified:
trunk/qgis/src/app/composer/qgscomposer.cpp
trunk/qgis/src/app/composer/qgscomposer.h
trunk/qgis/src/ui/qgscomposerbase.ui
Log:
Applied patch #2159 from ctimko
Modified: trunk/qgis/src/app/composer/qgscomposer.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.cpp 2010-05-21 09:31:57 UTC (rev 13544)
+++ trunk/qgis/src/app/composer/qgscomposer.cpp 2010-05-22 09:58:23 UTC (rev 13545)
@@ -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 @@
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_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::on_mActionPageSetup_triggered()
+{
+ if ( !mComposition )
+ {
+ return;
+ }
+ QPageSetupDialog pageSetupDialog( &mPrinter, this );
+ pageSetupDialog.exec();
+}
Modified: trunk/qgis/src/app/composer/qgscomposer.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.h 2010-05-21 09:31:57 UTC (rev 13544)
+++ trunk/qgis/src/app/composer/qgscomposer.h 2010-05-22 09:58:23 UTC (rev 13545)
@@ -20,6 +20,7 @@
#include "ui_qgscomposerbase.h"
#include "qgscomposeritem.h"
#include "qgscontexthelp.h"
+#include <QPrinter>
class QgisApp;
class QgsComposerArrow;
@@ -118,6 +119,9 @@
//! 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 @@
//! 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 @@
//! Window menu action to select this window
QAction *mWindowAction;
+
+ //! Page & Printer Setup
+ QPrinter mPrinter;
};
#endif
Modified: trunk/qgis/src/ui/qgscomposerbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscomposerbase.ui 2010-05-21 09:31:57 UTC (rev 13544)
+++ trunk/qgis/src/ui/qgscomposerbase.ui 2010-05-22 09:58:23 UTC (rev 13545)
@@ -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>
More information about the QGIS-commit
mailing list