DolphinQt: Use qOverload where applicable

Provides the same behvaior, but in a much more concise manner.
This commit is contained in:
Lioncash
2019-07-30 09:35:46 -04:00
committed by Léo Lam
parent 58de3c59ce
commit 19115c84dd
28 changed files with 96 additions and 127 deletions

View File

@ -68,7 +68,7 @@ void NewPatchDialog::CreateWidgets()
void NewPatchDialog::ConnectWidgets()
{
connect(m_name_edit, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
connect(m_name_edit, qOverload<const QString&>(&QLineEdit::textEdited),
[this](const QString& name) { m_patch.name = name.toStdString(); });
connect(m_add_button, &QPushButton::clicked, this, &NewPatchDialog::AddEntry);
@ -130,7 +130,7 @@ QGroupBox* NewPatchDialog::CreateEntry(PatchEngine::PatchEntry& entry)
layout->addWidget(remove, 3, 0, 1, -1);
box->setLayout(layout);
connect(offset, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
connect(offset, qOverload<const QString&>(&QLineEdit::textEdited),
[&entry, offset](const QString& text) {
bool okay = true;
entry.address = text.toUInt(&okay, 16);
@ -147,7 +147,7 @@ QGroupBox* NewPatchDialog::CreateEntry(PatchEngine::PatchEntry& entry)
offset->setPalette(palette);
});
connect(value, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
connect(value, qOverload<const QString&>(&QLineEdit::textEdited),
[&entry, value](const QString& text) {
bool okay;
entry.value = text.toUInt(&okay, 16);