Skip to content

Commit

Permalink
Support user defined page size selection
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@8108 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Feb 5, 2008
1 parent bcc8ecd commit 8b81139
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 17 deletions.
33 changes: 33 additions & 0 deletions src/plugins/quick_print/quickprintgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <QMessageBox>
#include <QFileDialog>
#include <QSettings>
#include <QPrinter>


//standard includes
Expand All @@ -29,6 +30,35 @@ QuickPrintGui::QuickPrintGui( QgsMapCanvas * thepMapCanvas,
setupUi(this);
readSettings();
grpOuput->hide(); //until properly implemented
cboPageSize->addItem("A0 (841 x 1189 mm)","QPrinter::A0");
cboPageSize->addItem("A1 (594 x 841 mm)","QPrinter::A1");
cboPageSize->addItem("A2 (420 x 594 mm)","QPrinter::A2");
cboPageSize->addItem("A3 (297 x 420 mm)","QPrinter::A3");
cboPageSize->addItem("A4 (210 x 297 mm, 8.26 x 11.69 inches)","QPrinter::A4");
cboPageSize->addItem("A5 (148 x 210 mm)","QPrinter::A5");
cboPageSize->addItem("A6 (105 x 148 mm)","QPrinter::A6");
cboPageSize->addItem("A7 (74 x 105 mm)","QPrinter::A7");
cboPageSize->addItem("A8 (52 x 74 mm)","QPrinter::A8");
cboPageSize->addItem("A9 (37 x 52 mm)","QPrinter::A9");
cboPageSize->addItem("B0 (1030 x 1456 mm)","QPrinter::B0");
cboPageSize->addItem("B1 (728 x 1030 mm)","QPrinter::B1");
cboPageSize->addItem("B10 (32 x 45 mm)","QPrinter::B10");
cboPageSize->addItem("B2 (515 x 728 mm)","QPrinter::B2");
cboPageSize->addItem("B3 (364 x 515 mm)","QPrinter::B3");
cboPageSize->addItem("B4 (257 x 364 mm)","QPrinter::B4");
cboPageSize->addItem("B5 (182 x 257 mm, 7.17 x 10.13 inches)","QPrinter::B5");
cboPageSize->addItem("B6 (128 x 182 mm)","QPrinter::B6");
cboPageSize->addItem("B7 (91 x 128 mm)","QPrinter::B7");
cboPageSize->addItem("B8 (64 x 91 mm)","QPrinter::B8");
cboPageSize->addItem("B9 (45 x 64 mm)","QPrinter::B9");
cboPageSize->addItem("C5E (163 x 229 mm)","QPrinter::C5E");
cboPageSize->addItem("Comm10E (105 x 241 mm, U.S. Common 10 Envelope)","QPrinter::Comm10E");
cboPageSize->addItem("DLE (110 x 220 mm)","QPrinter::DLE");
cboPageSize->addItem("Executive (7.5 x 10 inches, 191 x 254 mm)","QPrinter::Executive");
cboPageSize->addItem("Folio (210 x 330 mm)","QPrinter::Folio");
cboPageSize->addItem("Ledger (432 x 279 mm)","QPrinter::Ledger");
cboPageSize->addItem("Legal (8.5 x 14 inches, 216 x 356 mm)","QPrinter::Legal");
cboPageSize->addItem("Letter (8.5 x 11 inches, 216 x 279 mm)","QPrinter::Letter");
}

QuickPrintGui::~QuickPrintGui()
Expand Down Expand Up @@ -105,6 +135,9 @@ void QuickPrintGui::on_buttonBox_accepted()
myQuickPrint.setLogo1(QgsApplication::iconsPath() + "/qgis-icon.png");
myQuickPrint.setNorthArrow(myNorthArrowFile);
myQuickPrint.setOutputPdf(myOutputFileName);
QString myPageSizeString = cboPageSize->itemData(cboPageSize->currentIndex()).toString();
myQuickPrint.setPageSize(QgsQuickPrint::stringToPageSize( myPageSizeString ));
qDebug("Page size : " + myPageSizeString.toLocal8Bit());
myQuickPrint.printMap();
}
else
Expand Down
1 change: 0 additions & 1 deletion src/plugins/quick_print/quickprintgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <ui_quickprintguibase.h>
#include "qgsmapcanvas.h"


/**
@author Tim Sutton
*/
Expand Down
40 changes: 24 additions & 16 deletions src/plugins/quick_print/quickprintguibase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>419</width>
<height>443</height>
<width>427</width>
<height>522</height>
</rect>
</property>
<property name="windowTitle" >
Expand All @@ -16,18 +16,10 @@
<iconset resource="quickprint.qrc" >:/quickprint/quickprint.png</iconset>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>11</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="txtHeading" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down Expand Up @@ -91,16 +83,32 @@
<widget class="QTextEdit" name="teCopyright" />
</item>
<item row="7" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Page Size</string>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QComboBox" name="cboPageSize" />
</item>
<item row="9" column="0" >
<widget class="QGroupBox" name="grpOuput" >
<property name="title" >
<string>Output</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>11</number>
</property>
<property name="spacing" >
<number>6</number>
<property name="topMargin" >
<number>11</number>
</property>
<property name="rightMargin" >
<number>11</number>
</property>
<property name="bottomMargin" >
<number>11</number>
</property>
<item row="0" column="0" >
<widget class="QRadioButton" name="radUseIncrementedFileName" >
Expand Down Expand Up @@ -132,7 +140,7 @@
</layout>
</widget>
</item>
<item row="8" column="0" >
<item row="10" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Note: If you want more control over the map layout please use the map composer function in QGIS.</string>
Expand All @@ -142,7 +150,7 @@
</property>
</widget>
</item>
<item row="9" column="0" >
<item row="11" column="0" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
Expand Down

0 comments on commit 8b81139

Please sign in to comment.