Utils: Modernize connections

Change-Id: I4650abc84e7c82a4054197319f6c849af9e5b8ce
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-03-05 22:00:05 +02:00
committed by hjk
parent 0c5dac717e
commit 329c493764
29 changed files with 169 additions and 153 deletions

View File

@@ -121,10 +121,10 @@ CheckableMessageBox::CheckableMessageBox(QWidget *parent) :
{ {
setModal(true); setModal(true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept())); connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject())); connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)), connect(d->buttonBox, &QDialogButtonBox::clicked,
SLOT(slotClicked(QAbstractButton*))); this, [this](QAbstractButton *b) { d->clickedButton = b; });
} }
CheckableMessageBox::~CheckableMessageBox() CheckableMessageBox::~CheckableMessageBox()
@@ -132,11 +132,6 @@ CheckableMessageBox::~CheckableMessageBox()
delete d; delete d;
} }
void CheckableMessageBox::slotClicked(QAbstractButton *b)
{
d->clickedButton = b;
}
QAbstractButton *CheckableMessageBox::clickedButton() const QAbstractButton *CheckableMessageBox::clickedButton() const
{ {
return d->clickedButton; return d->clickedButton;

View File

@@ -130,9 +130,6 @@ public:
static QString msgDoNotAskAgain(); static QString msgDoNotAskAgain();
static QString msgDoNotShowAgain(); static QString msgDoNotShowAgain();
private slots:
void slotClicked(QAbstractButton *b);
private: private:
CheckableMessageBoxPrivate *d; CheckableMessageBoxPrivate *d;
}; };

View File

@@ -121,7 +121,8 @@ void CompletingTextEdit::setCompleter(QCompleter *c)
completer()->setWidget(this); completer()->setWidget(this);
completer()->setCompletionMode(QCompleter::PopupCompletion); 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 QCompleter *CompletingTextEdit::completer() const

View File

@@ -65,7 +65,6 @@ protected:
private: private:
class CompletingTextEditPrivate *d; class CompletingTextEditPrivate *d;
Q_PRIVATE_SLOT(d, void insertCompletion(const QString &))
}; };
} // namespace Utils } // namespace Utils

View File

@@ -62,7 +62,8 @@ ConsoleProcessPrivate::ConsoleProcessPrivate() :
ConsoleProcess::ConsoleProcess(QObject *parent) : ConsoleProcess::ConsoleProcess(QObject *parent) :
QObject(parent), d(new ConsoleProcessPrivate) 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); d->m_process.setProcessChannelMode(QProcess::ForwardedChannels);
} }
@@ -177,7 +178,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
return false; return false;
} }
d->m_stubConnectTimer = new QTimer(this); 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->setSingleShot(true);
d->m_stubConnectTimer->start(10000); d->m_stubConnectTimer->start(10000);
d->m_executable = program; d->m_executable = program;
@@ -282,8 +283,8 @@ void ConsoleProcess::stubConnectionAvailable()
d->m_stubConnected = true; d->m_stubConnected = true;
emit stubStarted(); emit stubStarted();
d->m_stubSocket = d->m_stubServer.nextPendingConnection(); d->m_stubSocket = d->m_stubServer.nextPendingConnection();
connect(d->m_stubSocket, SIGNAL(readyRead()), SLOT(readStubOutput())); connect(d->m_stubSocket, &QIODevice::readyRead, this, &ConsoleProcess::readStubOutput);
connect(d->m_stubSocket, SIGNAL(disconnected()), SLOT(stubExited())); connect(d->m_stubSocket, &QLocalSocket::disconnected, this, &ConsoleProcess::stubExited);
} }
static QString errorMsg(int code) static QString errorMsg(int code)

View File

