diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2015-03-05 22:00:05 +0200 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-03-06 13:47:27 +0000 |
commit | 329c493764cae50c0db341dbe5b63df60f3ca2d3 (patch) | |
tree | ffa33e70e15b32b98540f427e1b1d1856985b39d | |
parent | 0c5dac717e7ff554a9d565800bef6f040875fb5e (diff) | |
download | qt-creator-329c493764cae50c0db341dbe5b63df60f3ca2d3.tar.gz |
Utils: Modernize connections
Change-Id: I4650abc84e7c82a4054197319f6c849af9e5b8ce
Reviewed-by: hjk <hjk@theqtcompany.com>
29 files changed, 172 insertions, 156 deletions
diff --git a/src/libs/utils/checkablemessagebox.cpp b/src/libs/utils/checkablemessagebox.cpp index 2a5126c030..f99b31a7f1 100644 --- a/src/libs/utils/checkablemessagebox.cpp +++ b/src/libs/utils/checkablemessagebox.cpp @@ -121,10 +121,10 @@ CheckableMessageBox::CheckableMessageBox(QWidget *parent) : { setModal(true); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept())); - connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject())); - connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)), - SLOT(slotClicked(QAbstractButton*))); + connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + connect(d->buttonBox, &QDialogButtonBox::clicked, + this, [this](QAbstractButton *b) { d->clickedButton = b; }); } CheckableMessageBox::~CheckableMessageBox() @@ -132,11 +132,6 @@ CheckableMessageBox::~CheckableMessageBox() delete d; } -void CheckableMessageBox::slotClicked(QAbstractButton *b) -{ - d->clickedButton = b; -} - QAbstractButton *CheckableMessageBox::clickedButton() const { return d->clickedButton; diff --git a/src/libs/utils/checkablemessagebox.h b/src/libs/utils/checkablemessagebox.h index 894d955a64..0a01005250 100644 --- a/src/libs/utils/checkablemessagebox.h +++ b/src/libs/utils/checkablemessagebox.h @@ -130,9 +130,6 @@ public: static QString msgDoNotAskAgain(); static QString msgDoNotShowAgain(); -private slots: - void slotClicked(QAbstractButton *b); - private: CheckableMessageBoxPrivate *d; }; diff --git a/src/libs/utils/completingtextedit.cpp b/src/libs/utils/completingtextedit.cpp index a256b5b04d..5262b00043 100644 --- a/src/libs/utils/completingtextedit.cpp +++ b/src/libs/utils/completingtextedit.cpp @@ -121,7 +121,8 @@ void CompletingTextEdit::setCompleter(QCompleter *c) completer()->setWidget(this); completer()->setCompletionMode(QCompleter::PopupCompletion); - connect(completer(), SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString))); + connect(completer(), static_cast<void (QCompleter::*)(const QString &)>(&QCompleter::activated), + this, [this](const QString &str) { d->insertCompletion(str); }); } QCompleter *CompletingTextEdit::completer() const diff --git a/src/libs/utils/completingtextedit.h b/src/libs/utils/completingtextedit.h index 2cba933582..452d5ea31b 100644 --- a/src/libs/utils/completingtextedit.h +++ b/src/libs/utils/completingtextedit.h @@ -65,7 +65,6 @@ protected: private: class CompletingTextEditPrivate *d; - Q_PRIVATE_SLOT(d, void insertCompletion(const QString &)) }; } // namespace Utils diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 93b152b7d4..15cc2b574e 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -62,7 +62,8 @@ ConsoleProcessPrivate::ConsoleProcessPrivate() : ConsoleProcess::ConsoleProcess(QObject *parent) : QObject(parent), d(new ConsoleProcessPrivate) { - connect(&d->m_stubServer, SIGNAL(newConnection()), SLOT(stubConnectionAvailable())); + connect(&d->m_stubServer, &QLocalServer::newConnection, + this, &ConsoleProcess::stubConnectionAvailable); d->m_process.setProcessChannelMode(QProcess::ForwardedChannels); } @@ -177,7 +178,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args) return false; } d->m_stubConnectTimer = new QTimer(this); - connect(d->m_stubConnectTimer, SIGNAL(timeout()), SLOT(stop())); + connect(d->m_stubConnectTimer, &QTimer::timeout, this, &ConsoleProcess::stop); d->m_stubConnectTimer->setSingleShot(true); d->m_stubConnectTimer->start(10000); d->m_executable = program; @@ -282,8 +283,8 @@ void ConsoleProcess::stubConnectionAvailable() d->m_stubConnected = true; emit stubStarted(); d->m_stubSocket = d->m_stubServer.nextPendingConnection(); - connect(d->m_stubSocket, SIGNAL(readyRead()), SLOT(readStubOutput())); - connect(d->m_stubSocket, SIGNAL(disconnected()), SLOT(stubExited())); + connect(d->m_stubSocket, &QIODevice::readyRead, this, &ConsoleProcess::readStubOutput); + connect(d->m_stubSocket, &QLocalSocket::disconnected, this, &ConsoleProcess::stubExited); } static QString errorMsg(int code) diff --git a/src/libs/utils/consoleprocess_win.cpp b/src/libs/utils/consoleprocess_win.cpp index 8082f54270..b054e8af5e 100644 --- a/src/libs/utils/consoleprocess_win.cpp +++ b/src/libs/utils/consoleprocess_win.cpp @@ -58,7 +58,8 @@ ConsoleProcessPrivate::ConsoleProcessPrivate() : ConsoleProcess::ConsoleProcess(QObject *parent) : QObject(parent), d(new ConsoleProcessPrivate) { - connect(&d->m_stubServer, SIGNAL(newConnection()), SLOT(stubConnectionAvailable())); + connect(&d->m_stubServer, &QLocalServer::newConnection, + this, &ConsoleProcess::stubConnectionAvailable); } qint64 ConsoleProcess::applicationMainThreadID() const @@ -156,7 +157,8 @@ bool ConsoleProcess::start(const QString &program, const QString &args) } d->processFinishedNotifier = new QWinEventNotifier(d->m_pid->hProcess, this); - connect(d->processFinishedNotifier, SIGNAL(activated(HANDLE)), SLOT(stubExited())); + connect(d->processFinishedNotifier, &QWinEventNotifier::activated, + this, &ConsoleProcess::stubExited); return true; } @@ -210,7 +212,7 @@ void ConsoleProcess::stubConnectionAvailable() { emit stubStarted(); d->m_stubSocket = d->m_stubServer.nextPendingConnection(); - connect(d->m_stubSocket, SIGNAL(readyRead()), SLOT(readStubOutput())); + connect(d->m_stubSocket, &QIODevice::readyRead, this, &ConsoleProcess::readStubOutput); } void ConsoleProcess::readStubOutput() @@ -240,7 +242,8 @@ void ConsoleProcess::readStubOutput() continue; } d->inferiorFinishedNotifier = new QWinEventNotifier(d->m_hInferior, this); - connect(d->inferiorFinishedNotifier, SIGNAL(activated(HANDLE)), SLOT(inferiorExited())); + connect(d->inferiorFinishedNotifier, &QWinEventNotifier::activated, + this, &ConsoleProcess::inferiorExited); emit processStarted(); } else { emitError(QProcess::UnknownError, msgUnexpectedOutput(out)); diff --git a/src/libs/utils/crumblepath.cpp b/src/libs/utils/crumblepath.cpp index f0914d820e..818a704757 100644 --- a/src/libs/utils/crumblepath.cpp +++ b/src/libs/utils/crumblepath.cpp @@ -310,7 +310,7 @@ void CrumblePath::pushElement(const QString &title, const QVariant &data) { CrumblePathButton *newButton = new CrumblePathButton(title, this); newButton->hide(); - connect(newButton, SIGNAL(clicked()), SLOT(emitElementClicked())); + connect(newButton, &QAbstractButton::clicked, this, &CrumblePath::emitElementClicked); int segType = CrumblePathButton::MiddleSegment; if (!d->m_buttons.isEmpty()) { @@ -339,7 +339,7 @@ void CrumblePath::addChild(const QString &title, const QVariant &data) QAction *childAction = new QAction(title, lastButton); childAction->setData(data); - connect(childAction, SIGNAL(triggered()), this, SLOT(emitElementClicked())); + connect(childAction, &QAction::triggered, this, &CrumblePath::emitElementClicked); childList->addAction(childAction); lastButton->setMenu(childList); } diff --git a/src/libs/utils/detailswidget.cpp b/src/libs/utils/detailswidget.cpp index 46d92902df..a94d7702d8 100644 --- a/src/libs/utils/detailswidget.cpp +++ b/src/libs/utils/detailswidget.cpp @@ -209,12 +209,12 @@ DetailsWidget::DetailsWidget(QWidget *parent) : setUseCheckBox(false); - connect(d->m_detailsButton, SIGNAL(toggled(bool)), - this, SLOT(setExpanded(bool))); - connect(d->m_summaryCheckBox, SIGNAL(toggled(bool)), - this, SIGNAL(checked(bool))); - connect(d->m_summaryLabel, SIGNAL(linkActivated(QString)), - this, SIGNAL(linkActivated(QString))); + connect(d->m_detailsButton, &QAbstractButton::toggled, + this, &DetailsWidget::setExpanded); + connect(d->m_summaryCheckBox, &QAbstractButton::toggled, + this, &DetailsWidget::checked); + connect(d->m_summaryLabel, &QLabel::linkActivated, + this, &DetailsWidget::linkActivated); d->updateControls(); } diff --git a/src/libs/utils/fadingindicator.cpp b/src/libs/utils/fadingindicator.cpp index ee8c2c70b3..bfef677185 100644 --- a/src/libs/utils/fadingindicator.cpp +++ b/src/libs/utils/fadingindicator.cpp @@ -112,7 +112,7 @@ private slots: QPropertyAnimation *anim = new QPropertyAnimation(m_effect, "opacity", this); anim->setDuration(200); anim->setEndValue(0.); - connect(anim, SIGNAL(finished()), this, SLOT(deleteLater())); + connect(anim, &QAbstractAnimation::finished, this, &QObject::deleteLater); anim->start(QAbstractAnimation::DeleteWhenStopped); } diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index f2b7684b5c..fcb8a9cdcc 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -165,9 +165,9 @@ FancyLineEdit::FancyLineEdit(QWidget *parent) : ensurePolished(); updateMargins(); - connect(d->m_iconbutton[Left], SIGNAL(clicked()), this, SLOT(iconClicked())); - connect(d->m_iconbutton[Right], SIGNAL(clicked()), this, SLOT(iconClicked())); - connect(this, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString))); + connect(d->m_iconbutton[Left], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked); + connect(d->m_iconbutton[Right], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked); + connect(this, &QLineEdit::textChanged, this, &FancyLineEdit::onTextChanged); } FancyLineEdit::~FancyLineEdit() @@ -316,8 +316,8 @@ void FancyLineEdit::setHistoryCompleter(const QString &historyKey, bool restoreL // being emitted and more updates finally calling setText() (again). // To make sure we report the "final" content delay the addEntry() // "a bit". - connect(this, SIGNAL(editingFinished()), - this, SLOT(onEditingFinished()), Qt::QueuedConnection); + connect(this, &QLineEdit::editingFinished, + this, &FancyLineEdit::onEditingFinished, Qt::QueuedConnection); } void FancyLineEdit::onEditingFinished() @@ -371,9 +371,9 @@ void FancyLineEdit::setFiltering(bool on) setPlaceholderText(tr("Filter")); setButtonToolTip(Right, tr("Clear text")); setAutoHideButton(Right, true); - connect(this, SIGNAL(rightButtonClicked()), this, SLOT(clear())); + connect(this, &FancyLineEdit::rightButtonClicked, this, &QLineEdit::clear); } else { - disconnect(this, SIGNAL(rightButtonClicked()), this, SLOT(clear())); + disconnect(this, &FancyLineEdit::rightButtonClicked, this, &QLineEdit::clear); } } @@ -462,10 +462,8 @@ void FancyLineEdit::onTextChanged(const QString &t) d->m_state = newState; d->m_firstChange = false; setTextColor(this, newState == Invalid ? d->m_errorTextColor : d->m_okTextColor); - if (validHasChanged) { + if (validHasChanged) emit validChanged(newState == Valid); - emit validChanged(); - } } bool block = blockSignals(true); const QString fixedString = fixInputString(t); diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index c50adfea30..b7d7b4bf8b 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -156,7 +156,6 @@ signals: void filterChanged(const QString &); - void validChanged(); void validChanged(bool validState); void validReturnPressed(); diff --git a/src/libs/utils/filesystemwatcher.cpp b/src/libs/utils/filesystemwatcher.cpp index a34041f914..ac8ce0e26e 100644 --- a/src/libs/utils/filesystemwatcher.cpp +++ b/src/libs/utils/filesystemwatcher.cpp @@ -198,10 +198,10 @@ void FileSystemWatcher::init() qDebug() << this << "Created watcher for id " << d->m_id; } ++(d->m_staticData->m_objectCount); - connect(d->m_staticData->m_watcher, SIGNAL(fileChanged(QString)), - this, SLOT(slotFileChanged(QString))); - connect(d->m_staticData->m_watcher, SIGNAL(directoryChanged(QString)), - this, SLOT(slotDirectoryChanged(QString))); + connect(d->m_staticData->m_watcher, &QFileSystemWatcher::fileChanged, + this, &FileSystemWatcher::slotFileChanged); + connect(d->m_staticData->m_watcher, &QFileSystemWatcher::directoryChanged, + this, &FileSystemWatcher::slotDirectoryChanged); } FileSystemWatcher::~FileSystemWatcher() diff --git a/src/libs/utils/filewizardpage.cpp b/src/libs/utils/filewizardpage.cpp index 110ba85b58..93feb4e701 100644 --- a/src/libs/utils/filewizardpage.cpp +++ b/src/libs/utils/filewizardpage.cpp @@ -64,11 +64,15 @@ FileWizardPage::FileWizardPage(QWidget *parent) : d(new FileWizardPagePrivate) { d->m_ui.setupUi(this); - connect(d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); - connect(d->m_ui.nameLineEdit, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); - - connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); - connect(d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); + connect(d->m_ui.pathChooser, &PathChooser::validChanged, + this, &FileWizardPage::slotValidChanged); + connect(d->m_ui.nameLineEdit, &FancyLineEdit::validChanged, + this, &FileWizardPage::slotValidChanged); + + connect(d->m_ui.pathChooser, &PathChooser::returnPressed, + this, &FileWizardPage::slotActivated); + connect(d->m_ui.nameLineEdit, &FancyLineEdit::validReturnPressed, + this, &FileWizardPage::slotActivated); setProperty(SHORT_TITLE_PROPERTY, tr("Location")); diff --git a/src/libs/utils/multitask.h b/src/libs/utils/multitask.h index 34d289e4e9..589274c3e5 100644 --- a/src/libs/utils/multitask.h +++ b/src/libs/utils/multitask.h @@ -83,14 +83,18 @@ public: QFutureWatcher<R> *watcher = new QFutureWatcher<R>(); watchers.insert(object, watcher); finished.insert(watcher, false); - connect(watcher, SIGNAL(finished()), this, SLOT(setFinished())); - connect(watcher, SIGNAL(progressRangeChanged(int,int)), this, SLOT(setProgressRange(int,int))); - connect(watcher, SIGNAL(progressValueChanged(int)), this, SLOT(setProgressValue(int))); - connect(watcher, SIGNAL(progressTextChanged(QString)), this, SLOT(setProgressText(QString))); + connect(watcher, &QFutureWatcherBase::finished, + this, &MultiTask::setFinished); + connect(watcher, &QFutureWatcherBase::progressRangeChanged, + this, &MultiTask::setProgressRange); + connect(watcher, &QFutureWatcherBase::progressValueChanged, + this, &MultiTask::setProgressValue); + connect(watcher, &QFutureWatcherBase::progressTextChanged, + this, &MultiTask::setProgressText); watcher->setFuture(QtConcurrent::run(fn, object)); } selfWatcher = new QFutureWatcher<R>(); - connect(selfWatcher, SIGNAL(canceled()), this, SLOT(cancelSelf())); + connect(selfWatcher, &QFutureWatcherBase::canceled, this, &MultiTask::cancelSelf); selfWatcher->setFuture(futureInterface.future()); loop = new QEventLoop; loop->exec(); diff --git a/src/libs/utils/newclasswidget.cpp b/src/libs/utils/newclasswidget.cpp index c39ab6c6e3..dea3e69071 100644 --- a/src/libs/utils/newclasswidget.cpp +++ b/src/libs/utils/newclasswidget.cpp @@ -98,44 +98,45 @@ NewClassWidget::NewClassWidget(QWidget *parent) : setNamesDelimiter(QLatin1String("::")); - connect(d->m_ui.classLineEdit, SIGNAL(updateFileName(QString)), - this, SLOT(slotUpdateFileNames(QString))); - connect(d->m_ui.classLineEdit, SIGNAL(textEdited(QString)), - this, SLOT(classNameEdited())); - connect(d->m_ui.baseClassComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(suggestClassNameFromBase())); - connect(d->m_ui.baseClassComboBox, SIGNAL(editTextChanged(QString)), - this, SLOT(slotValidChanged())); - connect(d->m_ui.classLineEdit, SIGNAL(validChanged()), - this, SLOT(slotValidChanged())); - connect(d->m_ui.headerFileLineEdit, SIGNAL(validChanged()), - this, SLOT(slotValidChanged())); - connect(d->m_ui.sourceFileLineEdit, SIGNAL(validChanged()), - this, SLOT(slotValidChanged())); - connect(d->m_ui.formFileLineEdit, SIGNAL(validChanged()), - this, SLOT(slotValidChanged())); - connect(d->m_ui.pathChooser, SIGNAL(validChanged()), - this, SLOT(slotValidChanged())); - connect(d->m_ui.generateFormCheckBox, SIGNAL(toggled(bool)), - this, SLOT(slotValidChanged())); - - connect(d->m_ui.classLineEdit, SIGNAL(validReturnPressed()), - this, SLOT(slotActivated())); - connect(d->m_ui.headerFileLineEdit, SIGNAL(validReturnPressed()), - this, SLOT(slotActivated())); - connect(d->m_ui.sourceFileLineEdit, SIGNAL(validReturnPressed()), - this, SLOT(slotActivated())); - connect(d->m_ui.formFileLineEdit, SIGNAL(validReturnPressed()), - this, SLOT(slotActivated())); - connect(d->m_ui.formFileLineEdit, SIGNAL(validReturnPressed()), - this, SLOT(slotActivated())); - connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), - this, SLOT(slotActivated())); - - connect(d->m_ui.generateFormCheckBox, SIGNAL(stateChanged(int)), - this, SLOT(slotFormInputChecked())); - connect(d->m_ui.baseClassComboBox, SIGNAL(editTextChanged(QString)), - this, SLOT(slotBaseClassEdited(QString))); + connect(d->m_ui.classLineEdit, &ClassNameValidatingLineEdit::updateFileName, + this, &NewClassWidget::slotUpdateFileNames); + connect(d->m_ui.classLineEdit, &QLineEdit::textEdited, + this, &NewClassWidget::classNameEdited); + connect(d->m_ui.baseClassComboBox, + static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + this, &NewClassWidget::suggestClassNameFromBase); + connect(d->m_ui.baseClassComboBox, &QComboBox::editTextChanged, + this, &NewClassWidget::slotValidChanged); + connect(d->m_ui.classLineEdit, &FancyLineEdit::validChanged, + this, &NewClassWidget::slotValidChanged); + connect(d->m_ui.headerFileLineEdit, &FancyLineEdit::validChanged, + this, &NewClassWidget::slotValidChanged); + connect(d->m_ui.sourceFileLineEdit, &FancyLineEdit::validChanged, + this, &NewClassWidget::slotValidChanged); + connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validChanged, + this, &NewClassWidget::slotValidChanged); + connect(d->m_ui.pathChooser, &PathChooser::validChanged, + this, &NewClassWidget::slotValidChanged); + connect(d->m_ui.generateFormCheckBox, &QAbstractButton::toggled, + this, &NewClassWidget::slotValidChanged); + + connect(d->m_ui.classLineEdit, &FancyLineEdit::validReturnPressed, + this, &NewClassWidget::slotActivated); + connect(d->m_ui.headerFileLineEdit, &FancyLineEdit::validReturnPressed, + this, &NewClassWidget::slotActivated); + connect(d->m_ui.sourceFileLineEdit, &FancyLineEdit::validReturnPressed, + this, &NewClassWidget::slotActivated); + connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validReturnPressed, + this, &NewClassWidget::slotActivated); + connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validReturnPressed, + this, &NewClassWidget::slotActivated); + connect(d->m_ui.pathChooser, &PathChooser::returnPressed, + this, &NewClassWidget::slotActivated); + + connect(d->m_ui.generateFormCheckBox, &QCheckBox::stateChanged, + this, &NewClassWidget::slotFormInputChecked); + connect(d->m_ui.baseClassComboBox, &QComboBox::editTextChanged, + this, &NewClassWidget::slotBaseClassEdited); d->m_ui.generateFormCheckBox->setChecked(true); setFormInputCheckable(false, true); setClassType(NoClassType); diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 7fa64b2477..1c1a0c1bbf 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -234,12 +234,11 @@ PathChooser::PathChooser(QWidget *parent) : { d->m_hLayout->setContentsMargins(0, 0, 0, 0); - connect(d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed())); - connect(d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed(QString))); - connect(d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged())); - connect(d->m_lineEdit, SIGNAL(validChanged(bool)), this, SIGNAL(validChanged(bool))); - connect(d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); - connect(d->m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged())); + connect(d->m_lineEdit, &FancyLineEdit::validReturnPressed, this, &PathChooser::returnPressed); + connect(d->m_lineEdit, &QLineEdit::textChanged, this, &PathChooser::changed); + connect(d->m_lineEdit, &FancyLineEdit::validChanged, this, &PathChooser::validChanged); + connect(d->m_lineEdit, &QLineEdit::editingFinished, this, &PathChooser::editingFinished); + connect(d->m_lineEdit, &QLineEdit::textChanged, this, &PathChooser::slotTextChanged); d->m_lineEdit->setMinimumWidth(120); d->m_hLayout->addWidget(d->m_lineEdit); diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 21eccba935..591726b132 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -142,7 +142,6 @@ private: QString makeDialogTitle(const QString &title); signals: - void validChanged(); void validChanged(bool validState); void changed(const QString &text); void pathChanged(const QString &path); diff --git a/src/libs/utils/pathlisteditor.cpp b/src/libs/utils/pathlisteditor.cpp index 708ddfb7e8..a0b95ce092 100644 --- a/src/libs/utils/pathlisteditor.cpp +++ b/src/libs/utils/pathlisteditor.cpp @@ -135,7 +135,7 @@ PathListEditor::PathListEditor(QWidget *parent) : d->toolButton->setPopupMode(QToolButton::MenuButtonPopup); d->toolButton->setText(tr("Insert...")); d->toolButton->setMenu(d->buttonMenu); - connect(d->toolButton, SIGNAL(clicked()), this, SLOT(slotInsert())); + connect(d->toolButton, &QAbstractButton::clicked, this, &PathListEditor::slotInsert); addAction(tr("Add..."), this, SLOT(slotAdd())); addAction(tr("Delete Line"), this, SLOT(deletePathAtCursor())); @@ -255,7 +255,9 @@ void PathListEditor::addEnvVariableImportAction(const QString &var) { if (!d->envVarMapper) { d->envVarMapper = new QSignalMapper(this); - connect(d->envVarMapper, SIGNAL(mapped(QString)), this, SLOT(setPathListFromEnvVariable(QString))); + connect(d->envVarMapper, + static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped), + this, &PathListEditor::setPathListFromEnvVariable); } QAction *a = insertAction(lastAddActionIndex() + 1, diff --git a/src/libs/utils/projectintropage.cpp b/src/libs/utils/projectintropage.cpp index 5769afe763..028789981c 100644 --- a/src/libs/utils/projectintropage.cpp +++ b/src/libs/utils/projectintropage.cpp @@ -93,12 +93,19 @@ ProjectIntroPage::ProjectIntroPage(QWidget *parent) : d->m_ui.projectComboBox->setVisible(d->m_forceSubProject); d->m_ui.pathChooser->setDisabled(d->m_forceSubProject); d->m_ui.projectsDirectoryCheckBox->setDisabled(d->m_forceSubProject); - connect(d->m_ui.pathChooser, SIGNAL(changed(QString)), this, SLOT(slotChanged())); - connect(d->m_ui.nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotChanged())); - connect(d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged())); - connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); - connect(d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); - connect(d->m_ui.projectComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChanged())); + connect(d->m_ui.pathChooser, &PathChooser::changed, + this, &ProjectIntroPage::slotChanged); + connect(d->m_ui.nameLineEdit, &QLineEdit::textChanged, + this, &ProjectIntroPage::slotChanged); + connect(d->m_ui.pathChooser, &PathChooser::validChanged, + this, &ProjectIntroPage::slotChanged); + connect(d->m_ui.pathChooser, &PathChooser::returnPressed, + this, &ProjectIntroPage::slotActivated); + connect(d->m_ui.nameLineEdit, &FancyLineEdit::validReturnPressed, + this, &ProjectIntroPage::slotActivated); + connect(d->m_ui.projectComboBox, + static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + this, &ProjectIntroPage::slotChanged); setProperty(SHORT_TITLE_PROPERTY, tr("Location")); registerFieldWithName(QLatin1String("Path"), d->m_ui.pathChooser, "path", SIGNAL(pathChanged(QString))); diff --git a/src/libs/utils/proxyaction.cpp b/src/libs/utils/proxyaction.cpp index c75a7d41e2..21b7151dd6 100644 --- a/src/libs/utils/proxyaction.cpp +++ b/src/libs/utils/proxyaction.cpp @@ -39,7 +39,7 @@ ProxyAction::ProxyAction(QObject *parent) : m_showShortcut(false), m_block(false) { - connect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence())); + connect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence); updateState(); } @@ -68,18 +68,18 @@ void ProxyAction::updateState() void ProxyAction::disconnectAction() { if (m_action) { - disconnect(m_action, SIGNAL(changed()), this, SLOT(actionChanged())); - disconnect(this, SIGNAL(triggered(bool)), m_action, SIGNAL(triggered(bool))); - disconnect(this, SIGNAL(toggled(bool)), m_action, SLOT(setChecked(bool))); + disconnect(m_action.data(), &QAction::changed, this, &ProxyAction::actionChanged); + disconnect(this, &QAction::triggered, m_action.data(), &QAction::triggered); + disconnect(this, &QAction::toggled, m_action.data(), &QAction::setChecked); } } void ProxyAction::connectAction() { if (m_action) { - connect(m_action, SIGNAL(changed()), this, SLOT(actionChanged())); - connect(this, SIGNAL(triggered(bool)), m_action, SIGNAL(triggered(bool))); - connect(this, SIGNAL(toggled(bool)), m_action, SLOT(setChecked(bool))); + connect(m_action.data(), &QAction::changed, this, &ProxyAction::actionChanged); + connect(this, &QAction::triggered, m_action.data(), &QAction::triggered); + connect(this, &ProxyAction::toggled, m_action.data(), &QAction::setChecked); } } @@ -120,7 +120,7 @@ void ProxyAction::update(QAction *action, bool initialize) if (!action) return; disconnectAction(); - disconnect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence())); + disconnect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence); if (initialize) { setSeparator(action->isSeparator()); setMenuRole(action->menuRole()); @@ -146,7 +146,7 @@ void ProxyAction::update(QAction *action, bool initialize) setVisible(action->isVisible()); } connectAction(); - connect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence())); + connect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence); } bool ProxyAction::shortcutVisibleInToolTip() const diff --git a/src/libs/utils/qtcolorbutton.cpp b/src/libs/utils/qtcolorbutton.cpp index 3d84c097dd..38db0d2c0d 100644 --- a/src/libs/utils/qtcolorbutton.cpp +++ b/src/libs/utils/qtcolorbutton.cpp @@ -133,7 +133,7 @@ QtColorButton::QtColorButton(QWidget *parent) setAcceptDrops(true); - connect(this, SIGNAL(clicked()), d_ptr, SLOT(slotEditColor())); + connect(this, &QtColorButton::clicked, d_ptr, &QtColorButtonPrivate::slotEditColor); setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); } diff --git a/src/libs/utils/settingsselector.cpp b/src/libs/utils/settingsselector.cpp index 393b358ca3..47bf6512a5 100644 --- a/src/libs/utils/settingsselector.cpp +++ b/src/libs/utils/settingsselector.cpp @@ -72,11 +72,14 @@ SettingsSelector::SettingsSelector(QWidget *parent) : updateButtonState(); - connect(m_addButton, SIGNAL(clicked()), this, SIGNAL(add())); - connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeButtonClicked())); - connect(m_renameButton, SIGNAL(clicked()), this, SLOT(renameButtonClicked())); - connect(m_configurationCombo, SIGNAL(currentIndexChanged(int)), - this, SIGNAL(currentChanged(int))); + connect(m_addButton, &QAbstractButton::clicked, this, &SettingsSelector::add); + connect(m_removeButton, &QAbstractButton::clicked, + this, &SettingsSelector::removeButtonClicked); + connect(m_renameButton, &QAbstractButton::clicked, + this, &SettingsSelector::renameButtonClicked); + connect(m_configurationCombo, + static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + this, &SettingsSelector::currentChanged); } SettingsSelector::~SettingsSelector() @@ -85,12 +88,14 @@ SettingsSelector::~SettingsSelector() void SettingsSelector::setConfigurationModel(QAbstractItemModel *model) { if (m_configurationCombo->model()) { - disconnect(m_configurationCombo->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(updateButtonState())); - disconnect(m_configurationCombo->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(updateButtonState())); + disconnect(m_configurationCombo->model(), &QAbstractItemModel::rowsInserted, + this, &SettingsSelector::updateButtonState); + disconnect(m_configurationCombo->model(), &QAbstractItemModel::rowsRemoved, + this, &SettingsSelector::updateButtonState); } m_configurationCombo->setModel(model); - connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(updateButtonState())); - connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(updateButtonState())); + connect(model, &QAbstractItemModel::rowsInserted, this, &SettingsSelector::updateButtonState); + connect(model, &QAbstractItemModel::rowsRemoved, this, &SettingsSelector::updateButtonState); updateButtonState(); } diff --git a/src/libs/utils/statuslabel.cpp b/src/libs/utils/statuslabel.cpp index 841c9ca7ca..8e92af3027 100644 --- a/src/libs/utils/statuslabel.cpp +++ b/src/libs/utils/statuslabel.cpp @@ -60,7 +60,7 @@ void StatusLabel::showStatusMessage(const QString &message, int timeoutMS) if (!m_timer) { m_timer = new QTimer(this); m_timer->setSingleShot(true); - connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); + connect(m_timer, &QTimer::timeout, this, &StatusLabel::slotTimeout); } m_timer->start(timeoutMS); } else { diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp index 6bcc01a888..f8accc4517 100644 --- a/src/libs/utils/synchronousprocess.cpp +++ b/src/libs/utils/synchronousprocess.cpp @@ -249,13 +249,16 @@ SynchronousProcess::SynchronousProcess() : d(new SynchronousProcessPrivate) { d->m_timer.setInterval(1000); - connect(&d->m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); - connect(&d->m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus))); - connect(&d->m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError))); - connect(&d->m_process, SIGNAL(readyReadStandardOutput()), - this, SLOT(stdOutReady())); - connect(&d->m_process, SIGNAL(readyReadStandardError()), - this, SLOT(stdErrReady())); + connect(&d->m_timer, &QTimer::timeout, this, &SynchronousProcess::slotTimeout); + connect(&d->m_process, + static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), + this, &SynchronousProcess::finished); + connect(&d->m_process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), + this, &SynchronousProcess::error); + connect(&d->m_process, &QProcess::readyReadStandardOutput, + this, &SynchronousProcess::stdOutReady); + connect(&d->m_process, &QProcess::readyReadStandardError, + this, &SynchronousProcess::stdErrReady); } SynchronousProcess::~SynchronousProcess() diff --git a/src/libs/utils/textfieldcheckbox.cpp b/src/libs/utils/textfieldcheckbox.cpp index daa89d3506..52bb928c01 100644 --- a/src/libs/utils/textfieldcheckbox.cpp +++ b/src/libs/utils/textfieldcheckbox.cpp @@ -45,7 +45,7 @@ TextFieldCheckBox::TextFieldCheckBox(const QString &text, QWidget *parent) : QCheckBox(text, parent), m_trueText(QLatin1String("true")), m_falseText(QLatin1String("false")) { - connect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int))); + connect(this, &QCheckBox::stateChanged, this, &TextFieldCheckBox::slotStateChanged); } QString TextFieldCheckBox::text() const diff --git a/src/libs/utils/textfieldcombobox.cpp b/src/libs/utils/textfieldcombobox.cpp index fdf295a450..9c37d9271d 100644 --- a/src/libs/utils/textfieldcombobox.cpp +++ b/src/libs/utils/textfieldcombobox.cpp @@ -48,8 +48,8 @@ TextFieldComboBox::TextFieldComboBox(QWidget *parent) : QComboBox(parent) { setEditable(false); - connect(this, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotCurrentIndexChanged(int))); + connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + this, &TextFieldComboBox::slotCurrentIndexChanged); } QString TextFieldComboBox::text() const diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp index 022ce46782..9507425c51 100644 --- a/src/libs/utils/wizard.cpp +++ b/src/libs/utils/wizard.cpp @@ -142,20 +142,20 @@ LinearProgressWidget::LinearProgressWidget(WizardProgress *progress, QWidget *pa m_dotsItemWidget->setVisible(false); m_dotsItemWidget->setEnabled(false); - connect(m_wizardProgress, SIGNAL(itemAdded(WizardProgressItem*)), - this, SLOT(slotItemAdded(WizardProgressItem*))); - connect(m_wizardProgress, SIGNAL(itemRemoved(WizardProgressItem*)), - this, SLOT(slotItemRemoved(WizardProgressItem*))); - connect(m_wizardProgress, SIGNAL(itemChanged(WizardProgressItem*)), - this, SLOT(slotItemChanged(WizardProgressItem*))); - connect(m_wizardProgress, SIGNAL(nextItemsChanged(WizardProgressItem*,QList<WizardProgressItem*>)), - this, SLOT(slotNextItemsChanged(WizardProgressItem*,QList<WizardProgressItem*>))); - connect(m_wizardProgress, SIGNAL(nextShownItemChanged(WizardProgressItem*,WizardProgressItem*)), - this, SLOT(slotNextShownItemChanged(WizardProgressItem*,WizardProgressItem*))); - connect(m_wizardProgress, SIGNAL(startItemChanged(WizardProgressItem*)), - this, SLOT(slotStartItemChanged(WizardProgressItem*))); - connect(m_wizardProgress, SIGNAL(currentItemChanged(WizardProgressItem*)), - this, SLOT(slotCurrentItemChanged(WizardProgressItem*))); + connect(m_wizardProgress, &WizardProgress::itemAdded, + this, &LinearProgressWidget::slotItemAdded); + connect(m_wizardProgress, &WizardProgress::itemRemoved, + this, &LinearProgressWidget::slotItemRemoved); + connect(m_wizardProgress, &WizardProgress::itemChanged, + this, &LinearProgressWidget::slotItemChanged); + connect(m_wizardProgress, &WizardProgress::nextItemsChanged, + this, &LinearProgressWidget::slotNextItemsChanged); + connect(m_wizardProgress, &WizardProgress::nextShownItemChanged, + this, &LinearProgressWidget::slotNextShownItemChanged); + connect(m_wizardProgress, &WizardProgress::startItemChanged, + this, &LinearProgressWidget::slotStartItemChanged); + connect(m_wizardProgress, &WizardProgress::currentItemChanged, + this, &LinearProgressWidget::slotCurrentItemChanged); QList<WizardProgressItem *> items = m_wizardProgress->items(); for (int i = 0; i < items.count(); i++) diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp index 78838263fb..5c0faceb3d 100644 --- a/src/plugins/valgrind/suppressiondialog.cpp +++ b/src/plugins/valgrind/suppressiondialog.cpp @@ -166,7 +166,7 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error> m_suppressionEdit->setPlainText(suppressions); - connect(m_fileChooser, static_cast<void (Utils::PathChooser:: *)()>(&Utils::PathChooser::validChanged), + connect(m_fileChooser, &Utils::PathChooser::validChanged, this, &SuppressionDialog::validate); connect(m_suppressionEdit->document(), &QTextDocument::contentsChanged, this, &SuppressionDialog::validate); diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.cpp b/src/plugins/vcsbase/basecheckoutwizardpage.cpp index d92e7a4fd1..82e061d689 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.cpp +++ b/src/plugins/vcsbase/basecheckoutwizardpage.cpp @@ -81,8 +81,7 @@ BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) : d->ui.pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); d->ui.pathChooser->setHistoryCompleter(QLatin1String("Vcs.CheckoutDir.History")); - connect(d->ui.pathChooser, - static_cast<void (Utils::PathChooser::*)()>(&Utils::PathChooser::validChanged), + connect(d->ui.pathChooser, &Utils::PathChooser::validChanged, this, &BaseCheckoutWizardPage::slotChanged); d->ui.branchComboBox->setEnabled(false); |