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