Skip to content

Commit a7069a4

Browse files
Make this a struct. (#317)
* Make this a struct. That's what it really is. Also, move destructor logic to cpp file and declare an explicit copy constructor as defaulted. * Remove extra line.
1 parent afc8ddd commit a7069a4

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

Plugin/CppApi/include/CoordinateConversion/CoordinateConversionResults.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ namespace Toolkit
3232
/*!
3333
\internal
3434
*/
35-
class Result
35+
struct Result
3636
{
37-
public:
3837
Result(const QString& name, const QString& notation, int type);
39-
~Result() = default;
40-
QString m_name;
41-
QString m_notation;
42-
int m_type = 0; // CoordinateConversionOptions::CoordinateType as int
38+
Result(const Result& other);
39+
~Result();
40+
QString name;
41+
QString notation;
42+
int type = 0; // CoordinateConversionOptions::CoordinateType as int
4343
};
4444

4545
class TOOLKIT_EXPORT CoordinateConversionResults : public QAbstractListModel

Plugin/CppApi/source/CoordinateConversion/CoordinateConversionResults.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void CoordinateConversionResults::removeResult(const QString& name)
9595
{
9696
for (int i = 0; i < m_results.size(); ++i)
9797
{
98-
if (m_results.at(i).m_name.compare(name) == 0)
98+
if (m_results.at(i).name.compare(name) == 0)
9999
{
100100
beginRemoveRows(QModelIndex(), i, i);
101101
m_results.removeAt(i);
@@ -116,7 +116,7 @@ void CoordinateConversionResults::clearResults()
116116

117117
emit beginResetModel();
118118
for (auto& result : m_results)
119-
result.m_notation.clear();
119+
result.notation.clear();
120120
endResetModel();
121121

122122
emit resultsChanged();
@@ -176,12 +176,12 @@ QVariant CoordinateConversionResults::data(const QModelIndex& index, int role) c
176176
switch (role)
177177
{
178178
case CoordinateConversionResultsNameRole:
179-
return QVariant(result.m_name);
179+
return QVariant(result.name);
180180
case CoordinateConversionResultsNotationRole:
181-
return QVariant(result.m_notation);
181+
return QVariant(result.notation);
182182
case CoordinateConversionResultsCoordinateTypeRole:
183183
return QVariant::fromValue<CoordinateConversionOptions::CoordinateType>(
184-
static_cast<CoordinateConversionOptions::CoordinateType>(result.m_type));
184+
static_cast<CoordinateConversionOptions::CoordinateType>(result.type));
185185
default:
186186
break;
187187
}
@@ -193,10 +193,22 @@ QVariant CoordinateConversionResults::data(const QModelIndex& index, int role) c
193193
\internal
194194
*/
195195
Result::Result(const QString& name, const QString& notation, int type) :
196-
m_name(name), m_notation(notation), m_type(type)
196+
name(name),
197+
notation(notation),
198+
type(type)
197199
{
198200
}
199201

202+
/*!
203+
\internal
204+
*/
205+
Result::Result(const Result& other) = default;
206+
207+
/*!
208+
\internal
209+
*/
210+
Result::~Result() = default;
211+
200212
/*!
201213
\fn CoordinateConversionResults::resultsChanged()
202214
\brief Signal emitted when the results change.

0 commit comments

Comments
 (0)