File indexing completed on 2024-05-05 12:57:29
0001 /* 0002 * Copyright (C) 2010-2015 by Stephen Allewell 0003 * steve.allewell@gmail.com 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 */ 0010 0011 #include "PaperSizes.h" 0012 0013 #include <QSizeF> 0014 0015 QVector<QPageSize::PageSizeId> PageSizes::sizesForPrint() 0016 { 0017 static QVector<QPageSize::PageSizeId> sizes{ 0018 QPageSize::A0, QPageSize::A1, QPageSize::A2, QPageSize::A3, QPageSize::A4, QPageSize::A5, QPageSize::A6, QPageSize::A7, 0019 QPageSize::A8, QPageSize::A9, QPageSize::B0, QPageSize::B1, QPageSize::B2, QPageSize::B3, QPageSize::B4, QPageSize::B5, 0020 QPageSize::B6, QPageSize::B7, QPageSize::B8, QPageSize::B9, QPageSize::B10, QPageSize::C5E, QPageSize::Comm10E, QPageSize::DLE, 0021 QPageSize::Executive, QPageSize::Folio, QPageSize::Ledger, QPageSize::Legal, QPageSize::Letter, QPageSize::Tabloid, 0022 }; 0023 return sizes; 0024 } 0025 0026 int PageSizes::width(QPageSize::PageSizeId size, QPageLayout::Orientation orientation) 0027 { 0028 const QSizeF pageSize = QPageSize::size(size, QPageSize::Millimeter); 0029 return static_cast<int>((orientation == QPageLayout::Portrait) ? pageSize.width() : pageSize.height()); 0030 } 0031 0032 int PageSizes::height(QPageSize::PageSizeId size, QPageLayout::Orientation orientation) 0033 { 0034 const QSizeF pageSize = QPageSize::size(size, QPageSize::Millimeter); 0035 return static_cast<int>((orientation == QPageLayout::Portrait) ? pageSize.height() : pageSize.width()); 0036 }