From 186853407174091f148e38fb985b898a539e156c Mon Sep 17 00:00:00 2001 From: mpeco Date: Tue, 23 Aug 2022 17:00:42 -0300 Subject: [PATCH] functor-based Qt signal-slot syntax components --- .../contentselector/view/contentselector.cpp | 15 ++++++++------- components/process/processinvoker.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/components/contentselector/view/contentselector.cpp b/components/contentselector/view/contentselector.cpp index 0a12b01942..0f79a4c59d 100644 --- a/components/contentselector/view/contentselector.cpp +++ b/components/contentselector/view/contentselector.cpp @@ -29,8 +29,8 @@ void ContentSelectorView::ContentSelector::buildGameFileView() ui.gameFileView->addItem(""); ui.gameFileView->setVisible(true); - connect (ui.gameFileView, SIGNAL (currentIndexChanged(int)), - this, SLOT (slotCurrentGameFileIndexChanged(int))); + connect (ui.gameFileView, qOverload(&ComboBox::currentIndexChanged), + this, &ContentSelector::slotCurrentGameFileIndexChanged); ui.gameFileView->setCurrentIndex(0); } @@ -63,20 +63,21 @@ void ContentSelectorView::ContentSelector::buildAddonView() mAddonProxyModel->setDynamicSortFilter (true); mAddonProxyModel->setSourceModel (mContentModel); - connect(ui.searchFilter, SIGNAL(textEdited(QString)), mAddonProxyModel, SLOT(setFilterWildcard(QString))); - connect(ui.searchFilter, SIGNAL(textEdited(QString)), this, SLOT(slotSearchFilterTextChanged(QString))); + connect(ui.searchFilter, &QLineEdit::textEdited, mAddonProxyModel, &QSortFilterProxyModel::setFilterWildcard); + connect(ui.searchFilter, &QLineEdit::textEdited, this, &ContentSelector::slotSearchFilterTextChanged); ui.addonView->setModel(mAddonProxyModel); - connect(ui.addonView, SIGNAL(activated(const QModelIndex&)), this, SLOT(slotAddonTableItemActivated(const QModelIndex&))); - connect(mContentModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SIGNAL(signalAddonDataChanged(QModelIndex,QModelIndex))); + connect(ui.addonView, &QTableView::activated, this, &ContentSelector::slotAddonTableItemActivated); + connect(mContentModel, &ContentSelectorModel::ContentModel::dataChanged, + this, &ContentSelector::signalAddonDataChanged); buildContextMenu(); } void ContentSelectorView::ContentSelector::buildContextMenu() { ui.addonView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui.addonView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotShowContextMenu(const QPoint&))); + connect(ui.addonView, &QTableView::customContextMenuRequested, this, &ContentSelector::slotShowContextMenu); mContextMenu = new QMenu(ui.addonView); mContextMenu->addAction(tr("&Check Selected"), this, SLOT(slotCheckMultiSelectedItems())); diff --git a/components/process/processinvoker.cpp b/components/process/processinvoker.cpp index 54462acb9c..44c1b44008 100644 --- a/components/process/processinvoker.cpp +++ b/components/process/processinvoker.cpp @@ -14,11 +14,11 @@ Process::ProcessInvoker::ProcessInvoker(QObject* parent) { mProcess = new QProcess(this); - connect(mProcess, SIGNAL(error(QProcess::ProcessError)), - this, SLOT(processError(QProcess::ProcessError))); + connect(mProcess, &QProcess::errorOccurred, + this, &ProcessInvoker::processError); - connect(mProcess, SIGNAL(finished(int,QProcess::ExitStatus)), - this, SLOT(processFinished(int,QProcess::ExitStatus))); + connect(mProcess, qOverload(&QProcess::finished), + this, &ProcessInvoker::processFinished); mName = QString();