Commit 0e7ed642 authored by Volker Krause's avatar Volker Krause
Browse files

Use new device pixel ratio-aware Prison API

Also, we no longer need the dummy toImage() call workaround to get a valid
barcode size.
parent 8468c7cf
Pipeline #21213 passed with stage
in 15 minutes and 1 second
......@@ -226,8 +226,7 @@ bool ItineraryRenderer::render(const MimeTreeParser::MessagePartPtr &msgPart, Me
break;
}
if (barcode) {
barcode->toImage(barcode->minimumSize()); // minimumSize is only available after we rendered once...
const auto img = barcode->toImage(barcode->minimumSize());
const auto img = barcode->toImage(barcode->preferredSize(qGuiApp->devicePixelRatio()));
const QString fileName = dir + QLatin1String("/ticketToken") + QString::number(ticketTokenId++) + QLatin1String(".png");
img.save(fileName);
m.insert(QStringLiteral("ticketToken"), fileName);
......
......@@ -32,6 +32,7 @@
#include <prison/Prison>
#include <QGuiApplication>
#include <QUrl>
#include <QImage>
#include <QMetaProperty>
......@@ -126,10 +127,9 @@ public:
if (code) {
code->setData(barcode.message());
code->toImage(code->minimumSize()); // minimumSize is only available after we rendered once...
const QString fileName = dir + QStringLiteral("/barcode.png");
code->toImage(code->minimumSize()).save(fileName);
code->toImage(code->preferredSize(qGuiApp->devicePixelRatio())).save(fileName);
pass->setProperty("barcodeUrl", QUrl::fromLocalFile(fileName));
mp->nodeHelper()->addTempFile(fileName);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment