1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 23:07:59 +00:00

Use function-pointer based signal-slot connection

This commit is contained in:
Chocobo1 2020-12-19 16:03:54 +08:00
parent e8b5508463
commit e6cf186c23
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
2 changed files with 9 additions and 9 deletions

View File

@ -152,7 +152,7 @@ bool QtLocalPeer::isClient()
#endif #endif
if (!res) if (!res)
qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString()));
QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection())); connect(server, &QLocalServer::newConnection, this, &QtLocalPeer::receiveConnection);
return false; return false;
} }

View File

@ -715,12 +715,12 @@ void AdvancedSettings::addRow(const int row, const QString &text, T *widget)
setCellWidget(row, PROPERTY, label); setCellWidget(row, PROPERTY, label);
setCellWidget(row, VALUE, widget); setCellWidget(row, VALUE, widget);
if (std::is_same_v<T, QCheckBox>) if constexpr (std::is_same_v<T, QCheckBox>)
connect(widget, SIGNAL(stateChanged(int)), this, SIGNAL(settingsChanged())); connect(widget, &QCheckBox::stateChanged, this, &AdvancedSettings::settingsChanged);
else if (std::is_same_v<T, QSpinBox>) else if constexpr (std::is_same_v<T, QSpinBox>)
connect(widget, SIGNAL(valueChanged(int)), this, SIGNAL(settingsChanged())); connect(widget, qOverload<int>(&QSpinBox::valueChanged), this, &AdvancedSettings::settingsChanged);
else if (std::is_same_v<T, QComboBox>) else if constexpr (std::is_same_v<T, QComboBox>)
connect(widget, SIGNAL(currentIndexChanged(int)), this, SIGNAL(settingsChanged())); connect(widget, qOverload<int>(&QComboBox::currentIndexChanged), this, &AdvancedSettings::settingsChanged);
else if (std::is_same_v<T, QLineEdit>) else if constexpr (std::is_same_v<T, QLineEdit>)
connect(widget, SIGNAL(textChanged(QString)), this, SIGNAL(settingsChanged())); connect(widget, &QLineEdit::textChanged, this, &AdvancedSettings::settingsChanged);
} }