Use lambda functions for overloaded connections.

This commit is contained in:
Andrius Štikonas 2016-07-01 15:51:28 +01:00
parent 2b7f23ec27
commit 75adb928fe
4 changed files with 3 additions and 11 deletions

View File

@ -249,7 +249,7 @@ void MainWindow::setupActions()
smartStatusDevice->setStatusTip(i18nc("@info:status", "Show the device's SMART status if supported")); smartStatusDevice->setStatusTip(i18nc("@info:status", "Show the device's SMART status if supported"));
QAction* propertiesDevice = actionCollection()->addAction(QStringLiteral("propertiesDevice")); QAction* propertiesDevice = actionCollection()->addAction(QStringLiteral("propertiesDevice"));
connect(propertiesDevice, &QAction::triggered, this, &MainWindow::onPropertiesDevice2); connect(propertiesDevice, &QAction::triggered, [this] {onPropertiesDevice({});});
propertiesDevice->setEnabled(false); propertiesDevice->setEnabled(false);
propertiesDevice->setText(i18nc("@action:inmenu", "Properties")); propertiesDevice->setText(i18nc("@action:inmenu", "Properties"));
propertiesDevice->setToolTip(i18nc("@info:tooltip", "Show device properties dialog")); propertiesDevice->setToolTip(i18nc("@info:tooltip", "Show device properties dialog"));
@ -1066,11 +1066,6 @@ void MainWindow::onSmartStatusDevice()
} }
} }
void MainWindow::onPropertiesDevice2()
{
onPropertiesDevice({});
}
void MainWindow::onPropertiesDevice(const QString&) void MainWindow::onPropertiesDevice(const QString&)
{ {
Q_ASSERT(pmWidget().selectedDevice()); Q_ASSERT(pmWidget().selectedDevice());

View File

@ -253,7 +253,6 @@ protected:
void onFileSystemSupport(); void onFileSystemSupport();
void onSmartStatusDevice(); void onSmartStatusDevice();
void onPropertiesDevice2();
void onPropertiesDevice(const QString& deviceNode = {}); void onPropertiesDevice(const QString& deviceNode = {});
private: private:

View File

@ -255,7 +255,7 @@ void PartPropsDialog::updateHideAndShow()
void PartPropsDialog::setupConnections() void PartPropsDialog::setupConnections()
{ {
connect(&dialogWidget().label(), &QLineEdit::textEdited, this, &PartPropsDialog::setDirty2); connect(&dialogWidget().label(), &QLineEdit::textEdited, [this] (const QString &) {setDirty();});
connect(&dialogWidget().fileSystem(), static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &PartPropsDialog::onFilesystemChanged); connect(&dialogWidget().fileSystem(), static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &PartPropsDialog::onFilesystemChanged);
connect(&dialogWidget().checkRecreate(), &QCheckBox::stateChanged, this, &PartPropsDialog::onRecreate); connect(&dialogWidget().checkRecreate(), &QCheckBox::stateChanged, this, &PartPropsDialog::onRecreate);
@ -265,7 +265,7 @@ void PartPropsDialog::setupConnections()
// itemClicked alone isn't enough either. We choose to rather enable the OK-button too often than too // itemClicked alone isn't enough either. We choose to rather enable the OK-button too often than too
// seldom. // seldom.
connect(&dialogWidget().listFlags(), &QListWidget::itemClicked, this, &PartPropsDialog::setDirty); connect(&dialogWidget().listFlags(), &QListWidget::itemClicked, this, &PartPropsDialog::setDirty);
connect(&dialogWidget().listFlags(), &QListWidget::currentRowChanged, this, &PartPropsDialog::setDirty3); connect(&dialogWidget().listFlags(), &QListWidget::currentRowChanged, [this] (int) {setDirty();});
} }
void PartPropsDialog::setDirty(void*) void PartPropsDialog::setDirty(void*)

View File

@ -107,8 +107,6 @@ protected:
protected: protected:
void setDirty(void *unused = nullptr); void setDirty(void *unused = nullptr);
void setDirty2(QString) {setDirty();};
void setDirty3(int) {setDirty();};
void onFilesystemChanged(int idx); void onFilesystemChanged(int idx);
void onRecreate(int); void onRecreate(int);