Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpagesize.cpp
Go to the documentation of this file.
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
14
15using namespace Qt::StringLiterals;
16
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
25 DMPAPER_NONE = 0, // Not a DMPAPER, use for sizes without a DMPAPER value
145 DMPAPER_USER = 256
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
156static const int qt_windowsConversion[][2] = {
157 {DMPAPER_11X17, DMPAPER_TABLOID}, // = DMPAPER_LEDGER rotated
192 {DMPAPER_PENV_10_ROTATED, DMPAPER_PENV_10} // Is = DMPAPER_LAST, use as loop terminator
193};
194
195// Standard sizes data
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;
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
214
215 // Old Qt sizes including ISO, US, ANSI and other standards
216 {QPageSize::Letter , DMPAPER_LETTER , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Letter"},
217 {QPageSize::Legal , DMPAPER_LEGAL , QPageSize::Inch , 612, 1008, 215.9, 355.6, 8.5 , 14 , "Legal"},
218 {QPageSize::Executive , DMPAPER_NONE , QPageSize::Inch , 540, 720, 190.5, 254 , 7.5 , 10 , "Executive.7.5x10in"}, // Qt size differs from Postscript / Windows
219 {QPageSize::A0 , DMPAPER_NONE , QPageSize::Millimeter, 2384, 3370, 841 , 1189 , 33.11, 46.81, "A0"},
220 {QPageSize::A1 , DMPAPER_NONE , QPageSize::Millimeter, 1684, 2384, 594 , 841 , 23.39, 33.11, "A1"},
221 {QPageSize::A2 , DMPAPER_A2 , QPageSize::Millimeter, 1191, 1684, 420 , 594 , 16.54, 23.39, "A2"},
222 {QPageSize::A3 , DMPAPER_A3 , QPageSize::Millimeter, 842, 1191, 297 , 420 , 11.69, 16.54, "A3"},
223 {QPageSize::A4 , DMPAPER_A4 , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4"},
224 {QPageSize::A5 , DMPAPER_A5 , QPageSize::Millimeter, 420, 595, 148 , 210 , 5.83, 8.27, "A5"},
225 {QPageSize::A6 , DMPAPER_A6 , QPageSize::Millimeter, 297, 420, 105 , 148 , 4.13, 5.83, "A6"},
226 {QPageSize::A7 , DMPAPER_NONE , QPageSize::Millimeter, 210, 297, 74 , 105 , 2.91, 4.13, "A7"},
227 {QPageSize::A8 , DMPAPER_NONE , QPageSize::Millimeter, 148, 210, 52 , 74 , 2.05, 2.91, "A8"},
228 {QPageSize::A9 , DMPAPER_NONE , QPageSize::Millimeter, 105, 148, 37 , 52 , 1.46, 2.05, "A9"},
229 {QPageSize::A10 , DMPAPER_NONE , QPageSize::Millimeter, 73, 105, 26 , 37 , 1.02, 1.46, "A10"},
230 {QPageSize::B0 , DMPAPER_NONE , QPageSize::Millimeter, 2835, 4008, 1000 , 1414 , 39.37, 55.67, "ISOB0"},
231 {QPageSize::B1 , DMPAPER_NONE , QPageSize::Millimeter, 2004, 2835, 707 , 1000 , 27.83, 39.37, "ISOB1"},
232 {QPageSize::B2 , DMPAPER_NONE , QPageSize::Millimeter, 1417, 2004, 500 , 707 , 19.68, 27.83, "ISOB2"},
233 {QPageSize::B3 , DMPAPER_NONE , QPageSize::Millimeter, 1001, 1417, 353 , 500 , 13.9 , 19.68, "ISOB3"},
234 {QPageSize::B4 , DMPAPER_ISO_B4 , QPageSize::Millimeter, 709, 1001, 250 , 353 , 9.84, 13.9 , "ISOB4"},
235 {QPageSize::B5 , DMPAPER_NONE , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "ISOB5"},
236 {QPageSize::B6 , DMPAPER_NONE , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.92, 6.93, "ISOB6"},
237 {QPageSize::B7 , DMPAPER_NONE , QPageSize::Millimeter, 249, 354, 88 , 125 , 3.46, 4.92, "ISOB7"},
238 {QPageSize::B8 , DMPAPER_NONE , QPageSize::Millimeter, 176, 249, 62 , 88 , 2.44, 3.46, "ISOB8"},
239 {QPageSize::B9 , DMPAPER_NONE , QPageSize::Millimeter, 125, 176, 44 , 62 , 1.73, 2.44, "ISOB9"},
240 {QPageSize::B10 , DMPAPER_NONE , QPageSize::Millimeter, 88, 125, 31 , 44 , 1.22, 1.73, "ISOB10"},
241 {QPageSize::C5E , DMPAPER_ENV_C5 , QPageSize::Millimeter, 459, 649, 162 , 229 , 6.38, 9.02, "EnvC5"},
242 {QPageSize::Comm10E , DMPAPER_ENV_10 , QPageSize::Inch , 297, 684, 104.8, 241.3, 4.12, 9.5 , "Env10"},
243 {QPageSize::DLE , DMPAPER_ENV_DL , QPageSize::Millimeter, 312, 624, 110 , 220 , 4.33, 8.66, "EnvDL"},
244 {QPageSize::Folio , DMPAPER_NONE , QPageSize::Millimeter, 595, 935, 210 , 330 , 8.27, 13 , "Folio"},
245 {QPageSize::Ledger , DMPAPER_LEDGER , QPageSize::Inch , 1224, 792, 431.8, 279.4, 17 , 11 , "Ledger"},
246 {QPageSize::Tabloid , DMPAPER_TABLOID , QPageSize::Inch , 792, 1224, 279.4, 431.8, 11 , 17 , "Tabloid"},
247 {QPageSize::Custom , DMPAPER_USER , QPageSize::Millimeter, -1, -1, -1. , -1 , -1 , -1 , "Custom"}, // Special case to keep in sync with QPageSize::PageSizeId
248
249 // ISO Standard Sizes
250 {QPageSize::A3Extra , DMPAPER_A3_EXTRA , QPageSize::Millimeter, 913, 1262, 322 , 445 , 12.67, 17.52, "A3Extra"},
251 {QPageSize::A4Extra , DMPAPER_A4_EXTRA , QPageSize::Millimeter, 667, 914, 235.5, 322.3, 9.27, 12.69, "A4Extra"},
252 {QPageSize::A4Plus , DMPAPER_A4_PLUS , QPageSize::Millimeter, 595, 936, 210 , 330 , 8.27, 13 , "A4Plus"},
253 {QPageSize::A4Small , DMPAPER_A4SMALL , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4Small"},
254 {QPageSize::A5Extra , DMPAPER_A5_EXTRA , QPageSize::Millimeter, 492, 668, 174 , 235 , 6.85, 9.25, "A5Extra"},
255 {QPageSize::B5Extra , DMPAPER_B5_EXTRA , QPageSize::Millimeter, 570, 782, 201 , 276 , 7.9 , 10.8 , "ISOB5Extra"},
256
257 // JIS Standard Sizes
258 {QPageSize::JisB0 , DMPAPER_NONE , QPageSize::Millimeter, 2920, 4127, 1030 , 1456 , 40.55, 57.32, "B0"},
259 {QPageSize::JisB1 , DMPAPER_NONE , QPageSize::Millimeter, 2064, 2920, 728 , 1030 , 28.66, 40.55, "B1"},
260 {QPageSize::JisB2 , DMPAPER_NONE , QPageSize::Millimeter, 1460, 2064, 515 , 728 , 20.28, 28.66, "B2"},
261 {QPageSize::JisB3 , DMPAPER_NONE , QPageSize::Millimeter, 1032, 1460, 364 , 515 , 14.33, 20.28, "B3"},
262 {QPageSize::JisB4 , DMPAPER_B4 , QPageSize::Millimeter, 729, 1032, 257 , 364 , 10.12, 14.33, "B4"},
263 {QPageSize::JisB5 , DMPAPER_B5 , QPageSize::Millimeter, 516, 729, 182 , 257 , 7.17, 10.12, "B5"},
264 {QPageSize::JisB6 , DMPAPER_B6_JIS , QPageSize::Millimeter, 363, 516, 128 , 182 , 5.04, 7.17, "B6"},
265 {QPageSize::JisB7 , DMPAPER_NONE , QPageSize::Millimeter, 258, 363, 91 , 128 , 3.58, 5.04, "B7"},
266 {QPageSize::JisB8 , DMPAPER_NONE , QPageSize::Millimeter, 181, 258, 64 , 91 , 2.52, 3.58, "B8"},
267 {QPageSize::JisB9 , DMPAPER_NONE , QPageSize::Millimeter, 127, 181, 45 , 64 , 1.77, 2.52, "B9"},
268 {QPageSize::JisB10 , DMPAPER_NONE , QPageSize::Millimeter, 91, 127, 32 , 45 , 1.26, 1.77, "B10"},
269
270 // ANSI / US Standard sizes
271 {QPageSize::AnsiC , DMPAPER_NONE , QPageSize::Inch , 1224, 1584, 431.8, 558.8, 17 , 22 , "AnsiC"},
272 {QPageSize::AnsiD , DMPAPER_NONE , QPageSize::Inch , 1584, 2448, 558.8, 863.6, 22 , 34 , "AnsiD"},
273 {QPageSize::AnsiE , DMPAPER_NONE , QPageSize::Inch , 2448, 3168, 863.6, 1118 , 34 , 44 , "AnsiE"},
274 {QPageSize::LegalExtra , DMPAPER_LEGAL_EXTRA , QPageSize::Inch , 684, 1080, 241.3, 381 , 9.5 , 15 , "LegalExtra"},
275 {QPageSize::LetterExtra , DMPAPER_LETTER_EXTRA , QPageSize::Inch , 684, 864, 241.3, 304.8, 9.5 , 12 , "LetterExtra"},
276 {QPageSize::LetterPlus , DMPAPER_LETTER_PLUS , QPageSize::Inch , 612, 914, 215.9, 322.3, 8.5 , 12.69, "LetterPlus"},
277 {QPageSize::LetterSmall , DMPAPER_LETTERSMALL , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "LetterSmall"},
278 {QPageSize::TabloidExtra , DMPAPER_TABLOID_EXTRA , QPageSize::Inch , 864, 1296, 304.8, 457.2, 12 , 18 , "TabloidExtra"},
279
280 // Architectural sizes
281 {QPageSize::ArchA , DMPAPER_NONE , QPageSize::Inch , 648, 864, 228.6, 304.8, 9 , 12 , "ARCHA"},
282 {QPageSize::ArchB , DMPAPER_NONE , QPageSize::Inch , 864, 1296, 304.8, 457.2, 12 , 18 , "ARCHB"},
283 {QPageSize::ArchC , DMPAPER_CSHEET , QPageSize::Inch , 1296, 1728, 457.2, 609.6, 18 , 24 , "ARCHC"},
284 {QPageSize::ArchD , DMPAPER_DSHEET , QPageSize::Inch , 1728, 2592, 609.6, 914.4, 24 , 36 , "ARCHD"},
285 {QPageSize::ArchE , DMPAPER_ESHEET , QPageSize::Inch , 2592, 3456, 914.4, 1219 , 36 , 48 , "ARCHE"},
286
287 // Inch-based Sizes
288 {QPageSize::Imperial7x9 , DMPAPER_NONE , QPageSize::Inch , 504, 648, 177.8, 228.6, 7 , 9 , "7x9"},
289 {QPageSize::Imperial8x10 , DMPAPER_NONE , QPageSize::Inch , 576, 720, 203.2, 254 , 8 , 10 , "8x10"},
290 {QPageSize::Imperial9x11 , DMPAPER_9X11 , QPageSize::Inch , 648, 792, 228.6, 279.4, 9 , 11 , "9x11"},
291 {QPageSize::Imperial9x12 , DMPAPER_NONE , QPageSize::Inch , 648, 864, 228.6, 304.8, 9 , 12 , "9x12"},
292 {QPageSize::Imperial10x11 , DMPAPER_10X11 , QPageSize::Inch , 720, 792, 254 , 279.4, 10 , 11 , "10x11"},
293 {QPageSize::Imperial10x13 , DMPAPER_NONE , QPageSize::Inch , 720, 936, 254 , 330.2, 10 , 13 , "10x13"},
294 {QPageSize::Imperial10x14 , DMPAPER_10X14 , QPageSize::Inch , 720, 1008, 254 , 355.6, 10 , 14 , "10x14"},
295 {QPageSize::Imperial12x11 , DMPAPER_12X11 , QPageSize::Inch , 864, 792, 304.8, 279.4, 12 , 11 , "12x11"},
296 {QPageSize::Imperial15x11 , DMPAPER_15X11 , QPageSize::Inch , 1080, 792, 381 , 279.4, 15 , 11 , "15x11"},
297
298 // Other Page Sizes
299 {QPageSize::ExecutiveStandard , DMPAPER_EXECUTIVE , QPageSize::Inch , 522, 756, 184.2, 266.7, 7.25, 10.5 , "Executive"}, // Qt size differs from Postscript / Windows
300 {QPageSize::Note , DMPAPER_NOTE , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Note"},
301 {QPageSize::Quarto , DMPAPER_QUARTO , QPageSize::Inch , 610, 780, 215.9, 275.1, 8.5 , 10.83, "Quarto"},
302 {QPageSize::Statement , DMPAPER_STATEMENT , QPageSize::Inch , 396, 612, 139.7, 215.9, 5.5 , 8.5 , "Statement"},
303 {QPageSize::SuperA , DMPAPER_A_PLUS , QPageSize::Millimeter, 643, 1009, 227 , 356 , 8.94, 14 , "SuperA"},
304 {QPageSize::SuperB , DMPAPER_B_PLUS , QPageSize::Millimeter, 864, 1380, 305 , 487 , 12 , 19.17, "SuperB"},
305 {QPageSize::Postcard , DMPAPER_JAPANESE_POSTCARD , QPageSize::Millimeter, 284, 419, 100 , 148 , 3.94, 5.83, "Postcard"},
306 {QPageSize::DoublePostcard , DMPAPER_DBL_JAPANESE_POSTCARD, QPageSize::Millimeter, 567, 419, 200 , 148 , 7.87, 5.83, "DoublePostcard"},
307 {QPageSize::Prc16K , DMPAPER_P16K , QPageSize::Millimeter, 414, 610, 146 , 215 , 5.75, 8.5 , "PRC16K"},
308 {QPageSize::Prc32K , DMPAPER_P32K , QPageSize::Millimeter, 275, 428, 97 , 151 , 3.82, 5.95, "PRC32K"},
309 {QPageSize::Prc32KBig , DMPAPER_P32KBIG , QPageSize::Millimeter, 275, 428, 97 , 151 , 3.82, 5.95, "PRC32KBig"},
310
311 // Fan Fold Sizes
312 {QPageSize::FanFoldUS , DMPAPER_FANFOLD_US , QPageSize::Inch , 1071, 792, 377.8, 279.4, 14.875, 11 , "FanFoldUS"},
313 {QPageSize::FanFoldGerman , DMPAPER_FANFOLD_STD_GERMAN , QPageSize::Inch , 612, 864, 215.9, 304.8, 8.5 , 12 , "FanFoldGerman"},
314 {QPageSize::FanFoldGermanLegal, DMPAPER_FANFOLD_LGL_GERMAN , QPageSize::Inch , 612, 936, 215.9, 330 , 8.5 , 13 , "FanFoldGermanLegal"},
315
316 // ISO Envelopes
317 {QPageSize::EnvelopeB4 , DMPAPER_ENV_B4 , QPageSize::Millimeter, 708, 1001, 250 , 353 , 9.84, 13.9 , "EnvISOB4"},
318 {QPageSize::EnvelopeB5 , DMPAPER_ENV_B5 , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "EnvISOB5"},
319 {QPageSize::EnvelopeB6 , DMPAPER_ENV_B6 , QPageSize::Millimeter, 499, 354, 176 , 125 , 6.9 , 4.9 , "EnvISOB6"},
320 {QPageSize::EnvelopeC0 , DMPAPER_NONE , QPageSize::Millimeter, 2599, 3676, 917 , 1297 , 36.1 , 51.06, "EnvC0"},
321 {QPageSize::EnvelopeC1 , DMPAPER_NONE , QPageSize::Millimeter, 1837, 2599, 648 , 917 , 25.51, 36.1 , "EnvC1"},
322 {QPageSize::EnvelopeC2 , DMPAPER_NONE , QPageSize::Millimeter, 1298, 1837, 458 , 648 , 18.03, 25.51, "EnvC2"},
323 {QPageSize::EnvelopeC3 , DMPAPER_ENV_C3 , QPageSize::Millimeter, 918, 1296, 324 , 458 , 12.75, 18.03, "EnvC3"},
324 {QPageSize::EnvelopeC4 , DMPAPER_ENV_C4 , QPageSize::Millimeter, 649, 918, 229 , 324 , 9.02, 12.75, "EnvC4"},
325 {QPageSize::EnvelopeC6 , DMPAPER_ENV_C6 , QPageSize::Millimeter, 323, 459, 114 , 162 , 4.49, 6.38, "EnvC6"},
326 {QPageSize::EnvelopeC65 , DMPAPER_ENV_C65 , QPageSize::Millimeter, 324, 648, 114 , 229 , 4.5 , 9 , "EnvC65"},
327 {QPageSize::EnvelopeC7 , DMPAPER_NONE , QPageSize::Millimeter, 230, 323, 81 , 114 , 3.19, 4.49, "EnvC7"},
328
329 // US Envelopes
330 {QPageSize::Envelope9 , DMPAPER_ENV_9 , QPageSize::Inch , 279, 639, 98.4, 225.4, 3.875, 8.875, "Env9"},
331 {QPageSize::Envelope11 , DMPAPER_ENV_11 , QPageSize::Inch , 324, 747, 114.3, 263.5, 4.5 , 10.375, "Env11"},
332 {QPageSize::Envelope12 , DMPAPER_ENV_12 , QPageSize::Inch , 342, 792, 120.7, 279.4, 4.75, 11 , "Env12"},
333 {QPageSize::Envelope14 , DMPAPER_ENV_14 , QPageSize::Inch , 360, 828, 127 , 292.1, 5 , 11.5 , "Env14"},
334 {QPageSize::EnvelopeMonarch , DMPAPER_ENV_MONARCH , QPageSize::Inch , 279, 540, 98.43, 190.5, 3.875, 7.5 , "EnvMonarch"},
335 {QPageSize::EnvelopePersonal , DMPAPER_ENV_PERSONAL , QPageSize::Inch , 261, 468, 92.08, 165.1, 3.625, 6.5 , "EnvPersonal"},
336
337 // Other Envelopes
338 {QPageSize::EnvelopeChou3 , DMPAPER_JENV_CHOU3 , QPageSize::Millimeter, 340, 666, 120 , 235 , 4.72, 9.25, "EnvChou3"},
339 {QPageSize::EnvelopeChou4 , DMPAPER_JENV_CHOU4 , QPageSize::Millimeter, 255, 581, 90 , 205 , 3.54, 8 , "EnvChou4"},
340 {QPageSize::EnvelopeInvite , DMPAPER_ENV_INVITE , QPageSize::Millimeter, 624, 624, 220 , 220 , 8.66, 8.66, "EnvInvite"},
341 {QPageSize::EnvelopeItalian , DMPAPER_ENV_ITALY , QPageSize::Millimeter, 312, 652, 110 , 230 , 4.33, 9 , "EnvItalian"},
342 {QPageSize::EnvelopeKaku2 , DMPAPER_JENV_KAKU2 , QPageSize::Millimeter, 680, 941, 240 , 332 , 9.45, 13 , "EnvKaku2"},
343 {QPageSize::EnvelopeKaku3 , DMPAPER_JENV_KAKU3 , QPageSize::Millimeter, 612, 785, 216 , 277 , 8.5 , 10.9 , "EnvKaku3"},
344 {QPageSize::EnvelopePrc1 , DMPAPER_PENV_1 , QPageSize::Millimeter, 289, 468, 102 , 165 , 4 , 6.5 , "EnvPRC1"},
345 {QPageSize::EnvelopePrc2 , DMPAPER_PENV_2 , QPageSize::Millimeter, 289, 499, 102 , 176 , 4 , 6.9 , "EnvPRC2"},
346 {QPageSize::EnvelopePrc3 , DMPAPER_PENV_3 , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.9 , 6.9 , "EnvPRC3"},
347 {QPageSize::EnvelopePrc4 , DMPAPER_PENV_4 , QPageSize::Millimeter, 312, 590, 110 , 208 , 4.33, 8.2 , "EnvPRC4"},
348 {QPageSize::EnvelopePrc5 , DMPAPER_PENV_5 , QPageSize::Millimeter, 312, 624, 110 , 220 , 4.33, 8.66, "EnvPRC5"},
349 {QPageSize::EnvelopePrc6 , DMPAPER_PENV_6 , QPageSize::Millimeter, 340, 652, 120 , 230 , 4.7 , 9 , "EnvPRC6"},
350 {QPageSize::EnvelopePrc7 , DMPAPER_PENV_7 , QPageSize::Millimeter, 454, 652, 160 , 230 , 6.3 , 9 , "EnvPRC7"},
351 {QPageSize::EnvelopePrc8 , DMPAPER_PENV_8 , QPageSize::Millimeter, 340, 876, 120 , 309 , 4.7 , 12.2 , "EnvPRC8"},
352 {QPageSize::EnvelopePrc9 , DMPAPER_PENV_9 , QPageSize::Millimeter, 649, 918, 229 , 324 , 9 , 12.75, "EnvPRC9"},
353 {QPageSize::EnvelopePrc10 , DMPAPER_PENV_10 , QPageSize::Millimeter, 918, 1298, 324 , 458 , 12.75, 18 , "EnvPRC10"},
354 {QPageSize::EnvelopeYou4 , DMPAPER_JENV_YOU4 , QPageSize::Millimeter, 298, 666, 105 , 235 , 4.13, 9.25, "EnvYou4"}
355};
356
357static const int pageSizesCount = int(sizeof(qt_pageSizes) / sizeof(qt_pageSizes[0]));
358static_assert(pageSizesCount == QPageSize::LastPageSize + 1);
359static_assert(QPageSize::LastPageSize < 256);
360
361// Return key name for PageSize
363{
364 return QString::fromLatin1(qt_pageSizes[id].mediaOption);
365}
366
367// Return id name for PPD Key
368static 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("Rotated"_L1))
375 key.chop(7);
376 else if (key.endsWith(".Transverse"_L1))
377 key.chop(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
389static 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
415{
416 // PPD custom format
417 QString key = QStringLiteral("Custom.%1x%2%3");
418 QString abbrev;
419 switch (units) {
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;
435 abbrev = QStringLiteral("CC");
436 break;
437 }
438 // Assumes size is already max 2 decimal places
439 return key.arg(size.width()).arg(size.height()).arg(abbrev);
440}
441
442// Return localized name for custom size
444{
446 switch (units) {
448 //: Custom size name in millimeters
449 name = QCoreApplication::translate("QPageSize", "Custom (%1mm x %2mm)");
450 break;
451 case QPageSize::Point:
452 //: Custom size name in points
453 name = QCoreApplication::translate("QPageSize", "Custom (%1pt x %2pt)");
454 break;
455 case QPageSize::Inch:
456 //: Custom size name in inches
457 name = QCoreApplication::translate("QPageSize", "Custom (%1in x %2in)");
458 break;
459 case QPageSize::Pica:
460 //: Custom size name in picas
461 name = QCoreApplication::translate("QPageSize", "Custom (%1pc x %2pc)");
462 break;
463 case QPageSize::Didot:
464 //: Custom size name in didots
465 name = QCoreApplication::translate("QPageSize", "Custom (%1DD x %2DD)");
466 break;
468 //: Custom size name in ciceros
469 name = QCoreApplication::translate("QPageSize", "Custom (%1CC x %2CC)");
470 break;
471 }
472 // Assumes size is already max 2 decimal places
473 return name.arg(size.width()).arg(size.height());
474}
475
476// Multiplier for converting units to points.
478{
479 switch (unit) {
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;
491 return 12.789921252;
492 }
493 return 1.0;
494}
495
496// Multiplier for converting pixels to points.
497Q_GUI_EXPORT qreal qt_pixelMultiplier(int resolution)
498{
499 return resolution <= 0 ? 1.0 : 72.0 / resolution;
500}
501
503{
504 QPageSize::Unit units = qt_pageSizes[pageSizeId].definitionUnits;
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
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(size.width()) && qFuzzyIsNull(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(fromUnits);
524 newSize = newSize * multiplier;
525 }
526 // Then convert from points to required units
527 const qreal multiplier = qt_pointMultiplier(toUnits);
528 // Try force to 2 decimal places for consistency
529 const int width = qRound(newSize.width() * 100 / multiplier);
530 const int height = qRound(newSize.height() * 100 / multiplier);
531 return QSizeF(width / 100.0, height / 100.0);
532}
533
535{
536 if (!size.isValid())
537 return QSize();
539}
540
541static 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(qFloor(size.width() / multiplier), qFloor(size.height() / multiplier));
547}
548
550{
551 if (!size.isValid())
552 return QSizeF();
553 const qreal multiplier = qt_pointMultiplier(units);
554 // Try force to 2 decimal places for consistency
555 const int width = qRound(size.width() * 100 / multiplier);
556 const int height = qRound(size.height() * 100 / multiplier);
557 return QSizeF(width / 100.0, height / 100.0);
558}
559
561{
562 switch (units) {
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:
572 return qt_convertPointsToUnits(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
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
647{
648 if (!size.isValid())
649 return QPageSize::Custom;
650
651 // Try exact match if units are the same
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
680 return qt_idForPointSize(points, matchPolicy, match);
681}
682
684{
685public:
687 explicit QPageSizePrivate(QPageSize::PageSizeId pageSizeId);
688 QPageSizePrivate(const QSize &pointSize,
689 const QString &name,
690 QPageSize::SizeMatchPolicy matchPolicy);
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);
697
698 bool operator==(const QPageSizePrivate &other) const;
699 bool isEquivalentTo(const QPageSizePrivate &other) const;
700
701 bool isValid() const;
702
704 QSize sizePixels(int resolution) const;
705
706private:
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;
715 QSize m_pointSize;
716 QString m_name;
717 int m_windowsId;
718 QSizeF m_size;
719 QPageSize::Unit m_units;
720};
721
723 : m_id(QPageSize::Custom),
724 m_windowsId(0),
725 m_units(QPageSize::Point)
726{
727}
728
730 : m_id(QPageSize::Custom),
731 m_windowsId(0),
732 m_units(QPageSize::Point)
733{
734 if (unsigned(pageSizeId) <= unsigned(QPageSize::LastPageSize))
735 init(pageSizeId, QString());
736}
737
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(pointSize, matchPolicy, nullptr);
745 id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
746 }
747}
748
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, nullptr);
757 id == QPageSize::Custom ? init(size, units, name) : init(id, name);
758 }
759}
760
762 : m_id(QPageSize::Custom),
763 m_windowsId(0),
764 m_units(QPageSize::Point)
765{
766 if (!key.isEmpty() && pointSize.isValid()) {
768 // If not a known PPD key, check if size is a standard PPD size
769 if (id == QPageSize::Custom)
770 id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, nullptr);
771 id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
772 m_key = key;
773 }
774}
775
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, 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(pointSize, QPageSize::FuzzyMatch, nullptr);
786 id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
787 m_windowsId = windowsId;
788 }
789}
790
794
795// Init a standard PageSizeId
796void QPageSizePrivate::init(QPageSize::PageSizeId id, const QString &name)
797{
798 m_id = id;
799 m_size = qt_definitionSize(id);
800 m_units = qt_pageSizes[id].definitionUnits;
801 m_key = qt_keyForPageSizeId(id);
802 m_name = name.isEmpty() ? QPageSize::name(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
808void 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(m_size, m_units);
814 m_name = name.isEmpty() ? qt_nameForCustomSize(m_size, m_units) : name;
815 m_windowsId = 0;
816 m_pointSize = size;
817}
818
819// Init a unit size
820void 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(m_size, m_units);
826 if (name.isEmpty())
827 m_name = qt_nameForCustomSize(m_size, m_units);
828 else
829 m_name = name;
830 m_windowsId = 0;
831 m_pointSize = qt_convertUnitsToPoints(m_size, m_units);
832}
833
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
843{
844 return m_pointSize == other.m_pointSize;
845}
846
848{
849 return m_pointSize.isValid() && !m_key.isEmpty() && !m_name.isEmpty();
850}
851
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(m_size, m_units, units);
865
866 // Otherwise use the standard sizes
867 return qt_unitSize(m_id, units);
868}
869
871{
872 return qt_convertPointsToPixels(m_pointSize, resolution);
873}
874
875
1088 : d(new QPageSizePrivate())
1089{
1090}
1091
1100 : d(new QPageSizePrivate(pageSize))
1101{
1102}
1103
1121QPageSize::QPageSize(const QSize &pointSize, const QString &name, SizeMatchPolicy matchPolicy)
1122 : d(new QPageSizePrivate(pointSize, name, matchPolicy))
1123{
1124}
1125
1143 const QString &name, SizeMatchPolicy matchPolicy)
1144 : d(new QPageSizePrivate(size, units, name, matchPolicy))
1145{
1146}
1147
1154QPageSize::QPageSize(const QString &key, const QSize &pointSize, const QString &name)
1155 : d(new QPageSizePrivate(key, pointSize, name))
1156{
1157}
1158
1165QPageSize::QPageSize(int windowsId, const QSize &pointSize, const QString &name)
1166 : d(new QPageSizePrivate(windowsId, pointSize, name))
1167{
1168}
1169
1177 : d(&dd)
1178{
1179}
1180
1186 : d(other.d)
1187{
1188}
1189
1197
1203{
1204 d = other.d;
1205 return *this;
1206}
1207
1241bool QPageSize::equals(const QPageSize &other) const
1242{
1243 return d == other.d || *d == *other.d;
1244}
1245
1246
1253{
1254 if (d == other.d)
1255 return true;
1256 return d && other.d && d->isEquivalentTo(*other.d);
1257}
1258
1267{
1268 return d && d->isValid();
1269}
1270
1288{
1289 return isValid() ? d->m_key : QString();
1290}
1291
1303{
1304 return isValid() ? d->m_name : QString();
1305}
1306
1314{
1315 return isValid() ? d->m_id : Custom;
1316}
1317
1330{
1331 if (!isValid())
1332 return 0;
1333 return d->m_windowsId > 0 ? d->m_windowsId : windowsId(d->m_id);
1334}
1335
1352{
1353 return isValid() ? d->m_size : QSizeF();
1354}
1355
1372{
1373 return isValid() ? d->m_units : Unit(-1);
1374}
1375
1383{
1384 return isValid() ? d->size(units) : QSize();
1385}
1386
1394{
1395 return isValid() ? d->m_pointSize : QSize();
1396}
1397
1404QSize QPageSize::sizePixels(int resolution) const
1405{
1406 return isValid() ? d->sizePixels(resolution) : QSize();
1407}
1408
1416{
1417 return isValid() ? QRectF(QPointF(0, 0), d->size(units)) : QRectF();
1418}
1419
1427{
1428 return isValid() ? QRect(QPoint(0, 0), d->m_pointSize) : QRect();
1429}
1430
1437QRect QPageSize::rectPixels(int resolution) const
1438{
1439 return isValid() ? QRect(QPoint(0, 0), d->sizePixels(resolution)) : QRect();
1440}
1441
1442// Statics
1443
1451{
1452 if (unsigned(pageSizeId) > unsigned(LastPageSize))
1453 return QString();
1454 return QString::fromUtf8(qt_pageSizes[pageSizeId].mediaOption);
1455}
1456
1458{
1459 //: Page size in 'Inch'.
1460 return QCoreApplication::translate("QPageSize", "%1 x %2 in").arg(width).arg(height);
1461}
1462
1470{
1471 if (unsigned(pageSizeId) > unsigned(LastPageSize))
1472 return QString();
1473
1474 switch (pageSizeId) {
1475 case A0:
1476 return QCoreApplication::translate("QPageSize", "A0");
1477 case A1:
1478 return QCoreApplication::translate("QPageSize", "A1");
1479 case A2:
1480 return QCoreApplication::translate("QPageSize", "A2");
1481 case A3:
1482 return QCoreApplication::translate("QPageSize", "A3");
1483 case A4:
1484 return QCoreApplication::translate("QPageSize", "A4");
1485 case A5:
1486 return QCoreApplication::translate("QPageSize", "A5");
1487 case A6:
1488 return QCoreApplication::translate("QPageSize", "A6");
1489 case A7:
1490 return QCoreApplication::translate("QPageSize", "A7");
1491 case A8:
1492 return QCoreApplication::translate("QPageSize", "A8");
1493 case A9:
1494 return QCoreApplication::translate("QPageSize", "A9");
1495 case A10:
1496 return QCoreApplication::translate("QPageSize", "A10");
1497 case B0:
1498 return QCoreApplication::translate("QPageSize", "B0");
1499 case B1:
1500 return QCoreApplication::translate("QPageSize", "B1");
1501 case B2:
1502 return QCoreApplication::translate("QPageSize", "B2");
1503 case B3:
1504 return QCoreApplication::translate("QPageSize", "B3");
1505 case B4:
1506 return QCoreApplication::translate("QPageSize", "B4");
1507 case B5:
1508 return QCoreApplication::translate("QPageSize", "B5");
1509 case B6:
1510 return QCoreApplication::translate("QPageSize", "B6");
1511 case B7:
1512 return QCoreApplication::translate("QPageSize", "B7");
1513 case B8:
1514 return QCoreApplication::translate("QPageSize", "B8");
1515 case B9:
1516 return QCoreApplication::translate("QPageSize", "B9");
1517 case B10:
1518 return QCoreApplication::translate("QPageSize", "B10");
1519 case Executive:
1520 return QCoreApplication::translate("QPageSize", "Executive (7.5 x 10 in)");
1521 case ExecutiveStandard:
1522 return QCoreApplication::translate("QPageSize", "Executive (7.25 x 10.5 in)");
1523 case Folio:
1524 return QCoreApplication::translate("QPageSize", "Folio (8.27 x 13 in)");
1525 case Legal:
1526 return QCoreApplication::translate("QPageSize", "Legal");
1527 case Letter:
1528 return QCoreApplication::translate("QPageSize", "Letter / ANSI A");
1529 case Tabloid:
1530 return QCoreApplication::translate("QPageSize", "Tabloid / ANSI B");
1531 case Ledger:
1532 return QCoreApplication::translate("QPageSize", "Ledger / ANSI B");
1533 case Custom:
1534 return QCoreApplication::translate("QPageSize", "Custom");
1535 case A3Extra:
1536 return QCoreApplication::translate("QPageSize", "A3 Extra");
1537 case A4Extra:
1538 return QCoreApplication::translate("QPageSize", "A4 Extra");
1539 case A4Plus:
1540 return QCoreApplication::translate("QPageSize", "A4 Plus");
1541 case A4Small:
1542 return QCoreApplication::translate("QPageSize", "A4 Small");
1543 case A5Extra:
1544 return QCoreApplication::translate("QPageSize", "A5 Extra");
1545 case B5Extra:
1546 return QCoreApplication::translate("QPageSize", "B5 Extra");
1547 case JisB0:
1548 return QCoreApplication::translate("QPageSize", "JIS B0");
1549 case JisB1:
1550 return QCoreApplication::translate("QPageSize", "JIS B1");
1551 case JisB2:
1552 return QCoreApplication::translate("QPageSize", "JIS B2");
1553 case JisB3:
1554 return QCoreApplication::translate("QPageSize", "JIS B3");
1555 case JisB4:
1556 return QCoreApplication::translate("QPageSize", "JIS B4");
1557 case JisB5:
1558 return QCoreApplication::translate("QPageSize", "JIS B5");
1559 case JisB6:
1560 return QCoreApplication::translate("QPageSize", "JIS B6");
1561 case JisB7:
1562 return QCoreApplication::translate("QPageSize", "JIS B7");
1563 case JisB8:
1564 return QCoreApplication::translate("QPageSize", "JIS B8");
1565 case JisB9:
1566 return QCoreApplication::translate("QPageSize", "JIS B9");
1567 case JisB10:
1568 return QCoreApplication::translate("QPageSize", "JIS B10");
1569 case AnsiC:
1570 return QCoreApplication::translate("QPageSize", "ANSI C");
1571 case AnsiD:
1572 return QCoreApplication::translate("QPageSize", "ANSI D");
1573 case AnsiE:
1574 return QCoreApplication::translate("QPageSize", "ANSI E");
1575 case LegalExtra:
1576 return QCoreApplication::translate("QPageSize", "Legal Extra");
1577 case LetterExtra:
1578 return QCoreApplication::translate("QPageSize", "Letter Extra");
1579 case LetterPlus:
1580 return QCoreApplication::translate("QPageSize", "Letter Plus");
1581 case LetterSmall:
1582 return QCoreApplication::translate("QPageSize", "Letter Small");
1583 case TabloidExtra:
1584 return QCoreApplication::translate("QPageSize", "Tabloid Extra");
1585 case ArchA:
1586 return QCoreApplication::translate("QPageSize", "Architect A");
1587 case ArchB:
1588 return QCoreApplication::translate("QPageSize", "Architect B");
1589 case ArchC:
1590 return QCoreApplication::translate("QPageSize", "Architect C");
1591 case ArchD:
1592 return QCoreApplication::translate("QPageSize", "Architect D");
1593 case ArchE:
1594 return QCoreApplication::translate("QPageSize", "Architect E");
1595 case Imperial7x9:
1596 return msgImperialPageSizeInch(7, 9);
1597 case Imperial8x10:
1598 return msgImperialPageSizeInch(8, 10);
1599 case Imperial9x11:
1600 return msgImperialPageSizeInch(9, 11);
1601 case Imperial9x12:
1602 return msgImperialPageSizeInch(9, 12);
1603 case Imperial10x11:
1604 return msgImperialPageSizeInch(10, 11);
1605 case Imperial10x13:
1606 return msgImperialPageSizeInch(10, 13);
1607 case Imperial10x14:
1608 return msgImperialPageSizeInch(10, 14);
1609 case Imperial12x11:
1610 return msgImperialPageSizeInch(12, 11);
1611 case Imperial15x11:
1612 return msgImperialPageSizeInch(15, 11);
1613 case Note:
1614 return QCoreApplication::translate("QPageSize", "Note");
1615 case Quarto:
1616 return QCoreApplication::translate("QPageSize", "Quarto");
1617 case Statement:
1618 return QCoreApplication::translate("QPageSize", "Statement");
1619 case SuperA:
1620 return QCoreApplication::translate("QPageSize", "Super A");
1621 case SuperB:
1622 return QCoreApplication::translate("QPageSize", "Super B");
1623 case Postcard:
1624 return QCoreApplication::translate("QPageSize", "Postcard");
1625 case DoublePostcard:
1626 return QCoreApplication::translate("QPageSize", "Double Postcard");
1627 case Prc16K:
1628 return QCoreApplication::translate("QPageSize", "PRC 16K");
1629 case Prc32K:
1630 return QCoreApplication::translate("QPageSize", "PRC 32K");
1631 case Prc32KBig:
1632 return QCoreApplication::translate("QPageSize", "PRC 32K Big");
1633 case FanFoldUS:
1634 return QCoreApplication::translate("QPageSize", "Fan-fold US (14.875 x 11 in)");
1635 case FanFoldGerman:
1636 return QCoreApplication::translate("QPageSize", "Fan-fold German (8.5 x 12 in)");
1637 case FanFoldGermanLegal:
1638 return QCoreApplication::translate("QPageSize", "Fan-fold German Legal (8.5 x 13 in)");
1639 case EnvelopeB4:
1640 return QCoreApplication::translate("QPageSize", "Envelope B4");
1641 case EnvelopeB5:
1642 return QCoreApplication::translate("QPageSize", "Envelope B5");
1643 case EnvelopeB6:
1644 return QCoreApplication::translate("QPageSize", "Envelope B6");
1645 case EnvelopeC0:
1646 return QCoreApplication::translate("QPageSize", "Envelope C0");
1647 case EnvelopeC1:
1648 return QCoreApplication::translate("QPageSize", "Envelope C1");
1649 case EnvelopeC2:
1650 return QCoreApplication::translate("QPageSize", "Envelope C2");
1651 case EnvelopeC3:
1652 return QCoreApplication::translate("QPageSize", "Envelope C3");
1653 case EnvelopeC4:
1654 return QCoreApplication::translate("QPageSize", "Envelope C4");
1655 case EnvelopeC5: // C5E
1656 return QCoreApplication::translate("QPageSize", "Envelope C5");
1657 case EnvelopeC6:
1658 return QCoreApplication::translate("QPageSize", "Envelope C6");
1659 case EnvelopeC65:
1660 return QCoreApplication::translate("QPageSize", "Envelope C65");
1661 case EnvelopeC7:
1662 return QCoreApplication::translate("QPageSize", "Envelope C7");
1663 case EnvelopeDL: // DLE:
1664 return QCoreApplication::translate("QPageSize", "Envelope DL");
1665 case Envelope9:
1666 return QCoreApplication::translate("QPageSize", "Envelope US 9");
1667 case Envelope10: // Comm10E
1668 return QCoreApplication::translate("QPageSize", "Envelope US 10");
1669 case Envelope11:
1670 return QCoreApplication::translate("QPageSize", "Envelope US 11");
1671 case Envelope12:
1672 return QCoreApplication::translate("QPageSize", "Envelope US 12");
1673 case Envelope14:
1674 return QCoreApplication::translate("QPageSize", "Envelope US 14");
1675 case EnvelopeMonarch:
1676 return QCoreApplication::translate("QPageSize", "Envelope Monarch");
1677 case EnvelopePersonal:
1678 return QCoreApplication::translate("QPageSize", "Envelope Personal");
1679 case EnvelopeChou3:
1680 return QCoreApplication::translate("QPageSize", "Envelope Chou 3");
1681 case EnvelopeChou4:
1682 return QCoreApplication::translate("QPageSize", "Envelope Chou 4");
1683 case EnvelopeInvite:
1684 return QCoreApplication::translate("QPageSize", "Envelope Invite");
1685 case EnvelopeItalian:
1686 return QCoreApplication::translate("QPageSize", "Envelope Italian");
1687 case EnvelopeKaku2:
1688 return QCoreApplication::translate("QPageSize", "Envelope Kaku 2");
1689 case EnvelopeKaku3:
1690 return QCoreApplication::translate("QPageSize", "Envelope Kaku 3");
1691 case EnvelopePrc1:
1692 return QCoreApplication::translate("QPageSize", "Envelope PRC 1");
1693 case EnvelopePrc2:
1694 return QCoreApplication::translate("QPageSize", "Envelope PRC 2");
1695 case EnvelopePrc3:
1696 return QCoreApplication::translate("QPageSize", "Envelope PRC 3");
1697 case EnvelopePrc4:
1698 return QCoreApplication::translate("QPageSize", "Envelope PRC 4");
1699 case EnvelopePrc5:
1700 return QCoreApplication::translate("QPageSize", "Envelope PRC 5");
1701 case EnvelopePrc6:
1702 return QCoreApplication::translate("QPageSize", "Envelope PRC 6");
1703 case EnvelopePrc7:
1704 return QCoreApplication::translate("QPageSize", "Envelope PRC 7");
1705 case EnvelopePrc8:
1706 return QCoreApplication::translate("QPageSize", "Envelope PRC 8");
1707 case EnvelopePrc9:
1708 return QCoreApplication::translate("QPageSize", "Envelope PRC 9");
1709 case EnvelopePrc10:
1710 return QCoreApplication::translate("QPageSize", "Envelope PRC 10");
1711 case EnvelopeYou4:
1712 return QCoreApplication::translate("QPageSize", "Envelope You 4");
1713 }
1714 return QString();
1715}
1716
1728{
1729 return qt_idForPointSize(pointSize, matchPolicy, nullptr);
1730}
1731
1743 SizeMatchPolicy matchPolicy)
1744{
1745 return qt_idForSize(size, units, matchPolicy, nullptr);
1746}
1747
1758
1767{
1768 return qt_pageSizes[pageSizeId].windowsId;
1769}
1770
1778{
1779 if (pageSizeId == Custom)
1780 return QSizeF();
1781 return qt_definitionSize(pageSizeId);
1782}
1783
1791{
1792 if (pageSizeId == Custom)
1793 return Unit(-1);
1794 return qt_pageSizes[pageSizeId].definitionUnits;
1795}
1796
1802{
1803 if (pageSizeId == Custom)
1804 return QSizeF();
1805 return qt_unitSize(pageSizeId, units);
1806}
1807
1813{
1814 if (pageSizeId == Custom)
1815 return QSize();
1816 return QSize(qt_pageSizes[pageSizeId].widthPoints, qt_pageSizes[pageSizeId].heightPoints);
1817}
1818
1824QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution)
1825{
1826 if (pageSizeId == Custom)
1827 return QSize();
1828 return qt_convertPointsToPixels(sizePoints(pageSizeId), resolution);
1829}
1830
1831#ifndef QT_NO_DEBUG_STREAM
1832QDebug 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
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\inmodule QtCore
\inmodule QtCore
bool operator==(const QPageSizePrivate &other) const
QSizeF size(QPageSize::Unit units) const
bool isValid() const
bool isEquivalentTo(const QPageSizePrivate &other) const
QSize sizePixels(int resolution) const
\inmodule QtGui
Definition qpagesize.h:22
bool isValid() const
Returns true if this page size is valid.
QString key() const
Returns the unique key of the page size.
Unit
This enum type is used to specify the measurement unit for page sizes.
Definition qpagesize.h:175
QSizeF definitionSize() const
Returns the definition size of the page size.
~QPageSize()
Destroys the page.
int windowsId() const
Returns the Windows DMPAPER enum value for the page size.
QRect rectPoints() const
Returns the page rectangle in Postscript Points (1/72 of an inch).
Unit definitionUnits() const
Returns the definition units of the page size.
QSizeF size(Unit units) const
Returns the size of the page in the required units.
QRect rectPixels(int resolution) const
Returns the page rectangle in Device Pixels at the given resolution.
QString name() const
Returns a localized human-readable name for the page size.
QSize sizePoints() const
Returns the size of the page in Postscript Points (1/72 of an inch).
QSize sizePixels(int resolution) const
Returns the size of the page in Device Pixels at the given resolution.
bool isEquivalentTo(const QPageSize &other) const
Returns true if this page is equivalent to the other page, i.e.
QPageSize()
Creates a null QPageSize.
PageSizeId id() const
Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom.
QPageSize & operator=(const QPageSize &other)
Assignment operator, assigns other to this.
SizeMatchPolicy
\value FuzzyMatch Match to a standard page size if within the margin of tolerance.
Definition qpagesize.h:184
@ FuzzyOrientationMatch
Definition qpagesize.h:186
PageSizeId
This enum type lists the available page sizes as defined in the Postscript PPD standard.
Definition qpagesize.h:25
@ DoublePostcard
Definition qpagesize.h:114
@ Imperial12x11
Definition qpagesize.h:104
@ Imperial8x10
Definition qpagesize.h:98
@ Imperial10x11
Definition qpagesize.h:101
@ EnvelopePersonal
Definition qpagesize.h:143
@ EnvelopePrc10
Definition qpagesize.h:160
@ EnvelopeChou4
Definition qpagesize.h:146
@ Imperial10x13
Definition qpagesize.h:102
@ ExecutiveStandard
Definition qpagesize.h:107
@ FanFoldGerman
Definition qpagesize.h:120
@ EnvelopeKaku2
Definition qpagesize.h:149
@ Imperial9x11
Definition qpagesize.h:99
@ EnvelopeChou3
Definition qpagesize.h:145
@ TabloidExtra
Definition qpagesize.h:89
@ EnvelopeMonarch
Definition qpagesize.h:142
@ EnvelopeInvite
Definition qpagesize.h:147
@ Imperial10x14
Definition qpagesize.h:103
@ EnvelopeKaku3
Definition qpagesize.h:150
@ FanFoldGermanLegal
Definition qpagesize.h:121
@ LetterSmall
Definition qpagesize.h:88
@ EnvelopeItalian
Definition qpagesize.h:148
@ Imperial15x11
Definition qpagesize.h:105
@ LetterExtra
Definition qpagesize.h:86
@ Imperial7x9
Definition qpagesize.h:97
QRectF rect(Unit units) const
Returns the page rectangle in the required units.
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qshareddata.h:19
\inmodule QtCore
Definition qsize.h:208
constexpr QSize toSize() const noexcept
Returns an integer based copy of this size.
Definition qsize.h:401
constexpr qreal width() const noexcept
Returns the width.
Definition qsize.h:332
constexpr qreal height() const noexcept
Returns the height.
Definition qsize.h:335
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
Definition qsize.h:127
\inmodule QtCore
Definition qstringview.h:78
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5871
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
QSet< QString >::iterator it
Combined button and popup list for selecting options.
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:349
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:327
int qFloor(T v)
Definition qmath.h:42
#define QT_IMPL_METATYPE_EXTERN_TAGGED(TYPE, TAG)
Definition qmetatype.h:1384
#define QT_IMPL_METATYPE_EXTERN(TYPE)
Definition qmetatype.h:1390
GLuint64 key
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint id
[7]
GLint GLsizei width
GLfloat units
GLuint name
GLfixed GLfixed GLint GLint GLfixed points
static QSizeF qt_definitionSize(QPageSize::PageSizeId pageSizeId)
static QString msgImperialPageSizeInch(int width, int height)
static QString qt_keyForPageSizeId(QPageSize::PageSizeId id)
static qreal qt_pointMultiplier(QPageSize::Unit unit)
QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
static QPageSize::PageSizeId qt_idForWindowsID(int windowsId, QSize *match=nullptr)
Q_GUI_EXPORT qreal qt_pixelMultiplier(int resolution)
WindowsDmPaper
Definition qpagesize.cpp:24
@ DMPAPER_LETTER_EXTRA
Definition qpagesize.cpp:75
@ DMPAPER_PENV_9
@ DMPAPER_ENV_11
Definition qpagesize.cpp:46
@ DMPAPER_ENV_14
Definition qpagesize.cpp:48
@ DMPAPER_A5
Definition qpagesize.cpp:36
@ DMPAPER_15X11
Definition qpagesize.cpp:71
@ DMPAPER_PENV_8
@ DMPAPER_STATEMENT
Definition qpagesize.cpp:31
@ DMPAPER_PENV_7
@ DMPAPER_USER
@ DMPAPER_LETTER_TRANSVERSE
Definition qpagesize.cpp:79
@ DMPAPER_A4_ROTATED
@ DMPAPER_PENV_4
@ DMPAPER_A4_EXTRA
Definition qpagesize.cpp:78
@ DMPAPER_QUARTO
Definition qpagesize.cpp:40
@ DMPAPER_NONE
Definition qpagesize.cpp:25
@ DMPAPER_PENV_10_ROTATED
@ DMPAPER_RESERVED_48
Definition qpagesize.cpp:73
@ DMPAPER_LETTER_PLUS
Definition qpagesize.cpp:84
@ DMPAPER_A2
Definition qpagesize.cpp:91
@ DMPAPER_PENV_8_ROTATED
@ DMPAPER_ENV_12
Definition qpagesize.cpp:47
@ DMPAPER_A5_ROTATED
@ DMPAPER_A3_EXTRA_TRANSVERSE
Definition qpagesize.cpp:93
@ DMPAPER_B5_EXTRA
Definition qpagesize.cpp:90
@ DMPAPER_B_PLUS
Definition qpagesize.cpp:83
@ DMPAPER_PENV_4_ROTATED
@ DMPAPER_10X14
Definition qpagesize.cpp:41
@ DMPAPER_ENV_C65
Definition qpagesize.cpp:57
@ DMPAPER_B5
Definition qpagesize.cpp:38
@ DMPAPER_B4_JIS_ROTATED
@ DMPAPER_JENV_CHOU3
Definition qpagesize.cpp:98
@ DMPAPER_ENV_ITALY
Definition qpagesize.cpp:61
@ DMPAPER_ENV_9
Definition qpagesize.cpp:44
@ DMPAPER_LAST
@ DMPAPER_A_PLUS
Definition qpagesize.cpp:82
@ DMPAPER_P32K_ROTATED
@ DMPAPER_RESERVED_49
Definition qpagesize.cpp:74
@ DMPAPER_PENV_2
@ DMPAPER_A3
Definition qpagesize.cpp:33
@ DMPAPER_ENV_B5
Definition qpagesize.cpp:59
@ DMPAPER_JENV_CHOU4_ROTATED
@ DMPAPER_PENV_5
@ DMPAPER_10X11
Definition qpagesize.cpp:70
@ DMPAPER_FANFOLD_STD_GERMAN
Definition qpagesize.cpp:65
@ DMPAPER_FANFOLD_LGL_GERMAN
Definition qpagesize.cpp:66
@ DMPAPER_B4
Definition qpagesize.cpp:37
@ DMPAPER_NOTE
Definition qpagesize.cpp:43
@ DMPAPER_LEDGER
Definition qpagesize.cpp:29
@ DMPAPER_PENV_7_ROTATED
@ DMPAPER_JENV_KAKU2_ROTATED
@ DMPAPER_ENV_B4
Definition qpagesize.cpp:58
@ DMPAPER_A4SMALL
Definition qpagesize.cpp:35
@ DMPAPER_B6_JIS_ROTATED
@ DMPAPER_FOLIO
Definition qpagesize.cpp:39
@ DMPAPER_9X11
Definition qpagesize.cpp:69
@ DMPAPER_PENV_6_ROTATED
@ DMPAPER_LEGAL
Definition qpagesize.cpp:30
@ DMPAPER_JENV_CHOU3_ROTATED
@ DMPAPER_LETTERSMALL
Definition qpagesize.cpp:27
@ DMPAPER_LEGAL_EXTRA
Definition qpagesize.cpp:76
@ DMPAPER_A6
Definition qpagesize.cpp:95
@ DMPAPER_JENV_KAKU2
Definition qpagesize.cpp:96
@ DMPAPER_PENV_3
@ DMPAPER_A3_ROTATED
@ DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED
@ DMPAPER_B5_TRANSVERSE
Definition qpagesize.cpp:87
@ DMPAPER_ENV_10
Definition qpagesize.cpp:45
@ DMPAPER_A5_TRANSVERSE
Definition qpagesize.cpp:86
@ DMPAPER_ENV_DL
Definition qpagesize.cpp:52
@ DMPAPER_A6_ROTATED
@ DMPAPER_PENV_6
@ DMPAPER_PENV_10
@ DMPAPER_TABLOID_EXTRA
Definition qpagesize.cpp:77
@ DMPAPER_LETTER
Definition qpagesize.cpp:26
@ DMPAPER_P32K
@ DMPAPER_JENV_YOU4_ROTATED
@ DMPAPER_JENV_YOU4
@ DMPAPER_JENV_KAKU3_ROTATED
@ DMPAPER_PENV_1
@ DMPAPER_LETTER_ROTATED
@ DMPAPER_ENV_B6
Definition qpagesize.cpp:60
@ DMPAPER_JAPANESE_POSTCARD_ROTATED
@ DMPAPER_PENV_2_ROTATED
@ DMPAPER_ESHEET
Definition qpagesize.cpp:51
@ DMPAPER_P16K
@ DMPAPER_12X11
@ DMPAPER_EXECUTIVE
Definition qpagesize.cpp:32
@ DMPAPER_DBL_JAPANESE_POSTCARD
Definition qpagesize.cpp:94
@ DMPAPER_ENV_C3
Definition qpagesize.cpp:54
@ DMPAPER_JENV_KAKU3
Definition qpagesize.cpp:97
@ DMPAPER_P32KBIG_ROTATED
@ DMPAPER_JAPANESE_POSTCARD
Definition qpagesize.cpp:68
@ DMPAPER_PENV_3_ROTATED
@ DMPAPER_A3_EXTRA
Definition qpagesize.cpp:88
@ DMPAPER_DSHEET
Definition qpagesize.cpp:50
@ DMPAPER_PENV_5_ROTATED
@ DMPAPER_P16K_ROTATED
@ DMPAPER_ENV_C5
Definition qpagesize.cpp:53
@ DMPAPER_ISO_B4
Definition qpagesize.cpp:67
@ DMPAPER_PENV_1_ROTATED
@ DMPAPER_ENV_INVITE
Definition qpagesize.cpp:72
@ DMPAPER_ENV_C4
Definition qpagesize.cpp:55
@ DMPAPER_CSHEET
Definition qpagesize.cpp:49
@ DMPAPER_ENV_MONARCH
Definition qpagesize.cpp:62
@ DMPAPER_B5_JIS_ROTATED
@ DMPAPER_FANFOLD_US
Definition qpagesize.cpp:64
@ DMPAPER_P32KBIG
@ DMPAPER_ENV_C6
Definition qpagesize.cpp:56
@ DMPAPER_TABLOID
Definition qpagesize.cpp:28
@ DMPAPER_A3_TRANSVERSE
Definition qpagesize.cpp:92
@ DMPAPER_LETTER_EXTRA_TRANSVERSE
Definition qpagesize.cpp:81
@ DMPAPER_11X17
Definition qpagesize.cpp:42
@ DMPAPER_A4_PLUS
Definition qpagesize.cpp:85
@ DMPAPER_A5_EXTRA
Definition qpagesize.cpp:89
@ DMPAPER_B6_JIS
@ DMPAPER_A4
Definition qpagesize.cpp:34
@ DMPAPER_PENV_9_ROTATED
@ DMPAPER_A4_TRANSVERSE
Definition qpagesize.cpp:80
@ DMPAPER_ENV_PERSONAL
Definition qpagesize.cpp:63
@ DMPAPER_JENV_CHOU4
Definition qpagesize.cpp:99
static QPageSize::PageSizeId qt_idForSize(const QSizeF &size, QPageSize::Unit units, QPageSize::SizeMatchPolicy matchPolicy, QSize *match)
static QSizeF qt_unitSize(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units)
static QSize qt_convertUnitsToPoints(const QSizeF &size, QPageSize::Unit units)
static QSize qt_convertPointsToPixels(const QSize &size, int resolution)
static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match=nullptr)
static QString qt_nameForCustomSize(const QSizeF &size, QPageSize::Unit units)
static const StandardPageSize qt_pageSizes[]
static QString qt_keyForCustomSize(const QSizeF &size, QPageSize::Unit units)
static QSizeF qt_convertUnits(const QSizeF &size, QPageSize::Unit fromUnits, QPageSize::Unit toUnits)
static const int pageSizesCount
static QSizeF qt_convertPointsToUnits(const QSize &size, QPageSize::Unit units)
static const int qt_windowsConversion[][2]
static QPageSize::PageSizeId qt_idForPointSize(const QSize &size, QPageSize::SizeMatchPolicy matchPolicy, QSize *match)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QStringLiteral(str)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
double qreal
Definition qtypes.h:187
QSharedPointer< T > other(t)
[5]
const char mediaOption[20]
QPageSize::PageSizeId id
QPageSize::Unit definitionUnits