Skip to content

Commit 7c8f617

Browse files
committed
Don't need parent of QObject to be set in Report -> Increase constness of ResultsView::Save()
- our code already deletes all Report instances; there is no need for garbage collector
1 parent fc78cac commit 7c8f617

File tree

14 files changed

+25
-29
lines changed

14 files changed

+25
-29
lines changed

gui/csvreport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "report.h"
2424
#include "csvreport.h"
2525

26-
CsvReport::CsvReport(const QString &filename, QObject * parent) :
27-
Report(filename, parent)
26+
CsvReport::CsvReport(const QString &filename) :
27+
Report(filename)
2828
{
2929
}
3030

gui/csvreport.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#ifndef CSV_REPORT_H
2020
#define CSV_REPORT_H
2121

22-
#include <QObject>
2322
#include <QString>
2423
#include <QTextStream>
2524
#include "report.h"
@@ -36,7 +35,7 @@
3635
*/
3736
class CsvReport : public Report {
3837
public:
39-
CsvReport(const QString &filename, QObject * parent = 0);
38+
CsvReport(const QString &filename);
4039
virtual ~CsvReport();
4140

4241
/**

gui/report.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
#include <QFile>
2222
#include "report.h"
2323

24-
Report::Report(const QString &filename, QObject * parent) :
25-
QObject(parent),
24+
Report::Report(const QString &filename) :
2625
mFilename(filename)
2726
{
2827
}

gui/report.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Report : public QObject {
4040
CSV,
4141
};
4242

43-
Report(const QString &filename, QObject * parent = 0);
43+
Report(const QString &filename);
4444
virtual ~Report();
4545

4646
/**

gui/resultsview.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void ResultsView::FilterResults(const QString& filter)
132132
mUI.mTree->FilterResults(filter);
133133
}
134134

135-
void ResultsView::Save(const QString &filename, Report::Type type)
135+
void ResultsView::Save(const QString &filename, Report::Type type) const
136136
{
137137
if (!mErrorsFound) {
138138
QMessageBox msgBox;
@@ -145,16 +145,16 @@ void ResultsView::Save(const QString &filename, Report::Type type)
145145

146146
switch (type) {
147147
case Report::CSV:
148-
report = new CsvReport(filename, this);
148+
report = new CsvReport(filename);
149149
break;
150150
case Report::TXT:
151-
report = new TxtReport(filename, this);
151+
report = new TxtReport(filename);
152152
break;
153153
case Report::XML:
154-
report = new XmlReportV1(filename, this);
154+
report = new XmlReportV1(filename);
155155
break;
156156
case Report::XMLV2:
157-
report = new XmlReportV2(filename, this);
157+
report = new XmlReportV2(filename);
158158
break;
159159
}
160160

@@ -272,9 +272,9 @@ void ResultsView::ReadErrorsXml(const QString &filename)
272272

273273
XmlReport *report = NULL;
274274
if (version == 1)
275-
report = new XmlReportV1(filename, this);
275+
report = new XmlReportV1(filename);
276276
else if (version == 2)
277-
report = new XmlReportV2(filename, this);
277+
report = new XmlReportV2(filename);
278278

279279
QList<ErrorItem> errors;
280280
if (report) {

gui/resultsview.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ResultsView : public QWidget {
7373
* @param filename Filename to save results to
7474
* @param type Type of the report.
7575
*/
76-
void Save(const QString &filename, Report::Type type);
76+
void Save(const QString &filename, Report::Type type) const;
7777

7878
/**
7979
* @brief Update tree settings

gui/txtreport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include <QDir>
2020
#include "txtreport.h"
2121

22-
TxtReport::TxtReport(const QString &filename, QObject * parent) :
23-
Report(filename, parent)
22+
TxtReport::TxtReport(const QString &filename) :
23+
Report(filename)
2424
{
2525
}
2626

gui/txtreport.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#ifndef TXT_REPORT_H
2020
#define TXT_REPORT_H
2121

22-
#include <QObject>
2322
#include <QString>
2423
#include <QTextStream>
2524
#include "report.h"
@@ -36,7 +35,7 @@ class TxtReport : public Report {
3635
Q_OBJECT
3736

3837
public:
39-
TxtReport(const QString &filename, QObject * parent = 0);
38+
TxtReport(const QString &filename);
4039
virtual ~TxtReport();
4140

4241
/**

gui/xmlreport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
static const char ResultElementName[] = "results";
2727
static const char VersionAttribute[] = "version";
2828

29-
XmlReport::XmlReport(const QString &filename, QObject * parent) :
30-
Report(filename, parent)
29+
XmlReport::XmlReport(const QString &filename) :
30+
Report(filename)
3131
{
3232
}
3333

gui/xmlreport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class QObject;
3535
*/
3636
class XmlReport : public Report {
3737
public:
38-
XmlReport(const QString &filename, QObject * parent = 0);
38+
XmlReport(const QString &filename);
3939

4040
/**
4141
* @brief Read contents of the report file.

0 commit comments

Comments
 (0)