@@ -58,7 +58,8 @@ ConsoleProcessPrivate::ConsoleProcessPrivate() :
ConsoleProcess::ConsoleProcess(QObject *parent) : ConsoleProcess::ConsoleProcess(QObject *parent) :
QObject(parent), d(new ConsoleProcessPrivate) 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 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); 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; return true;
} }
@@ -210,7 +212,7 @@ void ConsoleProcess::stubConnectionAvailable()
{ {
emit stubStarted(); emit stubStarted();
d->m_stubSocket = d->m_stubServer.nextPendingConnection(); 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() void ConsoleProcess::readStubOutput()
@@ -240,7 +242,8 @@ void ConsoleProcess::readStubOutput()
continue; continue;
} }
d->inferiorFinishedNotifier = new QWinEventNotifier(d->m_hInferior, this); 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(); emit processStarted();
} else { } else {
emitError(QProcess::UnknownError, msgUnexpectedOutput(out)); emitError(QProcess::UnknownError, msgUnexpectedOutput(out));

View File

@@ -310,7 +310,7 @@ void CrumblePath::pushElement(const QString &title, const QVariant &data)
{ {
CrumblePathButton *newButton = new CrumblePathButton(title, this); CrumblePathButton *newButton = new CrumblePathButton(title, this);
newButton->hide(); newButton->hide();
connect(newButton, SIGNAL(clicked()), SLOT(emitElementClicked())); connect(newButton, &QAbstractButton::clicked, this, &CrumblePath::emitElementClicked);
int segType = CrumblePathButton::MiddleSegment; int segType = CrumblePathButton::MiddleSegment;
if (!d->m_buttons.isEmpty()) { if (!d->m_buttons.isEmpty()) {
@@ -339,7 +339,7 @@ void CrumblePath::addChild(const QString &title, const QVariant &data)
QAction *childAction = new QAction(title, lastButton); QAction *childAction = new QAction(title, lastButton);
childAction->setData(data); childAction->setData(data);
connect(childAction, SIGNAL(triggered()), this, SLOT(emitElementClicked())); connect(childAction, &QAction::triggered, this, &CrumblePath::emitElementClicked);
childList->addAction(childAction); childList->addAction(childAction);
lastButton->setMenu(childList); lastButton->setMenu(childList);
} }

View File

@@ -209,12 +209,12 @@ DetailsWidget::DetailsWidget(QWidget *parent) :
setUseCheckBox(false); setUseCheckBox(false);
connect(d->m_detailsButton, SIGNAL(toggled(bool)), connect(d->m_detailsButton, &QAbstractButton::toggled,
this, SLOT(setExpanded(bool))); this, &DetailsWidget::setExpanded);
connect(d->m_summaryCheckBox, SIGNAL(toggled(bool)), connect(d->m_summaryCheckBox, &QAbstractButton::toggled,
this, SIGNAL(checked(bool))); this, &DetailsWidget::checked);
connect(d->m_summaryLabel, SIGNAL(linkActivated(QString)), connect(d->m_summaryLabel, &QLabel::linkActivated,
this, SIGNAL(linkActivated(QString))); this, &DetailsWidget::linkActivated);
d->updateControls(); d->updateControls();
} }

View File

@@ -112,7 +112,7 @@ private slots:
QPropertyAnimation *anim = new QPropertyAnimation(m_effect, "opacity", this); QPropertyAnimation *anim = new QPropertyAnimation(m_effect, "opacity", this);
anim->setDuration(200); anim->setDuration(200);
anim->setEndValue(0.); anim->setEndValue(0.);
connect(anim, SIGNAL(finished()), this, SLOT(deleteLater())); connect(anim, &QAbstractAnimation::finished, this, &QObject::deleteLater);
anim->start(QAbstractAnimation::DeleteWhenStopped); anim->start(QAbstractAnimation::DeleteWhenStopped);
} }

View File

@@ -165,9 +165,9 @@ FancyLineEdit::FancyLineEdit(QWidget *parent) :
ensurePolished(); ensurePolished();
updateMargins(); updateMargins();
connect(d->m_iconbutton[Left], SIGNAL(clicked()), this, SLOT(iconClicked())); connect(d->m_iconbutton[Left], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
connect(d->m_iconbutton[Right], SIGNAL(clicked()), this, SLOT(iconClicked())); connect(d->m_iconbutton[Right], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
connect(this, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString))); connect(this, &QLineEdit::textChanged, this, &FancyLineEdit::onTextChanged);
} }
FancyLineEdit::~FancyLineEdit() FancyLineEdit::~FancyLineEdit()
@@ -316,8 +316,8 @@ void FancyLineEdit::setHistoryCompleter(const QString &historyKey, bool restoreL
// being emitted and more updates finally calling setText() (again). // being emitted and more updates finally calling setText() (again).
// To make sure we report the "final" content delay the addEntry() // To make sure we report the "final" content delay the addEntry()
// "a bit". // "a bit".
connect(this, SIGNAL(editingFinished()), connect(this, &QLineEdit::editingFinished,
this, SLOT(onEditingFinished()), Qt::QueuedConnection); this, &FancyLineEdit::onEditingFinished, Qt::QueuedConnection);
} }
void FancyLineEdit::onEditingFinished() void FancyLineEdit::onEditingFinished()
@@ -371,9 +371,9 @@ void FancyLineEdit::setFiltering(bool on)
setPlaceholderText(tr("Filter")); setPlaceholderText(tr("Filter"));
setButtonToolTip(Right, tr("Clear text")); setButtonToolTip(Right, tr("Clear text"));
setAutoHideButton(Right, true); setAutoHideButton(Right, true);
connect(this, SIGNAL(rightButtonClicked()), this, SLOT(clear())); connect(this, &FancyLineEdit::rightButtonClicked, this, &QLineEdit::clear);
} else { } 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_state = newState;
d->m_firstChange = false; d->m_firstChange = false;
setTextColor(this, newState == Invalid ? d->m_errorTextColor : d->m_okTextColor); setTextColor(this, newState == Invalid ? d->m_errorTextColor : d->m_okTextColor);
if (validHasChanged) { if (validHasChanged)
emit validChanged(newState == Valid); emit validChanged(newState == Valid);
emit validChanged();
}
} }
bool block = blockSignals(true); bool block = blockSignals(true);
const QString fixedString = fixInputString(t); const QString fixedString = fixInputString(t);

View File

@@ -156,7 +156,6 @@ signals:
void filterChanged(const QString &); void filterChanged(const QString &);
void validChanged();
void validChanged(bool validState); void validChanged(bool validState);
void validReturnPressed(); void validReturnPressed();

View File

@@ -198,10 +198,10 @@ void FileSystemWatcher::init()
qDebug() << this << "Created watcher for id " << d->m_id; qDebug() << this << "Created watcher for id " << d->m_id;
} }
++(d->m_staticData->m_objectCount); ++(d->m_staticData->m_objectCount);
connect(d->m_staticData->m_watcher, SIGNAL(fileChanged(QString)), connect(d->m_staticData->m_watcher, &QFileSystemWatcher::fileChanged,
this, SLOT(slotFileChanged(QString))); this, &FileSystemWatcher::slotFileChanged);
connect(d->m_staticData->m_watcher, SIGNAL(directoryChanged(QString)), connect(d->m_staticData->m_watcher, &QFileSystemWatcher::directoryChanged,
this, SLOT(slotDirectoryChanged(QString))); this, &FileSystemWatcher::slotDirectoryChanged);
} }
FileSystemWatcher::~FileSystemWatcher() FileSystemWatcher::~FileSystemWatcher()

View File

@@ -64,11 +64,15 @@ FileWizardPage::FileWizardPage(QWidget *parent) :
d(new FileWizardPagePrivate) d(new FileWizardPagePrivate)
{ {
d->m_ui.setupUi(this); d->m_ui.setupUi(this);
connect(d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); connect(d->m_ui.pathChooser, &PathChooser::validChanged,
connect(d->m_ui.nameLineEdit, SIGNAL(validChanged()), this, SLOT(slotValidChanged())); this, &FileWizardPage::slotValidChanged);
connect(d->m_ui.nameLineEdit, &FancyLineEdit::validChanged,
this, &FileWizardPage::slotValidChanged);
connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); connect(d->m_ui.pathChooser, &PathChooser::returnPressed,
connect(d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); this, &FileWizardPage::slotActivated);
connect(d->m_ui.nameLineEdit, &FancyLineEdit::validReturnPressed,
this, &FileWizardPage::slotActivated);
setProperty(SHORT_TITLE_PROPERTY, tr("Location")); setProperty(SHORT_TITLE_PROPERTY, tr("Location"));

View File

@@ -83,14 +83,18 @@ public:
QFutureWatcher<R> *watcher = new QFutureWatcher<R>(); QFutureWatcher<R> *watcher = new QFutureWatcher<R>();
watchers.insert(object, watcher); watchers.insert(object, watcher);
finished.insert(watcher, false); finished.insert(watcher, false);
connect(watcher, SIGNAL(finished()), this, SLOT(setFinished())); connect(watcher, &QFutureWatcherBase::finished,
connect(watcher, SIGNAL(progressRangeChanged(int,int)), this, SLOT(setProgressRange(int,int))); this, &MultiTask::setFinished);
connect(watcher, SIGNAL(progressValueChanged(int)), this, SLOT(setProgressValue(int))); connect(watcher, &QFutureWatcherBase::progressRangeChanged,
connect(watcher, SIGNAL(progressTextChanged(QString)), this, SLOT(setProgressText(QString))); this, &MultiTask::setProgressRange);
connect(watcher, &QFutureWatcherBase::progressValueChanged,
this, &MultiTask::setProgressValue);
connect(watcher, &QFutureWatcherBase::progressTextChanged,
this, &MultiTask::setProgressText);
watcher->setFuture(QtConcurrent::run(fn, object)); watcher->setFuture(QtConcurrent::run(fn, object));
} }
selfWatcher = new QFutureWatcher<R>(); selfWatcher = new QFutureWatcher<R>();
connect(selfWatcher, SIGNAL(canceled()), this, SLOT(cancelSelf())); connect(selfWatcher, &QFutureWatcherBase::canceled, this, &MultiTask::cancelSelf);
selfWatcher->setFuture(futureInterface.future()); selfWatcher->setFuture(futureInterface.future());
loop = new QEventLoop; loop = new QEventLoop;
loop->exec(); loop->exec();

View File

@@ -98,44 +98,45 @@ NewClassWidget::NewClassWidget(QWidget *parent) :
setNamesDelimiter(QLatin1String("::")); setNamesDelimiter(QLatin1String("::"));
connect(d->m_ui.classLineEdit, SIGNAL(updateFileName(QString)), connect(d->m_ui.classLineEdit, &ClassNameValidatingLineEdit::updateFileName,
this, SLOT(slotUpdateFileNames(QString))); this, &NewClassWidget::slotUpdateFileNames);
connect(d->m_ui.classLineEdit, SIGNAL(textEdited(QString)), connect(d->m_ui.classLineEdit, &QLineEdit::textEdited,
this, SLOT(classNameEdited())); this, &NewClassWidget::classNameEdited);
connect(d->m_ui.baseClassComboBox, SIGNAL(currentIndexChanged(int)), connect(d->m_ui.baseClassComboBox,
this, SLOT(suggestClassNameFromBase())); static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(d->m_ui.baseClassComboBox, SIGNAL(editTextChanged(QString)), this, &NewClassWidget::suggestClassNameFromBase);
this, SLOT(slotValidChanged())); connect(d->m_ui.baseClassComboBox, &QComboBox::editTextChanged,
connect(d->m_ui.classLineEdit, SIGNAL(validChanged()), this, &NewClassWidget::slotValidChanged);
this, SLOT(slotValidChanged())); connect(d->m_ui.classLineEdit, &FancyLineEdit::validChanged,
connect(d->m_ui.headerFileLineEdit, SIGNAL(validChanged()), this, &NewClassWidget::slotValidChanged);
this, SLOT(slotValidChanged())); connect(d->m_ui.headerFileLineEdit, &FancyLineEdit::validChanged,
connect(d->m_ui.sourceFileLineEdit, SIGNAL(validChanged()), this, &NewClassWidget::slotValidChanged);
this, SLOT(slotValidChanged())); connect(d->m_ui.sourceFileLineEdit, &FancyLineEdit::validChanged,
connect(d->m_ui.formFileLineEdit, SIGNAL(validChanged()), this, &NewClassWidget::slotValidChanged);
this, SLOT(slotValidChanged())); connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validChanged,
connect(d->m_ui.pathChooser, SIGNAL(validChanged()), this, &NewClassWidget::slotValidChanged);
this, SLOT(slotValidChanged())); connect(d->m_ui.pathChooser, &PathChooser::validChanged,
connect(d->m_ui.generateFormCheckBox, SIGNAL(toggled(bool)), this, &NewClassWidget::slotValidChanged);
this, SLOT(slotValidChanged())); connect(d->m_ui.generateFormCheckBox, &QAbstractButton::toggled,
this, &NewClassWidget::slotValidChanged);
connect(d->m_ui.classLineEdit, SIGNAL(validReturnPressed()), connect(d->m_ui.classLineEdit, &FancyLineEdit::validReturnPressed,
this, SLOT(slotActivated())); this, &NewClassWidget::slotActivated);
connect(d->m_ui.headerFileLineEdit, SIGNAL(validReturnPressed()), connect(d->m_ui.headerFileLineEdit, &FancyLineEdit::validReturnPressed,
this, SLOT(slotActivated())); this, &NewClassWidget::slotActivated);
connect(d->m_ui.sourceFileLineEdit, SIGNAL(validReturnPressed()), connect(d->m_ui.sourceFileLineEdit, &FancyLineEdit::validReturnPressed,
this, SLOT(slotActivated())); this, &NewClassWidget::slotActivated);
connect(d->m_ui.formFileLineEdit, SIGNAL(validReturnPressed()), connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validReturnPressed,
this, SLOT(slotActivated())); this, &NewClassWidget::slotActivated);
connect(d->m_ui.formFileLineEdit, SIGNAL(validReturnPressed()), connect(d->m_ui.formFileLineEdit, &FancyLineEdit::validReturnPressed,
this, SLOT(slotActivated())); this, &NewClassWidget::slotActivated);
connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), connect(d->m_ui.pathChooser, &PathChooser::returnPressed,
this, SLOT(slotActivated())); this, &NewClassWidget::slotActivated);
connect(d->m_ui.generateFormCheckBox, SIGNAL(stateChanged(int)), connect(d->m_ui.generateFormCheckBox, &QCheckBox::stateChanged,
this, SLOT(slotFormInputChecked())); this, &NewClassWidget::slotFormInputChecked);
connect(d->m_ui.baseClassComboBox, SIGNAL(editTextChanged(QString)), connect(d->m_ui.baseClassComboBox, &QComboBox::editTextChanged,
this, SLOT(slotBaseClassEdited(QString))); this, &NewClassWidget::slotBaseClassEdited);
d->m_ui.generateFormCheckBox->setChecked(true); d->m_ui.generateFormCheckBox->setChecked(true);
setFormInputCheckable(false, true); setFormInputCheckable(false, true);
setClassType(NoClassType); setClassType(NoClassType);

