From 4a7857f9f66cc471defe22549c7af813f844b6fc Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 5 Jun 2019 14:05:02 +0200 Subject: Use Qt5 style signal/slot connections --- src/dialog.cpp | 10 +++++----- src/vsession.cpp | 2 +- src/xsession.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dialog.cpp b/src/dialog.cpp index 5e68e10..5e7a6b0 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -48,7 +48,7 @@ Dialog::Dialog(QWidget *parent) QRect desktopRect = QApplication::desktop()->availableGeometry(this); oldCenter_ = desktopRect.center(); centerTimer_ = new QTimer(this); - connect(centerTimer_, SIGNAL(timeout()), this, SLOT(onCenterTimer())); + connect(centerTimer_, &QTimer::timeout, this, &Dialog::onCenterTimer); centerTimer_->start(1000); ui->treeView->setFocusProxy(ui->filterEdit); @@ -100,8 +100,8 @@ Dialog::Dialog(QWidget *parent) // TODO: Implement bug report dialog :) ui->buttonBugReport->setEnabled(false); - QObject::connect(SessionsIconHolder::get(), SIGNAL(iconDownloaded(const QUrl&, const QIcon&)), - this, SLOT(iconDownloaded(const QUrl&, const QIcon&))); + QObject::connect(SessionsIconHolder::get(), &SessionsIconHolder::iconDownloaded, + this, &Dialog::iconDownloaded); } @@ -789,8 +789,8 @@ void Dialog::setListModel(SessionTreeModel *model) { } // reconnect the treeModel - QObject::connect(ui->treeView->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), - this, SLOT(treeView_selectionChanged(const QModelIndex&, const QModelIndex&))); + QObject::connect(ui->treeView->selectionModel(), &QItemSelectionModel::currentChanged, + this, &Dialog::treeView_selectionChanged); // select the first element, if no element is selected if (ui->treeView->selectionModel()->selectedRows().count() == 0) { diff --git a/src/vsession.cpp b/src/vsession.cpp index a4e5a7b..fec9fad 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -279,7 +279,7 @@ bool VSession::run() const { tmpfile.setAutoRemove(false); tmpfile.close(); - QObject::connect(&_process, SIGNAL(finished(int, QProcess::ExitStatus)), QApplication::instance(), SLOT(quit())); + QObject::connect(&_process, QOverload::of(&QProcess::finished), QApplication::instance(), &QCoreApplication::quit); _process.start(Config::get(Config::RUNSCRIPT), QStringList(tmpFileName)); _process.waitForStarted(10); if (_process.state() == QProcess::Starting || _process.state() == QProcess::Running) diff --git a/src/xsession.cpp b/src/xsession.cpp index 2d7214a..8e26b86 100644 --- a/src/xsession.cpp +++ b/src/xsession.cpp @@ -149,7 +149,7 @@ QIcon XSession::icon() const { bool XSession::run() const { _process->start(this->exec_); - QObject::connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)), QApplication::instance(), SLOT(quit())); + QObject::connect(_process, QOverload::of(&QProcess::finished), QApplication::instance(), &QCoreApplication::quit); if (_process->state() == QProcess::Starting || _process->state() == QProcess::Running) return true; else -- cgit v1.2.3-55-g7522