Refactoring
Adjusted documentation of PrintableReport PrintableReport no longer provides the formatted report as QTextDocument but as plain QString (so that the caller can decide how to deal with the text)
This commit is contained in:
parent
ecf04c90e4
commit
2eb0832ac2
|
@ -18,11 +18,9 @@
|
|||
|
||||
#include "printablereport.h"
|
||||
#include <QDir>
|
||||
#include <QTextDocument>
|
||||
|
||||
PrintableReport::PrintableReport() :
|
||||
Report(QString()),
|
||||
mReportDocument(new QTextDocument(this))
|
||||
Report(QString())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -55,9 +53,8 @@ void PrintableReport::WriteError(const ErrorItem &error)
|
|||
mFormattedReport += "\n";
|
||||
}
|
||||
|
||||
QTextDocument* PrintableReport::GetReport() const
|
||||
QString PrintableReport::GetFormattedReportText() const
|
||||
{
|
||||
mReportDocument->setPlainText(mFormattedReport);
|
||||
return mReportDocument;
|
||||
return mFormattedReport;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,17 +21,13 @@
|
|||
|
||||
#include "report.h"
|
||||
|
||||
class QTextDocument;
|
||||
|
||||
/// @addtogroup GUI
|
||||
/// @{
|
||||
|
||||
|
||||
/**
|
||||
* @brief CSV text file report.
|
||||
* This report exports results as CSV (comma separated values). CSV files are
|
||||
* easy to import to many other programs.
|
||||
* @todo This class should be inherited from TxtReport?
|
||||
* @brief Printable (in-memory) report.
|
||||
* This report formats results and exposes them for printing.
|
||||
*/
|
||||
class PrintableReport : public Report {
|
||||
public:
|
||||
|
@ -60,12 +56,17 @@ public:
|
|||
*/
|
||||
virtual void WriteError(const ErrorItem &error);
|
||||
|
||||
QTextDocument* GetReport() const;
|
||||
/**
|
||||
* @brief Returns the formatted report.
|
||||
*/
|
||||
QString GetFormattedReportText() const;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Stores the formatted report contents.
|
||||
*/
|
||||
QString mFormattedReport;
|
||||
QTextDocument* mReportDocument;
|
||||
};
|
||||
/// @}
|
||||
#endif // PRINTABLE_REPORT_H
|
||||
|
|
|
@ -213,7 +213,8 @@ void ResultsView::Print(QPrinter* printer)
|
|||
|
||||
PrintableReport report;
|
||||
mUI.mTree->SaveResults(&report);
|
||||
report.GetReport()->print(printer);
|
||||
QTextDocument doc(report.GetFormattedReportText());
|
||||
doc.print(printer);
|
||||
}
|
||||
|
||||
void ResultsView::UpdateSettings(bool showFullPath,
|
||||
|
|
Loading…
Reference in New Issue