2019-01-13 18:54:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-02-03 18:53:51 +00:00
|
|
|
#include "CheckableTestModel.h"
|
|
|
|
|
2019-01-13 18:54:09 +00:00
|
|
|
#include <QPainter>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QPen>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QString>
|
|
|
|
|
2019-02-03 18:53:51 +00:00
|
|
|
class PrintableModel : public CheckableTestModel
|
2019-01-13 18:54:09 +00:00
|
|
|
{
|
2019-10-05 14:14:45 +00:00
|
|
|
Q_OBJECT
|
2019-02-03 18:53:51 +00:00
|
|
|
|
2019-01-13 18:54:09 +00:00
|
|
|
public:
|
2019-10-05 14:14:45 +00:00
|
|
|
PrintableModel(QObject* parent);
|
2019-02-03 18:53:51 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
virtual void printTo(QPainter& painter) const;
|
2019-01-13 18:54:09 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
static QFont h1Font();
|
|
|
|
static QFont h2Font();
|
|
|
|
static QFont tableFont();
|
2019-01-13 18:54:09 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
static QPen tablePen();
|
|
|
|
static QPen resultPen();
|
2019-01-13 18:54:09 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
static double headerWidthFactor();
|
|
|
|
static double cellWidthFactor();
|
2019-02-07 19:03:22 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
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);
|
|
|
|
static void drawResultSquare(QPainter& painter, double y, bool rightCell, unsigned int value);
|
|
|
|
static void drawGreySquare(QPainter& painter, const QRectF& cell);
|
2019-02-03 18:53:51 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
static void drawHeader2(QPainter& painter, const QString& text);
|
2019-02-03 18:53:51 +00:00
|
|
|
|
2019-02-07 21:36:39 +00:00
|
|
|
protected:
|
2019-10-05 14:14:45 +00:00
|
|
|
virtual void printHeader(QPainter& painter) const;
|
|
|
|
virtual void printTests(QPainter& painter) const;
|
|
|
|
virtual void printSummary(QPainter& painter) const;
|
2019-01-13 18:54:09 +00:00
|
|
|
};
|