Change paper sizes to QSizeF
This commit is contained in:
parent
b5b15236f8
commit
ebdfa9e4ee
3 changed files with 10 additions and 10 deletions
|
@ -193,9 +193,9 @@ try {
|
|||
qDebug() << "Unsupported paper size" << PaperSize;
|
||||
throw ConvertFailedException(tr("Unsupported paper size"));
|
||||
}
|
||||
QPair<float,float> wh = PaperSizes[PaperSize];
|
||||
quint32 Width = qRound(wh.first/25.4*HwResX);
|
||||
quint32 Height = qRound(wh.second/25.4*HwResY);
|
||||
QSizeF size = PaperSizes[PaperSize];
|
||||
quint32 Width = qRound(size.width()/25.4*HwResX);
|
||||
quint32 Height = qRound(size.height()/25.4*HwResY);
|
||||
|
||||
qDebug() << "Size is" << Width << "x" << Height;
|
||||
|
||||
|
@ -228,7 +228,7 @@ try {
|
|||
tmpPdfFile.open();
|
||||
QPdfWriter pdfWriter(tmpPdfFile.fileName());
|
||||
pdfWriter.setCreator("SeaPrint " SEAPRINT_VERSION);
|
||||
QPageSize pageSize(QSizeF {wh.first, wh.second}, QPageSize::Millimeter);
|
||||
QPageSize pageSize(size, QPageSize::Millimeter);
|
||||
pdfWriter.setPageSize(pageSize);
|
||||
pdfWriter.setResolution(HwResX);
|
||||
QPainter painter(&pdfWriter);
|
||||
|
@ -452,7 +452,7 @@ try {
|
|||
qDebug() << "Unsupported paper size" << PaperSize;
|
||||
throw ConvertFailedException(tr("Unsupported paper size"));
|
||||
}
|
||||
QPair<float,float> wh = PaperSizes[PaperSize];
|
||||
QSizeF size = PaperSizes[PaperSize];
|
||||
|
||||
QFile inFile(filename);
|
||||
if(!inFile.open(QIODevice::ReadOnly))
|
||||
|
@ -467,7 +467,7 @@ try {
|
|||
|
||||
QPdfWriter pdfWriter(tmpPdfFile.fileName());
|
||||
pdfWriter.setCreator("SeaPrint " SEAPRINT_VERSION);
|
||||
QPageSize pageSize(QSizeF {wh.first, wh.second}, QPageSize::Millimeter);
|
||||
QPageSize pageSize(size, QPageSize::Millimeter);
|
||||
pdfWriter.setPageSize(pageSize);
|
||||
pdfWriter.setResolution(resolution);
|
||||
|
||||
|
|
|
@ -521,8 +521,8 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
|
|||
return;
|
||||
}
|
||||
|
||||
int x = PaperSizes[PaperSize].first*100;
|
||||
int y = PaperSizes[PaperSize].second*100;
|
||||
int x = PaperSizes[PaperSize].width()*100;
|
||||
int y = PaperSizes[PaperSize].height()*100;
|
||||
|
||||
QJsonObject Dimensions =
|
||||
{{"tag", IppMsg::BeginCollection},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef PAPERSIZES_H
|
||||
#define PAPERSIZES_H
|
||||
#include <QMap>
|
||||
#include <QPair>
|
||||
#include <QSizeF>
|
||||
|
||||
static QMap<QString, QPair<float,float>> PaperSizes =
|
||||
static QMap<QString, QSizeF> PaperSizes =
|
||||
{{"asme_f_28x40in", {711.20, 1016.00}},
|
||||
{"iso_2a0_1189x1682mm", {1189.00, 1682.00}},
|
||||
{"iso_a0_841x1189mm", {841.00, 1189.00}},
|
||||
|
|
Loading…
Reference in a new issue