Wrap long row headers

This commit is contained in:
Michael Mandl 2019-02-07 20:03:22 +01:00
parent 1f5c0de80a
commit 189c24cf61
5 changed files with 72 additions and 6 deletions

View file

@ -39,6 +39,16 @@ QPen PrintableModel::resultPen()
return QPen(Qt::black, 2, Qt::SolidLine);
}
double PrintableModel::headerWidthFactor()
{
return 0.17;
}
double PrintableModel::cellWidthFactor()
{
return 0.085;
}
void PrintableModel::drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text)
{
auto prevPen = painter.pen();
@ -128,8 +138,8 @@ void PrintableModel::printTests(QPainter &painter) const
auto width = painter.device()->width();
auto height = 1.5 * painter.fontMetrics().lineSpacing();
double headerWidth = 0.2 * width;
double cellWidth = 0.08 * width;
double headerWidth = headerWidthFactor() * width;
double cellWidth = cellWidthFactor() * width;
double rowHeight = height;
double x = 0;

View file

@ -24,6 +24,9 @@ public:
static QPen tablePen();
static QPen resultPen();
static double headerWidthFactor();
static double cellWidthFactor();
static void drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text);
static void drawNumberSquare(QPainter &painter, double x, double y, int number);
static void drawCheckSquare(QPainter &painter, const QRectF &cell, bool checked);