Skip to content

Commit 8b81139

Browse files
author
timlinux
committed
Support user defined page size selection
git-svn-id: http://svn.osgeo.org/qgis/trunk@8108 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent bcc8ecd commit 8b81139

File tree

3 files changed

+57
-17
lines changed

3 files changed

+57
-17
lines changed

src/plugins/quick_print/quickprintgui.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <QMessageBox>
1919
#include <QFileDialog>
2020
#include <QSettings>
21+
#include <QPrinter>
2122

2223

2324
//standard includes
@@ -29,6 +30,35 @@ QuickPrintGui::QuickPrintGui( QgsMapCanvas * thepMapCanvas,
2930
setupUi(this);
3031
readSettings();
3132
grpOuput->hide(); //until properly implemented
33+
cboPageSize->addItem("A0 (841 x 1189 mm)","QPrinter::A0");
34+
cboPageSize->addItem("A1 (594 x 841 mm)","QPrinter::A1");
35+
cboPageSize->addItem("A2 (420 x 594 mm)","QPrinter::A2");
36+
cboPageSize->addItem("A3 (297 x 420 mm)","QPrinter::A3");
37+
cboPageSize->addItem("A4 (210 x 297 mm, 8.26 x 11.69 inches)","QPrinter::A4");
38+
cboPageSize->addItem("A5 (148 x 210 mm)","QPrinter::A5");
39+
cboPageSize->addItem("A6 (105 x 148 mm)","QPrinter::A6");
40+
cboPageSize->addItem("A7 (74 x 105 mm)","QPrinter::A7");
41+
cboPageSize->addItem("A8 (52 x 74 mm)","QPrinter::A8");
42+
cboPageSize->addItem("A9 (37 x 52 mm)","QPrinter::A9");
43+
cboPageSize->addItem("B0 (1030 x 1456 mm)","QPrinter::B0");
44+
cboPageSize->addItem("B1 (728 x 1030 mm)","QPrinter::B1");
45+
cboPageSize->addItem("B10 (32 x 45 mm)","QPrinter::B10");
46+
cboPageSize->addItem("B2 (515 x 728 mm)","QPrinter::B2");
47+
cboPageSize->addItem("B3 (364 x 515 mm)","QPrinter::B3");
48+
cboPageSize->addItem("B4 (257 x 364 mm)","QPrinter::B4");
49+
cboPageSize->addItem("B5 (182 x 257 mm, 7.17 x 10.13 inches)","QPrinter::B5");
50+
cboPageSize->addItem("B6 (128 x 182 mm)","QPrinter::B6");
51+
cboPageSize->addItem("B7 (91 x 128 mm)","QPrinter::B7");
52+
cboPageSize->addItem("B8 (64 x 91 mm)","QPrinter::B8");
53+
cboPageSize->addItem("B9 (45 x 64 mm)","QPrinter::B9");
54+
cboPageSize->addItem("C5E (163 x 229 mm)","QPrinter::C5E");
55+
cboPageSize->addItem("Comm10E (105 x 241 mm, U.S. Common 10 Envelope)","QPrinter::Comm10E");
56+
cboPageSize->addItem("DLE (110 x 220 mm)","QPrinter::DLE");
57+
cboPageSize->addItem("Executive (7.5 x 10 inches, 191 x 254 mm)","QPrinter::Executive");
58+
cboPageSize->addItem("Folio (210 x 330 mm)","QPrinter::Folio");
59+
cboPageSize->addItem("Ledger (432 x 279 mm)","QPrinter::Ledger");
60+
cboPageSize->addItem("Legal (8.5 x 14 inches, 216 x 356 mm)","QPrinter::Legal");
61+
cboPageSize->addItem("Letter (8.5 x 11 inches, 216 x 279 mm)","QPrinter::Letter");
3262
}
3363

3464
QuickPrintGui::~QuickPrintGui()
@@ -105,6 +135,9 @@ void QuickPrintGui::on_buttonBox_accepted()
105135
myQuickPrint.setLogo1(QgsApplication::iconsPath() + "/qgis-icon.png");
106136
myQuickPrint.setNorthArrow(myNorthArrowFile);
107137
myQuickPrint.setOutputPdf(myOutputFileName);
138+
QString myPageSizeString = cboPageSize->itemData(cboPageSize->currentIndex()).toString();
139+
myQuickPrint.setPageSize(QgsQuickPrint::stringToPageSize( myPageSizeString ));
140+
qDebug("Page size : " + myPageSizeString.toLocal8Bit());
108141
myQuickPrint.printMap();
109142
}
110143
else

src/plugins/quick_print/quickprintgui.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <ui_quickprintguibase.h>
2222
#include "qgsmapcanvas.h"
2323

24-
2524
/**
2625
@author Tim Sutton
2726
*/

src/plugins/quick_print/quickprintguibase.ui

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<rect>
66
<x>0</x>
77
<y>0</y>
8-
<width>419</width>
9-
<height>443</height>
8+
<width>427</width>
9+
<height>522</height>
1010
</rect>
1111
</property>
1212
<property name="windowTitle" >
@@ -16,18 +16,10 @@
1616
<iconset resource="quickprint.qrc" >:/quickprint/quickprint.png</iconset>
1717
</property>
1818
<layout class="QGridLayout" >
19-
<property name="margin" >
20-
<number>11</number>
21-
</property>
22-
<property name="spacing" >
23-
<number>6</number>
24-
</property>
2519
<item row="0" column="0" >
2620
<widget class="QLabel" name="txtHeading" >
2721
<property name="sizePolicy" >
28-
<sizepolicy>
29-
<hsizetype>0</hsizetype>
30-
<vsizetype>0</vsizetype>
22+
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
3123
<horstretch>0</horstretch>
3224
<verstretch>0</verstretch>
3325
</sizepolicy>
@@ -91,16 +83,32 @@
9183
<widget class="QTextEdit" name="teCopyright" />
9284
</item>
9385
<item row="7" column="0" >
86+
<widget class="QLabel" name="label_2" >
87+
<property name="text" >
88+
<string>Page Size</string>
89+
</property>
90+
</widget>
91+
</item>
92+
<item row="8" column="0" >
93+
<widget class="QComboBox" name="cboPageSize" />
94+
</item>
95+
<item row="9" column="0" >
9496
<widget class="QGroupBox" name="grpOuput" >
9597
<property name="title" >
9698
<string>Output</string>
9799
</property>
98100
<layout class="QGridLayout" >
99-
<property name="margin" >
101+
<property name="leftMargin" >
100102
<number>11</number>
101103
</property>
102-
<property name="spacing" >
103-
<number>6</number>
104+
<property name="topMargin" >
105+
<number>11</number>
106+
</property>
107+
<property name="rightMargin" >
108+
<number>11</number>
109+
</property>
110+
<property name="bottomMargin" >
111+
<number>11</number>
104112
</property>
105113
<item row="0" column="0" >
106114
<widget class="QRadioButton" name="radUseIncrementedFileName" >
@@ -132,7 +140,7 @@
132140
</layout>
133141
</widget>
134142
</item>
135-
<item row="8" column="0" >
143+
<item row="10" column="0" >
136144
<widget class="QLabel" name="label" >
137145
<property name="text" >
138146
<string>Note: If you want more control over the map layout please use the map composer function in QGIS.</string>
@@ -142,7 +150,7 @@
142150
</property>
143151
</widget>
144152
</item>
145-
<item row="9" column="0" >
153+
<item row="11" column="0" >
146154
<widget class="QDialogButtonBox" name="buttonBox" >
147155
<property name="orientation" >
148156
<enum>Qt::Horizontal</enum>

0 commit comments

Comments
 (0)