Use central table format for printing
This commit is contained in:
parent
a718113747
commit
6eb585b08c
14 changed files with 48 additions and 64 deletions
|
@ -134,9 +134,7 @@ void CheckableTestModel::printTo(QTextCursor &cursor) const
|
|||
|
||||
void CheckableTestModel::printTableTo(QTextCursor &cursor) const
|
||||
{
|
||||
QTextTableFormat tableFormat;
|
||||
tableFormat.setCellPadding(2);
|
||||
tableFormat.setCellSpacing(0);
|
||||
QTextTableFormat tableFormat = defaultTableFormat();
|
||||
|
||||
tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::PercentageLength, 20),
|
||||
QTextLength(QTextLength::PercentageLength, 9),
|
||||
|
@ -180,9 +178,7 @@ void CheckableTestModel::printTableTo(QTextCursor &cursor) const
|
|||
|
||||
void CheckableTestModel::printSummaryTo(QTextCursor &cursor) const
|
||||
{
|
||||
QTextTableFormat tableFormat;
|
||||
tableFormat.setCellPadding(2);
|
||||
tableFormat.setCellSpacing(0);
|
||||
QTextTableFormat tableFormat = defaultTableFormat();
|
||||
|
||||
tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::PercentageLength, 76),
|
||||
QTextLength(QTextLength::PercentageLength, 20),
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "../PrintableModel.h"
|
||||
#include "CheckableTest.h"
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QTextCursor>
|
||||
|
||||
class CheckableTestModel : public QAbstractTableModel
|
||||
class CheckableTestModel : public QAbstractTableModel, protected PrintableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -28,7 +30,7 @@ public:
|
|||
|
||||
unsigned int getPoints() const;
|
||||
|
||||
virtual void printTo(QTextCursor &cursor) const;
|
||||
void printTo(QTextCursor &cursor) const override;
|
||||
|
||||
protected:
|
||||
virtual bool isValidIndex(const QModelIndex &index) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue