diff --git a/src/devicewidget/performancewidget.cpp b/src/devicewidget/performancewidget.cpp index bb7247c..1b9e95c 100644 --- a/src/devicewidget/performancewidget.cpp +++ b/src/devicewidget/performancewidget.cpp @@ -57,7 +57,14 @@ PerformanceWidget::PerformanceWidget(libopenrazer::Device *device) pollComboBox->setCurrentText(QString::number(pollRate) + " Hz"); verticalLayout->addWidget(pollComboBox); - connect(pollComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &PerformanceWidget::pollCombo); + connect(pollComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, [=](int) { + try { + device->setPollRate(pollComboBox->currentData().value()); + } catch (const libopenrazer::DBusException &e) { + qWarning("Failed to set polling rate"); + util::showError(tr("Failed to set polling rate")); + } + }); } /* Spacer to bottom */ @@ -71,14 +78,3 @@ bool PerformanceWidget::isAvailable(libopenrazer::Device *device) { return device->hasFeature("dpi") || device->hasFeature("poll_rate"); } - -void PerformanceWidget::pollCombo(int /* index */) -{ - auto *sender = qobject_cast(QObject::sender()); - try { - device->setPollRate(sender->currentData().value()); - } catch (const libopenrazer::DBusException &e) { - qWarning("Failed to set polling rate"); - util::showError(tr("Failed to set polling rate")); - } -} diff --git a/src/devicewidget/performancewidget.h b/src/devicewidget/performancewidget.h index 9a8d0f8..6a6dcfb 100644 --- a/src/devicewidget/performancewidget.h +++ b/src/devicewidget/performancewidget.h @@ -17,9 +17,6 @@ class PerformanceWidget : public QWidget static bool isAvailable(libopenrazer::Device *device); -public slots: - void pollCombo(int /* index */); - private: libopenrazer::Device *device; };