Some size changes for comp name on poster

This commit is contained in:
Dorian Zedler 2021-07-08 11:42:31 +02:00
parent 45fd7add57
commit 9c979d43ab
Signed by: dorian
GPG key ID: 989DE36109AFA354
3 changed files with 21 additions and 11 deletions

View file

@ -58,6 +58,7 @@ private:
#endif #endif
const QStringList _validBaseDomains = {"digitalrock.de", "bluerock.dev"}; const QStringList _validBaseDomains = {"digitalrock.de", "bluerock.dev"};
bool _pendingIntentsChecked; bool _pendingIntentsChecked;
signals: signals:
Q_INVOKABLE void openedViaUrl(QString url, QString scheme); Q_INVOKABLE void openedViaUrl(QString url, QString scheme);

View file

@ -195,7 +195,7 @@ Window {
//app.openAthlete() // dorian: 53139 , rustam: 6933 , helen: 53300 //app.openAthlete() // dorian: 53139 , rustam: 6933 , helen: 53300
//openWidget({nation:'GER'}) //openWidget({nation:'GER'})
//mainStack.push("Pages/AthleteSearchPage.qml") //mainStack.push("Pages/AthleteSearchPage.qml")
openWidget({comp: 11651, cat: 26}) //openWidget({comp: 11651, cat: 26})
//openWidget({person: 6623}) //openWidget({person: 6623})
//console.log(JSON.stringify(serverConn.getParamsFromUrl(""))) //console.log(JSON.stringify(serverConn.getParamsFromUrl("")))
//openWidgetFromUrl("https://l.bluerock.dev/?comp=11601&type=starters") //openWidgetFromUrl("https://l.bluerock.dev/?comp=11601&type=starters")
@ -563,8 +563,8 @@ Window {
Product { Product {
id: speedFlowChartProduct id: speedFlowChartProduct
//identifier: "speed_flowchart" identifier: "speed_flowchart"
identifier: "android.test.purchased" //identifier: "android.test.purchased"
//identifier: "android.test.canceled" //identifier: "android.test.canceled"
//identifier: "android.test.refunded" //identifier: "android.test.refunded"

View file

@ -123,6 +123,19 @@ void BlueRockBackend::shareResultsAsPoster(QString url, QString compName) {
return; return;
} }
// dimensions
QRect qrCodeRect = QRect(276, 276, 1100, 1100);
int compNameTextLineHeight = 44;
QFont compNameTextFont("OpenSans-Light");
compNameTextFont.setPixelSize(compNameTextLineHeight);
QRect compNameTextRect = QRect(
216,
1670,
1220,
100
);
QPdfWriter writer(&file); QPdfWriter writer(&file);
writer.setPageSize(QPageSize(QSizeF(70.02, 99.02), QPageSize::Millimeter)); writer.setPageSize(QPageSize(QSizeF(70.02, 99.02), QPageSize::Millimeter));
writer.setPageMargins(QMargins(0, 0, 0, 0)); writer.setPageMargins(QMargins(0, 0, 0, 0));
@ -133,17 +146,13 @@ void BlueRockBackend::shareResultsAsPoster(QString url, QString compName) {
painter.drawPixmap(0,0, writer.width(), writer.height(), background); painter.drawPixmap(0,0, writer.width(), writer.height(), background);
QPixmap barcode; QPixmap barcode;
int size = 1100; QZXingEncoderConfig encoderConfig(QZXing::EncoderFormat_QR_CODE, qrCodeRect.size(), QZXing::EncodeErrorCorrectionLevel_H, false, false);
QZXingEncoderConfig encoderConfig(QZXing::EncoderFormat_QR_CODE, QSize(size, size), QZXing::EncodeErrorCorrectionLevel_H, false, false);
barcode.convertFromImage(QZXing::encodeData(url, encoderConfig)); barcode.convertFromImage(QZXing::encodeData(url, encoderConfig));
painter.drawPixmap(276, 276, size, size, barcode); painter.drawPixmap(qrCodeRect, barcode);
QFont font("OpenSans-Light"); painter.setFont(compNameTextFont);
font.setPixelSize(44);
painter.setFont(font);
painter.setPen(Qt::black); painter.setPen(Qt::black);
// QFontMetrics(painter.font()).size(Qt::TextSingleLine, "One ").width() painter.drawText(compNameTextRect, Qt::AlignLeft|Qt::AlignBottom|Qt::TextWordWrap, rawCompName);
painter.drawText(QRect(216, 1670, 1220, 100), Qt::AlignLeft|Qt::AlignTop|Qt::TextWordWrap, rawCompName);
painter.end(); painter.end();
file.close(); file.close();