View File

@@ -234,12 +234,11 @@ PathChooser::PathChooser(QWidget *parent) :
{ {
d->m_hLayout->setContentsMargins(0, 0, 0, 0); d->m_hLayout->setContentsMargins(0, 0, 0, 0);
connect(d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed())); connect(d->m_lineEdit, &FancyLineEdit::validReturnPressed, this, &PathChooser::returnPressed);
connect(d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed(QString))); connect(d->m_lineEdit, &QLineEdit::textChanged, this, &PathChooser::changed);
connect(d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged())); connect(d->m_lineEdit, &FancyLineEdit::validChanged, this, &PathChooser::validChanged);
connect(d->m_lineEdit, SIGNAL(validChanged(bool)), this, SIGNAL(validChanged(bool))); connect(d->m_lineEdit, &QLineEdit::editingFinished, this, &PathChooser::editingFinished);
connect(d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); connect(d->m_lineEdit, &QLineEdit::textChanged, this, &PathChooser::slotTextChanged);
connect(d->m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
d->m_lineEdit->setMinimumWidth(120); d->m_lineEdit->setMinimumWidth(120);
d->m_hLayout->addWidget(d->m_lineEdit); d->m_hLayout->addWidget(d->m_lineEdit);

View File

@@ -142,7 +142,6 @@ private:
QString makeDialogTitle(const QString &title); QString makeDialogTitle(const QString &title);
signals: signals:
void validChanged();
void validChanged(bool validState); void validChanged(bool validState);
void changed(const QString &text); void changed(const QString &text);
void pathChanged(const QString &path); void pathChanged(const QString &path);

View File

@@ -135,7 +135,7 @@ PathListEditor::PathListEditor(QWidget *parent) :
d->toolButton->setPopupMode(QToolButton::MenuButtonPopup); d->toolButton->setPopupMode(QToolButton::MenuButtonPopup);
d->toolButton->setText(tr("Insert...")); d->toolButton->setText(tr("Insert..."));
d->toolButton->setMenu(d->buttonMenu); 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("Add..."), this, SLOT(slotAdd()));
addAction(tr("Delete Line"), this, SLOT(deletePathAtCursor())); addAction(tr("Delete Line"), this, SLOT(deletePathAtCursor()));
@@ -255,7 +255,9 @@ void PathListEditor::addEnvVariableImportAction(const QString &var)
{ {
if (!d->envVarMapper) { if (!d->envVarMapper) {
d->envVarMapper = new QSignalMapper(this); 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, QAction *a = insertAction(lastAddActionIndex() + 1,

View File

@@ -93,12 +93,19 @@ ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
d->m_ui.projectComboBox->setVisible(d->m_forceSubProject); d->m_ui.projectComboBox->setVisible(d->m_forceSubProject);
d->m_ui.pathChooser->setDisabled(d->m_forceSubProject); d->m_ui.pathChooser->setDisabled(d->m_forceSubProject);
d->m_ui.projectsDirectoryCheckBox->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.pathChooser, &PathChooser::changed,
connect(d->m_ui.nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotChanged())); this, &ProjectIntroPage::slotChanged);
connect(d->m_ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged())); connect(d->m_ui.nameLineEdit, &QLineEdit::textChanged,
connect(d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated())); this, &ProjectIntroPage::slotChanged);
connect(d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated())); connect(d->m_ui.pathChooser, &PathChooser::validChanged,
connect(d->m_ui.projectComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChanged())); 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")); setProperty(SHORT_TITLE_PROPERTY, tr("Location"));
registerFieldWithName(QLatin1String("Path"), d->m_ui.pathChooser, "path", SIGNAL(pathChanged(QString))); registerFieldWithName(QLatin1String("Path"), d->m_ui.pathChooser, "path", SIGNAL(pathChanged(QString)));

View File

@@ -39,7 +39,7 @@ ProxyAction::ProxyAction(QObject *parent) :
m_showShortcut(false), m_showShortcut(false),
m_block(false) m_block(false)
{ {
connect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence())); connect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence);
updateState(); updateState();
} }
@@ -68,18 +68,18 @@ void ProxyAction::updateState()
void ProxyAction::disconnectAction() void ProxyAction::disconnectAction()
{ {
if (m_action) { if (m_action) {
disconnect(m_action, SIGNAL(changed()), this, SLOT(actionChanged())); disconnect(m_action.data(), &QAction::changed, this, &ProxyAction::actionChanged);
disconnect(this, SIGNAL(triggered(bool)), m_action, SIGNAL(triggered(bool))); disconnect(this, &QAction::triggered, m_action.data(), &QAction::triggered);
disconnect(this, SIGNAL(toggled(bool)), m_action, SLOT(setChecked(bool))); disconnect(this, &QAction::toggled, m_action.data(), &QAction::setChecked);
} }
} }
void ProxyAction::connectAction() void ProxyAction::connectAction()
{ {
if (m_action) { if (m_action) {
connect(m_action, SIGNAL(changed()), this, SLOT(actionChanged())); connect(m_action.data(), &QAction::changed, this, &ProxyAction::actionChanged);
connect(this, SIGNAL(triggered(bool)), m_action, SIGNAL(triggered(bool))); connect(this, &QAction::triggered, m_action.data(), &QAction::triggered);
connect(this, SIGNAL(toggled(bool)), m_action, SLOT(setChecked(bool))); connect(this, &ProxyAction::toggled, m_action.data(), &QAction::setChecked);
} }
} }
@@ -120,7 +120,7 @@ void ProxyAction::update(QAction *action, bool initialize)
if (!action) if (!action)
return; return;
disconnectAction(); disconnectAction();
disconnect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence())); disconnect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence);
if (initialize) { if (initialize) {
setSeparator(action->isSeparator()); setSeparator(action->isSeparator());
setMenuRole(action->menuRole()); setMenuRole(action->menuRole());
@@ -146,7 +146,7 @@ void ProxyAction::update(QAction *action, bool initialize)
setVisible(action->isVisible()); setVisible(action->isVisible());
} }
connectAction(); connectAction();
connect(this, SIGNAL(changed()), this, SLOT(updateToolTipWithKeySequence())); connect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence);
} }
bool ProxyAction::shortcutVisibleInToolTip() const bool ProxyAction::shortcutVisibleInToolTip() const

View File

@@ -133,7 +133,7 @@ QtColorButton::QtColorButton(QWidget *parent)
setAcceptDrops(true); setAcceptDrops(true);
connect(this, SIGNAL(clicked()), d_ptr, SLOT(slotEditColor())); connect(this, &QtColorButton::clicked, d_ptr, &QtColorButtonPrivate::slotEditColor);
setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
} }

View File

@@ -72,11 +72,14 @@ SettingsSelector::SettingsSelector(QWidget *parent) :
updateButtonState(); updateButtonState();
connect(m_addButton, SIGNAL(clicked()), this, SIGNAL(add())); connect(m_addButton, &QAbstractButton::clicked, this, &SettingsSelector::add);
connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeButtonClicked())); connect(m_removeButton, &QAbstractButton::clicked,
connect(m_renameButton, SIGNAL(clicked()), this, SLOT(renameButtonClicked())); this, &SettingsSelector::removeButtonClicked);
connect(m_configurationCombo, SIGNAL(currentIndexChanged(int)), connect(m_renameButton, &QAbstractButton::clicked,
this, SIGNAL(currentChanged(int))); this, &SettingsSelector::renameButtonClicked);
connect(m_configurationCombo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &SettingsSelector::currentChanged);
} }
SettingsSelector::~SettingsSelector() SettingsSelector::~SettingsSelector()
@@ -85,12 +88,14 @@ SettingsSelector::~SettingsSelector()
void SettingsSelector::setConfigurationModel(QAbstractItemModel *model) void SettingsSelector::setConfigurationModel(QAbstractItemModel *model)
{ {
if (m_configurationCombo->model()) { if (m_configurationCombo->model()) {
disconnect(m_configurationCombo->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(updateButtonState())); disconnect(m_configurationCombo->model(), &QAbstractItemModel::rowsInserted,
disconnect(m_configurationCombo->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(updateButtonState())); this, &SettingsSelector::updateButtonState);
disconnect(m_configurationCombo->model(), &QAbstractItemModel::rowsRemoved,
this, &SettingsSelector::updateButtonState);
} }
m_configurationCombo->setModel(model); m_configurationCombo->setModel(model);
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(updateButtonState())); connect(model, &QAbstractItemModel::rowsInserted, this, &SettingsSelector::updateButtonState);
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(updateButtonState())); connect(model, &QAbstractItemModel::rowsRemoved, this, &SettingsSelector::updateButtonState);
updateButtonState(); updateButtonState();
} }

View File

@@ -60,7 +60,7 @@ void StatusLabel::showStatusMessage(const QString &message, int timeoutMS)
if (!m_timer) { if (!m_timer) {
m_timer = new QTimer(this); m_timer = new QTimer(this);
m_timer->setSingleShot(true); m_timer->setSingleShot(true);
connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); connect(m_timer, &QTimer::timeout, this, &StatusLabel::slotTimeout);
} }
m_timer->start(timeoutMS); m_timer->start(timeoutMS);
} else { } else {

View File

@@ -249,13 +249,16 @@ SynchronousProcess::SynchronousProcess() :
d(new SynchronousProcessPrivate) d(new SynchronousProcessPrivate)
{ {
d->m_timer.setInterval(1000); d->m_timer.setInterval(1000);
connect(&d->m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); connect(&d->m_timer, &QTimer::timeout, this, &SynchronousProcess::slotTimeout);
connect(&d->m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus))); connect(&d->m_process,
connect(&d->m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError))); static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
connect(&d->m_process, SIGNAL(readyReadStandardOutput()), this, &SynchronousProcess::finished);
this, SLOT(stdOutReady())); connect(&d->m_process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
connect(&d->m_process, SIGNAL(readyReadStandardError()), this, &SynchronousProcess::error);
this, SLOT(stdErrReady())); connect(&d->m_process, &QProcess::readyReadStandardOutput,
this, &SynchronousProcess::stdOutReady);
connect(&d->m_process, &QProcess::readyReadStandardError,
this, &SynchronousProcess::stdErrReady);
} }
SynchronousProcess::~SynchronousProcess() SynchronousProcess::~SynchronousProcess()

View File

@@ -45,7 +45,7 @@ TextFieldCheckBox::TextFieldCheckBox(const QString &text, QWidget *parent) :
QCheckBox(text, parent), QCheckBox(text, parent),
m_trueText(QLatin1String("true")), m_falseText(QLatin1String("false")) 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 QString TextFieldCheckBox::text() const

View File

@@ -48,8 +48,8 @@ TextFieldComboBox::TextFieldComboBox(QWidget *parent) :
QComboBox(parent) QComboBox(parent)
{ {
setEditable(false); setEditable(false);
connect(this, SIGNAL(currentIndexChanged(int)), connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, SLOT(slotCurrentIndexChanged(int))); this, &TextFieldComboBox::slotCurrentIndexChanged);
} }
QString TextFieldComboBox::text() const QString TextFieldComboBox::text() const

View File

@@ -142,20 +142,20 @@ LinearProgressWidget::LinearProgressWidget(WizardProgress *progress, QWidget *pa
m_dotsItemWidget->setVisible(false); m_dotsItemWidget->setVisible(false);
m_dotsItemWidget->setEnabled(false); m_dotsItemWidget->setEnabled(false);
connect(m_wizardProgress, SIGNAL(itemAdded(WizardProgressItem*)), connect(m_wizardProgress, &WizardProgress::itemAdded,
this, SLOT(slotItemAdded(WizardProgressItem*))); this, &LinearProgressWidget::slotItemAdded);
connect(m_wizardProgress, SIGNAL(itemRemoved(WizardProgressItem*)), connect(m_wizardProgress, &WizardProgress::itemRemoved,
this, SLOT(slotItemRemoved(WizardProgressItem*))); this, &LinearProgressWidget::slotItemRemoved);
connect(m_wizardProgress, SIGNAL(itemChanged(WizardProgressItem*)), connect(m_wizardProgress, &WizardProgress::itemChanged,
this, SLOT(slotItemChanged(WizardProgressItem*))); this, &LinearProgressWidget::slotItemChanged);
connect(m_wizardProgress, SIGNAL(nextItemsChanged(WizardProgressItem*,QList<WizardProgressItem*>)), connect(m_wizardProgress, &WizardProgress::nextItemsChanged,
this, SLOT(slotNextItemsChanged(WizardProgressItem*,QList<WizardProgressItem*>))); this, &LinearProgressWidget::slotNextItemsChanged);
connect(m_wizardProgress, SIGNAL(nextShownItemChanged(WizardProgressItem*,WizardProgressItem*)), connect(m_wizardProgress, &WizardProgress::nextShownItemChanged,
this, SLOT(slotNextShownItemChanged(WizardProgressItem*,WizardProgressItem*))); this, &LinearProgressWidget::slotNextShownItemChanged);
connect(m_wizardProgress, SIGNAL(startItemChanged(WizardProgressItem*)), connect(m_wizardProgress, &WizardProgress::startItemChanged,
this, SLOT(slotStartItemChanged(WizardProgressItem*))); this, &LinearProgressWidget::slotStartItemChanged);
connect(m_wizardProgress, SIGNAL(currentItemChanged(WizardProgressItem*)), connect(m_wizardProgress, &WizardProgress::currentItemChanged,
this, SLOT(slotCurrentItemChanged(WizardProgressItem*))); this, &LinearProgressWidget::slotCurrentItemChanged);
QList<WizardProgressItem *> items = m_wizardProgress->items(); QList<WizardProgressItem *> items = m_wizardProgress->items();
for (int i = 0; i < items.count(); i++) for (int i = 0; i < items.count(); i++)

View File

@@ -166,7 +166,7 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
m_suppressionEdit->setPlainText(suppressions); m_suppressionEdit->setPlainText(suppressions);
connect(m_fileChooser, static_cast<void (Utils::PathChooser:: *)()>(&Utils::PathChooser::validChanged), connect(m_fileChooser, &Utils::PathChooser::validChanged,
this, &SuppressionDialog::validate); this, &SuppressionDialog::validate);
connect(m_suppressionEdit->document(), &QTextDocument::contentsChanged, connect(m_suppressionEdit->document(), &QTextDocument::contentsChanged,
this, &SuppressionDialog::validate); this, &SuppressionDialog::validate);

View File

@@ -81,8 +81,7 @@ BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) :
d->ui.pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); d->ui.pathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
d->ui.pathChooser->setHistoryCompleter(QLatin1String("Vcs.CheckoutDir.History")); d->ui.pathChooser->setHistoryCompleter(QLatin1String("Vcs.CheckoutDir.History"));
connect(d->ui.pathChooser, connect(d->ui.pathChooser, &Utils::PathChooser::validChanged,
static_cast<void (Utils::PathChooser::*)()>(&Utils::PathChooser::validChanged),
this, &BaseCheckoutWizardPage::slotChanged); this, &BaseCheckoutWizardPage::slotChanged);
d->ui.branchComboBox->setEnabled(false); d->ui.branchComboBox->setEnabled(false);