diff --git a/src/widgets/commandwidget.cpp b/src/widgets/commandwidget.cpp --- a/src/widgets/commandwidget.cpp +++ b/src/widgets/commandwidget.cpp @@ -36,7 +36,7 @@ //we have a few buttons to make here. Lets name this newButton so its easier to reuse auto newButton = new QPushButton(tr("Send")); - connect(newButton, &QPushButton::clicked, [&] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(commandPressed(lineCommand->text())); lineCommand->clear(); }); @@ -55,7 +55,7 @@ //Reuse our button pointer. newButton = new QPushButton(tr("Send")); - connect(newButton, &QPushButton::clicked, [&] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(messagePressed(lineMessage->text())); lineMessage->clear(); }); diff --git a/src/widgets/logwidget.cpp b/src/widgets/logwidget.cpp --- a/src/widgets/logwidget.cpp +++ b/src/widgets/logwidget.cpp @@ -70,7 +70,7 @@ helpButton->setCheckable(true); helpButton->setChecked(false); helpButton->setIcon(QIcon::fromTheme(QStringLiteral("help-about"), style()->standardIcon(QStyle::SP_DialogHelpButton))); - connect(helpButton, &QPushButton::clicked, [this, mainStack](bool checked) { + connect(helpButton, &QPushButton::clicked, this, [this, mainStack](bool checked) { mainStack->setCurrentIndex(checked); }); diff --git a/src/widgets/movementwidget.cpp b/src/widgets/movementwidget.cpp --- a/src/widgets/movementwidget.cpp +++ b/src/widgets/movementwidget.cpp @@ -32,32 +32,32 @@ if (showHomeAndDisableWidgets) { newButton = new QPushButton(tr("Home All")); hBoxLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(homeAllPressed()); }); newButton = new QPushButton(tr("Home X")); hBoxLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(homeXPressed()); }); newButton = new QPushButton(tr("Home Y")); hBoxLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(homeYPressed()); }); newButton = new QPushButton(tr("Home Z")); hBoxLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(homeZPressed()); }); mainLayout->addLayout(hBoxLayout); newButton = new QPushButton(tr("Disable Motors")); mainLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(disableMotorsPressed()); }); diff --git a/src/widgets/printwidget.cpp b/src/widgets/printwidget.cpp --- a/src/widgets/printwidget.cpp +++ b/src/widgets/printwidget.cpp @@ -30,12 +30,12 @@ QHBoxLayout *hBoxLayout = nullptr; if (showAllControls) { buttonPrint = new QPushButton(tr("Print File")); - connect(buttonPrint, &QPushButton::clicked, [this] { + connect(buttonPrint, &QPushButton::clicked, this, [this] { emit(printPressed()); }); newButton = new QPushButton(tr("Emergency Stop")); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(emergencyStopPressed()); }); @@ -62,7 +62,7 @@ sbPrintSpeed->setSuffix(QStringLiteral("%")); newButton = new QPushButton(tr("Set")); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(printSpeedChanged(sbPrintSpeed->value())); }); @@ -79,7 +79,7 @@ sbFlowRate->setSuffix(QStringLiteral("%")); newButton = new QPushButton(tr("Set")); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(flowRateChanged(sbFlowRate->value())); }); hBoxLayout = new QHBoxLayout; @@ -94,7 +94,7 @@ sbFanSpeed->setSuffix(QStringLiteral("%")); newButton = new QPushButton(tr("Set")); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(fanSpeedChanged(sbFanSpeed->value(), comboFanSelect->currentIndex())); }); diff --git a/src/widgets/sdwidget.cpp b/src/widgets/sdwidget.cpp --- a/src/widgets/sdwidget.cpp +++ b/src/widgets/sdwidget.cpp @@ -29,22 +29,22 @@ auto newButton = new QPushButton(tr("Get List")); hBoxLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(requestSdList()); }); newButton = new QPushButton(tr("Print Selected")); hBoxLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { if (listSdFiles->currentRow() != -1) { emit(printSdFile(listSdFiles->currentItem()->text())); } }); newButton = new QPushButton(tr("Delete Selected")); hBoxLayout->addWidget(newButton); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { if (listSdFiles->currentRow() != -1) { emit(deleteSdFile(listSdFiles->currentItem()->text())); diff --git a/src/widgets/statuswidget.cpp b/src/widgets/statuswidget.cpp --- a/src/widgets/statuswidget.cpp +++ b/src/widgets/statuswidget.cpp @@ -35,7 +35,7 @@ if (showStop) { auto newButton = new QPushButton(style()->standardIcon(QStyle::SP_BrowserStop), QString()); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(stopPressed()); }); hBoxLayout->addWidget(newButton); diff --git a/src/widgets/temperaturewidget.cpp b/src/widgets/temperaturewidget.cpp --- a/src/widgets/temperaturewidget.cpp +++ b/src/widgets/temperaturewidget.cpp @@ -35,7 +35,7 @@ sbBedTemp->setSuffix(QStringLiteral("°C")); auto *newButton = new QPushButton(tr("Set")); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(bedTempChanged(sbBedTemp->value(), checkAndWait->isChecked())); }); @@ -51,7 +51,7 @@ sbExtruderTemp->setSuffix(QStringLiteral("°C")); newButton = new QPushButton(tr("Set")); - connect(newButton, &QPushButton::clicked, [this] { + connect(newButton, &QPushButton::clicked, this, [this] { emit(extTempChanged(sbExtruderTemp->value(), comboExtruderSelect->currentIndex(), checkAndWait->isChecked())); }); diff --git a/testclient/mainwindow.cpp b/testclient/mainwindow.cpp --- a/testclient/mainwindow.cpp +++ b/testclient/mainwindow.cpp @@ -72,7 +72,7 @@ QMenu *menuHelp = new QMenu(tr("Help")); QAction *actionAbout = new QAction(tr("About")); actionAbout->setShortcut(QKeySequence(Qt::Key_F1)); - connect(actionAbout, &QAction::triggered, [] { + connect(actionAbout, &QAction::triggered, this, [] { auto *dialog = new About; dialog->exec(); }); @@ -152,7 +152,7 @@ connect(printWidget, &PrintWidget::emergencyStopPressed, core, &AtCore::emergencyStop); connect(printWidget, &PrintWidget::fanSpeedChanged, core, &AtCore::setFanSpeed); - connect(printWidget, &PrintWidget::printSpeedChanged, [this](const int speed) { + connect(printWidget, &PrintWidget::printSpeedChanged, this, [this](const int speed) { core->setPrinterSpeed(speed); }); @@ -172,25 +172,25 @@ plotWidget = new PlotWidget; //make and connect our plots in the widget. plotWidget->addPlot(tr("Actual Bed")); - connect(&core->temperature(), &Temperature::bedTemperatureChanged, [ this ](float temp) { + connect(&core->temperature(), &Temperature::bedTemperatureChanged, this, [this](float temp) { checkTemperature(0x00, 0, temp); plotWidget->appendPoint(tr("Actual Bed"), temp); }); plotWidget->addPlot(tr("Target Bed")); - connect(&core->temperature(), &Temperature::bedTargetTemperatureChanged, [ this ](float temp) { + connect(&core->temperature(), &Temperature::bedTargetTemperatureChanged, this, [this](float temp) { checkTemperature(0x01, 0, temp); plotWidget->appendPoint(tr("Target Bed"), temp); }); plotWidget->addPlot(tr("Actual Ext.1")); - connect(&core->temperature(), &Temperature::extruderTemperatureChanged, [ this ](float temp) { + connect(&core->temperature(), &Temperature::extruderTemperatureChanged, this, [this](float temp) { checkTemperature(0x02, 0, temp); plotWidget->appendPoint(tr("Actual Ext.1"), temp); }); plotWidget->addPlot(tr("Target Ext.1")); - connect(&core->temperature(), &Temperature::extruderTargetTemperatureChanged, [ this ](float temp) { + connect(&core->temperature(), &Temperature::extruderTargetTemperatureChanged, this, [this](float temp) { checkTemperature(0x03, 0, temp); plotWidget->appendPoint(tr("Target Ext.1"), temp); }); @@ -263,36 +263,36 @@ { movementWidget = new MovementWidget; - connect(movementWidget, &MovementWidget::homeAllPressed, [this] { + connect(movementWidget, &MovementWidget::homeAllPressed, this, [this] { logWidget->appendLog(tr("Home All")); core->home(); }); - connect(movementWidget, &MovementWidget::homeXPressed, [this] { + connect(movementWidget, &MovementWidget::homeXPressed, this, [this] { logWidget->appendLog(tr("Home X")); core->home(AtCore::X); }); - connect(movementWidget, &MovementWidget::homeYPressed, [this] { + connect(movementWidget, &MovementWidget::homeYPressed, this, [this] { logWidget->appendLog(tr("Home Y")); core->home(AtCore::Y); }); - connect(movementWidget, &MovementWidget::homeZPressed, [this] { + connect(movementWidget, &MovementWidget::homeZPressed, this, [this] { logWidget->appendLog(tr("Home Z")); core->home(AtCore::Z); }); - connect(movementWidget, &MovementWidget::absoluteMove, [this](const QLatin1Char & axis, const double & value) { + connect(movementWidget, &MovementWidget::absoluteMove, this, [this](const QLatin1Char & axis, const double & value) { logWidget->appendLog(GCode::description(GCode::G1)); core->move(axis, value); }); - connect(movementWidget, &MovementWidget::disableMotorsPressed, [this] { + connect(movementWidget, &MovementWidget::disableMotorsPressed, this, [this] { core->disableMotors(0); }); - connect(movementWidget, &MovementWidget::relativeMove, [this](const QLatin1Char & axis, const double & value) { + connect(movementWidget, &MovementWidget::relativeMove, this, [this](const QLatin1Char & axis, const double & value) { core->setRelativePosition(); core->move(axis, value); core->setAbsolutePosition(); @@ -323,15 +323,15 @@ sdWidget = new SdWidget; connect(sdWidget, &SdWidget::requestSdList, core, &AtCore::sdFileList); - connect(sdWidget, &SdWidget::printSdFile, [this](const QString & fileName) { + connect(sdWidget, &SdWidget::printSdFile, this, [this](const QString & fileName) { if (fileName.isEmpty()) { QMessageBox::information(this, tr("Print Error"), tr("You must Select a file from the list")); } else { core->print(fileName, true); } }); - connect(sdWidget, &SdWidget::deleteSdFile, [this](const QString & fileName) { + connect(sdWidget, &SdWidget::deleteSdFile, this, [this](const QString & fileName) { if (fileName.isEmpty()) { QMessageBox::information(this, tr("Delete Error"), tr("You must Select a file from the list")); } else {