Skip to content

Commit 8edab97

Browse files
committed
Pass slot parameters by value
1 parent 8226a49 commit 8edab97

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

gui/checkthread.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class ThreadResult;
4949
*/
5050
class CheckThread : public QThread {
5151
Q_OBJECT
52-
5352
public:
5453
struct Details {
5554
int threadIndex;
@@ -111,8 +110,8 @@ class CheckThread : public QThread {
111110
*/
112111
void done();
113112

114-
void startCheck(const CheckThread::Details& details);
115-
void finishCheck(const CheckThread::Details& details);
113+
void startCheck(CheckThread::Details details);
114+
void finishCheck(CheckThread::Details details);
116115
protected:
117116

118117
/**
@@ -160,5 +159,6 @@ class CheckThread : public QThread {
160159
QStringList mClangIncludePaths;
161160
QList<SuppressionList::Suppression> mSuppressionsUi;
162161
};
162+
Q_DECLARE_METATYPE(CheckThread::Details);
163163
/// @}
164164
#endif // CHECKTHREAD_H

gui/threaddetails.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ThreadDetails::~ThreadDetails()
2222
delete mUi;
2323
}
2424

25-
void ThreadDetails::threadDetailsUpdated(const QMap<int, CheckThread::Details>& threadDetails)
25+
void ThreadDetails::threadDetailsUpdated(QMap<int, CheckThread::Details> threadDetails)
2626
{
2727
QMutexLocker locker(&mMutex);
2828
mThreadDetails = threadDetails;
@@ -31,7 +31,7 @@ void ThreadDetails::threadDetailsUpdated(const QMap<int, CheckThread::Details>&
3131
}
3232
}
3333

34-
void ThreadDetails::progress(const QString &filename, const QString& stage, const std::size_t value) {
34+
void ThreadDetails::progress(QString filename, QString stage, const std::size_t value) {
3535
QMutexLocker locker(&mMutex);
3636
mProgress[filename] = {QString(), stage + QString(value > 0 ? ": %1%" : "").arg(value)};
3737
}

gui/threaddetails.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class ThreadDetails : public QWidget
2424
}
2525

2626
public slots:
27-
void threadDetailsUpdated(const QMap<int, CheckThread::Details>& threadDetails);
28-
void progress(const QString &filename, const QString& stage, const std::size_t value);
27+
void threadDetailsUpdated(QMap<int, CheckThread::Details> threadDetails);
28+
void progress(QString filename, QString stage, const std::size_t value);
2929

3030
private slots:
3131
void updateUI();

gui/threadhandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ void ThreadHandler::setCheckStartTime(QDateTime checkStartTime)
331331

332332
// cppcheck-suppress passedByValueCallback
333333
// NOLINTNEXTLINE(performance-unnecessary-value-param)
334-
void ThreadHandler::startCheck(const CheckThread::Details& details)
334+
void ThreadHandler::startCheck(CheckThread::Details details)
335335
{
336336
mThreadDetails[details.threadIndex] = details;
337337
emitThreadDetailsUpdated();
338338
}
339339

340340
// NOLINTNEXTLINE(performance-unnecessary-value-param)
341-
void ThreadHandler::finishCheck(const CheckThread::Details& details)
341+
void ThreadHandler::finishCheck(CheckThread::Details details)
342342
{
343343
mThreadDetails.remove(details.threadIndex);
344344
emitThreadDetailsUpdated();

gui/threadhandler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,16 @@ public slots:
213213
* @brief Slot threads use to signal this class that it started checking a file
214214
* @param details Details about what file is being checked and by what thread
215215
*/
216-
void startCheck(const CheckThread::Details& details);
216+
void startCheck(CheckThread::Details details);
217217

218218
/**
219219
* @brief Slot threads use to signal this class that it finish checking a file
220220
* @param details Details about what file finished being checked and by what thread
221221
*/
222-
void finishCheck(const CheckThread::Details& details);
222+
void finishCheck(CheckThread::Details details);
223223

224224
signals:
225-
void progress(const QString &filename, const QString& stage, const std::size_t value);
225+
void progress(QString filename, QString stage, const std::size_t value);
226226

227227
protected slots:
228228
/**

gui/threadresult.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void ThreadResult::reportOut(const std::string &outmsg, Color /*c*/)
3535
}
3636

3737
// NOLINTNEXTLINE(performance-unnecessary-value-param)
38-
void ThreadResult::finishCheck(const CheckThread::Details& details)
38+
void ThreadResult::finishCheck(CheckThread::Details details)
3939
{
4040
std::lock_guard<std::mutex> locker(mutex);
4141

gui/threadresult.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public slots:
9292
* @brief Slot threads use to signal this class that it finish checking a file
9393
* @param details Details about what file finished being checked and by what thread
9494
*/
95-
void finishCheck(const CheckThread::Details& details);
95+
void finishCheck(CheckThread::Details details);
9696

9797
signals:
9898
/**
@@ -127,7 +127,7 @@ public slots:
127127
// NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) - caused by generated MOC code
128128
void debugError(const ErrorItem &item);
129129

130-
void progress(const QString &filename, const QString& stage, const std::size_t value);
130+
void progress(QString filename, QString stage, const std::size_t value);
131131

132132
protected:
133133

0 commit comments

Comments
 (0)