make font settings cross platform
This commit is contained in:
parent
2561b03583
commit
f260bc2b0c
5 changed files with 12 additions and 13 deletions
|
@ -13,7 +13,7 @@ std::string formatCentAsEuroString(const int cent, int width)
|
||||||
currStream << std::right << std::setw(width) << std::showbase
|
currStream << std::right << std::setw(width) << std::showbase
|
||||||
<< std::put_money(cent, false);
|
<< std::put_money(cent, false);
|
||||||
} catch (std::runtime_error& err) {
|
} catch (std::runtime_error& err) {
|
||||||
currStream << std::fixed << std::setw(width) << std::setprecision(2) << cent / 100.0L
|
currStream << std::fixed << std::setw(width - 2) << std::setprecision(2) << cent / 100.0L
|
||||||
<< " €";
|
<< " €";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QFontDatabase>
|
||||||
|
|
||||||
BasketModel::BasketModel(Marketplace* market, QObject* parent)
|
BasketModel::BasketModel(Marketplace* market, QObject* parent)
|
||||||
: QAbstractTableModel(parent), marketplace_(market)
|
: QAbstractTableModel(parent), marketplace_(market)
|
||||||
|
@ -24,13 +25,11 @@ QVariant BasketModel::data(const QModelIndex& index, int role) const
|
||||||
case 0:
|
case 0:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case 1:
|
case 1:
|
||||||
myFont.setFamily("monospace");
|
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
return myFont;
|
|
||||||
case 2:
|
case 2:
|
||||||
return myFont;
|
return myFont;
|
||||||
case 3:
|
case 3:
|
||||||
myFont.setFamily("monospace");
|
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
return myFont;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <posprinter.h>
|
#include <posprinter.h>
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QFontDatabase>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtPrintSupport/QPrintDialog>
|
#include <QtPrintSupport/QPrintDialog>
|
||||||
|
@ -74,7 +75,7 @@ void ReportDialog::onPrintReportButtonClicked()
|
||||||
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
||||||
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
||||||
"Auswertung Kindersachenmarkt");
|
"Auswertung Kindersachenmarkt");
|
||||||
painter.setFont(QFont("monospace", 12));
|
painter.setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
QString content;
|
QString content;
|
||||||
content += QString("%1 %2 %3 %4 %5 %6 %7")
|
content += QString("%1 %2 %3 %4 %5 %6 %7")
|
||||||
.arg("Nr.", -3)
|
.arg("Nr.", -3)
|
||||||
|
@ -109,7 +110,7 @@ void ReportDialog::onPrintReportButtonClicked()
|
||||||
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
||||||
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
||||||
"Auswertung Kindersachenmarkt");
|
"Auswertung Kindersachenmarkt");
|
||||||
painter.setFont(QFont("monospace", 12));
|
painter.setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
QString content("Einzelteile ohne Nummer\n=======================\n\n");
|
QString content("Einzelteile ohne Nummer\n=======================\n\n");
|
||||||
unsigned int lines{0};
|
unsigned int lines{0};
|
||||||
unsigned int pages{1};
|
unsigned int pages{1};
|
||||||
|
@ -138,7 +139,7 @@ void ReportDialog::onPrintReportButtonClicked()
|
||||||
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
painter.setFont(QFont("Arial", 16, QFont::Bold));
|
||||||
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
painter.drawText(QRect(0, 0, width, height), Qt::AlignTop | Qt::AlignHCenter,
|
||||||
"Auswertung Kindersachenmarkt");
|
"Auswertung Kindersachenmarkt");
|
||||||
painter.setFont(QFont("monospace", 12));
|
painter.setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
QString content("Gesamtstatistik\n===============\n\n");
|
QString content("Gesamtstatistik\n===============\n\n");
|
||||||
content += QString("Registrierte Verkäufer: %1\n").arg(sellers.size(), 6);
|
content += QString("Registrierte Verkäufer: %1\n").arg(sellers.size(), 6);
|
||||||
content += QString("Verkaufte Artikel: %1\n\n").arg(6, 6);
|
content += QString("Verkaufte Artikel: %1\n\n").arg(6, 6);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "reportmodel.h"
|
#include "reportmodel.h"
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#include <QFontDatabase>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
ReportModel::ReportModel(Marketplace* market, QObject* parent)
|
ReportModel::ReportModel(Marketplace* market, QObject* parent)
|
||||||
|
@ -9,7 +10,6 @@ ReportModel::ReportModel(Marketplace* market, QObject* parent)
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
feeInPercent_ = settings.value("global/feeInPercent").toInt();
|
feeInPercent_ = settings.value("global/feeInPercent").toInt();
|
||||||
maxFeeInCent_ = settings.value("global/maxFeeInEuro").toInt() * 100;
|
maxFeeInCent_ = settings.value("global/maxFeeInEuro").toInt() * 100;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReportModel::rowCount([[maybe_unused]] const QModelIndex& parent) const
|
int ReportModel::rowCount([[maybe_unused]] const QModelIndex& parent) const
|
||||||
|
@ -30,8 +30,7 @@ QVariant ReportModel::data(const QModelIndex& index, int role) const
|
||||||
case 5:
|
case 5:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case 6:
|
case 6:
|
||||||
myFont.setFamily("monospace");
|
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
return myFont;
|
|
||||||
default:
|
default:
|
||||||
return myFont;
|
return myFont;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#include <QFontDatabase>
|
||||||
|
|
||||||
SaleModel::SaleModel(Marketplace* market, QObject* parent) : QAbstractItemModel(parent)
|
SaleModel::SaleModel(Marketplace* market, QObject* parent) : QAbstractItemModel(parent)
|
||||||
{
|
{
|
||||||
|
@ -83,8 +84,7 @@ QVariant SaleModel::data(const QModelIndex& index, int role) const
|
||||||
case 0:
|
case 0:
|
||||||
return myFont;
|
return myFont;
|
||||||
case 1:
|
case 1:
|
||||||
myFont.setFamily("monospace");
|
return QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
return myFont;
|
|
||||||
default:
|
default:
|
||||||
return myFont;
|
return myFont;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue