Clean up PageSizeId enum

Reorder, and remove ### Qt 6 comment

It would be nice to have a way to statically assert that the order
of StandardPageSizes (and their id) matches the order of the enum,
but it's not possible (or at least very cumbersome) to do so.

Change-Id: Id0d0a58958f1e17151725cbe8f8068db64f84939
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-09-09 17:53:19 +02:00
parent 78b66c7a69
commit 62f5ecca7d
2 changed files with 5 additions and 7 deletions

View File

@ -243,8 +243,6 @@ struct StandardPageSize {
static const StandardPageSize qt_pageSizes[] = {
// Existing Qt sizes including ISO, US, ANSI and other standards
{QPageSize::A4 , DMPAPER_A4 , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4"},
{QPageSize::B5 , DMPAPER_NONE , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "ISOB5"},
{QPageSize::Letter , DMPAPER_LETTER , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Letter"},
{QPageSize::Legal , DMPAPER_LEGAL , QPageSize::Inch , 612, 1008, 215.9, 355.6, 8.5 , 14 , "Legal"},
{QPageSize::Executive , DMPAPER_NONE , QPageSize::Inch , 540, 720, 190.5, 254 , 7.5 , 10 , "Executive.7.5x10in"}, // Qt size differs from Postscript / Windows
@ -252,6 +250,7 @@ static const StandardPageSize qt_pageSizes[] = {
{QPageSize::A1 , DMPAPER_NONE , QPageSize::Millimeter, 1684, 2384, 594 , 841 , 23.39, 33.11, "A1"},
{QPageSize::A2 , DMPAPER_A2 , QPageSize::Millimeter, 1191, 1684, 420 , 594 , 16.54, 23.39, "A2"},
{QPageSize::A3 , DMPAPER_A3 , QPageSize::Millimeter, 842, 1191, 297 , 420 , 11.69, 16.54, "A3"},
{QPageSize::A4 , DMPAPER_A4 , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4"},
{QPageSize::A5 , DMPAPER_A5 , QPageSize::Millimeter, 420, 595, 148 , 210 , 5.83, 8.27, "A5"},
{QPageSize::A6 , DMPAPER_A6 , QPageSize::Millimeter, 297, 420, 105 , 148 , 4.13, 5.83, "A6"},
{QPageSize::A7 , DMPAPER_NONE , QPageSize::Millimeter, 210, 297, 74 , 105 , 2.91, 4.13, "A7"},
@ -263,6 +262,7 @@ static const StandardPageSize qt_pageSizes[] = {
{QPageSize::B2 , DMPAPER_NONE , QPageSize::Millimeter, 1417, 2004, 500 , 707 , 19.68, 27.83, "ISOB2"},
{QPageSize::B3 , DMPAPER_NONE , QPageSize::Millimeter, 1001, 1417, 353 , 500 , 13.9 , 19.68, "ISOB3"},
{QPageSize::B4 , DMPAPER_ISO_B4 , QPageSize::Millimeter, 709, 1001, 250 , 353 , 9.84, 13.9 , "ISOB4"},
{QPageSize::B5 , DMPAPER_NONE , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "ISOB5"},
{QPageSize::B6 , DMPAPER_NONE , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.92, 6.93, "ISOB6"},
{QPageSize::B7 , DMPAPER_NONE , QPageSize::Millimeter, 249, 354, 88 , 125 , 3.46, 4.92, "ISOB7"},
{QPageSize::B8 , DMPAPER_NONE , QPageSize::Millimeter, 176, 249, 62 , 88 , 2.44, 3.46, "ISOB8"},

View File

@ -58,12 +58,8 @@ class Q_GUI_EXPORT QPageSize
{
public:
// ### Qt6 Re-order and remove duplicates
// NOTE: Must keep in sync with QPagedPrintEngine and QPrinter
enum PageSizeId {
// Existing Qt sizes
A4,
B5,
Letter,
Legal,
Executive,
@ -71,6 +67,7 @@ public:
A1,
A2,
A3,
A4,
A5,
A6,
A7,
@ -83,6 +80,7 @@ public:
B3,
B4,
B6,
B5,
B7,
B8,
B9,
@ -198,7 +196,7 @@ public:
EnvelopePrc10,
EnvelopeYou4,
// Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
// Last item, with commonly used synynoms
LastPageSize = EnvelopeYou4,
NPageSize = LastPageSize,
NPaperSize = LastPageSize,