1 | // Copyright (C) 2014 John Layt <jlayt@kde.org> |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "qpagesize.h" |
5 | |
6 | #include <QtCore/qcoreapplication.h> |
7 | #include <QtCore/qdebug.h> |
8 | #include <QtCore/qpoint.h> |
9 | #include <QtCore/qrect.h> |
10 | #include <QtCore/qsize.h> |
11 | #include <QtCore/qstring.h> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | using namespace Qt::StringLiterals; |
16 | |
17 | QT_IMPL_METATYPE_EXTERN(QPageSize) |
18 | QT_IMPL_METATYPE_EXTERN_TAGGED(QPageSize::PageSizeId, QPageSize__PageSizeId) |
19 | QT_IMPL_METATYPE_EXTERN_TAGGED(QPageSize::Unit, QPageSize__Unit) |
20 | |
21 | // Define the Windows DMPAPER sizes for use in the look-up table |
22 | // See http://msdn.microsoft.com/en-us/library/windows/desktop/dd319099.aspx |
23 | |
24 | enum WindowsDmPaper { |
25 | DMPAPER_NONE = 0, // Not a DMPAPER, use for sizes without a DMPAPER value |
26 | DMPAPER_LETTER = 1, |
27 | DMPAPER_LETTERSMALL = 2, |
28 | DMPAPER_TABLOID = 3, |
29 | DMPAPER_LEDGER = 4, |
30 | DMPAPER_LEGAL = 5, |
31 | DMPAPER_STATEMENT = 6, |
32 | DMPAPER_EXECUTIVE = 7, |
33 | DMPAPER_A3 = 8, |
34 | DMPAPER_A4 = 9, |
35 | DMPAPER_A4SMALL = 10, |
36 | DMPAPER_A5 = 11, |
37 | DMPAPER_B4 = 12, |
38 | DMPAPER_B5 = 13, |
39 | DMPAPER_FOLIO = 14, |
40 | DMPAPER_QUARTO = 15, |
41 | DMPAPER_10X14 = 16, |
42 | DMPAPER_11X17 = 17, |
43 | DMPAPER_NOTE = 18, |
44 | DMPAPER_ENV_9 = 19, |
45 | DMPAPER_ENV_10 = 20, |
46 | DMPAPER_ENV_11 = 21, |
47 | DMPAPER_ENV_12 = 22, |
48 | DMPAPER_ENV_14 = 23, |
49 | DMPAPER_CSHEET = 24, |
50 | DMPAPER_DSHEET = 25, |
51 | DMPAPER_ESHEET = 26, |
52 | DMPAPER_ENV_DL = 27, |
53 | DMPAPER_ENV_C5 = 28, |
54 | DMPAPER_ENV_C3 = 29, |
55 | DMPAPER_ENV_C4 = 30, |
56 | DMPAPER_ENV_C6 = 31, |
57 | DMPAPER_ENV_C65 = 32, |
58 | DMPAPER_ENV_B4 = 33, |
59 | DMPAPER_ENV_B5 = 34, |
60 | DMPAPER_ENV_B6 = 35, |
61 | DMPAPER_ENV_ITALY = 36, |
62 | DMPAPER_ENV_MONARCH = 37, |
63 | DMPAPER_ENV_PERSONAL = 38, |
64 | DMPAPER_FANFOLD_US = 39, |
65 | DMPAPER_FANFOLD_STD_GERMAN = 40, |
66 | DMPAPER_FANFOLD_LGL_GERMAN = 41, |
67 | DMPAPER_ISO_B4 = 42, |
68 | DMPAPER_JAPANESE_POSTCARD = 43, |
69 | DMPAPER_9X11 = 44, |
70 | DMPAPER_10X11 = 45, |
71 | DMPAPER_15X11 = 46, |
72 | DMPAPER_ENV_INVITE = 47, |
73 | DMPAPER_RESERVED_48 = 48, |
74 | DMPAPER_RESERVED_49 = 49, |
75 | = 50, |
76 | = 51, |
77 | = 52, |
78 | = 53, |
79 | DMPAPER_LETTER_TRANSVERSE = 54, |
80 | DMPAPER_A4_TRANSVERSE = 55, |
81 | = 56, |
82 | DMPAPER_A_PLUS = 57, |
83 | DMPAPER_B_PLUS = 58, |
84 | DMPAPER_LETTER_PLUS = 59, |
85 | DMPAPER_A4_PLUS = 60, |
86 | DMPAPER_A5_TRANSVERSE = 61, |
87 | DMPAPER_B5_TRANSVERSE = 62, |
88 | = 63, |
89 | = 64, |
90 | = 65, |
91 | DMPAPER_A2 = 66, |
92 | DMPAPER_A3_TRANSVERSE = 67, |
93 | = 68, |
94 | DMPAPER_DBL_JAPANESE_POSTCARD = 69, |
95 | DMPAPER_A6 = 70, |
96 | DMPAPER_JENV_KAKU2 = 71, |
97 | DMPAPER_JENV_KAKU3 = 72, |
98 | DMPAPER_JENV_CHOU3 = 73, |
99 | DMPAPER_JENV_CHOU4 = 74, |
100 | DMPAPER_LETTER_ROTATED = 75, |
101 | DMPAPER_A3_ROTATED = 76, |
102 | DMPAPER_A4_ROTATED = 77, |
103 | DMPAPER_A5_ROTATED = 78, |
104 | DMPAPER_B4_JIS_ROTATED = 79, |
105 | DMPAPER_B5_JIS_ROTATED = 80, |
106 | DMPAPER_JAPANESE_POSTCARD_ROTATED = 81, |
107 | DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82, |
108 | DMPAPER_A6_ROTATED = 83, |
109 | DMPAPER_JENV_KAKU2_ROTATED = 84, |
110 | DMPAPER_JENV_KAKU3_ROTATED = 85, |
111 | DMPAPER_JENV_CHOU3_ROTATED = 86, |
112 | DMPAPER_JENV_CHOU4_ROTATED = 87, |
113 | DMPAPER_B6_JIS = 88, |
114 | DMPAPER_B6_JIS_ROTATED = 89, |
115 | DMPAPER_12X11 = 90, |
116 | DMPAPER_JENV_YOU4 = 91, |
117 | DMPAPER_JENV_YOU4_ROTATED = 92, |
118 | DMPAPER_P16K = 93, |
119 | DMPAPER_P32K = 94, |
120 | DMPAPER_P32KBIG = 95, |
121 | DMPAPER_PENV_1 = 96, |
122 | DMPAPER_PENV_2 = 97, |
123 | DMPAPER_PENV_3 = 98, |
124 | DMPAPER_PENV_4 = 99, |
125 | DMPAPER_PENV_5 = 100, |
126 | DMPAPER_PENV_6 = 101, |
127 | DMPAPER_PENV_7 = 102, |
128 | DMPAPER_PENV_8 = 103, |
129 | DMPAPER_PENV_9 = 104, |
130 | DMPAPER_PENV_10 = 105, |
131 | DMPAPER_P16K_ROTATED = 106, |
132 | DMPAPER_P32K_ROTATED = 107, |
133 | DMPAPER_P32KBIG_ROTATED = 108, |
134 | DMPAPER_PENV_1_ROTATED = 109, |
135 | DMPAPER_PENV_2_ROTATED = 110, |
136 | DMPAPER_PENV_3_ROTATED = 111, |
137 | DMPAPER_PENV_4_ROTATED = 112, |
138 | DMPAPER_PENV_5_ROTATED = 113, |
139 | DMPAPER_PENV_6_ROTATED = 114, |
140 | DMPAPER_PENV_7_ROTATED = 115, |
141 | DMPAPER_PENV_8_ROTATED = 116, |
142 | DMPAPER_PENV_9_ROTATED = 117, |
143 | DMPAPER_PENV_10_ROTATED = 118, |
144 | DMPAPER_LAST = DMPAPER_PENV_10_ROTATED, |
145 | DMPAPER_USER = 256 |
146 | }; |
147 | |
148 | // Conversion table for historic page size values that we don't support. |
149 | // These are deprecated in PPD and strongly discouraged from being used, |
150 | // so convert them to usable page sizes to support older print devices. |
151 | // The paper source orientation will be handled in the QPrintMedia class, |
152 | // we're only concerned about the standard size in QPageSize. |
153 | // _ROTATED = 90 degrees or QPageLayout::Landscape |
154 | // _TRANSVERSE = 180 degrees or QPageLayout::ReversePortrait |
155 | |
156 | static const int qt_windowsConversion[][2] = { |
157 | {DMPAPER_11X17, DMPAPER_TABLOID}, // = DMPAPER_LEDGER rotated |
158 | {DMPAPER_A3_EXTRA_TRANSVERSE, DMPAPER_A3_EXTRA}, |
159 | {DMPAPER_A3_ROTATED, DMPAPER_A3}, |
160 | {DMPAPER_A3_TRANSVERSE, DMPAPER_A3}, |
161 | {DMPAPER_A4_ROTATED, DMPAPER_A4}, |
162 | {DMPAPER_A4_TRANSVERSE, DMPAPER_A4}, |
163 | {DMPAPER_A5_ROTATED, DMPAPER_A5}, |
164 | {DMPAPER_A5_TRANSVERSE, DMPAPER_A5}, |
165 | {DMPAPER_A6_ROTATED, DMPAPER_A6}, |
166 | {DMPAPER_B4_JIS_ROTATED, DMPAPER_B4}, |
167 | {DMPAPER_B5_JIS_ROTATED, DMPAPER_B5}, |
168 | {DMPAPER_B5_TRANSVERSE, DMPAPER_B5}, |
169 | {DMPAPER_B6_JIS_ROTATED, DMPAPER_B6_JIS}, |
170 | {DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED, DMPAPER_DBL_JAPANESE_POSTCARD}, |
171 | {DMPAPER_JAPANESE_POSTCARD_ROTATED, DMPAPER_JAPANESE_POSTCARD}, |
172 | {DMPAPER_JENV_CHOU3_ROTATED, DMPAPER_JENV_CHOU3}, |
173 | {DMPAPER_JENV_CHOU4_ROTATED, DMPAPER_JENV_CHOU4}, |
174 | {DMPAPER_JENV_KAKU2_ROTATED, DMPAPER_JENV_KAKU2}, |
175 | {DMPAPER_JENV_KAKU3_ROTATED, DMPAPER_JENV_KAKU3}, |
176 | {DMPAPER_JENV_YOU4_ROTATED, DMPAPER_JENV_YOU4}, |
177 | {DMPAPER_LETTER_EXTRA_TRANSVERSE, DMPAPER_LETTER_EXTRA}, |
178 | {DMPAPER_LETTER_ROTATED, DMPAPER_LETTER}, |
179 | {DMPAPER_LETTER_TRANSVERSE, DMPAPER_LETTER}, |
180 | {DMPAPER_P16K_ROTATED, DMPAPER_P16K}, |
181 | {DMPAPER_P32K_ROTATED, DMPAPER_P32K}, |
182 | {DMPAPER_P32KBIG_ROTATED, DMPAPER_P32KBIG}, |
183 | {DMPAPER_PENV_1_ROTATED, DMPAPER_PENV_1}, |
184 | {DMPAPER_PENV_2_ROTATED, DMPAPER_PENV_2}, |
185 | {DMPAPER_PENV_3_ROTATED, DMPAPER_PENV_3}, |
186 | {DMPAPER_PENV_4_ROTATED, DMPAPER_PENV_4}, |
187 | {DMPAPER_PENV_5_ROTATED, DMPAPER_PENV_5}, |
188 | {DMPAPER_PENV_6_ROTATED, DMPAPER_PENV_6}, |
189 | {DMPAPER_PENV_7_ROTATED, DMPAPER_PENV_7}, |
190 | {DMPAPER_PENV_8_ROTATED, DMPAPER_PENV_8}, |
191 | {DMPAPER_PENV_9_ROTATED, DMPAPER_PENV_9}, |
192 | {DMPAPER_PENV_10_ROTATED, DMPAPER_PENV_10} // Is = DMPAPER_LAST, use as loop terminator |
193 | }; |
194 | |
195 | // Standard sizes data |
196 | struct StandardPageSize { |
197 | QPageSize::PageSizeId id : 8; |
198 | int windowsId : 16; // Windows DMPAPER value |
199 | QPageSize::Unit definitionUnits : 8; // Standard definition size, e.g. ISO uses mm, ANSI uses inches |
200 | int widthPoints : 16; |
201 | int heightPoints : 16; |
202 | qreal widthMillimeters; |
203 | qreal heightMillimeters; |
204 | qreal widthInches; |
205 | qreal heightInches; |
206 | const char mediaOption[20]; // PPD standard mediaOption ID |
207 | }; |
208 | |
209 | // Standard page sizes taken from the Postscript PPD Standard v4.3 |
210 | // See http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf |
211 | // Excludes all Transverse and Rotated sizes |
212 | // NB! This table needs to be in sync with QPageSize::PageSizeId |
213 | static const StandardPageSize qt_pageSizes[] = { |
214 | |
215 | // Old Qt sizes including ISO, US, ANSI and other standards |
216 | {.id: QPageSize::Letter , .windowsId: DMPAPER_LETTER , .definitionUnits: QPageSize::Inch , .widthPoints: 612, .heightPoints: 792, .widthMillimeters: 215.9, .heightMillimeters: 279.4, .widthInches: 8.5 , .heightInches: 11 , .mediaOption: "Letter" }, |
217 | {.id: QPageSize::Legal , .windowsId: DMPAPER_LEGAL , .definitionUnits: QPageSize::Inch , .widthPoints: 612, .heightPoints: 1008, .widthMillimeters: 215.9, .heightMillimeters: 355.6, .widthInches: 8.5 , .heightInches: 14 , .mediaOption: "Legal" }, |
218 | {.id: QPageSize::Executive , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 540, .heightPoints: 720, .widthMillimeters: 190.5, .heightMillimeters: 254 , .widthInches: 7.5 , .heightInches: 10 , .mediaOption: "Executive.7.5x10in" }, // Qt size differs from Postscript / Windows |
219 | {.id: QPageSize::A0 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 2384, .heightPoints: 3370, .widthMillimeters: 841 , .heightMillimeters: 1189 , .widthInches: 33.11, .heightInches: 46.81, .mediaOption: "A0" }, |
220 | {.id: QPageSize::A1 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1684, .heightPoints: 2384, .widthMillimeters: 594 , .heightMillimeters: 841 , .widthInches: 23.39, .heightInches: 33.11, .mediaOption: "A1" }, |
221 | {.id: QPageSize::A2 , .windowsId: DMPAPER_A2 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1191, .heightPoints: 1684, .widthMillimeters: 420 , .heightMillimeters: 594 , .widthInches: 16.54, .heightInches: 23.39, .mediaOption: "A2" }, |
222 | {.id: QPageSize::A3 , .windowsId: DMPAPER_A3 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 842, .heightPoints: 1191, .widthMillimeters: 297 , .heightMillimeters: 420 , .widthInches: 11.69, .heightInches: 16.54, .mediaOption: "A3" }, |
223 | {.id: QPageSize::A4 , .windowsId: DMPAPER_A4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 595, .heightPoints: 842, .widthMillimeters: 210 , .heightMillimeters: 297 , .widthInches: 8.27, .heightInches: 11.69, .mediaOption: "A4" }, |
224 | {.id: QPageSize::A5 , .windowsId: DMPAPER_A5 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 420, .heightPoints: 595, .widthMillimeters: 148 , .heightMillimeters: 210 , .widthInches: 5.83, .heightInches: 8.27, .mediaOption: "A5" }, |
225 | {.id: QPageSize::A6 , .windowsId: DMPAPER_A6 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 297, .heightPoints: 420, .widthMillimeters: 105 , .heightMillimeters: 148 , .widthInches: 4.13, .heightInches: 5.83, .mediaOption: "A6" }, |
226 | {.id: QPageSize::A7 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 210, .heightPoints: 297, .widthMillimeters: 74 , .heightMillimeters: 105 , .widthInches: 2.91, .heightInches: 4.13, .mediaOption: "A7" }, |
227 | {.id: QPageSize::A8 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 148, .heightPoints: 210, .widthMillimeters: 52 , .heightMillimeters: 74 , .widthInches: 2.05, .heightInches: 2.91, .mediaOption: "A8" }, |
228 | {.id: QPageSize::A9 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 105, .heightPoints: 148, .widthMillimeters: 37 , .heightMillimeters: 52 , .widthInches: 1.46, .heightInches: 2.05, .mediaOption: "A9" }, |
229 | {.id: QPageSize::A10 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 73, .heightPoints: 105, .widthMillimeters: 26 , .heightMillimeters: 37 , .widthInches: 1.02, .heightInches: 1.46, .mediaOption: "A10" }, |
230 | {.id: QPageSize::B0 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 2835, .heightPoints: 4008, .widthMillimeters: 1000 , .heightMillimeters: 1414 , .widthInches: 39.37, .heightInches: 55.67, .mediaOption: "ISOB0" }, |
231 | {.id: QPageSize::B1 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 2004, .heightPoints: 2835, .widthMillimeters: 707 , .heightMillimeters: 1000 , .widthInches: 27.83, .heightInches: 39.37, .mediaOption: "ISOB1" }, |
232 | {.id: QPageSize::B2 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1417, .heightPoints: 2004, .widthMillimeters: 500 , .heightMillimeters: 707 , .widthInches: 19.68, .heightInches: 27.83, .mediaOption: "ISOB2" }, |
233 | {.id: QPageSize::B3 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1001, .heightPoints: 1417, .widthMillimeters: 353 , .heightMillimeters: 500 , .widthInches: 13.9 , .heightInches: 19.68, .mediaOption: "ISOB3" }, |
234 | {.id: QPageSize::B4 , .windowsId: DMPAPER_ISO_B4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 709, .heightPoints: 1001, .widthMillimeters: 250 , .heightMillimeters: 353 , .widthInches: 9.84, .heightInches: 13.9 , .mediaOption: "ISOB4" }, |
235 | {.id: QPageSize::B5 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 499, .heightPoints: 709, .widthMillimeters: 176 , .heightMillimeters: 250 , .widthInches: 6.9 , .heightInches: 9.8 , .mediaOption: "ISOB5" }, |
236 | {.id: QPageSize::B6 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 354, .heightPoints: 499, .widthMillimeters: 125 , .heightMillimeters: 176 , .widthInches: 4.92, .heightInches: 6.93, .mediaOption: "ISOB6" }, |
237 | {.id: QPageSize::B7 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 249, .heightPoints: 354, .widthMillimeters: 88 , .heightMillimeters: 125 , .widthInches: 3.46, .heightInches: 4.92, .mediaOption: "ISOB7" }, |
238 | {.id: QPageSize::B8 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 176, .heightPoints: 249, .widthMillimeters: 62 , .heightMillimeters: 88 , .widthInches: 2.44, .heightInches: 3.46, .mediaOption: "ISOB8" }, |
239 | {.id: QPageSize::B9 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 125, .heightPoints: 176, .widthMillimeters: 44 , .heightMillimeters: 62 , .widthInches: 1.73, .heightInches: 2.44, .mediaOption: "ISOB9" }, |
240 | {.id: QPageSize::B10 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 88, .heightPoints: 125, .widthMillimeters: 31 , .heightMillimeters: 44 , .widthInches: 1.22, .heightInches: 1.73, .mediaOption: "ISOB10" }, |
241 | {.id: QPageSize::C5E , .windowsId: DMPAPER_ENV_C5 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 459, .heightPoints: 649, .widthMillimeters: 162 , .heightMillimeters: 229 , .widthInches: 6.38, .heightInches: 9.02, .mediaOption: "EnvC5" }, |
242 | {.id: QPageSize::Comm10E , .windowsId: DMPAPER_ENV_10 , .definitionUnits: QPageSize::Inch , .widthPoints: 297, .heightPoints: 684, .widthMillimeters: 104.8, .heightMillimeters: 241.3, .widthInches: 4.12, .heightInches: 9.5 , .mediaOption: "Env10" }, |
243 | {.id: QPageSize::DLE , .windowsId: DMPAPER_ENV_DL , .definitionUnits: QPageSize::Millimeter, .widthPoints: 312, .heightPoints: 624, .widthMillimeters: 110 , .heightMillimeters: 220 , .widthInches: 4.33, .heightInches: 8.66, .mediaOption: "EnvDL" }, |
244 | {.id: QPageSize::Folio , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 595, .heightPoints: 935, .widthMillimeters: 210 , .heightMillimeters: 330 , .widthInches: 8.27, .heightInches: 13 , .mediaOption: "Folio" }, |
245 | {.id: QPageSize::Ledger , .windowsId: DMPAPER_LEDGER , .definitionUnits: QPageSize::Inch , .widthPoints: 1224, .heightPoints: 792, .widthMillimeters: 431.8, .heightMillimeters: 279.4, .widthInches: 17 , .heightInches: 11 , .mediaOption: "Ledger" }, |
246 | {.id: QPageSize::Tabloid , .windowsId: DMPAPER_TABLOID , .definitionUnits: QPageSize::Inch , .widthPoints: 792, .heightPoints: 1224, .widthMillimeters: 279.4, .heightMillimeters: 431.8, .widthInches: 11 , .heightInches: 17 , .mediaOption: "Tabloid" }, |
247 | {.id: QPageSize::Custom , .windowsId: DMPAPER_USER , .definitionUnits: QPageSize::Millimeter, .widthPoints: -1, .heightPoints: -1, .widthMillimeters: -1. , .heightMillimeters: -1 , .widthInches: -1 , .heightInches: -1 , .mediaOption: "Custom" }, // Special case to keep in sync with QPageSize::PageSizeId |
248 | |
249 | // ISO Standard Sizes |
250 | {.id: QPageSize::A3Extra , .windowsId: DMPAPER_A3_EXTRA , .definitionUnits: QPageSize::Millimeter, .widthPoints: 913, .heightPoints: 1262, .widthMillimeters: 322 , .heightMillimeters: 445 , .widthInches: 12.67, .heightInches: 17.52, .mediaOption: "A3Extra" }, |
251 | {.id: QPageSize::A4Extra , .windowsId: DMPAPER_A4_EXTRA , .definitionUnits: QPageSize::Millimeter, .widthPoints: 667, .heightPoints: 914, .widthMillimeters: 235.5, .heightMillimeters: 322.3, .widthInches: 9.27, .heightInches: 12.69, .mediaOption: "A4Extra" }, |
252 | {.id: QPageSize::A4Plus , .windowsId: DMPAPER_A4_PLUS , .definitionUnits: QPageSize::Millimeter, .widthPoints: 595, .heightPoints: 936, .widthMillimeters: 210 , .heightMillimeters: 330 , .widthInches: 8.27, .heightInches: 13 , .mediaOption: "A4Plus" }, |
253 | {.id: QPageSize::A4Small , .windowsId: DMPAPER_A4SMALL , .definitionUnits: QPageSize::Millimeter, .widthPoints: 595, .heightPoints: 842, .widthMillimeters: 210 , .heightMillimeters: 297 , .widthInches: 8.27, .heightInches: 11.69, .mediaOption: "A4Small" }, |
254 | {.id: QPageSize::A5Extra , .windowsId: DMPAPER_A5_EXTRA , .definitionUnits: QPageSize::Millimeter, .widthPoints: 492, .heightPoints: 668, .widthMillimeters: 174 , .heightMillimeters: 235 , .widthInches: 6.85, .heightInches: 9.25, .mediaOption: "A5Extra" }, |
255 | {.id: QPageSize::B5Extra , .windowsId: DMPAPER_B5_EXTRA , .definitionUnits: QPageSize::Millimeter, .widthPoints: 570, .heightPoints: 782, .widthMillimeters: 201 , .heightMillimeters: 276 , .widthInches: 7.9 , .heightInches: 10.8 , .mediaOption: "ISOB5Extra" }, |
256 | |
257 | // JIS Standard Sizes |
258 | {.id: QPageSize::JisB0 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 2920, .heightPoints: 4127, .widthMillimeters: 1030 , .heightMillimeters: 1456 , .widthInches: 40.55, .heightInches: 57.32, .mediaOption: "B0" }, |
259 | {.id: QPageSize::JisB1 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 2064, .heightPoints: 2920, .widthMillimeters: 728 , .heightMillimeters: 1030 , .widthInches: 28.66, .heightInches: 40.55, .mediaOption: "B1" }, |
260 | {.id: QPageSize::JisB2 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1460, .heightPoints: 2064, .widthMillimeters: 515 , .heightMillimeters: 728 , .widthInches: 20.28, .heightInches: 28.66, .mediaOption: "B2" }, |
261 | {.id: QPageSize::JisB3 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1032, .heightPoints: 1460, .widthMillimeters: 364 , .heightMillimeters: 515 , .widthInches: 14.33, .heightInches: 20.28, .mediaOption: "B3" }, |
262 | {.id: QPageSize::JisB4 , .windowsId: DMPAPER_B4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 729, .heightPoints: 1032, .widthMillimeters: 257 , .heightMillimeters: 364 , .widthInches: 10.12, .heightInches: 14.33, .mediaOption: "B4" }, |
263 | {.id: QPageSize::JisB5 , .windowsId: DMPAPER_B5 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 516, .heightPoints: 729, .widthMillimeters: 182 , .heightMillimeters: 257 , .widthInches: 7.17, .heightInches: 10.12, .mediaOption: "B5" }, |
264 | {.id: QPageSize::JisB6 , .windowsId: DMPAPER_B6_JIS , .definitionUnits: QPageSize::Millimeter, .widthPoints: 363, .heightPoints: 516, .widthMillimeters: 128 , .heightMillimeters: 182 , .widthInches: 5.04, .heightInches: 7.17, .mediaOption: "B6" }, |
265 | {.id: QPageSize::JisB7 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 258, .heightPoints: 363, .widthMillimeters: 91 , .heightMillimeters: 128 , .widthInches: 3.58, .heightInches: 5.04, .mediaOption: "B7" }, |
266 | {.id: QPageSize::JisB8 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 181, .heightPoints: 258, .widthMillimeters: 64 , .heightMillimeters: 91 , .widthInches: 2.52, .heightInches: 3.58, .mediaOption: "B8" }, |
267 | {.id: QPageSize::JisB9 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 127, .heightPoints: 181, .widthMillimeters: 45 , .heightMillimeters: 64 , .widthInches: 1.77, .heightInches: 2.52, .mediaOption: "B9" }, |
268 | {.id: QPageSize::JisB10 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 91, .heightPoints: 127, .widthMillimeters: 32 , .heightMillimeters: 45 , .widthInches: 1.26, .heightInches: 1.77, .mediaOption: "B10" }, |
269 | |
270 | // ANSI / US Standard sizes |
271 | {.id: QPageSize::AnsiC , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 1224, .heightPoints: 1584, .widthMillimeters: 431.8, .heightMillimeters: 558.8, .widthInches: 17 , .heightInches: 22 , .mediaOption: "AnsiC" }, |
272 | {.id: QPageSize::AnsiD , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 1584, .heightPoints: 2448, .widthMillimeters: 558.8, .heightMillimeters: 863.6, .widthInches: 22 , .heightInches: 34 , .mediaOption: "AnsiD" }, |
273 | {.id: QPageSize::AnsiE , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 2448, .heightPoints: 3168, .widthMillimeters: 863.6, .heightMillimeters: 1118 , .widthInches: 34 , .heightInches: 44 , .mediaOption: "AnsiE" }, |
274 | {.id: QPageSize::LegalExtra , .windowsId: DMPAPER_LEGAL_EXTRA , .definitionUnits: QPageSize::Inch , .widthPoints: 684, .heightPoints: 1080, .widthMillimeters: 241.3, .heightMillimeters: 381 , .widthInches: 9.5 , .heightInches: 15 , .mediaOption: "LegalExtra" }, |
275 | {.id: QPageSize::LetterExtra , .windowsId: DMPAPER_LETTER_EXTRA , .definitionUnits: QPageSize::Inch , .widthPoints: 684, .heightPoints: 864, .widthMillimeters: 241.3, .heightMillimeters: 304.8, .widthInches: 9.5 , .heightInches: 12 , .mediaOption: "LetterExtra" }, |
276 | {.id: QPageSize::LetterPlus , .windowsId: DMPAPER_LETTER_PLUS , .definitionUnits: QPageSize::Inch , .widthPoints: 612, .heightPoints: 914, .widthMillimeters: 215.9, .heightMillimeters: 322.3, .widthInches: 8.5 , .heightInches: 12.69, .mediaOption: "LetterPlus" }, |
277 | {.id: QPageSize::LetterSmall , .windowsId: DMPAPER_LETTERSMALL , .definitionUnits: QPageSize::Inch , .widthPoints: 612, .heightPoints: 792, .widthMillimeters: 215.9, .heightMillimeters: 279.4, .widthInches: 8.5 , .heightInches: 11 , .mediaOption: "LetterSmall" }, |
278 | {.id: QPageSize::TabloidExtra , .windowsId: DMPAPER_TABLOID_EXTRA , .definitionUnits: QPageSize::Inch , .widthPoints: 864, .heightPoints: 1296, .widthMillimeters: 304.8, .heightMillimeters: 457.2, .widthInches: 12 , .heightInches: 18 , .mediaOption: "TabloidExtra" }, |
279 | |
280 | // Architectural sizes |
281 | {.id: QPageSize::ArchA , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 648, .heightPoints: 864, .widthMillimeters: 228.6, .heightMillimeters: 304.8, .widthInches: 9 , .heightInches: 12 , .mediaOption: "ARCHA" }, |
282 | {.id: QPageSize::ArchB , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 864, .heightPoints: 1296, .widthMillimeters: 304.8, .heightMillimeters: 457.2, .widthInches: 12 , .heightInches: 18 , .mediaOption: "ARCHB" }, |
283 | {.id: QPageSize::ArchC , .windowsId: DMPAPER_CSHEET , .definitionUnits: QPageSize::Inch , .widthPoints: 1296, .heightPoints: 1728, .widthMillimeters: 457.2, .heightMillimeters: 609.6, .widthInches: 18 , .heightInches: 24 , .mediaOption: "ARCHC" }, |
284 | {.id: QPageSize::ArchD , .windowsId: DMPAPER_DSHEET , .definitionUnits: QPageSize::Inch , .widthPoints: 1728, .heightPoints: 2592, .widthMillimeters: 609.6, .heightMillimeters: 914.4, .widthInches: 24 , .heightInches: 36 , .mediaOption: "ARCHD" }, |
285 | {.id: QPageSize::ArchE , .windowsId: DMPAPER_ESHEET , .definitionUnits: QPageSize::Inch , .widthPoints: 2592, .heightPoints: 3456, .widthMillimeters: 914.4, .heightMillimeters: 1219 , .widthInches: 36 , .heightInches: 48 , .mediaOption: "ARCHE" }, |
286 | |
287 | // Inch-based Sizes |
288 | {.id: QPageSize::Imperial7x9 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 504, .heightPoints: 648, .widthMillimeters: 177.8, .heightMillimeters: 228.6, .widthInches: 7 , .heightInches: 9 , .mediaOption: "7x9" }, |
289 | {.id: QPageSize::Imperial8x10 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 576, .heightPoints: 720, .widthMillimeters: 203.2, .heightMillimeters: 254 , .widthInches: 8 , .heightInches: 10 , .mediaOption: "8x10" }, |
290 | {.id: QPageSize::Imperial9x11 , .windowsId: DMPAPER_9X11 , .definitionUnits: QPageSize::Inch , .widthPoints: 648, .heightPoints: 792, .widthMillimeters: 228.6, .heightMillimeters: 279.4, .widthInches: 9 , .heightInches: 11 , .mediaOption: "9x11" }, |
291 | {.id: QPageSize::Imperial9x12 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 648, .heightPoints: 864, .widthMillimeters: 228.6, .heightMillimeters: 304.8, .widthInches: 9 , .heightInches: 12 , .mediaOption: "9x12" }, |
292 | {.id: QPageSize::Imperial10x11 , .windowsId: DMPAPER_10X11 , .definitionUnits: QPageSize::Inch , .widthPoints: 720, .heightPoints: 792, .widthMillimeters: 254 , .heightMillimeters: 279.4, .widthInches: 10 , .heightInches: 11 , .mediaOption: "10x11" }, |
293 | {.id: QPageSize::Imperial10x13 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Inch , .widthPoints: 720, .heightPoints: 936, .widthMillimeters: 254 , .heightMillimeters: 330.2, .widthInches: 10 , .heightInches: 13 , .mediaOption: "10x13" }, |
294 | {.id: QPageSize::Imperial10x14 , .windowsId: DMPAPER_10X14 , .definitionUnits: QPageSize::Inch , .widthPoints: 720, .heightPoints: 1008, .widthMillimeters: 254 , .heightMillimeters: 355.6, .widthInches: 10 , .heightInches: 14 , .mediaOption: "10x14" }, |
295 | {.id: QPageSize::Imperial12x11 , .windowsId: DMPAPER_12X11 , .definitionUnits: QPageSize::Inch , .widthPoints: 864, .heightPoints: 792, .widthMillimeters: 304.8, .heightMillimeters: 279.4, .widthInches: 12 , .heightInches: 11 , .mediaOption: "12x11" }, |
296 | {.id: QPageSize::Imperial15x11 , .windowsId: DMPAPER_15X11 , .definitionUnits: QPageSize::Inch , .widthPoints: 1080, .heightPoints: 792, .widthMillimeters: 381 , .heightMillimeters: 279.4, .widthInches: 15 , .heightInches: 11 , .mediaOption: "15x11" }, |
297 | |
298 | // Other Page Sizes |
299 | {.id: QPageSize::ExecutiveStandard , .windowsId: DMPAPER_EXECUTIVE , .definitionUnits: QPageSize::Inch , .widthPoints: 522, .heightPoints: 756, .widthMillimeters: 184.2, .heightMillimeters: 266.7, .widthInches: 7.25, .heightInches: 10.5 , .mediaOption: "Executive" }, // Qt size differs from Postscript / Windows |
300 | {.id: QPageSize::Note , .windowsId: DMPAPER_NOTE , .definitionUnits: QPageSize::Inch , .widthPoints: 612, .heightPoints: 792, .widthMillimeters: 215.9, .heightMillimeters: 279.4, .widthInches: 8.5 , .heightInches: 11 , .mediaOption: "Note" }, |
301 | {.id: QPageSize::Quarto , .windowsId: DMPAPER_QUARTO , .definitionUnits: QPageSize::Inch , .widthPoints: 610, .heightPoints: 780, .widthMillimeters: 215.9, .heightMillimeters: 275.1, .widthInches: 8.5 , .heightInches: 10.83, .mediaOption: "Quarto" }, |
302 | {.id: QPageSize::Statement , .windowsId: DMPAPER_STATEMENT , .definitionUnits: QPageSize::Inch , .widthPoints: 396, .heightPoints: 612, .widthMillimeters: 139.7, .heightMillimeters: 215.9, .widthInches: 5.5 , .heightInches: 8.5 , .mediaOption: "Statement" }, |
303 | {.id: QPageSize::SuperA , .windowsId: DMPAPER_A_PLUS , .definitionUnits: QPageSize::Millimeter, .widthPoints: 643, .heightPoints: 1009, .widthMillimeters: 227 , .heightMillimeters: 356 , .widthInches: 8.94, .heightInches: 14 , .mediaOption: "SuperA" }, |
304 | {.id: QPageSize::SuperB , .windowsId: DMPAPER_B_PLUS , .definitionUnits: QPageSize::Millimeter, .widthPoints: 864, .heightPoints: 1380, .widthMillimeters: 305 , .heightMillimeters: 487 , .widthInches: 12 , .heightInches: 19.17, .mediaOption: "SuperB" }, |
305 | {.id: QPageSize::Postcard , .windowsId: DMPAPER_JAPANESE_POSTCARD , .definitionUnits: QPageSize::Millimeter, .widthPoints: 284, .heightPoints: 419, .widthMillimeters: 100 , .heightMillimeters: 148 , .widthInches: 3.94, .heightInches: 5.83, .mediaOption: "Postcard" }, |
306 | {.id: QPageSize::DoublePostcard , .windowsId: DMPAPER_DBL_JAPANESE_POSTCARD, .definitionUnits: QPageSize::Millimeter, .widthPoints: 567, .heightPoints: 419, .widthMillimeters: 200 , .heightMillimeters: 148 , .widthInches: 7.87, .heightInches: 5.83, .mediaOption: "DoublePostcard" }, |
307 | {.id: QPageSize::Prc16K , .windowsId: DMPAPER_P16K , .definitionUnits: QPageSize::Millimeter, .widthPoints: 414, .heightPoints: 610, .widthMillimeters: 146 , .heightMillimeters: 215 , .widthInches: 5.75, .heightInches: 8.5 , .mediaOption: "PRC16K" }, |
308 | {.id: QPageSize::Prc32K , .windowsId: DMPAPER_P32K , .definitionUnits: QPageSize::Millimeter, .widthPoints: 275, .heightPoints: 428, .widthMillimeters: 97 , .heightMillimeters: 151 , .widthInches: 3.82, .heightInches: 5.95, .mediaOption: "PRC32K" }, |
309 | {.id: QPageSize::Prc32KBig , .windowsId: DMPAPER_P32KBIG , .definitionUnits: QPageSize::Millimeter, .widthPoints: 275, .heightPoints: 428, .widthMillimeters: 97 , .heightMillimeters: 151 , .widthInches: 3.82, .heightInches: 5.95, .mediaOption: "PRC32KBig" }, |
310 | |
311 | // Fan Fold Sizes |
312 | {.id: QPageSize::FanFoldUS , .windowsId: DMPAPER_FANFOLD_US , .definitionUnits: QPageSize::Inch , .widthPoints: 1071, .heightPoints: 792, .widthMillimeters: 377.8, .heightMillimeters: 279.4, .widthInches: 14.875, .heightInches: 11 , .mediaOption: "FanFoldUS" }, |
313 | {.id: QPageSize::FanFoldGerman , .windowsId: DMPAPER_FANFOLD_STD_GERMAN , .definitionUnits: QPageSize::Inch , .widthPoints: 612, .heightPoints: 864, .widthMillimeters: 215.9, .heightMillimeters: 304.8, .widthInches: 8.5 , .heightInches: 12 , .mediaOption: "FanFoldGerman" }, |
314 | {.id: QPageSize::FanFoldGermanLegal, .windowsId: DMPAPER_FANFOLD_LGL_GERMAN , .definitionUnits: QPageSize::Inch , .widthPoints: 612, .heightPoints: 936, .widthMillimeters: 215.9, .heightMillimeters: 330 , .widthInches: 8.5 , .heightInches: 13 , .mediaOption: "FanFoldGermanLegal" }, |
315 | |
316 | // ISO Envelopes |
317 | {.id: QPageSize::EnvelopeB4 , .windowsId: DMPAPER_ENV_B4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 708, .heightPoints: 1001, .widthMillimeters: 250 , .heightMillimeters: 353 , .widthInches: 9.84, .heightInches: 13.9 , .mediaOption: "EnvISOB4" }, |
318 | {.id: QPageSize::EnvelopeB5 , .windowsId: DMPAPER_ENV_B5 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 499, .heightPoints: 709, .widthMillimeters: 176 , .heightMillimeters: 250 , .widthInches: 6.9 , .heightInches: 9.8 , .mediaOption: "EnvISOB5" }, |
319 | {.id: QPageSize::EnvelopeB6 , .windowsId: DMPAPER_ENV_B6 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 499, .heightPoints: 354, .widthMillimeters: 176 , .heightMillimeters: 125 , .widthInches: 6.9 , .heightInches: 4.9 , .mediaOption: "EnvISOB6" }, |
320 | {.id: QPageSize::EnvelopeC0 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 2599, .heightPoints: 3676, .widthMillimeters: 917 , .heightMillimeters: 1297 , .widthInches: 36.1 , .heightInches: 51.06, .mediaOption: "EnvC0" }, |
321 | {.id: QPageSize::EnvelopeC1 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1837, .heightPoints: 2599, .widthMillimeters: 648 , .heightMillimeters: 917 , .widthInches: 25.51, .heightInches: 36.1 , .mediaOption: "EnvC1" }, |
322 | {.id: QPageSize::EnvelopeC2 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 1298, .heightPoints: 1837, .widthMillimeters: 458 , .heightMillimeters: 648 , .widthInches: 18.03, .heightInches: 25.51, .mediaOption: "EnvC2" }, |
323 | {.id: QPageSize::EnvelopeC3 , .windowsId: DMPAPER_ENV_C3 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 918, .heightPoints: 1296, .widthMillimeters: 324 , .heightMillimeters: 458 , .widthInches: 12.75, .heightInches: 18.03, .mediaOption: "EnvC3" }, |
324 | {.id: QPageSize::EnvelopeC4 , .windowsId: DMPAPER_ENV_C4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 649, .heightPoints: 918, .widthMillimeters: 229 , .heightMillimeters: 324 , .widthInches: 9.02, .heightInches: 12.75, .mediaOption: "EnvC4" }, |
325 | {.id: QPageSize::EnvelopeC6 , .windowsId: DMPAPER_ENV_C6 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 323, .heightPoints: 459, .widthMillimeters: 114 , .heightMillimeters: 162 , .widthInches: 4.49, .heightInches: 6.38, .mediaOption: "EnvC6" }, |
326 | {.id: QPageSize::EnvelopeC65 , .windowsId: DMPAPER_ENV_C65 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 324, .heightPoints: 648, .widthMillimeters: 114 , .heightMillimeters: 229 , .widthInches: 4.5 , .heightInches: 9 , .mediaOption: "EnvC65" }, |
327 | {.id: QPageSize::EnvelopeC7 , .windowsId: DMPAPER_NONE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 230, .heightPoints: 323, .widthMillimeters: 81 , .heightMillimeters: 114 , .widthInches: 3.19, .heightInches: 4.49, .mediaOption: "EnvC7" }, |
328 | |
329 | // US Envelopes |
330 | {.id: QPageSize::Envelope9 , .windowsId: DMPAPER_ENV_9 , .definitionUnits: QPageSize::Inch , .widthPoints: 279, .heightPoints: 639, .widthMillimeters: 98.4, .heightMillimeters: 225.4, .widthInches: 3.875, .heightInches: 8.875, .mediaOption: "Env9" }, |
331 | {.id: QPageSize::Envelope11 , .windowsId: DMPAPER_ENV_11 , .definitionUnits: QPageSize::Inch , .widthPoints: 324, .heightPoints: 747, .widthMillimeters: 114.3, .heightMillimeters: 263.5, .widthInches: 4.5 , .heightInches: 10.375, .mediaOption: "Env11" }, |
332 | {.id: QPageSize::Envelope12 , .windowsId: DMPAPER_ENV_12 , .definitionUnits: QPageSize::Inch , .widthPoints: 342, .heightPoints: 792, .widthMillimeters: 120.7, .heightMillimeters: 279.4, .widthInches: 4.75, .heightInches: 11 , .mediaOption: "Env12" }, |
333 | {.id: QPageSize::Envelope14 , .windowsId: DMPAPER_ENV_14 , .definitionUnits: QPageSize::Inch , .widthPoints: 360, .heightPoints: 828, .widthMillimeters: 127 , .heightMillimeters: 292.1, .widthInches: 5 , .heightInches: 11.5 , .mediaOption: "Env14" }, |
334 | {.id: QPageSize::EnvelopeMonarch , .windowsId: DMPAPER_ENV_MONARCH , .definitionUnits: QPageSize::Inch , .widthPoints: 279, .heightPoints: 540, .widthMillimeters: 98.43, .heightMillimeters: 190.5, .widthInches: 3.875, .heightInches: 7.5 , .mediaOption: "EnvMonarch" }, |
335 | {.id: QPageSize::EnvelopePersonal , .windowsId: DMPAPER_ENV_PERSONAL , .definitionUnits: QPageSize::Inch , .widthPoints: 261, .heightPoints: 468, .widthMillimeters: 92.08, .heightMillimeters: 165.1, .widthInches: 3.625, .heightInches: 6.5 , .mediaOption: "EnvPersonal" }, |
336 | |
337 | // Other Envelopes |
338 | {.id: QPageSize::EnvelopeChou3 , .windowsId: DMPAPER_JENV_CHOU3 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 340, .heightPoints: 666, .widthMillimeters: 120 , .heightMillimeters: 235 , .widthInches: 4.72, .heightInches: 9.25, .mediaOption: "EnvChou3" }, |
339 | {.id: QPageSize::EnvelopeChou4 , .windowsId: DMPAPER_JENV_CHOU4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 255, .heightPoints: 581, .widthMillimeters: 90 , .heightMillimeters: 205 , .widthInches: 3.54, .heightInches: 8 , .mediaOption: "EnvChou4" }, |
340 | {.id: QPageSize::EnvelopeInvite , .windowsId: DMPAPER_ENV_INVITE , .definitionUnits: QPageSize::Millimeter, .widthPoints: 624, .heightPoints: 624, .widthMillimeters: 220 , .heightMillimeters: 220 , .widthInches: 8.66, .heightInches: 8.66, .mediaOption: "EnvInvite" }, |
341 | {.id: QPageSize::EnvelopeItalian , .windowsId: DMPAPER_ENV_ITALY , .definitionUnits: QPageSize::Millimeter, .widthPoints: 312, .heightPoints: 652, .widthMillimeters: 110 , .heightMillimeters: 230 , .widthInches: 4.33, .heightInches: 9 , .mediaOption: "EnvItalian" }, |
342 | {.id: QPageSize::EnvelopeKaku2 , .windowsId: DMPAPER_JENV_KAKU2 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 680, .heightPoints: 941, .widthMillimeters: 240 , .heightMillimeters: 332 , .widthInches: 9.45, .heightInches: 13 , .mediaOption: "EnvKaku2" }, |
343 | {.id: QPageSize::EnvelopeKaku3 , .windowsId: DMPAPER_JENV_KAKU3 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 612, .heightPoints: 785, .widthMillimeters: 216 , .heightMillimeters: 277 , .widthInches: 8.5 , .heightInches: 10.9 , .mediaOption: "EnvKaku3" }, |
344 | {.id: QPageSize::EnvelopePrc1 , .windowsId: DMPAPER_PENV_1 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 289, .heightPoints: 468, .widthMillimeters: 102 , .heightMillimeters: 165 , .widthInches: 4 , .heightInches: 6.5 , .mediaOption: "EnvPRC1" }, |
345 | {.id: QPageSize::EnvelopePrc2 , .windowsId: DMPAPER_PENV_2 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 289, .heightPoints: 499, .widthMillimeters: 102 , .heightMillimeters: 176 , .widthInches: 4 , .heightInches: 6.9 , .mediaOption: "EnvPRC2" }, |
346 | {.id: QPageSize::EnvelopePrc3 , .windowsId: DMPAPER_PENV_3 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 354, .heightPoints: 499, .widthMillimeters: 125 , .heightMillimeters: 176 , .widthInches: 4.9 , .heightInches: 6.9 , .mediaOption: "EnvPRC3" }, |
347 | {.id: QPageSize::EnvelopePrc4 , .windowsId: DMPAPER_PENV_4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 312, .heightPoints: 590, .widthMillimeters: 110 , .heightMillimeters: 208 , .widthInches: 4.33, .heightInches: 8.2 , .mediaOption: "EnvPRC4" }, |
348 | {.id: QPageSize::EnvelopePrc5 , .windowsId: DMPAPER_PENV_5 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 312, .heightPoints: 624, .widthMillimeters: 110 , .heightMillimeters: 220 , .widthInches: 4.33, .heightInches: 8.66, .mediaOption: "EnvPRC5" }, |
349 | {.id: QPageSize::EnvelopePrc6 , .windowsId: DMPAPER_PENV_6 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 340, .heightPoints: 652, .widthMillimeters: 120 , .heightMillimeters: 230 , .widthInches: 4.7 , .heightInches: 9 , .mediaOption: "EnvPRC6" }, |
350 | {.id: QPageSize::EnvelopePrc7 , .windowsId: DMPAPER_PENV_7 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 454, .heightPoints: 652, .widthMillimeters: 160 , .heightMillimeters: 230 , .widthInches: 6.3 , .heightInches: 9 , .mediaOption: "EnvPRC7" }, |
351 | {.id: QPageSize::EnvelopePrc8 , .windowsId: DMPAPER_PENV_8 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 340, .heightPoints: 876, .widthMillimeters: 120 , .heightMillimeters: 309 , .widthInches: 4.7 , .heightInches: 12.2 , .mediaOption: "EnvPRC8" }, |
352 | {.id: QPageSize::EnvelopePrc9 , .windowsId: DMPAPER_PENV_9 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 649, .heightPoints: 918, .widthMillimeters: 229 , .heightMillimeters: 324 , .widthInches: 9 , .heightInches: 12.75, .mediaOption: "EnvPRC9" }, |
353 | {.id: QPageSize::EnvelopePrc10 , .windowsId: DMPAPER_PENV_10 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 918, .heightPoints: 1298, .widthMillimeters: 324 , .heightMillimeters: 458 , .widthInches: 12.75, .heightInches: 18 , .mediaOption: "EnvPRC10" }, |
354 | {.id: QPageSize::EnvelopeYou4 , .windowsId: DMPAPER_JENV_YOU4 , .definitionUnits: QPageSize::Millimeter, .widthPoints: 298, .heightPoints: 666, .widthMillimeters: 105 , .heightMillimeters: 235 , .widthInches: 4.13, .heightInches: 9.25, .mediaOption: "EnvYou4" } |
355 | }; |
356 | |
357 | static const int pageSizesCount = int(sizeof(qt_pageSizes) / sizeof(qt_pageSizes[0])); |
358 | static_assert(pageSizesCount == QPageSize::LastPageSize + 1); |
359 | static_assert(QPageSize::LastPageSize < 256); |
360 | |
361 | // Return key name for PageSize |
362 | static QString qt_keyForPageSizeId(QPageSize::PageSizeId id) |
363 | { |
364 | return QString::fromLatin1(ba: qt_pageSizes[id].mediaOption); |
365 | } |
366 | |
367 | // Return id name for PPD Key |
368 | static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match = nullptr) |
369 | { |
370 | if (ppdKey.isEmpty()) |
371 | return QPageSize::Custom; |
372 | QStringView key(ppdKey); |
373 | // Remove any Rotated or Tranverse modifiers |
374 | if (key.endsWith(s: "Rotated"_L1 )) |
375 | key.chop(n: 7); |
376 | else if (key.endsWith(s: ".Transverse"_L1 )) |
377 | key.chop(n: 11); |
378 | for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) { |
379 | if (QLatin1StringView(qt_pageSizes[i].mediaOption) == key) { |
380 | if (match) |
381 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
382 | return qt_pageSizes[i].id; |
383 | } |
384 | } |
385 | return QPageSize::Custom; |
386 | } |
387 | |
388 | // Return id name for Windows ID |
389 | static QPageSize::PageSizeId qt_idForWindowsID(int windowsId, QSize *match = nullptr) |
390 | { |
391 | // If outside known values then is Custom |
392 | if (windowsId <= DMPAPER_NONE || windowsId > DMPAPER_LAST) |
393 | return QPageSize::Custom; |
394 | // Check if one of the unsupported values, convert to valid value if is |
395 | for (const auto &it : qt_windowsConversion) { |
396 | if (it[0] == windowsId) { |
397 | windowsId = it[1]; |
398 | break; |
399 | } |
400 | } |
401 | // Look for the value in our supported size table |
402 | for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) { |
403 | if (qt_pageSizes[i].windowsId == windowsId) { |
404 | if (match) |
405 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
406 | return qt_pageSizes[i].id; |
407 | } |
408 | } |
409 | // Otherwise is Custom |
410 | return QPageSize::Custom; |
411 | } |
412 | |
413 | // Return key name for custom size |
414 | static QString qt_keyForCustomSize(const QSizeF &size, QPageSize::Unit units) |
415 | { |
416 | // PPD custom format |
417 | QString key = QStringLiteral("Custom.%1x%2%3" ); |
418 | QString abbrev; |
419 | switch (units) { |
420 | case QPageSize::Millimeter: |
421 | abbrev = QStringLiteral("mm" ); |
422 | break; |
423 | case QPageSize::Point: |
424 | break; |
425 | case QPageSize::Inch: |
426 | abbrev = QStringLiteral("in" ); |
427 | break; |
428 | case QPageSize::Pica: |
429 | abbrev = QStringLiteral("pc" ); |
430 | break; |
431 | case QPageSize::Didot: |
432 | abbrev = QStringLiteral("DD" ); |
433 | break; |
434 | case QPageSize::Cicero: |
435 | abbrev = QStringLiteral("CC" ); |
436 | break; |
437 | } |
438 | // Assumes size is already max 2 decimal places |
439 | return key.arg(a: size.width()).arg(a: size.height()).arg(a: abbrev); |
440 | } |
441 | |
442 | // Return localized name for custom size |
443 | static QString qt_nameForCustomSize(const QSizeF &size, QPageSize::Unit units) |
444 | { |
445 | QString name; |
446 | switch (units) { |
447 | case QPageSize::Millimeter: |
448 | //: Custom size name in millimeters |
449 | name = QCoreApplication::translate(context: "QPageSize" , key: "Custom (%1mm x %2mm)" ); |
450 | break; |
451 | case QPageSize::Point: |
452 | //: Custom size name in points |
453 | name = QCoreApplication::translate(context: "QPageSize" , key: "Custom (%1pt x %2pt)" ); |
454 | break; |
455 | case QPageSize::Inch: |
456 | //: Custom size name in inches |
457 | name = QCoreApplication::translate(context: "QPageSize" , key: "Custom (%1in x %2in)" ); |
458 | break; |
459 | case QPageSize::Pica: |
460 | //: Custom size name in picas |
461 | name = QCoreApplication::translate(context: "QPageSize" , key: "Custom (%1pc x %2pc)" ); |
462 | break; |
463 | case QPageSize::Didot: |
464 | //: Custom size name in didots |
465 | name = QCoreApplication::translate(context: "QPageSize" , key: "Custom (%1DD x %2DD)" ); |
466 | break; |
467 | case QPageSize::Cicero: |
468 | //: Custom size name in ciceros |
469 | name = QCoreApplication::translate(context: "QPageSize" , key: "Custom (%1CC x %2CC)" ); |
470 | break; |
471 | } |
472 | // Assumes size is already max 2 decimal places |
473 | return name.arg(a: size.width()).arg(a: size.height()); |
474 | } |
475 | |
476 | // Multiplier for converting units to points. |
477 | static qreal qt_pointMultiplier(QPageSize::Unit unit) |
478 | { |
479 | switch (unit) { |
480 | case QPageSize::Millimeter: |
481 | return 2.83464566929; |
482 | case QPageSize::Point: |
483 | return 1.0; |
484 | case QPageSize::Inch: |
485 | return 72.0; |
486 | case QPageSize::Pica: |
487 | return 12; |
488 | case QPageSize::Didot: |
489 | return 1.065826771; |
490 | case QPageSize::Cicero: |
491 | return 12.789921252; |
492 | } |
493 | return 1.0; |
494 | } |
495 | |
496 | // Multiplier for converting pixels to points. |
497 | Q_GUI_EXPORT qreal qt_pixelMultiplier(int resolution) |
498 | { |
499 | return resolution <= 0 ? 1.0 : 72.0 / resolution; |
500 | } |
501 | |
502 | static QSizeF qt_definitionSize(QPageSize::PageSizeId pageSizeId) |
503 | { |
504 | QPageSize::Unit units = qt_pageSizes[pageSizeId].definitionUnits; |
505 | if (units == QPageSize::Millimeter) |
506 | return QSizeF(qt_pageSizes[pageSizeId].widthMillimeters, qt_pageSizes[pageSizeId].heightMillimeters); |
507 | Q_ASSERT(units == QPageSize::Inch); // We currently only support definitions in mm or inches |
508 | return QSizeF(qt_pageSizes[pageSizeId].widthInches, qt_pageSizes[pageSizeId].heightInches); |
509 | } |
510 | |
511 | static QSizeF qt_convertUnits(const QSizeF &size, QPageSize::Unit fromUnits, QPageSize::Unit toUnits) |
512 | { |
513 | if (!size.isValid()) |
514 | return QSizeF(); |
515 | |
516 | // If the units are the same or the size is 0, then don't need to convert |
517 | if (fromUnits == toUnits || (qFuzzyIsNull(d: size.width()) && qFuzzyIsNull(d: size.height()))) |
518 | return size; |
519 | |
520 | QSizeF newSize = size; |
521 | // First convert to points |
522 | if (fromUnits != QPageSize::Point) { |
523 | const qreal multiplier = qt_pointMultiplier(unit: fromUnits); |
524 | newSize = newSize * multiplier; |
525 | } |
526 | // Then convert from points to required units |
527 | const qreal multiplier = qt_pointMultiplier(unit: toUnits); |
528 | // Try force to 2 decimal places for consistency |
529 | const int width = qRound(d: newSize.width() * 100 / multiplier); |
530 | const int height = qRound(d: newSize.height() * 100 / multiplier); |
531 | return QSizeF(width / 100.0, height / 100.0); |
532 | } |
533 | |
534 | static QSize qt_convertUnitsToPoints(const QSizeF &size, QPageSize::Unit units) |
535 | { |
536 | if (!size.isValid()) |
537 | return QSize(); |
538 | return QSizeF(size * qt_pointMultiplier(unit: units)).toSize(); |
539 | } |
540 | |
541 | static QSize qt_convertPointsToPixels(const QSize &size, int resolution) |
542 | { |
543 | if (!size.isValid() || resolution <= 0) |
544 | return QSize(); |
545 | const qreal multiplier = qt_pixelMultiplier(resolution); |
546 | return QSize(qRound(d: size.width() / multiplier), qRound(d: size.height() / multiplier)); |
547 | } |
548 | |
549 | static QSizeF qt_convertPointsToUnits(const QSize &size, QPageSize::Unit units) |
550 | { |
551 | if (!size.isValid()) |
552 | return QSizeF(); |
553 | const qreal multiplier = qt_pointMultiplier(unit: units); |
554 | // Try force to 2 decimal places for consistency |
555 | const int width = qRound(d: size.width() * 100 / multiplier); |
556 | const int height = qRound(d: size.height() * 100 / multiplier); |
557 | return QSizeF(width / 100.0, height / 100.0); |
558 | } |
559 | |
560 | static QSizeF qt_unitSize(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units) |
561 | { |
562 | switch (units) { |
563 | case QPageSize::Millimeter: |
564 | return QSizeF(qt_pageSizes[pageSizeId].widthMillimeters, qt_pageSizes[pageSizeId].heightMillimeters); |
565 | case QPageSize::Point: |
566 | return QSizeF(qt_pageSizes[pageSizeId].widthPoints, qt_pageSizes[pageSizeId].heightPoints); |
567 | case QPageSize::Inch: |
568 | return QSizeF(qt_pageSizes[pageSizeId].widthInches, qt_pageSizes[pageSizeId].heightInches); |
569 | case QPageSize::Pica: |
570 | case QPageSize::Didot: |
571 | case QPageSize::Cicero: |
572 | return qt_convertPointsToUnits(size: QSize(qt_pageSizes[pageSizeId].widthPoints, |
573 | qt_pageSizes[pageSizeId].heightPoints), units); |
574 | } |
575 | return QSizeF(); |
576 | } |
577 | |
578 | // Find matching standard page size for point size |
579 | static QPageSize::PageSizeId qt_idForPointSize(const QSize &size, QPageSize::SizeMatchPolicy matchPolicy, QSize *match) |
580 | { |
581 | if (!size.isValid()) |
582 | return QPageSize::Custom; |
583 | |
584 | // Try exact match in portrait layout |
585 | for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) { |
586 | if (size.width() == qt_pageSizes[i].widthPoints && size.height() == qt_pageSizes[i].heightPoints) { |
587 | if (match) |
588 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
589 | return qt_pageSizes[i].id; |
590 | } |
591 | } |
592 | |
593 | // If no exact match only try fuzzy if asked |
594 | if (matchPolicy != QPageSize::ExactMatch) { |
595 | // Set up the fuzzy tolerance |
596 | // TODO Use ISO standard tolerance based on page size? |
597 | const int tolerance = 3; // = approx 1mm |
598 | const int minWidth = size.width() - tolerance; |
599 | const int maxWidth = size.width() + tolerance; |
600 | const int minHeight = size.height() - tolerance; |
601 | const int maxHeight = size.height() + tolerance; |
602 | |
603 | // First try fuzzy match in portrait layout |
604 | for (int i = 0; i <= QPageSize::LastPageSize; ++i) { |
605 | const int width = qt_pageSizes[i].widthPoints; |
606 | const int height = qt_pageSizes[i].heightPoints; |
607 | if (width >= minWidth && width <= maxWidth && height >= minHeight && height <= maxHeight) { |
608 | if (match) |
609 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
610 | return qt_pageSizes[i].id; |
611 | } |
612 | } |
613 | |
614 | // If FuzzyOrientationMatch then try rotated sizes |
615 | if (matchPolicy == QPageSize::FuzzyOrientationMatch) { |
616 | // First try exact match in landscape layout |
617 | for (int i = 0; i <= QPageSize::LastPageSize; ++i) { |
618 | if (size.width() == qt_pageSizes[i].heightPoints && size.height() == qt_pageSizes[i].widthPoints) { |
619 | if (match) |
620 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
621 | return qt_pageSizes[i].id; |
622 | } |
623 | } |
624 | |
625 | // Then try fuzzy match in landscape layout |
626 | for (int i = 0; i <= QPageSize::LastPageSize; ++i) { |
627 | const int width = qt_pageSizes[i].heightPoints; |
628 | const int height = qt_pageSizes[i].widthPoints; |
629 | if (width >= minWidth && width <= maxWidth && height >= minHeight && height <= maxHeight) { |
630 | if (match) |
631 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
632 | return qt_pageSizes[i].id; |
633 | } |
634 | } |
635 | } |
636 | } |
637 | |
638 | if (match) |
639 | *match = size; |
640 | // Otherwise no match so Custom |
641 | return QPageSize::Custom; |
642 | } |
643 | |
644 | // Find matching standard page size for point size |
645 | static QPageSize::PageSizeId qt_idForSize(const QSizeF &size, QPageSize::Unit units, |
646 | QPageSize::SizeMatchPolicy matchPolicy, QSize *match) |
647 | { |
648 | if (!size.isValid()) |
649 | return QPageSize::Custom; |
650 | |
651 | // Try exact match if units are the same |
652 | if (units == QPageSize::Millimeter) { |
653 | for (int i = 0; i <= QPageSize::LastPageSize; ++i) { |
654 | if (size.width() == qt_pageSizes[i].widthMillimeters && size.height() == qt_pageSizes[i].heightMillimeters) { |
655 | if (match) |
656 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
657 | return qt_pageSizes[i].id; |
658 | } |
659 | } |
660 | } else if (units == QPageSize::Inch) { |
661 | for (int i = 0; i <= QPageSize::LastPageSize; ++i) { |
662 | if (size.width() == qt_pageSizes[i].widthInches && size.height() == qt_pageSizes[i].heightInches) { |
663 | if (match) |
664 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
665 | return qt_pageSizes[i].id; |
666 | } |
667 | } |
668 | } else if (units == QPageSize::Point) { |
669 | for (int i = 0; i <= QPageSize::LastPageSize; ++i) { |
670 | if (size.width() == qt_pageSizes[i].widthPoints && size.height() == qt_pageSizes[i].heightPoints) { |
671 | if (match) |
672 | *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints); |
673 | return qt_pageSizes[i].id; |
674 | } |
675 | } |
676 | } |
677 | |
678 | // If no exact match then convert to points and try match those |
679 | QSize points = qt_convertUnitsToPoints(size, units); |
680 | return qt_idForPointSize(size: points, matchPolicy, match); |
681 | } |
682 | |
683 | class QPageSizePrivate : public QSharedData |
684 | { |
685 | public: |
686 | QPageSizePrivate(); |
687 | explicit QPageSizePrivate(QPageSize::PageSizeId pageSizeId); |
688 | QPageSizePrivate(const QSize &pointSize, |
689 | const QString &name, |
690 | QPageSize::SizeMatchPolicy matchPolicy); |
691 | QPageSizePrivate(const QSizeF &size, QPageSize::Unit units, |
692 | const QString &name, |
693 | QPageSize::SizeMatchPolicy matchPolicy); |
694 | QPageSizePrivate(const QString &key, const QSize &size, const QString &name); |
695 | QPageSizePrivate(int windowsId, const QSize &pointSize, const QString &name); |
696 | ~QPageSizePrivate(); |
697 | |
698 | bool operator==(const QPageSizePrivate &other) const; |
699 | bool isEquivalentTo(const QPageSizePrivate &other) const; |
700 | |
701 | bool isValid() const; |
702 | |
703 | QSizeF size(QPageSize::Unit units) const; |
704 | QSize sizePixels(int resolution) const; |
705 | |
706 | private: |
707 | friend class QPageSize; |
708 | |
709 | void init(QPageSize::PageSizeId id, const QString &name); |
710 | void init(const QSize &size, const QString &name); |
711 | void init(const QSizeF &size, QPageSize::Unit units, const QString &name); |
712 | |
713 | QString m_key; |
714 | QPageSize::PageSizeId m_id; |
715 | QSize m_pointSize; |
716 | QString m_name; |
717 | int m_windowsId; |
718 | QSizeF m_size; |
719 | QPageSize::Unit m_units; |
720 | }; |
721 | |
722 | QPageSizePrivate::QPageSizePrivate() |
723 | : m_id(QPageSize::Custom), |
724 | m_windowsId(0), |
725 | m_units(QPageSize::Point) |
726 | { |
727 | } |
728 | |
729 | QPageSizePrivate::QPageSizePrivate(QPageSize::PageSizeId pageSizeId) |
730 | : m_id(QPageSize::Custom), |
731 | m_windowsId(0), |
732 | m_units(QPageSize::Point) |
733 | { |
734 | if (unsigned(pageSizeId) <= unsigned(QPageSize::LastPageSize)) |
735 | init(id: pageSizeId, name: QString()); |
736 | } |
737 | |
738 | QPageSizePrivate::QPageSizePrivate(const QSize &pointSize, const QString &name, QPageSize::SizeMatchPolicy matchPolicy) |
739 | : m_id(QPageSize::Custom), |
740 | m_windowsId(0), |
741 | m_units(QPageSize::Point) |
742 | { |
743 | if (pointSize.isValid()) { |
744 | QPageSize::PageSizeId id = qt_idForPointSize(size: pointSize, matchPolicy, match: nullptr); |
745 | id == QPageSize::Custom ? init(size: pointSize, name) : init(id, name); |
746 | } |
747 | } |
748 | |
749 | QPageSizePrivate::QPageSizePrivate(const QSizeF &size, QPageSize::Unit units, |
750 | const QString &name, QPageSize::SizeMatchPolicy matchPolicy) |
751 | : m_id(QPageSize::Custom), |
752 | m_windowsId(0), |
753 | m_units(QPageSize::Point) |
754 | { |
755 | if (size.isValid()) { |
756 | QPageSize::PageSizeId id = qt_idForSize(size, units, matchPolicy, match: nullptr); |
757 | id == QPageSize::Custom ? init(size, units, name) : init(id, name); |
758 | } |
759 | } |
760 | |
761 | QPageSizePrivate::QPageSizePrivate(const QString &key, const QSize &pointSize, const QString &name) |
762 | : m_id(QPageSize::Custom), |
763 | m_windowsId(0), |
764 | m_units(QPageSize::Point) |
765 | { |
766 | if (!key.isEmpty() && pointSize.isValid()) { |
767 | QPageSize::PageSizeId id = qt_idForPpdKey(ppdKey: key, match: nullptr); |
768 | // If not a known PPD key, check if size is a standard PPD size |
769 | if (id == QPageSize::Custom) |
770 | id = qt_idForPointSize(size: pointSize, matchPolicy: QPageSize::FuzzyMatch, match: nullptr); |
771 | id == QPageSize::Custom ? init(size: pointSize, name) : init(id, name); |
772 | m_key = key; |
773 | } |
774 | } |
775 | |
776 | QPageSizePrivate::QPageSizePrivate(int windowsId, const QSize &pointSize, const QString &name) |
777 | : m_id(QPageSize::Custom), |
778 | m_windowsId(0), |
779 | m_units(QPageSize::Point) |
780 | { |
781 | if (windowsId > 0 && pointSize.isValid()) { |
782 | QPageSize::PageSizeId id = qt_idForWindowsID(windowsId, match: nullptr); |
783 | // If not a known Windows ID, check if size is a standard PPD size |
784 | if (id == QPageSize::Custom) |
785 | id = qt_idForPointSize(size: pointSize, matchPolicy: QPageSize::FuzzyMatch, match: nullptr); |
786 | id == QPageSize::Custom ? init(size: pointSize, name) : init(id, name); |
787 | m_windowsId = windowsId; |
788 | } |
789 | } |
790 | |
791 | QPageSizePrivate::~QPageSizePrivate() |
792 | { |
793 | } |
794 | |
795 | // Init a standard PageSizeId |
796 | void QPageSizePrivate::init(QPageSize::PageSizeId id, const QString &name) |
797 | { |
798 | m_id = id; |
799 | m_size = qt_definitionSize(pageSizeId: id); |
800 | m_units = qt_pageSizes[id].definitionUnits; |
801 | m_key = qt_keyForPageSizeId(id); |
802 | m_name = name.isEmpty() ? QPageSize::name(pageSizeId: id) : name; |
803 | m_windowsId = qt_pageSizes[id].windowsId; |
804 | m_pointSize = QSize(qt_pageSizes[id].widthPoints, qt_pageSizes[id].heightPoints); |
805 | } |
806 | |
807 | // Init a point size |
808 | void QPageSizePrivate::init(const QSize &size, const QString &name) |
809 | { |
810 | m_id = QPageSize::Custom; |
811 | m_size = size; |
812 | m_units = QPageSize::Point; |
813 | m_key = qt_keyForCustomSize(size: m_size, units: m_units); |
814 | m_name = name.isEmpty() ? qt_nameForCustomSize(size: m_size, units: m_units) : name; |
815 | m_windowsId = 0; |
816 | m_pointSize = size; |
817 | } |
818 | |
819 | // Init a unit size |
820 | void QPageSizePrivate::init(const QSizeF &size, QPageSize::Unit units, const QString &name) |
821 | { |
822 | m_id = QPageSize::Custom; |
823 | m_size = size; |
824 | m_units = units; |
825 | m_key = qt_keyForCustomSize(size: m_size, units: m_units); |
826 | if (name.isEmpty()) |
827 | m_name = qt_nameForCustomSize(size: m_size, units: m_units); |
828 | else |
829 | m_name = name; |
830 | m_windowsId = 0; |
831 | m_pointSize = qt_convertUnitsToPoints(size: m_size, units: m_units); |
832 | } |
833 | |
834 | bool QPageSizePrivate::operator==(const QPageSizePrivate &other) const |
835 | { |
836 | return m_size == other.m_size |
837 | && m_units == other.m_units |
838 | && m_key == other.m_key |
839 | && m_name == other.m_name; |
840 | } |
841 | |
842 | bool QPageSizePrivate::isEquivalentTo(const QPageSizePrivate &other) const |
843 | { |
844 | return m_pointSize == other.m_pointSize; |
845 | } |
846 | |
847 | bool QPageSizePrivate::isValid() const |
848 | { |
849 | return m_pointSize.isValid() && !m_key.isEmpty() && !m_name.isEmpty(); |
850 | } |
851 | |
852 | QSizeF QPageSizePrivate::size(QPageSize::Unit units) const |
853 | { |
854 | // If want units we've stored in, we already have them |
855 | if (units == m_units) |
856 | return m_size; |
857 | |
858 | // If want points we already have them |
859 | if (units == QPageSize::Point) |
860 | return QSizeF(m_pointSize.width(), m_pointSize.height()); |
861 | |
862 | // If a custom size do a conversion |
863 | if (m_id == QPageSize::Custom) |
864 | return qt_convertUnits(size: m_size, fromUnits: m_units, toUnits: units); |
865 | |
866 | // Otherwise use the standard sizes |
867 | return qt_unitSize(pageSizeId: m_id, units); |
868 | } |
869 | |
870 | QSize QPageSizePrivate::sizePixels(int resolution) const |
871 | { |
872 | return qt_convertPointsToPixels(size: m_pointSize, resolution);; |
873 | } |
874 | |
875 | |
876 | /*! |
877 | \class QPageSize |
878 | \inmodule QtGui |
879 | \since 5.3 |
880 | \brief The QPageSize class describes the size and name of a defined page size. |
881 | |
882 | This class implements support for the set of standard page sizes as defined |
883 | in the Adobe Postscript PPD Standard v4.3. It defines the standard set of |
884 | page sizes in points, millimeters and inches and ensures these sizes are |
885 | consistently used. Other size units can be used but will be calculated |
886 | results and so may not always be consistent. The defined point sizes are |
887 | always a integer, all other sizes can be fractions of a unit. |
888 | |
889 | The defined size is always in width x height order with no implied page |
890 | orientation. Note that it is possible for page sizes to be defined where the |
891 | width is greater than the height, such as QPageSize::Ledger, so you cannot |
892 | rely on comparing the width and height values to determine page orientation. |
893 | |
894 | For example, A4 is defined by the standard as 210mm x 297mm, 8.27in x 11.69in, |
895 | or 595pt x 842pt. |
896 | |
897 | You can also define custom page sizes with custom names in any units you want |
898 | and this unit size will be preserved and used as the base for all other unit |
899 | size calculations. |
900 | |
901 | When creating a QPageSize using a custom QSize you can choose if you want |
902 | QPageSize to try match the size to a standard page size. By default |
903 | QPaperSize uses a FuzzyMatch mode where it will match a given page size to |
904 | a standard page size if it falls within 3 postscript points of a defined |
905 | standard size. You can override this to request only an exact match but this |
906 | is not recommended as conversions between units can easily lose 3 points and |
907 | result in incorrect page sizes. |
908 | |
909 | A QPageSize instance may also be obtained by querying the supported page sizes |
910 | for a print device. In this case the localized name returned is that defined |
911 | by the printer itself. Note that the print device may not support the current |
912 | default locale language. |
913 | |
914 | The class also provides convenience methods for converting page size IDs to and from |
915 | various unit sizes. |
916 | |
917 | \sa QPagedPaintDevice, QPdfWriter |
918 | */ |
919 | |
920 | /*! |
921 | \enum QPageSize::PageSizeId |
922 | |
923 | This enum type lists the available page sizes as defined in the Postscript |
924 | PPD standard. These values are duplicated in QPagedPaintDevice and QPrinter. |
925 | |
926 | The defined sizes are: |
927 | |
928 | \value A0 841 x 1189 mm |
929 | \value A1 594 x 841 mm |
930 | \value A2 420 x 594 mm |
931 | \value A3 297 x 420 mm |
932 | \value A4 210 x 297 mm, 8.26 x 11.69 inches |
933 | \value A5 148 x 210 mm |
934 | \value A6 105 x 148 mm |
935 | \value A7 74 x 105 mm |
936 | \value A8 52 x 74 mm |
937 | \value A9 37 x 52 mm |
938 | \value B0 1000 x 1414 mm |
939 | \value B1 707 x 1000 mm |
940 | \value B2 500 x 707 mm |
941 | \value B3 353 x 500 mm |
942 | \value B4 250 x 353 mm |
943 | \value B5 176 x 250 mm, 6.93 x 9.84 inches |
944 | \value B6 125 x 176 mm |
945 | \value B7 88 x 125 mm |
946 | \value B8 62 x 88 mm |
947 | \value B9 44 x 62 mm |
948 | \value B10 31 x 44 mm |
949 | \value C5E 163 x 229 mm |
950 | \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope |
951 | \value DLE 110 x 220 mm |
952 | \value Executive 7.5 x 10 inches, 190.5 x 254 mm |
953 | \value Folio 210 x 330 mm |
954 | \value Ledger 431.8 x 279.4 mm |
955 | \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm |
956 | \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm |
957 | \value Tabloid 279.4 x 431.8 mm |
958 | \value Custom Unknown, or a user defined size. |
959 | \value A10 |
960 | \value A3Extra |
961 | \value A4Extra |
962 | \value A4Plus |
963 | \value A4Small |
964 | \value A5Extra |
965 | \value B5Extra |
966 | \value JisB0 |
967 | \value JisB1 |
968 | \value JisB2 |
969 | \value JisB3 |
970 | \value JisB4 |
971 | \value JisB5 |
972 | \value JisB6, |
973 | \value JisB7 |
974 | \value JisB8 |
975 | \value JisB9 |
976 | \value JisB10 |
977 | \value AnsiA = Letter |
978 | \value AnsiB = Ledger |
979 | \value AnsiC |
980 | \value AnsiD |
981 | \value AnsiE |
982 | \value LegalExtra |
983 | \value LetterExtra |
984 | \value LetterPlus |
985 | \value LetterSmall |
986 | \value TabloidExtra |
987 | \value ArchA |
988 | \value ArchB |
989 | \value ArchC |
990 | \value ArchD |
991 | \value ArchE |
992 | \value Imperial7x9 |
993 | \value Imperial8x10 |
994 | \value Imperial9x11 |
995 | \value Imperial9x12 |
996 | \value Imperial10x11 |
997 | \value Imperial10x13 |
998 | \value Imperial10x14 |
999 | \value Imperial12x11 |
1000 | \value Imperial15x11 |
1001 | \value ExecutiveStandard |
1002 | \value Note |
1003 | \value Quarto |
1004 | \value Statement |
1005 | \value SuperA |
1006 | \value SuperB |
1007 | \value Postcard |
1008 | \value DoublePostcard |
1009 | \value Prc16K |
1010 | \value Prc32K |
1011 | \value Prc32KBig |
1012 | \value FanFoldUS |
1013 | \value FanFoldGerman |
1014 | \value FanFoldGermanLegal |
1015 | \value EnvelopeB4 |
1016 | \value EnvelopeB5 |
1017 | \value EnvelopeB6 |
1018 | \value EnvelopeC0 |
1019 | \value EnvelopeC1 |
1020 | \value EnvelopeC2 |
1021 | \value EnvelopeC3 |
1022 | \value EnvelopeC4 |
1023 | \value EnvelopeC5 = C5E |
1024 | \value EnvelopeC6 |
1025 | \value EnvelopeC65 |
1026 | \value EnvelopeC7 |
1027 | \value EnvelopeDL = DLE |
1028 | \value Envelope9 |
1029 | \value Envelope10 = Comm10E |
1030 | \value Envelope11 |
1031 | \value Envelope12 |
1032 | \value Envelope14 |
1033 | \value EnvelopeMonarch |
1034 | \value EnvelopePersonal |
1035 | \value EnvelopeChou3 |
1036 | \value EnvelopeChou4 |
1037 | \value EnvelopeInvite |
1038 | \value EnvelopeItalian |
1039 | \value EnvelopeKaku2 |
1040 | \value EnvelopeKaku3 |
1041 | \value EnvelopePrc1 |
1042 | \value EnvelopePrc2 |
1043 | \value EnvelopePrc3 |
1044 | \value EnvelopePrc4 |
1045 | \value EnvelopePrc5 |
1046 | \value EnvelopePrc6 |
1047 | \value EnvelopePrc7 |
1048 | \value EnvelopePrc8 |
1049 | \value EnvelopePrc9 |
1050 | \value EnvelopePrc10 |
1051 | \value EnvelopeYou4 |
1052 | \value LastPageSize = EnvelopeYou4 |
1053 | |
1054 | Due to historic reasons QPageSize::Executive is not the same as the standard |
1055 | Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead. |
1056 | |
1057 | The Postscript standard size QPageSize::Folio is different to the Windows |
1058 | DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal |
1059 | if needed. |
1060 | */ |
1061 | |
1062 | /*! |
1063 | \enum QPageSize::Unit |
1064 | |
1065 | This enum type is used to specify the measurement unit for page sizes. |
1066 | |
1067 | \value Millimeter |
1068 | \value Point 1/72th of an inch |
1069 | \value Inch |
1070 | \value Pica 1/72th of a foot, 1/6th of an inch, 12 Points |
1071 | \value Didot 1/72th of a French inch, 0.375 mm |
1072 | \value Cicero 1/6th of a French inch, 12 Didot, 4.5mm |
1073 | */ |
1074 | |
1075 | /*! |
1076 | \enum QPageSize::SizeMatchPolicy |
1077 | |
1078 | \value FuzzyMatch Match to a standard page size if within the margin of tolerance. |
1079 | \value FuzzyOrientationMatch Match to a standard page size if within the margin of tolerance regardless of orientation. |
1080 | \value ExactMatch Only match to a standard page size if the sizes match exactly. |
1081 | */ |
1082 | |
1083 | /*! |
1084 | Creates a null QPageSize. |
1085 | */ |
1086 | |
1087 | QPageSize::QPageSize() |
1088 | : d(new QPageSizePrivate()) |
1089 | { |
1090 | } |
1091 | |
1092 | /*! |
1093 | Creates a QPageSize of the standard \a pageSize. |
1094 | |
1095 | If \a pageSize is QPageSize::Custom then the resulting QPageSize will not |
1096 | be valid. Use the custom size constructor instead. |
1097 | */ |
1098 | |
1099 | QPageSize::QPageSize(PageSizeId pageSize) |
1100 | : d(new QPageSizePrivate(pageSize)) |
1101 | { |
1102 | } |
1103 | |
1104 | /*! |
1105 | Creates a QPageSize of the given \a pointSize in Points using the matching \a matchPolicy. |
1106 | |
1107 | If the given \a pointSize matches a standard QPageSize::PageSizeId, then that page |
1108 | size will be used. Note that if the \a matchPolicy is FuzzyMatch this may result |
1109 | in the \a pointSize being adjusted to the standard size. To prevent this happening |
1110 | use a \a matchPolicy of ExactMatch instead. |
1111 | |
1112 | If the given \a pointSize is not a standard QPageSize::PageSizeId then a QPageSize::Custom |
1113 | size will be created. |
1114 | |
1115 | If \a name is null then the standard localized name will be used. If a custom page |
1116 | size then a custom name in the format "Custom (width x height)" will be created. |
1117 | |
1118 | The \a matchPolicy defaults to FuzzyMatch. |
1119 | */ |
1120 | |
1121 | QPageSize::QPageSize(const QSize &pointSize, const QString &name, SizeMatchPolicy matchPolicy) |
1122 | : d(new QPageSizePrivate(pointSize, name, matchPolicy)) |
1123 | { |
1124 | } |
1125 | |
1126 | /*! |
1127 | Creates a custom page of the given \a size in \a units. |
1128 | |
1129 | If the given \a size matches a standard QPageSize::PageSizeId, then that page |
1130 | size will be used. Note that if the \a matchPolicy is FuzzyMatch this may result |
1131 | in the \a size being adjusted to the standard size. To prevent this happening |
1132 | use a \a matchPolicy of ExactMatch instead. |
1133 | |
1134 | If the given \a size is not a standard QPageSize::PageSizeId then a QPageSize::Custom |
1135 | size will be created. The original unit size will be preserved and used as the |
1136 | base for all other unit size calculations. |
1137 | |
1138 | If \a name is null then a custom name will be created in the form |
1139 | "Custom (width x height)" where the size is expressed in units provided. |
1140 | */ |
1141 | |
1142 | QPageSize::QPageSize(const QSizeF &size, Unit units, |
1143 | const QString &name, SizeMatchPolicy matchPolicy) |
1144 | : d(new QPageSizePrivate(size, units, name, matchPolicy)) |
1145 | { |
1146 | } |
1147 | |
1148 | /*! |
1149 | \internal |
1150 | |
1151 | Create page with given key, size and name, for use by printer plugin. |
1152 | */ |
1153 | |
1154 | QPageSize::QPageSize(const QString &key, const QSize &pointSize, const QString &name) |
1155 | : d(new QPageSizePrivate(key, pointSize, name)) |
1156 | { |
1157 | } |
1158 | |
1159 | /*! |
1160 | \internal |
1161 | |
1162 | Create page with given windows ID, size and name, for use by printer plugin. |
1163 | */ |
1164 | |
1165 | QPageSize::QPageSize(int windowsId, const QSize &pointSize, const QString &name) |
1166 | : d(new QPageSizePrivate(windowsId, pointSize, name)) |
1167 | { |
1168 | } |
1169 | |
1170 | /*! |
1171 | \internal |
1172 | |
1173 | Create page with given private backend |
1174 | */ |
1175 | |
1176 | QPageSize::QPageSize(QPageSizePrivate &dd) |
1177 | : d(&dd) |
1178 | { |
1179 | } |
1180 | |
1181 | /*! |
1182 | Copy constructor, copies \a other to this. |
1183 | */ |
1184 | |
1185 | QPageSize::QPageSize(const QPageSize &other) |
1186 | : d(other.d) |
1187 | { |
1188 | } |
1189 | |
1190 | /*! |
1191 | Destroys the page. |
1192 | */ |
1193 | |
1194 | QPageSize::~QPageSize() |
1195 | { |
1196 | } |
1197 | |
1198 | /*! |
1199 | Assignment operator, assigns \a other to this. |
1200 | */ |
1201 | |
1202 | QPageSize &QPageSize::operator=(const QPageSize &other) |
1203 | { |
1204 | d = other.d; |
1205 | return *this; |
1206 | } |
1207 | |
1208 | /*! |
1209 | \fn void QPageSize::swap(QPageSize &other) |
1210 | |
1211 | Swaps this QPageSize with \a other. This function is very fast and |
1212 | never fails. |
1213 | */ |
1214 | |
1215 | /*! |
1216 | \fn QPageSize &QPageSize::operator=(QPageSize &&other) |
1217 | |
1218 | Move-assigns \a other to this QPageSize instance, transferring the |
1219 | ownership of the managed pointer to this instance. |
1220 | */ |
1221 | |
1222 | /*! |
1223 | \fn bool QPageSize::operator==(const QPageSize &lhs, const QPageSize &rhs) |
1224 | |
1225 | Returns \c true if page size \a lhs is equal to page size \a rhs, |
1226 | i.e. if the page sizes have the same attributes. Current |
1227 | attributes are size and name. |
1228 | */ |
1229 | |
1230 | /*! |
1231 | \fn bool QPageSize::operator!=(const QPageSize &lhs, const QPageSize &rhs) |
1232 | |
1233 | Returns \c true if page size \a lhs is unequal to page size \a |
1234 | rhs, i.e. if the page size has different attributes. Current |
1235 | attributes are size and name. |
1236 | */ |
1237 | |
1238 | /*! |
1239 | \internal |
1240 | */ |
1241 | bool QPageSize::equals(const QPageSize &other) const |
1242 | { |
1243 | return d == other.d || *d == *other.d; |
1244 | } |
1245 | |
1246 | |
1247 | /*! |
1248 | Returns \c true if this page is equivalent to the \a other page, i.e. if the |
1249 | page has the same size regardless of other attributes like name. |
1250 | */ |
1251 | |
1252 | bool QPageSize::isEquivalentTo(const QPageSize &other) const |
1253 | { |
1254 | if (d == other.d) |
1255 | return true; |
1256 | return d && other.d && d->isEquivalentTo(other: *other.d); |
1257 | } |
1258 | |
1259 | /*! |
1260 | Returns \c true if this page size is valid. |
1261 | |
1262 | The page size may be invalid if created with an invalid PageSizeId, or a |
1263 | negative or invalid QSize or QSizeF, or the null constructor. |
1264 | */ |
1265 | |
1266 | bool QPageSize::isValid() const |
1267 | { |
1268 | return d && d->isValid(); |
1269 | } |
1270 | |
1271 | /*! |
1272 | Returns the unique key of the page size. |
1273 | |
1274 | By default this is the PPD standard mediaOption keyword for the page size, |
1275 | or the PPD custom format key. If the QPageSize instance was obtained from |
1276 | a print device then this will be the key provided by the print device and |
1277 | may differ from the standard key. |
1278 | |
1279 | If the QPageSize is invalid then the key will be an empty string. |
1280 | |
1281 | This key should never be shown to end users, it is an internal key only. |
1282 | For a human-readable name use name(). |
1283 | |
1284 | \sa name() |
1285 | */ |
1286 | |
1287 | QString QPageSize::key() const |
1288 | { |
1289 | return isValid() ? d->m_key : QString(); |
1290 | } |
1291 | |
1292 | /*! |
1293 | Returns a localized human-readable name for the page size. |
1294 | |
1295 | If the QPageSize instance was obtained from a print device then the name |
1296 | used is that provided by the print device. Note that a print device may |
1297 | not support the current default locale language. |
1298 | |
1299 | If the QPageSize is invalid then the name will be an empty string. |
1300 | */ |
1301 | |
1302 | QString QPageSize::name() const |
1303 | { |
1304 | return isValid() ? d->m_name : QString(); |
1305 | } |
1306 | |
1307 | /*! |
1308 | Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom. |
1309 | |
1310 | If the QPageSize is invalid then the ID will be QPageSize::Custom. |
1311 | */ |
1312 | |
1313 | QPageSize::PageSizeId QPageSize::id() const |
1314 | { |
1315 | return isValid() ? d->m_id : Custom; |
1316 | } |
1317 | |
1318 | /*! |
1319 | Returns the Windows DMPAPER enum value for the page size. |
1320 | |
1321 | Not all valid PPD page sizes have a Windows equivalent, in which case 0 |
1322 | will be returned. |
1323 | |
1324 | If the QPageSize is invalid then the Windows ID will be 0. |
1325 | |
1326 | \sa id() |
1327 | */ |
1328 | |
1329 | int QPageSize::windowsId() const |
1330 | { |
1331 | if (!isValid()) |
1332 | return 0; |
1333 | return d->m_windowsId > 0 ? d->m_windowsId : windowsId(pageSizeId: d->m_id); |
1334 | } |
1335 | |
1336 | /*! |
1337 | Returns the definition size of the page size. |
1338 | |
1339 | For a standard page size this will be the size as defined in the relevant |
1340 | standard, i.e. ISO A4 will be defined in millimeters while ANSI Letter will |
1341 | be defined in inches. |
1342 | |
1343 | For a custom page size this will be the original size used to create the |
1344 | page size object. |
1345 | |
1346 | If the QPageSize is invalid then the QSizeF will be invalid. |
1347 | |
1348 | \sa definitionUnits() |
1349 | */ |
1350 | |
1351 | QSizeF QPageSize::definitionSize() const |
1352 | { |
1353 | return isValid() ? d->m_size : QSizeF(); |
1354 | } |
1355 | |
1356 | /*! |
1357 | Returns the definition units of the page size. |
1358 | |
1359 | For a standard page size this will be the units as defined in the relevant |
1360 | standard, i.e. ISO A4 will be defined in millimeters while ANSI Letter will |
1361 | be defined in inches. |
1362 | |
1363 | For a custom page size this will be the original units used to create the |
1364 | page size object. |
1365 | |
1366 | If the QPageSize is invalid then the QPageSize::Unit will be invalid. |
1367 | |
1368 | \sa definitionSize() |
1369 | */ |
1370 | |
1371 | QPageSize::Unit QPageSize::definitionUnits() const |
1372 | { |
1373 | return isValid() ? d->m_units : Unit(-1); |
1374 | } |
1375 | |
1376 | /*! |
1377 | Returns the size of the page in the required \a units. |
1378 | |
1379 | If the QPageSize is invalid then the QSizeF will be invalid. |
1380 | */ |
1381 | |
1382 | QSizeF QPageSize::size(Unit units) const |
1383 | { |
1384 | return isValid() ? d->size(units) : QSize(); |
1385 | } |
1386 | |
1387 | /*! |
1388 | Returns the size of the page in Postscript Points (1/72 of an inch). |
1389 | |
1390 | If the QPageSize is invalid then the QSize will be invalid. |
1391 | */ |
1392 | |
1393 | QSize QPageSize::sizePoints() const |
1394 | { |
1395 | return isValid() ? d->m_pointSize : QSize(); |
1396 | } |
1397 | |
1398 | /*! |
1399 | Returns the size of the page in Device Pixels at the given \a resolution. |
1400 | |
1401 | If the QPageSize is invalid then the QSize will be invalid. |
1402 | */ |
1403 | |
1404 | QSize QPageSize::sizePixels(int resolution) const |
1405 | { |
1406 | return isValid() ? d->sizePixels(resolution) : QSize(); |
1407 | } |
1408 | |
1409 | /*! |
1410 | Returns the page rectangle in the required \a units. |
1411 | |
1412 | If the QPageSize is invalid then the QRect will be invalid. |
1413 | */ |
1414 | |
1415 | QRectF QPageSize::rect(Unit units) const |
1416 | { |
1417 | return isValid() ? QRectF(QPointF(0, 0), d->size(units)) : QRectF(); |
1418 | } |
1419 | |
1420 | /*! |
1421 | Returns the page rectangle in Postscript Points (1/72 of an inch). |
1422 | |
1423 | If the QPageSize is invalid then the QRect will be invalid. |
1424 | */ |
1425 | |
1426 | QRect QPageSize::rectPoints() const |
1427 | { |
1428 | return isValid() ? QRect(QPoint(0, 0), d->m_pointSize) : QRect(); |
1429 | } |
1430 | |
1431 | /*! |
1432 | Returns the page rectangle in Device Pixels at the given \a resolution. |
1433 | |
1434 | If the QPageSize is invalid then the QRect will be invalid. |
1435 | */ |
1436 | |
1437 | QRect QPageSize::rectPixels(int resolution) const |
1438 | { |
1439 | return isValid() ? QRect(QPoint(0, 0), d->sizePixels(resolution)) : QRect(); |
1440 | } |
1441 | |
1442 | // Statics |
1443 | |
1444 | /*! |
1445 | Returns the PPD mediaOption keyword of the standard \a pageSizeId. |
1446 | |
1447 | If the QPageSize is invalid then the key will be empty. |
1448 | */ |
1449 | |
1450 | QString QPageSize::key(PageSizeId pageSizeId) |
1451 | { |
1452 | if (unsigned(pageSizeId) > unsigned(LastPageSize)) |
1453 | return QString(); |
1454 | return QString::fromUtf8(utf8: qt_pageSizes[pageSizeId].mediaOption); |
1455 | } |
1456 | |
1457 | static QString msgImperialPageSizeInch(int width, int height) |
1458 | { |
1459 | //: Page size in 'Inch'. |
1460 | return QCoreApplication::translate(context: "QPageSize" , key: "%1 x %2 in" ).arg(a: width).arg(a: height); |
1461 | } |
1462 | |
1463 | /*! |
1464 | Returns the localized name of the standard \a pageSizeId. |
1465 | |
1466 | If the QPageSize is invalid then the name will be empty. |
1467 | */ |
1468 | |
1469 | QString QPageSize::name(PageSizeId pageSizeId) |
1470 | { |
1471 | if (unsigned(pageSizeId) > unsigned(LastPageSize)) |
1472 | return QString(); |
1473 | |
1474 | switch (pageSizeId) { |
1475 | case A0: |
1476 | return QCoreApplication::translate(context: "QPageSize" , key: "A0" ); |
1477 | case A1: |
1478 | return QCoreApplication::translate(context: "QPageSize" , key: "A1" ); |
1479 | case A2: |
1480 | return QCoreApplication::translate(context: "QPageSize" , key: "A2" ); |
1481 | case A3: |
1482 | return QCoreApplication::translate(context: "QPageSize" , key: "A3" ); |
1483 | case A4: |
1484 | return QCoreApplication::translate(context: "QPageSize" , key: "A4" ); |
1485 | case A5: |
1486 | return QCoreApplication::translate(context: "QPageSize" , key: "A5" ); |
1487 | case A6: |
1488 | return QCoreApplication::translate(context: "QPageSize" , key: "A6" ); |
1489 | case A7: |
1490 | return QCoreApplication::translate(context: "QPageSize" , key: "A7" ); |
1491 | case A8: |
1492 | return QCoreApplication::translate(context: "QPageSize" , key: "A8" ); |
1493 | case A9: |
1494 | return QCoreApplication::translate(context: "QPageSize" , key: "A9" ); |
1495 | case A10: |
1496 | return QCoreApplication::translate(context: "QPageSize" , key: "A10" ); |
1497 | case B0: |
1498 | return QCoreApplication::translate(context: "QPageSize" , key: "B0" ); |
1499 | case B1: |
1500 | return QCoreApplication::translate(context: "QPageSize" , key: "B1" ); |
1501 | case B2: |
1502 | return QCoreApplication::translate(context: "QPageSize" , key: "B2" ); |
1503 | case B3: |
1504 | return QCoreApplication::translate(context: "QPageSize" , key: "B3" ); |
1505 | case B4: |
1506 | return QCoreApplication::translate(context: "QPageSize" , key: "B4" ); |
1507 | case B5: |
1508 | return QCoreApplication::translate(context: "QPageSize" , key: "B5" ); |
1509 | case B6: |
1510 | return QCoreApplication::translate(context: "QPageSize" , key: "B6" ); |
1511 | case B7: |
1512 | return QCoreApplication::translate(context: "QPageSize" , key: "B7" ); |
1513 | case B8: |
1514 | return QCoreApplication::translate(context: "QPageSize" , key: "B8" ); |
1515 | case B9: |
1516 | return QCoreApplication::translate(context: "QPageSize" , key: "B9" ); |
1517 | case B10: |
1518 | return QCoreApplication::translate(context: "QPageSize" , key: "B10" ); |
1519 | case Executive: |
1520 | return QCoreApplication::translate(context: "QPageSize" , key: "Executive (7.5 x 10 in)" ); |
1521 | case ExecutiveStandard: |
1522 | return QCoreApplication::translate(context: "QPageSize" , key: "Executive (7.25 x 10.5 in)" ); |
1523 | case Folio: |
1524 | return QCoreApplication::translate(context: "QPageSize" , key: "Folio (8.27 x 13 in)" ); |
1525 | case Legal: |
1526 | return QCoreApplication::translate(context: "QPageSize" , key: "Legal" ); |
1527 | case Letter: |
1528 | return QCoreApplication::translate(context: "QPageSize" , key: "Letter / ANSI A" ); |
1529 | case Tabloid: |
1530 | return QCoreApplication::translate(context: "QPageSize" , key: "Tabloid / ANSI B" ); |
1531 | case Ledger: |
1532 | return QCoreApplication::translate(context: "QPageSize" , key: "Ledger / ANSI B" ); |
1533 | case Custom: |
1534 | return QCoreApplication::translate(context: "QPageSize" , key: "Custom" ); |
1535 | case A3Extra: |
1536 | return QCoreApplication::translate(context: "QPageSize" , key: "A3 Extra" ); |
1537 | case A4Extra: |
1538 | return QCoreApplication::translate(context: "QPageSize" , key: "A4 Extra" ); |
1539 | case A4Plus: |
1540 | return QCoreApplication::translate(context: "QPageSize" , key: "A4 Plus" ); |
1541 | case A4Small: |
1542 | return QCoreApplication::translate(context: "QPageSize" , key: "A4 Small" ); |
1543 | case A5Extra: |
1544 | return QCoreApplication::translate(context: "QPageSize" , key: "A5 Extra" ); |
1545 | case B5Extra: |
1546 | return QCoreApplication::translate(context: "QPageSize" , key: "B5 Extra" ); |
1547 | case JisB0: |
1548 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B0" ); |
1549 | case JisB1: |
1550 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B1" ); |
1551 | case JisB2: |
1552 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B2" ); |
1553 | case JisB3: |
1554 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B3" ); |
1555 | case JisB4: |
1556 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B4" ); |
1557 | case JisB5: |
1558 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B5" ); |
1559 | case JisB6: |
1560 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B6" ); |
1561 | case JisB7: |
1562 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B7" ); |
1563 | case JisB8: |
1564 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B8" ); |
1565 | case JisB9: |
1566 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B9" ); |
1567 | case JisB10: |
1568 | return QCoreApplication::translate(context: "QPageSize" , key: "JIS B10" ); |
1569 | case AnsiC: |
1570 | return QCoreApplication::translate(context: "QPageSize" , key: "ANSI C" ); |
1571 | case AnsiD: |
1572 | return QCoreApplication::translate(context: "QPageSize" , key: "ANSI D" ); |
1573 | case AnsiE: |
1574 | return QCoreApplication::translate(context: "QPageSize" , key: "ANSI E" ); |
1575 | case LegalExtra: |
1576 | return QCoreApplication::translate(context: "QPageSize" , key: "Legal Extra" ); |
1577 | case LetterExtra: |
1578 | return QCoreApplication::translate(context: "QPageSize" , key: "Letter Extra" ); |
1579 | case LetterPlus: |
1580 | return QCoreApplication::translate(context: "QPageSize" , key: "Letter Plus" ); |
1581 | case LetterSmall: |
1582 | return QCoreApplication::translate(context: "QPageSize" , key: "Letter Small" ); |
1583 | case TabloidExtra: |
1584 | return QCoreApplication::translate(context: "QPageSize" , key: "Tabloid Extra" ); |
1585 | case ArchA: |
1586 | return QCoreApplication::translate(context: "QPageSize" , key: "Architect A" ); |
1587 | case ArchB: |
1588 | return QCoreApplication::translate(context: "QPageSize" , key: "Architect B" ); |
1589 | case ArchC: |
1590 | return QCoreApplication::translate(context: "QPageSize" , key: "Architect C" ); |
1591 | case ArchD: |
1592 | return QCoreApplication::translate(context: "QPageSize" , key: "Architect D" ); |
1593 | case ArchE: |
1594 | return QCoreApplication::translate(context: "QPageSize" , key: "Architect E" ); |
1595 | case Imperial7x9: |
1596 | return msgImperialPageSizeInch(width: 7, height: 9); |
1597 | case Imperial8x10: |
1598 | return msgImperialPageSizeInch(width: 8, height: 10); |
1599 | case Imperial9x11: |
1600 | return msgImperialPageSizeInch(width: 9, height: 11); |
1601 | case Imperial9x12: |
1602 | return msgImperialPageSizeInch(width: 9, height: 12); |
1603 | case Imperial10x11: |
1604 | return msgImperialPageSizeInch(width: 10, height: 11); |
1605 | case Imperial10x13: |
1606 | return msgImperialPageSizeInch(width: 10, height: 13); |
1607 | case Imperial10x14: |
1608 | return msgImperialPageSizeInch(width: 10, height: 14); |
1609 | case Imperial12x11: |
1610 | return msgImperialPageSizeInch(width: 12, height: 11); |
1611 | case Imperial15x11: |
1612 | return msgImperialPageSizeInch(width: 15, height: 11); |
1613 | case Note: |
1614 | return QCoreApplication::translate(context: "QPageSize" , key: "Note" ); |
1615 | case Quarto: |
1616 | return QCoreApplication::translate(context: "QPageSize" , key: "Quarto" ); |
1617 | case Statement: |
1618 | return QCoreApplication::translate(context: "QPageSize" , key: "Statement" ); |
1619 | case SuperA: |
1620 | return QCoreApplication::translate(context: "QPageSize" , key: "Super A" ); |
1621 | case SuperB: |
1622 | return QCoreApplication::translate(context: "QPageSize" , key: "Super B" ); |
1623 | case Postcard: |
1624 | return QCoreApplication::translate(context: "QPageSize" , key: "Postcard" ); |
1625 | case DoublePostcard: |
1626 | return QCoreApplication::translate(context: "QPageSize" , key: "Double Postcard" ); |
1627 | case Prc16K: |
1628 | return QCoreApplication::translate(context: "QPageSize" , key: "PRC 16K" ); |
1629 | case Prc32K: |
1630 | return QCoreApplication::translate(context: "QPageSize" , key: "PRC 32K" ); |
1631 | case Prc32KBig: |
1632 | return QCoreApplication::translate(context: "QPageSize" , key: "PRC 32K Big" ); |
1633 | case FanFoldUS: |
1634 | return QCoreApplication::translate(context: "QPageSize" , key: "Fan-fold US (14.875 x 11 in)" ); |
1635 | case FanFoldGerman: |
1636 | return QCoreApplication::translate(context: "QPageSize" , key: "Fan-fold German (8.5 x 12 in)" ); |
1637 | case FanFoldGermanLegal: |
1638 | return QCoreApplication::translate(context: "QPageSize" , key: "Fan-fold German Legal (8.5 x 13 in)" ); |
1639 | case EnvelopeB4: |
1640 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope B4" ); |
1641 | case EnvelopeB5: |
1642 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope B5" ); |
1643 | case EnvelopeB6: |
1644 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope B6" ); |
1645 | case EnvelopeC0: |
1646 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C0" ); |
1647 | case EnvelopeC1: |
1648 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C1" ); |
1649 | case EnvelopeC2: |
1650 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C2" ); |
1651 | case EnvelopeC3: |
1652 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C3" ); |
1653 | case EnvelopeC4: |
1654 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C4" ); |
1655 | case EnvelopeC5: // C5E |
1656 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C5" ); |
1657 | case EnvelopeC6: |
1658 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C6" ); |
1659 | case EnvelopeC65: |
1660 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C65" ); |
1661 | case EnvelopeC7: |
1662 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope C7" ); |
1663 | case EnvelopeDL: // DLE: |
1664 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope DL" ); |
1665 | case Envelope9: |
1666 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope US 9" ); |
1667 | case Envelope10: // Comm10E |
1668 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope US 10" ); |
1669 | case Envelope11: |
1670 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope US 11" ); |
1671 | case Envelope12: |
1672 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope US 12" ); |
1673 | case Envelope14: |
1674 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope US 14" ); |
1675 | case EnvelopeMonarch: |
1676 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Monarch" ); |
1677 | case EnvelopePersonal: |
1678 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Personal" ); |
1679 | case EnvelopeChou3: |
1680 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Chou 3" ); |
1681 | case EnvelopeChou4: |
1682 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Chou 4" ); |
1683 | case EnvelopeInvite: |
1684 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Invite" ); |
1685 | case EnvelopeItalian: |
1686 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Italian" ); |
1687 | case EnvelopeKaku2: |
1688 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Kaku 2" ); |
1689 | case EnvelopeKaku3: |
1690 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope Kaku 3" ); |
1691 | case EnvelopePrc1: |
1692 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 1" ); |
1693 | case EnvelopePrc2: |
1694 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 2" ); |
1695 | case EnvelopePrc3: |
1696 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 3" ); |
1697 | case EnvelopePrc4: |
1698 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 4" ); |
1699 | case EnvelopePrc5: |
1700 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 5" ); |
1701 | case EnvelopePrc6: |
1702 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 6" ); |
1703 | case EnvelopePrc7: |
1704 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 7" ); |
1705 | case EnvelopePrc8: |
1706 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 8" ); |
1707 | case EnvelopePrc9: |
1708 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 9" ); |
1709 | case EnvelopePrc10: |
1710 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope PRC 10" ); |
1711 | case EnvelopeYou4: |
1712 | return QCoreApplication::translate(context: "QPageSize" , key: "Envelope You 4" ); |
1713 | } |
1714 | return QString(); |
1715 | } |
1716 | |
1717 | /*! |
1718 | Returns the standard QPageSize::PageSizeId of the given \a pointSize in |
1719 | points using the given \a matchPolicy. |
1720 | |
1721 | If using FuzzyMatch then the point size of the PageSizeId returned may not |
1722 | exactly match the \a pointSize you passed in. You should call |
1723 | QPageSize::sizePoints() using the returned PageSizeId to find out the actual |
1724 | point size of the PageSizeId before using it in any calculations. |
1725 | */ |
1726 | |
1727 | QPageSize::PageSizeId QPageSize::id(const QSize &pointSize, SizeMatchPolicy matchPolicy) |
1728 | { |
1729 | return qt_idForPointSize(size: pointSize, matchPolicy, match: nullptr); |
1730 | } |
1731 | |
1732 | /*! |
1733 | Returns the standard QPageSize::PageSizeId of the given \a size in \a units |
1734 | using the given \a matchPolicy. |
1735 | |
1736 | If using FuzzyMatch then the unit size of the PageSizeId returned may not |
1737 | exactly match the \a size you passed in. You should call |
1738 | QPageSize::size() using the returned PageSizeId to find out the actual |
1739 | unit size of the PageSizeId before using it in any calculations. |
1740 | */ |
1741 | |
1742 | QPageSize::PageSizeId QPageSize::id(const QSizeF &size, Unit units, |
1743 | SizeMatchPolicy matchPolicy) |
1744 | { |
1745 | return qt_idForSize(size, units, matchPolicy, match: nullptr); |
1746 | } |
1747 | |
1748 | /*! |
1749 | Returns the PageSizeId for the given Windows DMPAPER enum value \a windowsId. |
1750 | |
1751 | If there is no matching PageSizeId then QPageSize::Custom is returned. |
1752 | */ |
1753 | |
1754 | QPageSize::PageSizeId QPageSize::id(int windowsId) |
1755 | { |
1756 | return qt_idForWindowsID(windowsId); |
1757 | } |
1758 | |
1759 | /*! |
1760 | Returns the Windows DMPAPER enum value of the standard \a pageSizeId. |
1761 | |
1762 | Not all valid PPD page sizes have a Windows equivalent, in which case 0 |
1763 | will be returned. |
1764 | */ |
1765 | |
1766 | int QPageSize::windowsId(PageSizeId pageSizeId) |
1767 | { |
1768 | return qt_pageSizes[pageSizeId].windowsId; |
1769 | } |
1770 | |
1771 | /*! |
1772 | Returns the definition size of the standard \a pageSizeId. |
1773 | |
1774 | To obtain the definition units, call QPageSize::definitionUnits(). |
1775 | */ |
1776 | |
1777 | QSizeF QPageSize::definitionSize(PageSizeId pageSizeId) |
1778 | { |
1779 | if (pageSizeId == Custom) |
1780 | return QSizeF(); |
1781 | return qt_definitionSize(pageSizeId); |
1782 | } |
1783 | |
1784 | /*! |
1785 | Returns the definition units of the standard \a pageSizeId. |
1786 | |
1787 | To obtain the definition size, call QPageSize::definitionSize(). |
1788 | */ |
1789 | |
1790 | QPageSize::Unit QPageSize::definitionUnits(PageSizeId pageSizeId) |
1791 | { |
1792 | if (pageSizeId == Custom) |
1793 | return Unit(-1); |
1794 | return qt_pageSizes[pageSizeId].definitionUnits; |
1795 | } |
1796 | |
1797 | /*! |
1798 | Returns the size of the standard \a pageSizeId in the requested \a units. |
1799 | */ |
1800 | |
1801 | QSizeF QPageSize::size(PageSizeId pageSizeId, Unit units) |
1802 | { |
1803 | if (pageSizeId == Custom) |
1804 | return QSizeF(); |
1805 | return qt_unitSize(pageSizeId, units); |
1806 | } |
1807 | |
1808 | /*! |
1809 | Returns the size of the standard \a pageSizeId in Points. |
1810 | */ |
1811 | |
1812 | QSize QPageSize::sizePoints(PageSizeId pageSizeId) |
1813 | { |
1814 | if (pageSizeId == Custom) |
1815 | return QSize(); |
1816 | return QSize(qt_pageSizes[pageSizeId].widthPoints, qt_pageSizes[pageSizeId].heightPoints); |
1817 | } |
1818 | |
1819 | /*! |
1820 | Returns the size of the standard \a pageSizeId in Device Pixels |
1821 | for the given \a resolution. |
1822 | */ |
1823 | |
1824 | QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution) |
1825 | { |
1826 | if (pageSizeId == Custom) |
1827 | return QSize(); |
1828 | return qt_convertPointsToPixels(size: sizePoints(pageSizeId), resolution); |
1829 | } |
1830 | |
1831 | #ifndef QT_NO_DEBUG_STREAM |
1832 | QDebug operator<<(QDebug dbg, const QPageSize &pageSize) |
1833 | { |
1834 | QDebugStateSaver saver(dbg); |
1835 | dbg.nospace(); |
1836 | dbg.noquote(); |
1837 | dbg << "QPageSize(" ; |
1838 | if (pageSize.isValid()) { |
1839 | dbg << '"' << pageSize.name() << "\", key=\"" << pageSize.key() |
1840 | << "\", " << pageSize.sizePoints().width() << 'x' |
1841 | << pageSize.sizePoints().height() << "pt, id=" << pageSize.id(); |
1842 | } else { |
1843 | dbg.nospace() << "QPageSize()" ; |
1844 | } |
1845 | dbg << ')'; |
1846 | return dbg; |
1847 | } |
1848 | #endif |
1849 | |
1850 | QT_END_NAMESPACE |
1851 | |