AutoTest: Avoid pass by value

Reported by Coverity.

Change-Id: Ic0ec726ab4ec1ed96b7f4ca95a6e7dc462baeda2
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Orgad Shaneh
2023-01-30 09:58:37 +02:00
committed by Orgad Shaneh
parent e3f6eca25d
commit b05ec7dc3c

View File

@@ -609,7 +609,7 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos)
QAction *action = new QAction(Tr::tr("Copy"), &menu);
action->setShortcut(QKeySequence(QKeySequence::Copy));
action->setEnabled(resultsAvailable && clicked.isValid());
connect(action, &QAction::triggered, this, [this, clicked] {
connect(action, &QAction::triggered, this, [this, &clicked] {
onCopyItemTriggered(clicked);
});
menu.addAction(action);
@@ -627,14 +627,14 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos)
const auto correlatingItem = (enabled && clicked.isValid()) ? clicked.findTestTreeItem() : nullptr;
action = new QAction(Tr::tr("Run This Test"), &menu);
action->setEnabled(correlatingItem && correlatingItem->canProvideTestConfiguration());
connect(action, &QAction::triggered, this, [this, clicked] {
connect(action, &QAction::triggered, this, [this, &clicked] {
onRunThisTestTriggered(TestRunMode::Run, clicked);
});
menu.addAction(action);
action = new QAction(Tr::tr("Run This Test Without Deployment"), &menu);
action->setEnabled(correlatingItem && correlatingItem->canProvideTestConfiguration());
connect(action, &QAction::triggered, this, [this, clicked] {
connect(action, &QAction::triggered, this, [this, &clicked] {
onRunThisTestTriggered(TestRunMode::RunWithoutDeploy, clicked);
});
menu.addAction(action);
@@ -648,14 +648,14 @@ void TestResultsPane::onCustomContextMenuRequested(const QPoint &pos)
}
}
action->setEnabled(debugEnabled);
connect(action, &QAction::triggered, this, [this, clicked] {
connect(action, &QAction::triggered, this, [this, &clicked] {
onRunThisTestTriggered(TestRunMode::Debug, clicked);
});
menu.addAction(action);
action = new QAction(Tr::tr("Debug This Test Without Deployment"), &menu);
action->setEnabled(debugEnabled);
connect(action, &QAction::triggered, this, [this, clicked] {
connect(action, &QAction::triggered, this, [this, &clicked] {
onRunThisTestTriggered(TestRunMode::DebugWithoutDeploy, clicked);
});
menu.addAction(action);