diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2016-02-02 09:10:54 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2016-02-03 07:54:02 +0000 |
commit | 5646480f27007789429c7e813423c7f142810cc3 (patch) | |
tree | 29452400aa66e2dc8b17f4ef643128aff25ba8ce | |
parent | 7a9cc3499e81185ec24ce383cefc0f6e43f00ce4 (diff) |
Core: Use Qt5-style connects
The heavy lifting was done by clazy.
Change-Id: I2dde14919d917816d02117338205f8f861d8af0a
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
93 files changed, 527 insertions, 546 deletions
diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp index 28aca727ed..c1ca6e7970 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp @@ -239,8 +239,8 @@ void ActionContainerPrivate::addAction(Command *command, Id groupId) QAction *beforeAction = insertLocation(groupIt); m_groups[groupIt-m_groups.constBegin()].items.append(command); - connect(command, SIGNAL(activeStateChanged()), this, SLOT(scheduleUpdate())); - connect(command, SIGNAL(destroyed()), this, SLOT(itemDestroyed())); + connect(command, &Command::activeStateChanged, this, &ActionContainerPrivate::scheduleUpdate); + connect(command, &QObject::destroyed, this, &ActionContainerPrivate::itemDestroyed); insertAction(beforeAction, command->action()); scheduleUpdate(); } @@ -258,7 +258,7 @@ void ActionContainerPrivate::addMenu(ActionContainer *menu, Id groupId) QAction *beforeAction = insertLocation(groupIt); m_groups[groupIt-m_groups.constBegin()].items.append(menu); - connect(menu, SIGNAL(destroyed()), this, SLOT(itemDestroyed())); + connect(menu, &QObject::destroyed, this, &ActionContainerPrivate::itemDestroyed); insertMenu(beforeAction, container->menu()); scheduleUpdate(); } @@ -276,7 +276,7 @@ void ActionContainerPrivate::addMenu(ActionContainer *before, ActionContainer *m QAction *beforeAction = before->menu()->menuAction(); m_groups[groupIt-m_groups.constBegin()].items.append(menu); - connect(menu, SIGNAL(destroyed()), this, SLOT(itemDestroyed())); + connect(menu, &QObject::destroyed, this, &ActionContainerPrivate::itemDestroyed); insertMenu(beforeAction, container->menu()); scheduleUpdate(); } @@ -311,11 +311,13 @@ void ActionContainerPrivate::clear() foreach (QObject *item, group.items) { if (Command *command = qobject_cast<Command *>(item)) { removeAction(command->action()); - disconnect(command, SIGNAL(activeStateChanged()), this, SLOT(scheduleUpdate())); - disconnect(command, SIGNAL(destroyed()), this, SLOT(itemDestroyed())); + disconnect(command, &Command::activeStateChanged, + this, &ActionContainerPrivate::scheduleUpdate); + disconnect(command, &QObject::destroyed, this, &ActionContainerPrivate::itemDestroyed); } else if (ActionContainer *container = qobject_cast<ActionContainer *>(item)) { container->clear(); - disconnect(container, SIGNAL(destroyed()), this, SLOT(itemDestroyed())); + disconnect(container, &QObject::destroyed, + this, &ActionContainerPrivate::itemDestroyed); removeMenu(container->menu()); } } @@ -360,7 +362,7 @@ void ActionContainerPrivate::scheduleUpdate() if (m_updateRequested) return; m_updateRequested = true; - QTimer::singleShot(0, this, SLOT(update())); + QTimer::singleShot(0, this, &ActionContainerPrivate::update); } void ActionContainerPrivate::update() diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer_p.h b/src/plugins/coreplugin/actionmanager/actioncontainer_p.h index 8e0133bb10..2350119ee7 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer_p.h +++ b/src/plugins/coreplugin/actionmanager/actioncontainer_p.h @@ -82,12 +82,11 @@ protected: // groupId --> list of Command* and ActionContainer* QList<Group> m_groups; -private slots: +private: void scheduleUpdate(); void update(); void itemDestroyed(); -private: QList<Group>::const_iterator findGroup(Id groupId) const; QAction *insertLocation(QList<Group>::const_iterator group) const; diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index bf761ae875..3bd250c98d 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -99,7 +99,7 @@ using namespace Core::Internal; "myplugin.myaction", Context(C_GLOBAL)); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+u"))); - connect(myAction, SIGNAL(triggered()), this, SLOT(performMyAction())); + connect(myAction, &QAction::triggered, this, &MyPlugin::performMyAction); \endcode So the \c connect is done to your own QAction instance. If you create e.g. diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index 53dff13d55..3e737290ae 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -206,7 +206,7 @@ Action::Action(Id id) m_contextInitialized(false) { m_action->setShortcutVisibleInToolTip(true); - connect(m_action, SIGNAL(changed()), this, SLOT(updateActiveState())); + connect(m_action, &QAction::changed, this, &Action::updateActiveState); } Id Action::id() const diff --git a/src/plugins/coreplugin/actionmanager/command_p.h b/src/plugins/coreplugin/actionmanager/command_p.h index defe3babfb..eec5f814f2 100644 --- a/src/plugins/coreplugin/actionmanager/command_p.h +++ b/src/plugins/coreplugin/actionmanager/command_p.h @@ -78,10 +78,8 @@ public: void removeAttribute(CommandAttribute attr); bool hasAttribute(CommandAttribute attr) const; -private slots: - void updateActiveState(); - private: + void updateActiveState(); void setActive(bool state); Context m_context; diff --git a/src/plugins/coreplugin/actionmanager/commandbutton.cpp b/src/plugins/coreplugin/actionmanager/commandbutton.cpp index 7c3c902faa..29ac42ad73 100644 --- a/src/plugins/coreplugin/actionmanager/commandbutton.cpp +++ b/src/plugins/coreplugin/actionmanager/commandbutton.cpp @@ -58,7 +58,7 @@ CommandButton::CommandButton(Id id, QWidget *parent) void CommandButton::setCommandId(Id id) { if (m_command) - disconnect(m_command, SIGNAL(keySequenceChanged()), this, SLOT(updateToolTip())); + disconnect(m_command.data(), &Command::keySequenceChanged, this, &CommandButton::updateToolTip); m_command = ActionManager::command(id); @@ -66,7 +66,7 @@ void CommandButton::setCommandId(Id id) m_toolTipBase = m_command->description(); updateToolTip(); - connect(m_command, SIGNAL(keySequenceChanged()), this, SLOT(updateToolTip())); + connect(m_command.data(), &Command::keySequenceChanged, this, &CommandButton::updateToolTip); } QString CommandButton::toolTipBase() const diff --git a/src/plugins/coreplugin/actionmanager/commandbutton.h b/src/plugins/coreplugin/actionmanager/commandbutton.h index 46edd695e9..5828eb6563 100644 --- a/src/plugins/coreplugin/actionmanager/commandbutton.h +++ b/src/plugins/coreplugin/actionmanager/commandbutton.h @@ -48,10 +48,9 @@ public: QString toolTipBase() const; void setToolTipBase(const QString &toolTipBase); -private slots: +private: void updateToolTip(); -private: QPointer<Command> m_command; QString m_toolTipBase; }; diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp index 9509eb8e2f..c2c8bbf49e 100644 --- a/src/plugins/coreplugin/designmode.cpp +++ b/src/plugins/coreplugin/designmode.cpp @@ -187,7 +187,7 @@ void DesignMode::currentEditorChanged(IEditor *editor) } } if (d->m_currentEditor) - disconnect(d->m_currentEditor.data()->document(), SIGNAL(changed()), this, SLOT(updateActions())); + disconnect(d->m_currentEditor.data()->document(), &IDocument::changed, this, &DesignMode::updateActions); if (!mimeEditorAvailable) { setActiveContext(Context()); @@ -200,7 +200,7 @@ void DesignMode::currentEditorChanged(IEditor *editor) d->m_currentEditor = editor; if (d->m_currentEditor) - connect(d->m_currentEditor.data()->document(), SIGNAL(changed()), this, SLOT(updateActions())); + connect(d->m_currentEditor.data()->document(), &IDocument::changed, this, &DesignMode::updateActions); emit actionsUpdated(d->m_currentEditor.data()); } diff --git a/src/plugins/coreplugin/designmode.h b/src/plugins/coreplugin/designmode.h index f23b39c744..7c261f800a 100644 --- a/src/plugins/coreplugin/designmode.h +++ b/src/plugins/coreplugin/designmode.h @@ -65,10 +65,9 @@ public: signals: void actionsUpdated(Core::IEditor *editor); -private slots: +private: void updateActions(); -private: void currentEditorChanged(IEditor *editor); void updateContext(IMode *newMode, IMode *oldMode); void setActiveContext(const Context &context); diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 624beea011..e3e337a31b 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -442,8 +442,8 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : ui->toolTree->setModel(m_model); ui->toolTree->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed); - connect(ui->toolTree->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(handleCurrentChanged(QModelIndex,QModelIndex))); + connect(ui->toolTree->selectionModel(), &QItemSelectionModel::currentChanged, + this, &ExternalToolConfig::handleCurrentChanged); auto chooser = new VariableChooser(this); chooser->addSupportedWidget(ui->executable->lineEdit()); @@ -451,30 +451,40 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) : chooser->addSupportedWidget(ui->workingDirectory->lineEdit()); chooser->addSupportedWidget(ui->inputText); - connect(ui->description, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem())); - connect(ui->executable, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem())); - connect(ui->executable, SIGNAL(browsingFinished()), this, SLOT(updateCurrentItem())); - connect(ui->arguments, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem())); - connect(ui->arguments, SIGNAL(editingFinished()), this, SLOT(updateEffectiveArguments())); - connect(ui->workingDirectory, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem())); - connect(ui->workingDirectory, SIGNAL(browsingFinished()), this, SLOT(updateCurrentItem())); - connect(ui->environmentButton, SIGNAL(clicked()), this, SLOT(editEnvironmentChanges())); - connect(ui->outputBehavior, SIGNAL(activated(int)), this, SLOT(updateCurrentItem())); - connect(ui->errorOutputBehavior, SIGNAL(activated(int)), this, SLOT(updateCurrentItem())); - connect(ui->modifiesDocumentCheckbox, SIGNAL(clicked()), this, SLOT(updateCurrentItem())); - connect(ui->inputText, SIGNAL(textChanged()), this, SLOT(updateCurrentItem())); - - connect(ui->revertButton, SIGNAL(clicked()), this, SLOT(revertCurrentItem())); - connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(removeTool())); + connect(ui->description, &QLineEdit::editingFinished, + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->executable, &Utils::PathChooser::editingFinished, + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->executable, &Utils::PathChooser::browsingFinished, + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->arguments, &QLineEdit::editingFinished, this, &ExternalToolConfig::updateCurrentItem); + connect(ui->arguments, &QLineEdit::editingFinished, + this, &ExternalToolConfig::updateEffectiveArguments); + connect(ui->workingDirectory, &Utils::PathChooser::editingFinished, + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->workingDirectory, &Utils::PathChooser::browsingFinished, + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->environmentButton, &QAbstractButton::clicked, + this, &ExternalToolConfig::editEnvironmentChanges); + connect(ui->outputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->errorOutputBehavior, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->modifiesDocumentCheckbox, &QAbstractButton::clicked, + this, &ExternalToolConfig::updateCurrentItem); + connect(ui->inputText, &QPlainTextEdit::textChanged, this, &ExternalToolConfig::updateCurrentItem); + + connect(ui->revertButton, &QAbstractButton::clicked, this, &ExternalToolConfig::revertCurrentItem); + connect(ui->removeButton, &QAbstractButton::clicked, this, &ExternalToolConfig::removeTool); QMenu *menu = new QMenu(ui->addButton); ui->addButton->setMenu(menu); QAction *addTool = new QAction(tr("Add Tool"), this); menu->addAction(addTool); - connect(addTool, SIGNAL(triggered()), this, SLOT(addTool())); + connect(addTool, &QAction::triggered, this, &ExternalToolConfig::addTool); QAction *addCategory = new QAction(tr("Add Category"), this); menu->addAction(addCategory); - connect(addCategory, SIGNAL(triggered()), this, SLOT(addCategory())); + connect(addCategory, &QAction::triggered, this, &ExternalToolConfig::addCategory); showInfoForItem(QModelIndex()); diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.h b/src/plugins/coreplugin/dialogs/externaltoolconfig.h index d08bc4d207..b7f395a653 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.h +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.h @@ -104,7 +104,7 @@ public: QMap<QString, QList<ExternalTool *> > tools() const; void apply(); -private slots: +private: void handleCurrentChanged(const QModelIndex &now, const QModelIndex &previous); void showInfoForItem(const QModelIndex &index); void updateItem(const QModelIndex &index); @@ -118,7 +118,6 @@ private slots: void editEnvironmentChanges(); void updateEnvironmentLabel(); -private: Ui::ExternalToolConfig *ui; QStringList m_environment; ExternalToolModel *m_model; diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index 62e47e7847..0a7ed68f19 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -231,7 +231,9 @@ NewDialog::NewDialog(QWidget *parent) : connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &NewDialog::accept); connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &NewDialog::reject); - connect(m_ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setSelectedPlatform(QString))); + connect(m_ui->comboBox, + static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), + this, &NewDialog::setSelectedPlatform); } // Sort by category. id diff --git a/src/plugins/coreplugin/dialogs/newdialog.h b/src/plugins/coreplugin/dialogs/newdialog.h index 7a8e8676ad..cd51db330b 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.h +++ b/src/plugins/coreplugin/dialogs/newdialog.h @@ -67,7 +67,7 @@ public: protected: bool event(QEvent *); -private slots: +private: void currentCategoryChanged(const QModelIndex &); void currentItemChanged(const QModelIndex &); void accept(); @@ -75,7 +75,6 @@ private slots: void updateOkButton(); void setSelectedPlatform(const QString &platform); -private: Core::IWizardFactory *currentWizardFactory() const; void addItem(QStandardItem *topLevelCategoryItem, IWizardFactory *factory); void saveState(); diff --git a/src/plugins/coreplugin/dialogs/openwithdialog.cpp b/src/plugins/coreplugin/dialogs/openwithdialog.cpp index 7d0f4fd189..7452fdb319 100644 --- a/src/plugins/coreplugin/dialogs/openwithdialog.cpp +++ b/src/plugins/coreplugin/dialogs/openwithdialog.cpp @@ -40,14 +40,14 @@ OpenWithDialog::OpenWithDialog(const QString &fileName, QWidget *parent) label->setText(tr("Open file \"%1\" with:").arg(Utils::FileName::fromString(fileName).fileName())); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - connect(buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), - this, SLOT(accept())); - connect(buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), - this, SLOT(reject())); - connect(editorListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), - this, SLOT(accept())); - connect(editorListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - this, SLOT(currentItemChanged(QListWidgetItem*,QListWidgetItem*))); + connect(buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, + this, &QDialog::accept); + connect(buttonBox->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked, + this, &QDialog::reject); + connect(editorListWidget, &QListWidget::itemDoubleClicked, + this, &QDialog::accept); + connect(editorListWidget, &QListWidget::currentItemChanged, + this, &OpenWithDialog::currentItemChanged); setOkButtonEnabled(false); } diff --git a/src/plugins/coreplugin/dialogs/openwithdialog.h b/src/plugins/coreplugin/dialogs/openwithdialog.h index 7118b19985..4d1fd3f762 100644 --- a/src/plugins/coreplugin/dialogs/openwithdialog.h +++ b/src/plugins/coreplugin/dialogs/openwithdialog.h @@ -49,10 +49,8 @@ public: void setCurrentEditor(int index); -private slots: - void currentItemChanged(QListWidgetItem *, QListWidgetItem *); - private: + void currentItemChanged(QListWidgetItem *, QListWidgetItem *); void setOkButtonEnabled(bool); }; diff --git a/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp b/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp index 7f6f8c9b67..95b6a948d2 100644 --- a/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp +++ b/src/plugins/coreplugin/dialogs/promptoverwritedialog.cpp @@ -72,8 +72,8 @@ PromptOverwriteDialog::PromptOverwriteDialog(QWidget *parent) : m_view->setModel(m_model); mainLayout->addWidget(m_view); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); - connect(bb, SIGNAL(accepted()), this, SLOT(accept())); - connect(bb, SIGNAL(rejected()), this, SLOT(reject())); + connect(bb, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(bb, &QDialogButtonBox::rejected, this, &QDialog::reject); mainLayout->addWidget(bb); } diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp index f6f992c6c9..885b08e934 100644 --- a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp @@ -82,10 +82,11 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent, adjustButtonWidths(); updateSaveButton(); - connect(m_ui.buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), - this, SLOT(collectItemsToSave())); - connect(discardButton, SIGNAL(clicked()), this, SLOT(discardAll())); - connect(m_ui.treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateSaveButton())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Save), &QAbstractButton::clicked, + this, &SaveItemsDialog::collectItemsToSave); + connect(discardButton, &QAbstractButton::clicked, this, &SaveItemsDialog::discardAll); + connect(m_ui.treeWidget, &QTreeWidget::itemSelectionChanged, + this, &SaveItemsDialog::updateSaveButton); } void SaveItemsDialog::setMessage(const QString &msg) diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.h b/src/plugins/coreplugin/dialogs/saveitemsdialog.h index 44d4f86f39..cd988eb05e 100644 --- a/src/plugins/coreplugin/dialogs/saveitemsdialog.h +++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.h @@ -56,12 +56,10 @@ public: bool alwaysSaveChecked(); QList<IDocument *> itemsToSave() const; -private slots: +private: void collectItemsToSave(); void discardAll(); void updateSaveButton(); - -private: void adjustButtonWidths(); Ui::SaveItemsDialog m_ui; diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index d7d4dadb51..0b2fd234a4 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -126,8 +126,9 @@ struct FileState }; -struct DocumentManagerPrivate +class DocumentManagerPrivate { +public: DocumentManagerPrivate(); QFileSystemWatcher *fileWatcher(); QFileSystemWatcher *linkWatcher(); @@ -163,8 +164,8 @@ QFileSystemWatcher *DocumentManagerPrivate::fileWatcher() { if (!m_fileWatcher) { m_fileWatcher= new QFileSystemWatcher(m_instance); - QObject::connect(m_fileWatcher, SIGNAL(fileChanged(QString)), - m_instance, SLOT(changedFile(QString))); + QObject::connect(m_fileWatcher, &QFileSystemWatcher::fileChanged, + m_instance, &DocumentManager::changedFile); } return m_fileWatcher; } @@ -175,8 +176,8 @@ QFileSystemWatcher *DocumentManagerPrivate::linkWatcher() if (!m_linkWatcher) { m_linkWatcher = new QFileSystemWatcher(m_instance); m_linkWatcher->setObjectName(QLatin1String("_qt_autotest_force_engine_poller")); - QObject::connect(m_linkWatcher, SIGNAL(fileChanged(QString)), - m_instance, SLOT(changedFile(QString))); + QObject::connect(m_linkWatcher, &QFileSystemWatcher::fileChanged, + m_instance, &DocumentManager::changedFile); } return m_linkWatcher; } @@ -271,7 +272,8 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add foreach (IDocument *document, documents) { if (document && !d->m_documentsWithoutWatch.contains(document)) { - connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*))); + connect(document, &QObject::destroyed, + m_instance, &DocumentManager::documentDestroyed); connect(document, &IDocument::filePathChanged, m_instance, &DocumentManager::filePathChanged); d->m_documentsWithoutWatch.append(document); @@ -282,9 +284,10 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add foreach (IDocument *document, documents) { if (document && !d->m_documentsWithWatch.contains(document)) { - connect(document, SIGNAL(changed()), m_instance, SLOT(checkForNewFileName())); - connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*))); - connect(document, &IDocument::filePathChanged, m_instance, &DocumentManager::filePathChanged); + connect(document, &IDocument::changed, m_instance, &DocumentManager::checkForNewFileName); + connect(document, &QObject::destroyed, m_instance, &DocumentManager::documentDestroyed); + connect(document, &IDocument::filePathChanged, + m_instance, &DocumentManager::filePathChanged); addFileInfo(document); } } @@ -425,9 +428,9 @@ bool DocumentManager::removeDocument(IDocument *document) if (!d->m_documentsWithoutWatch.removeOne(document)) { addWatcher = true; removeFileInfo(document); - disconnect(document, SIGNAL(changed()), m_instance, SLOT(checkForNewFileName())); + disconnect(document, &IDocument::changed, m_instance, &DocumentManager::checkForNewFileName); } - disconnect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*))); + disconnect(document, &QObject::destroyed, m_instance, &DocumentManager::documentDestroyed); return addWatcher; } @@ -888,7 +891,7 @@ void DocumentManager::changedFile(const QString &fileName) d->m_changedFiles.insert(fileName); if (wasempty && !d->m_changedFiles.isEmpty()) - QTimer::singleShot(200, this, SLOT(checkForReload())); + QTimer::singleShot(200, this, &DocumentManager::checkForReload); } void DocumentManager::checkForReload() @@ -904,7 +907,7 @@ void DocumentManager::checkForReload() // file modified dialog, or of loading large files, has delivered a file change event from // a watcher *and* the timer triggered. We may never end up here in a nested way, so // recheck later. - QTimer::singleShot(200, this, SLOT(checkForReload())); + QTimer::singleShot(200, this, &DocumentManager::checkForReload); return; } @@ -1374,7 +1377,7 @@ bool DocumentManager::eventFilter(QObject *obj, QEvent *e) { if (obj == qApp && e->type() == QEvent::ApplicationActivate) { // activeWindow is not necessarily set yet, do checkForReload asynchronously - QTimer::singleShot(0, this, SLOT(checkForReload())); + QTimer::singleShot(0, this, &DocumentManager::checkForReload); } return false; } diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h index 7ad36b3403..f2eaf8fc26 100644 --- a/src/plugins/coreplugin/documentmanager.h +++ b/src/plugins/coreplugin/documentmanager.h @@ -45,7 +45,10 @@ namespace Core { class IContext; class IDocument; -namespace Internal { class MainWindow; } +namespace Internal { +class DocumentManagerPrivate; +class MainWindow; +} class CORE_EXPORT DocumentManager : public QObject { @@ -148,19 +151,18 @@ signals: protected: bool eventFilter(QObject *obj, QEvent *e); -private slots: - void documentDestroyed(QObject *obj); - void checkForNewFileName(); - void checkForReload(); - void changedFile(const QString &file); - private: explicit DocumentManager(QObject *parent); ~DocumentManager(); + void documentDestroyed(QObject *obj); + void checkForNewFileName(); + void checkForReload(); + void changedFile(const QString &file); void filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName); friend class Core::Internal::MainWindow; + friend class Core::Internal::DocumentManagerPrivate; }; /*! The FileChangeBlocker blocks all change notifications to all IDocument * that diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp index c579a909ed..84ea7cd42e 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel.cpp +++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp @@ -69,11 +69,10 @@ public: bool disambiguateDisplayNames(DocumentModel::Entry *entry); -private slots: +private: friend class DocumentModel; void itemChanged(); -private: class DynamicEntry { public: @@ -263,7 +262,7 @@ void DocumentModelPrivate::addEntry(DocumentModel::Entry *entry) previousEntry = 0; disambiguateDisplayNames(entry); if (replace) - connect(entry->document, SIGNAL(changed()), this, SLOT(itemChanged())); + connect(entry->document, &IDocument::changed, this, &DocumentModelPrivate::itemChanged); return; } @@ -282,7 +281,7 @@ void DocumentModelPrivate::addEntry(DocumentModel::Entry *entry) disambiguateDisplayNames(entry); if (!fixedPath.isEmpty()) m_entryByFixedPath[fixedPath] = entry; - connect(entry->document, SIGNAL(changed()), this, SLOT(itemChanged())); + connect(entry->document, &IDocument::changed, this, &DocumentModelPrivate::itemChanged); endInsertRows(); } @@ -406,7 +405,7 @@ void DocumentModelPrivate::removeDocument(int idx) DocumentManager::ResolveLinks); m_entryByFixedPath.remove(fixedPath); } - disconnect(entry->document, SIGNAL(changed()), this, SLOT(itemChanged())); + disconnect(entry->document, &IDocument::changed, this, &DocumentModelPrivate::itemChanged); disambiguateDisplayNames(entry); delete entry; } diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 0297c41fa2..ed06a7a237 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -243,7 +243,7 @@ EditorManagerPrivate::~EditorManagerPrivate() // close all extra windows for (int i = 0; i < m_editorAreas.size(); ++i) { EditorArea *area = m_editorAreas.at(i); - disconnect(area, SIGNAL(destroyed(QObject*)), this, SLOT(editorAreaDestroyed(QObject*))); + disconnect(area, &QObject::destroyed, this, &EditorManagerPrivate::editorAreaDestroyed); delete area; } m_editorAreas.clear(); @@ -271,15 +271,15 @@ void EditorManagerPrivate::init() cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Revert File to Saved")); mfile->addAction(cmd, Constants::G_FILE_SAVE); - connect(m_revertToSavedAction, SIGNAL(triggered()), m_instance, SLOT(revertToSaved())); + connect(m_revertToSavedAction, &QAction::triggered, m_instance, &EditorManager::revertToSaved); // Save Action ActionManager::registerAction(m_saveAction, Constants::SAVE, editManagerContext); - connect(m_saveAction, SIGNAL(triggered()), m_instance, SLOT(saveDocument())); + connect(m_saveAction, &QAction::triggered, m_instance, []() { EditorManager::saveDocument(); }); // Save As Action ActionManager::registerAction(m_saveAsAction, Constants::SAVEAS, editManagerContext); - connect(m_saveAsAction, SIGNAL(triggered()), m_instance, SLOT(saveDocumentAs())); + connect(m_saveAsAction, &QAction::triggered, m_instance, &EditorManager::saveDocumentAs); // Window Menu ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); @@ -294,8 +294,8 @@ void EditorManagerPrivate::init() cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(m_closeCurrentEditorAction->text()); mfile->addAction(cmd, Constants::G_FILE_CLOSE); - connect(m_closeCurrentEditorAction, SIGNAL(triggered()), - m_instance, SLOT(slotCloseCurrentEditorOrDocument())); + connect(m_closeCurrentEditorAction, &QAction::triggered, + m_instance, &EditorManager::slotCloseCurrentEditorOrDocument); if (HostOsInfo::isWindowsHost()) { // workaround for QTCREATORBUG-72 @@ -303,121 +303,133 @@ void EditorManagerPrivate::init() cmd = ActionManager::registerAction(action, Constants::CLOSE_ALTERNATIVE, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F4"))); cmd->setDescription(EditorManager::tr("Close")); - connect(action, SIGNAL(triggered()), m_instance, SLOT(slotCloseCurrentEditorOrDocument())); + connect(action, &QAction::triggered, + m_instance, &EditorManager::slotCloseCurrentEditorOrDocument); } // Close All Action cmd = ActionManager::registerAction(m_closeAllEditorsAction, Constants::CLOSEALL, editManagerContext, true); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+W"))); mfile->addAction(cmd, Constants::G_FILE_CLOSE); - connect(m_closeAllEditorsAction, SIGNAL(triggered()), m_instance, SLOT(closeAllEditors())); + connect(m_closeAllEditorsAction, &QAction::triggered, + m_instance, []() { EditorManager::closeAllEditors(); }); // Close All Others Action cmd = ActionManager::registerAction(m_closeOtherDocumentsAction, Constants::CLOSEOTHERS, editManagerContext, true); mfile->addAction(cmd, Constants::G_FILE_CLOSE); cmd->setAttribute(Command::CA_UpdateText); - connect(m_closeOtherDocumentsAction, SIGNAL(triggered()), m_instance, SLOT(closeOtherDocuments())); + connect(m_closeOtherDocumentsAction, &QAction::triggered, + m_instance, []() { EditorManager::closeOtherDocuments(); }); // Close All Others Except Visible Action cmd = ActionManager::registerAction(m_closeAllEditorsExceptVisibleAction, Constants::CLOSEALLEXCEPTVISIBLE, editManagerContext, true); mfile->addAction(cmd, Constants::G_FILE_CLOSE); - connect(m_closeAllEditorsExceptVisibleAction, SIGNAL(triggered()), - this, SLOT(closeAllEditorsExceptVisible())); + connect(m_closeAllEditorsExceptVisibleAction, &QAction::triggered, + this, &EditorManagerPrivate::closeAllEditorsExceptVisible); //Save XXX Context Actions - connect(m_copyFilePathContextAction, SIGNAL(triggered()), - this, SLOT(copyFilePathFromContextMenu())); - connect(m_copyLocationContextAction, SIGNAL(triggered()), - this, SLOT(copyLocationFromContextMenu())); - connect(m_copyFileNameContextAction, SIGNAL(triggered()), - this, SLOT(copyFileNameFromContextMenu())); - connect(m_saveCurrentEditorContextAction, SIGNAL(triggered()), - this, SLOT(saveDocumentFromContextMenu())); - connect(m_saveAsCurrentEditorContextAction, SIGNAL(triggered()), - this, SLOT(saveDocumentAsFromContextMenu())); - connect(m_revertToSavedCurrentEditorContextAction, SIGNAL(triggered()), - this, SLOT(revertToSavedFromContextMenu())); + connect(m_copyFilePathContextAction, &QAction::triggered, + this, &EditorManagerPrivate::copyFilePathFromContextMenu); + connect(m_copyLocationContextAction, &QAction::triggered, + this, &EditorManagerPrivate::copyLocationFromContextMenu); + connect(m_copyFileNameContextAction, &QAction::triggered, + this, &EditorManagerPrivate::copyFileNameFromContextMenu); + connect(m_saveCurrentEditorContextAction, &QAction::triggered, + this, &EditorManagerPrivate::saveDocumentFromContextMenu); + connect(m_saveAsCurrentEditorContextAction, &QAction::triggered, + this, &EditorManagerPrivate::saveDocumentAsFromContextMenu); + connect(m_revertToSavedCurrentEditorContextAction, &QAction::triggered, + this, &EditorManagerPrivate::revertToSavedFromContextMenu); // Close XXX Context Actions - connect(m_closeAllEditorsContextAction, SIGNAL(triggered()), - m_instance, SLOT(closeAllEditors())); - connect(m_closeCurrentEditorContextAction, SIGNAL(triggered()), - this, SLOT(closeEditorFromContextMenu())); - connect(m_closeOtherDocumentsContextAction, SIGNAL(triggered()), - this, SLOT(closeOtherDocumentsFromContextMenu())); - connect(m_closeAllEditorsExceptVisibleContextAction, SIGNAL(triggered()), - this, SLOT(closeAllEditorsExceptVisible())); - - connect(m_openGraphicalShellAction, SIGNAL(triggered()), this, SLOT(showInGraphicalShell())); - connect(m_openTerminalAction, SIGNAL(triggered()), this, SLOT(openTerminal())); - connect(m_findInDirectoryAction, SIGNAL(triggered()), this, SLOT(findInDirectory())); + connect(m_closeAllEditorsContextAction, &QAction::triggered, + m_instance, []() { EditorManager::closeAllEditors(); }); + connect(m_closeCurrentEditorContextAction, &QAction::triggered, + this, &EditorManagerPrivate::closeEditorFromContextMenu); + connect(m_closeOtherDocumentsContextAction, &QAction::triggered, + this, &EditorManagerPrivate::closeOtherDocumentsFromContextMenu); + connect(m_closeAllEditorsExceptVisibleContextAction, &QAction::triggered, + this, &EditorManagerPrivate::closeAllEditorsExceptVisible); + + connect(m_openGraphicalShellAction, &QAction::triggered, + this, &EditorManagerPrivate::showInGraphicalShell); + connect(m_openTerminalAction, &QAction::triggered, this, &EditorManagerPrivate::openTerminal); + connect(m_findInDirectoryAction, &QAction::triggered, + this, &EditorManagerPrivate::findInDirectory); // Goto Previous In History Action cmd = ActionManager::registerAction(m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Tab") : tr("Ctrl+Tab"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); - connect(m_gotoPreviousDocHistoryAction, SIGNAL(triggered()), - this, SLOT(gotoPreviousDocHistory())); + connect(m_gotoPreviousDocHistoryAction, &QAction::triggered, + this, &EditorManagerPrivate::gotoPreviousDocHistory); // Goto Next In History Action cmd = ActionManager::registerAction(m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Shift+Tab") : tr("Ctrl+Shift+Tab"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); - connect(m_gotoNextDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoNextDocHistory())); + connect(m_gotoNextDocHistoryAction, &QAction::triggered, + this, &EditorManagerPrivate::gotoNextDocHistory); // Go back in navigation history cmd = ActionManager::registerAction(m_goBackAction, Constants::GO_BACK, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Left") : tr("Alt+Left"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); - connect(m_goBackAction, SIGNAL(triggered()), m_instance, SLOT(goBackInNavigationHistory())); + connect(m_goBackAction, &QAction::triggered, + m_instance, &EditorManager::goBackInNavigationHistory); // Go forward in navigation history cmd = ActionManager::registerAction(m_goForwardAction, Constants::GO_FORWARD, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Right") : tr("Alt+Right"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); - connect(m_goForwardAction, SIGNAL(triggered()), m_instance, SLOT(goForwardInNavigationHistory())); + connect(m_goForwardAction, &QAction::triggered, + m_instance, &EditorManager::goForwardInNavigationHistory); m_splitAction = new QAction(tr("Split"), this); cmd = ActionManager::registerAction(m_splitAction, Constants::SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(m_splitAction, SIGNAL(triggered()), this, SLOT(split())); + connect(m_splitAction, &QAction::triggered, this, [this]() { split(Qt::Vertical); }); m_splitSideBySideAction = new QAction(tr("Split Side by Side"), this); cmd = ActionManager::registerAction(m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,3") : tr("Ctrl+E,3"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(m_splitSideBySideAction, SIGNAL(triggered()), m_instance, SLOT(splitSideBySide())); + connect(m_splitSideBySideAction, &QAction::triggered, m_instance, &EditorManager::splitSideBySide); m_splitNewWindowAction = new QAction(tr("Open in New Window"), this); cmd = ActionManager::registerAction(m_splitNewWindowAction, Constants::SPLIT_NEW_WINDOW, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,4") : tr("Ctrl+E,4"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(m_splitNewWindowAction, SIGNAL(triggered()), this, SLOT(splitNewWindow())); + connect(m_splitNewWindowAction, &QAction::triggered, + this, [this]() { splitNewWindow(currentEditorView()); }); m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this); cmd = ActionManager::registerAction(m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,0") : tr("Ctrl+E,0"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(m_removeCurrentSplitAction, SIGNAL(triggered()), this, SLOT(removeCurrentSplit())); + connect(m_removeCurrentSplitAction, &QAction::triggered, + this, &EditorManagerPrivate::removeCurrentSplit); m_removeAllSplitsAction = new QAction(tr("Remove All Splits"), this); cmd = ActionManager::registerAction(m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,1") : tr("Ctrl+E,1"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits())); + connect(m_removeAllSplitsAction, &QAction::triggered, + this, &EditorManagerPrivate::removeAllSplits); m_gotoPreviousSplitAction = new QAction(tr("Go to Previous Split or Window"), this); cmd = ActionManager::registerAction(m_gotoPreviousSplitAction, Constants::GOTO_PREV_SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,i") : tr("Ctrl+E,i"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(m_gotoPreviousSplitAction, SIGNAL(triggered()), this, SLOT(gotoPreviousSplit())); + connect(m_gotoPreviousSplitAction, &QAction::triggered, + this, &EditorManagerPrivate::gotoPreviousSplit); m_gotoNextSplitAction = new QAction(tr("Go to Next Split or Window"), this); cmd = ActionManager::registerAction(m_gotoNextSplitAction, Constants::GOTO_NEXT_SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(m_gotoNextSplitAction, SIGNAL(triggered()), this, SLOT(gotoNextSplit())); + connect(m_gotoNextSplitAction, &QAction::triggered, this, &EditorManagerPrivate::gotoNextSplit); ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT); ActionContainer *advancedMenu = ActionManager::createMenu(Constants::M_EDIT_ADVANCED); @@ -442,7 +454,7 @@ void EditorManagerPrivate::init() mainEditorArea->hide(); connect(mainEditorArea, &EditorArea::windowTitleNeedsUpdate, this, &EditorManagerPrivate::updateWindowTitle); - connect(mainEditorArea, SIGNAL(destroyed(QObject*)), this, SLOT(editorAreaDestroyed(QObject*))); + connect(mainEditorArea, &QObject::destroyed, this, &EditorManagerPrivate::editorAreaDestroyed); d->m_editorAreas.append(mainEditorArea); d->m_currentView = mainEditorArea->view(); @@ -454,7 +466,7 @@ void EditorManagerPrivate::init() m_autoSaveTimer = new QTimer(this); m_autoSaveTimer->setObjectName(QLatin1String("EditorManager::m_autoSaveTimer")); - connect(m_autoSaveTimer, SIGNAL(timeout()), SLOT(autoSave())); + connect(m_autoSaveTimer, &QTimer::timeout, this, &EditorManagerPrivate::autoSave); updateAutoSave(); d->m_openEditorsFactory = new OpenEditorsViewFactory(); @@ -1114,7 +1126,7 @@ IEditor *EditorManagerPrivate::createEditor(IEditorFactory *factory, const QStri IEditor *editor = factory->createEditor(); if (editor) { QTC_CHECK(editor->document()->id().isValid()); // sanity check that the editor has an id set - connect(editor->document(), SIGNAL(changed()), d, SLOT(handleDocumentStateChange())); + connect(editor->document(), &IDocument::changed, d, &EditorManagerPrivate::handleDocumentStateChange); emit m_instance->editorCreated(editor, fileName); } @@ -1420,7 +1432,7 @@ void EditorManagerPrivate::splitNewWindow(EditorView *view) auto win = new EditorWindow; EditorArea *area = win->editorArea(); d->m_editorAreas.append(area); - connect(area, SIGNAL(destroyed(QObject*)), d, SLOT(editorAreaDestroyed(QObject*))); + connect(area, &QObject::destroyed, d, &EditorManagerPrivate::editorAreaDestroyed); win->show(); ICore::raiseWindow(win); if (newEditor) @@ -1809,7 +1821,7 @@ void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context) // the locator line edit) first activates the window and sets focus to its focus widget. // Only afterwards the focus is shifted to the widget that received the click. d->m_scheduledCurrentEditor = editor; - QTimer::singleShot(0, d, SLOT(setCurrentEditorFromContextChange())); + QTimer::singleShot(0, d, &EditorManagerPrivate::setCurrentEditorFromContextChange); } else { updateActions(); } @@ -2028,16 +2040,6 @@ void EditorManagerPrivate::split(Qt::Orientation orientation) updateActions(); } -void EditorManagerPrivate::split() -{ - split(Qt::Vertical); -} - -void EditorManagerPrivate::splitNewWindow() -{ - splitNewWindow(currentEditorView()); -} - void EditorManagerPrivate::removeCurrentSplit() { EditorView *viewToClose = currentEditorView(); diff --git a/src/plugins/coreplugin/editormanager/editormanager_p.h b/src/plugins/coreplugin/editormanager/editormanager_p.h index 16c62ff9d7..96defc9ec5 100644 --- a/src/plugins/coreplugin/editormanager/editormanager_p.h +++ b/src/plugins/coreplugin/editormanager/editormanager_p.h @@ -136,12 +136,12 @@ public slots: static void gotoNextSplit(); void handleDocumentStateChange(); - static void editorAreaDestroyed(QObject *area); + void editorAreaDestroyed(QObject *area); signals: void placeholderTextChanged(const QString &text); -private slots: +private: static void gotoNextDocHistory(); static void gotoPreviousDocHistory(); @@ -164,13 +164,10 @@ private slots: static void openTerminal(); static void findInDirectory(); - static void split(); - static void splitNewWindow(); static void removeCurrentSplit(); static void setCurrentEditorFromContextChange(); -private: static OpenEditorsWindow *windowPopup(); static void showPopupOrSelectDocument(); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index f2442d225b..b495081688 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -74,15 +74,20 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) : tl->setSpacing(0); tl->setMargin(0); { - connect(m_toolBar, SIGNAL(goBackClicked()), this, SLOT(goBackInNavigationHistory())); - connect(m_toolBar, SIGNAL(goForwardClicked()), this, SLOT(goForwardInNavigationHistory())); - connect(m_toolBar, SIGNAL(closeClicked()), this, SLOT(closeCurrentEditor())); - connect(m_toolBar, SIGNAL(listSelectionActivated(int)), this, SLOT(listSelectionActivated(int))); - connect(m_toolBar, &EditorToolBar::currentDocumentMoved, this, &EditorView::closeCurrentEditor); - connect(m_toolBar, SIGNAL(horizontalSplitClicked()), this, SLOT(splitHorizontally())); - connect(m_toolBar, SIGNAL(verticalSplitClicked()), this, SLOT(splitVertically())); - connect(m_toolBar, SIGNAL(splitNewWindowClicked()), this, SLOT(splitNewWindow())); - connect(m_toolBar, SIGNAL(closeSplitClicked()), this, SLOT(closeSplit())); + connect(m_toolBar, &EditorToolBar::goBackClicked, + this, &EditorView::goBackInNavigationHistory); + connect(m_toolBar, &EditorToolBar::goForwardClicked, + this, &EditorView::goForwardInNavigationHistory); + connect(m_toolBar, &EditorToolBar::closeClicked, this, &EditorView::closeCurrentEditor); + connect(m_toolBar, &EditorToolBar::listSelectionActivated, + this, &EditorView::listSelectionActivated); + connect(m_toolBar, &EditorToolBar::currentDocumentMoved, + this, &EditorView::closeCurrentEditor); + connect(m_toolBar, &EditorToolBar::horizontalSplitClicked, + this, &EditorView::splitHorizontally); + connect(m_toolBar, &EditorToolBar::verticalSplitClicked, this, &EditorView::splitVertically); + connect(m_toolBar, &EditorToolBar::splitNewWindowClicked, this, &EditorView::splitNewWindow); + connect(m_toolBar, &EditorToolBar::closeSplitClicked, this, &EditorView::closeSplit); m_toolBar->setMenuProvider([this](QMenu *menu) { fillListContextMenu(menu); }); tl->addWidget(m_toolBar); } diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h index ce979555ed..831b84c3b1 100644 --- a/src/plugins/coreplugin/editormanager/editorview.h +++ b/src/plugins/coreplugin/editormanager/editorview.h @@ -111,7 +111,9 @@ protected: void mousePressEvent(QMouseEvent *e); void focusInEvent(QFocusEvent *); -private slots: +private: + friend class SplitterOrView; // for setParentSplitterOrView + void closeCurrentEditor(); void listSelectionActivated(int index); void splitHorizontally(); @@ -120,8 +122,6 @@ private slots: void closeSplit(); void openDroppedFiles(const QList<Utils::DropSupport::FileSpec> &files); -private: - friend class SplitterOrView; // for setParentSplitterOrView void setParentSplitterOrView(SplitterOrView *splitterOrView); void fillListContextMenu(QMenu *menu); diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.cpp b/src/plugins/coreplugin/editormanager/openeditorsview.cpp index a73cb2d6d3..8277e17e1b 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsview.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsview.cpp @@ -197,29 +197,29 @@ void ProxyModel::setSourceModel(QAbstractItemModel *sm) { QAbstractItemModel *previousModel = sourceModel(); if (previousModel) { - disconnect(previousModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(sourceDataChanged(QModelIndex,QModelIndex))); - disconnect(previousModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(sourceRowsInserted(QModelIndex,int,int))); - disconnect(previousModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(sourceRowsRemoved(QModelIndex,int,int))); - disconnect(previousModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), - this, SLOT(sourceRowsAboutToBeInserted(QModelIndex,int,int))); - disconnect(previousModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), - this, SLOT(sourceRowsAboutToBeRemoved(QModelIndex,int,int))); + disconnect(previousModel, &QAbstractItemModel::dataChanged, + this, &ProxyModel::sourceDataChanged); + disconnect(previousModel, &QAbstractItemModel::rowsInserted, + this, &ProxyModel::sourceRowsInserted); + disconnect(previousModel, &QAbstractItemModel::rowsRemoved, + this, &ProxyModel::sourceRowsRemoved); + disconnect(previousModel, &QAbstractItemModel::rowsAboutToBeInserted, + this, &ProxyModel::sourceRowsAboutToBeInserted); + disconnect(previousModel, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &ProxyModel::sourceRowsAboutToBeRemoved); } QAbstractProxyModel::setSourceModel(sm); if (sm) { - connect(sm, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(sourceDataChanged(QModelIndex,QModelIndex))); - connect(sm, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(sourceRowsInserted(QModelIndex,int,int))); - connect(sm, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(sourceRowsRemoved(QModelIndex,int,int))); - connect(sm, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), - this, SLOT(sourceRowsAboutToBeInserted(QModelIndex,int,int))); - connect(sm, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), - this, SLOT(sourceRowsAboutToBeRemoved(QModelIndex,int,int))); + connect(sm, &QAbstractItemModel::dataChanged, + this, &ProxyModel::sourceDataChanged); + connect(sm, &QAbstractItemModel::rowsInserted, + this, &ProxyModel::sourceRowsInserted); + connect(sm, &QAbstractItemModel::rowsRemoved, + this, &ProxyModel::sourceRowsRemoved); + connect(sm, &QAbstractItemModel::rowsAboutToBeInserted, + this, &ProxyModel::sourceRowsAboutToBeInserted); + connect(sm, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &ProxyModel::sourceRowsAboutToBeRemoved); } } diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.h b/src/plugins/coreplugin/editormanager/openeditorsview.h index 2a2f5202a4..fcca6b6e42 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsview.h +++ b/src/plugins/coreplugin/editormanager/openeditorsview.h @@ -56,7 +56,7 @@ public: // QAbstractProxyModel::supportedDragActions delegation is missing in Qt 5 Qt::DropActions supportedDragActions() const; -private slots: +private: void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void sourceRowsRemoved(const QModelIndex &parent, int start, int end); void sourceRowsInserted(const QModelIndex &parent, int start, int end); diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index 256c5a3f14..654f64bb96 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -70,8 +70,8 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) : layout->setMargin(0); layout->addWidget(m_editorList); - connect(m_editorList, SIGNAL(itemClicked(QTreeWidgetItem*,int)), - this, SLOT(editorClicked(QTreeWidgetItem*))); + connect(m_editorList, &QTreeWidget::itemClicked, + this, &OpenEditorsWindow::editorClicked); } void OpenEditorsWindow::selectAndHide() diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.h b/src/plugins/coreplugin/editormanager/openeditorswindow.h index 572081be10..93c1c07c34 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.h +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.h @@ -74,11 +74,10 @@ public: public slots: void selectAndHide(); -private slots: +private: void editorClicked(QTreeWidgetItem *item); void selectEditor(QTreeWidgetItem *item); -private: void addHistoryItems(const QList<EditLocation> &history, EditorView *view, QSet<IDocument*> &documentsDone); void addRestoredItems(); void ensureCurrentVisible(); diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index 20d6588746..26ad0b5d7c 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -135,8 +135,8 @@ EditorToolBar::EditorToolBar(QWidget *parent) : d->m_dragHandleMenu = new QMenu(d->m_dragHandle); d->m_dragHandle->setMenu(d->m_dragHandleMenu); - connect(d->m_goBackAction, SIGNAL(triggered()), this, SIGNAL(goBackClicked())); - connect(d->m_goForwardAction, SIGNAL(triggered()), this, SIGNAL(goForwardClicked())); + connect(d->m_goBackAction, &QAction::triggered, this, &EditorToolBar::goBackClicked); + connect(d->m_goForwardAction, &QAction::triggered, this, &EditorToolBar::goForwardClicked); d->m_editorList->setProperty("hideicon", true); d->m_editorList->setProperty("notelideasterisk", true); @@ -193,7 +193,8 @@ EditorToolBar::EditorToolBar(QWidget *parent) : // this signal is disconnected for standalone toolbars and replaced with // a private slot connection - connect(d->m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int))); + connect(d->m_editorList, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + this, &EditorToolBar::listSelectionActivated); connect(d->m_editorList, &QComboBox::customContextMenuRequested, [this](QPoint p) { QMenu menu; @@ -204,24 +205,25 @@ EditorToolBar::EditorToolBar(QWidget *parent) : d->m_dragHandleMenu->clear(); fillListContextMenu(d->m_dragHandleMenu); }); - connect(d->m_lockButton, SIGNAL(clicked()), this, SLOT(makeEditorWritable())); - connect(d->m_closeEditorButton, SIGNAL(clicked()), this, SLOT(closeEditor()), Qt::QueuedConnection); - connect(d->m_horizontalSplitAction, SIGNAL(triggered()), - this, SIGNAL(horizontalSplitClicked()), Qt::QueuedConnection); - connect(d->m_verticalSplitAction, SIGNAL(triggered()), - this, SIGNAL(verticalSplitClicked()), Qt::QueuedConnection); - connect(d->m_splitNewWindowAction, SIGNAL(triggered()), - this, SIGNAL(splitNewWindowClicked()), Qt::QueuedConnection); - connect(d->m_closeSplitButton, SIGNAL(clicked()), - this, SIGNAL(closeSplitClicked()), Qt::QueuedConnection); - - - connect(ActionManager::command(Constants::CLOSE), SIGNAL(keySequenceChanged()), - this, SLOT(updateActionShortcuts())); - connect(ActionManager::command(Constants::GO_BACK), SIGNAL(keySequenceChanged()), - this, SLOT(updateActionShortcuts())); - connect(ActionManager::command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()), - this, SLOT(updateActionShortcuts())); + connect(d->m_lockButton, &QAbstractButton::clicked, this, &EditorToolBar::makeEditorWritable); + connect(d->m_closeEditorButton, &QAbstractButton::clicked, + this, &EditorToolBar::closeEditor, Qt::QueuedConnection); + connect(d->m_horizontalSplitAction, &QAction::triggered, + this, &EditorToolBar::horizontalSplitClicked, Qt::QueuedConnection); + connect(d->m_verticalSplitAction, &QAction::triggered, + this, &EditorToolBar::verticalSplitClicked, Qt::QueuedConnection); + connect(d->m_splitNewWindowAction, &QAction::triggered, + this, &EditorToolBar::splitNewWindowClicked, Qt::QueuedConnection); + connect(d->m_closeSplitButton, &QAbstractButton::clicked, + this, &EditorToolBar::closeSplitClicked, Qt::QueuedConnection); + + + connect(ActionManager::command(Constants::CLOSE), &Command::keySequenceChanged, + this, &EditorToolBar::updateActionShortcuts); + connect(ActionManager::command(Constants::GO_BACK), &Command::keySequenceChanged, + this, &EditorToolBar::updateActionShortcuts); + connect(ActionManager::command(Constants::GO_FORWARD), &Command::keySequenceChanged, + this, &EditorToolBar::updateActionShortcuts); updateActionShortcuts(); } @@ -234,7 +236,7 @@ EditorToolBar::~EditorToolBar() void EditorToolBar::removeToolbarForEditor(IEditor *editor) { QTC_ASSERT(editor, return); - disconnect(editor->document(), SIGNAL(changed()), this, SLOT(checkDocumentStatus())); + disconnect(editor->document(), &IDocument::changed, this, &EditorToolBar::checkDocumentStatus); QWidget *toolBar = editor->toolBar(); if (toolBar != 0) { @@ -268,7 +270,7 @@ void EditorToolBar::closeEditor() void EditorToolBar::addEditor(IEditor *editor) { QTC_ASSERT(editor, return); - connect(editor->document(), SIGNAL(changed()), this, SLOT(checkDocumentStatus())); + connect(editor->document(), &IDocument::changed, this, &EditorToolBar::checkDocumentStatus); QWidget *toolBar = editor->toolBar(); if (toolBar && !d->m_isStandalone) @@ -304,8 +306,10 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags) connect(EditorManager::instance(), &EditorManager::currentEditorChanged, this, &EditorToolBar::updateEditorListSelection); - disconnect(d->m_editorList, SIGNAL(activated(int)), this, SIGNAL(listSelectionActivated(int))); - connect(d->m_editorList, SIGNAL(activated(int)), this, SLOT(changeActiveEditor(int))); + disconnect(d->m_editorList, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + this, &EditorToolBar::listSelectionActivated); + connect(d->m_editorList, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + this, &EditorToolBar::changeActiveEditor); d->m_splitButton->setVisible(false); d->m_closeSplitButton->setVisible(false); } diff --git a/src/plugins/coreplugin/editortoolbar.h b/src/plugins/coreplugin/editortoolbar.h index cd8f8ecf1b..e395b4c392 100644 --- a/src/plugins/coreplugin/editortoolbar.h +++ b/src/plugins/coreplugin/editortoolbar.h @@ -97,7 +97,7 @@ signals: protected: bool eventFilter(QObject *obj, QEvent *event); -private slots: +private: void changeActiveEditor(int row); void makeEditorWritable(); @@ -105,7 +105,6 @@ private slots: void closeEditor(); void updateActionShortcuts(); -private: void updateDocumentStatus(IDocument *document); void updateEditorListSelection(IEditor *newSelection); void fillListContextMenu(QMenu *menu); diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index 48941ee5d0..0f309182c1 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -623,11 +623,15 @@ void ExternalToolRunner::run() } } m_process = new QtcProcess(this); - connect(m_process, SIGNAL(started()), this, SLOT(started())); - connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus))); - connect(m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError))); - connect(m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); - connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); + connect(m_process, &QProcess::started, this, &ExternalToolRunner::started); + connect(m_process, static_cast<void (QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), + this, &ExternalToolRunner::finished); + connect(m_process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), + this, &ExternalToolRunner::error); + connect(m_process, &QProcess::readyReadStandardOutput, + this, &ExternalToolRunner::readStandardOutput); + connect(m_process, &QProcess::readyReadStandardError, + this, &ExternalToolRunner::readStandardError); if (!m_resolvedWorkingDirectory.isEmpty()) m_process->setWorkingDirectory(m_resolvedWorkingDirectory); m_process->setCommand(m_resolvedExecutable.toString(), m_resolvedArguments); diff --git a/src/plugins/coreplugin/externaltool.h b/src/plugins/coreplugin/externaltool.h index 61626085f5..eafd198f42 100644 --- a/src/plugins/coreplugin/externaltool.h +++ b/src/plugins/coreplugin/externaltool.h @@ -129,14 +129,13 @@ public: bool hasError() const; QString errorString() const; -private slots: +private: void started(); void finished(int exitCode, QProcess::ExitStatus status); void error(QProcess::ProcessError error); void readStandardOutput(); void readStandardError(); -private: void run(); bool resolve(); diff --git a/src/plugins/coreplugin/fancyactionbar.h b/src/plugins/coreplugin/fancyactionbar.h index 773a83a95c..590694186b 100644 --- a/src/plugins/coreplugin/fancyactionbar.h +++ b/src/plugins/coreplugin/fancyactionbar.h @@ -55,7 +55,7 @@ public: static void hoverOverlay(QPainter *painter, const QRect &spanRect); -private slots: +private: void actionChanged(); }; diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index 28e4660be0..75b8e69adb 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -87,7 +87,7 @@ FancyTabBar::FancyTabBar(QWidget *parent) m_triggerTimer.setSingleShot(true); // We use a zerotimer to keep the sidebar responsive - connect(&m_triggerTimer, SIGNAL(timeout()), this, SLOT(emitCurrentIndex())); + connect(&m_triggerTimer, &QTimer::timeout, this, &FancyTabBar::emitCurrentIndex); } FancyTabBar::~FancyTabBar() @@ -468,7 +468,7 @@ FancyTabWidget::FancyTabWidget(QWidget *parent) mainLayout->addLayout(vlayout); setLayout(mainLayout); - connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(showWidget(int))); + connect(m_tabBar, &FancyTabBar::currentChanged, this, &FancyTabWidget::showWidget); } void FancyTabWidget::setSelectionWidgetVisible(bool visible) diff --git a/src/plugins/coreplugin/fancytabwidget.h b/src/plugins/coreplugin/fancytabwidget.h index 0331dc7a77..cb14adf4af 100644 --- a/src/plugins/coreplugin/fancytabwidget.h +++ b/src/plugins/coreplugin/fancytabwidget.h @@ -167,10 +167,9 @@ public slots: void setCurrentIndex(int index); void setSelectionWidgetVisible(bool visible); -private slots: +private: void showWidget(int index); -private: FancyTabBar *m_tabBar; QWidget *m_cornerWidgetContainer; QStackedLayout *m_modesStack; diff --git a/src/plugins/coreplugin/find/currentdocumentfind.cpp b/src/plugins/coreplugin/find/currentdocumentfind.cpp index 71534edded..eca3527bac 100644 --- a/src/plugins/coreplugin/find/currentdocumentfind.cpp +++ b/src/plugins/coreplugin/find/currentdocumentfind.cpp @@ -164,13 +164,13 @@ void CurrentDocumentFind::updateCandidateFindFilter(QWidget *old, QWidget *now) if (candidate == m_candidateWidget && impl == m_candidateFind) return; if (m_candidateWidget) - disconnect(Aggregation::Aggregate::parentAggregate(m_candidateWidget), SIGNAL(changed()), - this, SLOT(candidateAggregationChanged())); + disconnect(Aggregation::Aggregate::parentAggregate(m_candidateWidget), &Aggregation::Aggregate::changed, + this, &CurrentDocumentFind::candidateAggregationChanged); m_candidateWidget = candidate; m_candidateFind = impl; if (m_candidateWidget) - connect(Aggregation::Aggregate::parentAggregate(m_candidateWidget), SIGNAL(changed()), - this, SLOT(candidateAggregationChanged())); + connect(Aggregation::Aggregate::parentAggregate(m_candidateWidget), &Aggregation::Aggregate::changed, + this, &CurrentDocumentFind::candidateAggregationChanged); emit candidateChanged(); } @@ -183,17 +183,17 @@ void CurrentDocumentFind::acceptCandidate() m_currentFind->clearHighlights(); if (m_currentWidget) - disconnect(Aggregation::Aggregate::parentAggregate(m_currentWidget), SIGNAL(changed()), - this, SLOT(aggregationChanged())); + disconnect(Aggregation::Aggregate::parentAggregate(m_currentWidget), &Aggregation::Aggregate::changed, + this, &CurrentDocumentFind::aggregationChanged); m_currentWidget = m_candidateWidget; - connect(Aggregation::Aggregate::parentAggregate(m_currentWidget), SIGNAL(changed()), - this, SLOT(aggregationChanged())); + connect(Aggregation::Aggregate::parentAggregate(m_currentWidget), &Aggregation::Aggregate::changed, + this, &CurrentDocumentFind::aggregationChanged); m_currentFind = m_candidateFind; if (m_currentFind) { connect(m_currentFind.data(), &IFindSupport::changed, this, &CurrentDocumentFind::changed); - connect(m_currentFind, SIGNAL(destroyed(QObject*)), SLOT(clearFindSupport())); + connect(m_currentFind.data(), &QObject::destroyed, this, &CurrentDocumentFind::clearFindSupport); } if (m_currentWidget) m_currentWidget->installEventFilter(this); diff --git a/src/plugins/coreplugin/find/currentdocumentfind.h b/src/plugins/coreplugin/find/currentdocumentfind.h index a9c6289f5f..613eab7adc 100644 --- a/src/plugins/coreplugin/find/currentdocumentfind.h +++ b/src/plugins/coreplugin/find/currentdocumentfind.h @@ -68,13 +68,11 @@ signals: void changed(); void candidateChanged(); -private slots: +private: void updateCandidateFindFilter(QWidget *old, QWidget *now); void clearFindSupport(); void aggregationChanged(); void candidateAggregationChanged(); - -private: void removeFindSupportConnections(); QPointer<IFindSupport> m_currentFind; diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp index 900108d743..247ffb7d9c 100644 --- a/src/plugins/coreplugin/find/findplugin.cpp +++ b/src/plugins/coreplugin/find/findplugin.cpp @@ -138,7 +138,7 @@ void FindPlugin::initialize(const QStringList &, QString *) d->m_findDialog = new Internal::FindToolWindow(this); d->m_searchResultWindow = new SearchResultWindow(d->m_findDialog); ExtensionSystem::PluginManager::addObject(d->m_searchResultWindow); - connect(ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(writeSettings())); + connect(ICore::instance(), &ICore::saveSettingsRequested, this, &FindPlugin::writeSettings); } void FindPlugin::extensionsInitialized() diff --git a/src/plugins/coreplugin/find/findplugin.h b/src/plugins/coreplugin/find/findplugin.h index bd95b9735e..1399c48170 100644 --- a/src/plugins/coreplugin/find/findplugin.h +++ b/src/plugins/coreplugin/find/findplugin.h @@ -83,13 +83,11 @@ public slots: signals: void findFlagsChanged(); -private slots: +private: void filterChanged(); void displayNameChanged(); void openFindFilter(); void writeSettings(); - -private: void setFindFlag(Core::FindFlag flag, bool enabled); void updateCompletion(const QString &text, QStringList &completions, QStringListModel *model); void setupMenu(); diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp index 51a03f7986..33e87ebe4a 100644 --- a/src/plugins/coreplugin/find/findtoolbar.cpp +++ b/src/plugins/coreplugin/find/findtoolbar.cpp @@ -173,7 +173,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen cmd = ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT); cmd->setDefaultKeySequence(QKeySequence::Find); mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT); - connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind())); + connect(m_findInDocumentAction, &QAction::triggered, this, [this]() { openFind(); }); // Pressing the find shortcut while focus is in the tool bar should not change the search text, // so register a different find action for the tool bar @@ -188,8 +188,9 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen cmd = ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString"); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+E"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_enterFindStringAction, &QAction::triggered, this, &FindToolBar::putSelectionToFindClipboard); - connect(QApplication::clipboard(), SIGNAL(findBufferChanged()), this, SLOT(updateFromFindClipboard())); + connect(m_enterFindStringAction, &QAction::triggered, + this, &FindToolBar::putSelectionToFindClipboard); + connect(QApplication::clipboard(), &QClipboard::findBufferChanged, this, &FindToolBar::updateFromFindClipboard); } m_findNextAction = new QAction(tr("Find Next"), this); @@ -224,7 +225,8 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen cmd = ActionManager::registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F3"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_findPreviousSelectedAction, &QAction::triggered, this, &FindToolBar::findPreviousSelected); + connect(m_findPreviousSelectedAction, &QAction::triggered, + this, &FindToolBar::findPreviousSelected); m_replaceAction = new QAction(tr("Replace"), this); cmd = ActionManager::registerAction(m_replaceAction, Constants::REPLACE); @@ -252,11 +254,13 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this); cmd = ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - connect(m_replacePreviousAction, &QAction::triggered, this, &FindToolBar::invokeGlobalReplacePrevious); + connect(m_replacePreviousAction, &QAction::triggered, + this, &FindToolBar::invokeGlobalReplacePrevious); m_localReplacePreviousAction = new QAction(m_replacePreviousAction->text(), this); cmd = ActionManager::registerAction(m_localReplacePreviousAction, Constants::REPLACE_PREVIOUS, findcontext); cmd->augmentActionWithShortcutToolTip(m_localReplacePreviousAction); - connect(m_localReplacePreviousAction, &QAction::triggered, this, &FindToolBar::invokeReplacePrevious); + connect(m_localReplacePreviousAction, &QAction::triggered, + this, &FindToolBar::invokeReplacePrevious); m_replaceAllAction = new QAction(tr("Replace All"), this); cmd = ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL); @@ -300,8 +304,10 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_preserveCaseAction, &QAction::toggled, this, &FindToolBar::setPreserveCase); - connect(m_currentDocumentFind, &CurrentDocumentFind::candidateChanged, this, &FindToolBar::adaptToCandidate); - connect(m_currentDocumentFind, &CurrentDocumentFind::changed, this, &FindToolBar::updateGlobalActions); + connect(m_currentDocumentFind, &CurrentDocumentFind::candidateChanged, + this, &FindToolBar::adaptToCandidate); + connect(m_currentDocumentFind, &CurrentDocumentFind::changed, + this, &FindToolBar::updateGlobalActions); connect(m_currentDocumentFind, &CurrentDocumentFind::changed, this, &FindToolBar::updateToolBar); updateGlobalActions(); updateToolBar(); @@ -868,7 +874,7 @@ bool FindToolBar::focusNextPrevChild(bool next) void FindToolBar::resizeEvent(QResizeEvent *event) { Q_UNUSED(event) - QTimer::singleShot(0, this, SLOT(updateToolBar())); + QTimer::singleShot(0, this, &FindToolBar::updateToolBar); } void FindToolBar::writeSettings() diff --git a/src/plugins/coreplugin/find/findtoolbar.h b/src/plugins/coreplugin/find/findtoolbar.h index 6076c24212..7c94721137 100644 --- a/src/plugins/coreplugin/find/findtoolbar.h +++ b/src/plugins/coreplugin/find/findtoolbar.h @@ -56,10 +56,9 @@ protected: bool event(QEvent *ev); bool eventFilter(QObject *obj, QEvent *ev); -private slots: +private: void actionChanged(); -private: QCheckBox *createCheckboxForCommand(Id id); QMap<QAction *, QCheckBox *> m_checkboxMap; @@ -89,10 +88,15 @@ public: void setUseFakeVim(bool on); void setLightColoredIcon(bool lightColored); + public slots: void setBackward(bool backward); -private slots: +protected: + bool focusNextPrevChild(bool next); + void resizeEvent(QResizeEvent *event); + +private: void invokeFindNext(); void invokeGlobalFindNext(); void invokeFindPrevious(); @@ -133,11 +137,6 @@ private slots: void setFocusToCurrentFindSupport(); -protected: - bool focusNextPrevChild(bool next); - void resizeEvent(QResizeEvent *event); - -private: void installEventFilters(); void invokeClearResults(); void setFindFlag(FindFlag flag, bool enabled); diff --git a/src/plugins/coreplugin/find/findtoolwindow.cpp b/src/plugins/coreplugin/find/findtoolwindow.cpp index 649eaf522e..13cca28e05 100644 --- a/src/plugins/coreplugin/find/findtoolwindow.cpp +++ b/src/plugins/coreplugin/find/findtoolwindow.cpp @@ -55,13 +55,14 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin, QWidget *parent) m_ui.searchTerm->setPlaceholderText(QString()); setFocusProxy(m_ui.searchTerm); - connect(m_ui.searchButton, SIGNAL(clicked()), this, SLOT(search())); - connect(m_ui.replaceButton, SIGNAL(clicked()), this, SLOT(replace())); - connect(m_ui.matchCase, SIGNAL(toggled(bool)), m_plugin, SLOT(setCaseSensitive(bool))); - connect(m_ui.wholeWords, SIGNAL(toggled(bool)), m_plugin, SLOT(setWholeWord(bool))); - connect(m_ui.regExp, SIGNAL(toggled(bool)), m_plugin, SLOT(setRegularExpression(bool))); - connect(m_ui.filterList, SIGNAL(activated(int)), this, SLOT(setCurrentFilter(int))); - connect(m_ui.searchTerm, SIGNAL(textChanged(QString)), this, SLOT(updateButtonStates())); + connect(m_ui.searchButton, &QAbstractButton::clicked, this, &FindToolWindow::search); + connect(m_ui.replaceButton, &QAbstractButton::clicked, this, &FindToolWindow::replace); + connect(m_ui.matchCase, &QAbstractButton::toggled, m_plugin, &FindPlugin::setCaseSensitive); + connect(m_ui.wholeWords, &QAbstractButton::toggled, m_plugin, &FindPlugin::setWholeWord); + connect(m_ui.regExp, &QAbstractButton::toggled, m_plugin, &FindPlugin::setRegularExpression); + connect(m_ui.filterList, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), + this, static_cast<void (FindToolWindow::*)(int)>(&FindToolWindow::setCurrentFilter)); + connect(m_ui.searchTerm, &QLineEdit::textChanged, this, &FindToolWindow::updateButtonStates); m_findCompleter->setModel(m_plugin->findCompletionModel()); m_ui.searchTerm->setSpecialCompleter(m_findCompleter); @@ -72,7 +73,7 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin, QWidget *parent) m_ui.configWidget->setLayout(layout); updateButtonStates(); - connect(m_plugin, SIGNAL(findFlagsChanged()), this, SLOT(updateFindFlags())); + connect(m_plugin, &FindPlugin::findFlagsChanged, this, &FindToolWindow::updateFindFlags); } FindToolWindow::~FindToolWindow() @@ -190,9 +191,11 @@ void FindToolWindow::setCurrentFilter(int index) if (i == index) { m_configWidget = configWidget; if (m_currentFilter) - disconnect(m_currentFilter, SIGNAL(enabledChanged(bool)), this, SLOT(updateButtonStates())); + disconnect(m_currentFilter, &IFindFilter::enabledChanged, + this, &FindToolWindow::updateButtonStates); m_currentFilter = m_filters.at(i); - connect(m_currentFilter, SIGNAL(enabledChanged(bool)), this, SLOT(updateButtonStates())); + connect(m_currentFilter, &IFindFilter::enabledChanged, + this, &FindToolWindow::updateButtonStates); updateButtonStates(); if (m_configWidget) m_ui.configWidget->layout()->addWidget(m_configWidget); diff --git a/src/plugins/coreplugin/find/findtoolwindow.h b/src/plugins/coreplugin/find/findtoolwindow.h index 3e7cc4c411..3c27210b7b 100644 --- a/src/plugins/coreplugin/find/findtoolwindow.h +++ b/src/plugins/coreplugin/find/findtoolwindow.h @@ -59,14 +59,13 @@ protected: bool event(QEvent *event); bool eventFilter(QObject *obj, QEvent *event); -private slots: +private: void search(); void replace(); void setCurrentFilter(int index); void updateButtonStates(); void updateFindFlags(); -private: void acceptAndGetParameters(QString *term, IFindFilter **filter); Ui::FindDialog m_ui; diff --git a/src/plugins/coreplugin/find/searchresultwidget.cpp b/src/plugins/coreplugin/find/searchresultwidget.cpp index 62a141300d..b2dba922f7 100644 --- a/src/plugins/coreplugin/find/searchresultwidget.cpp +++ b/src/plugins/coreplugin/find/searchresultwidget.cpp @@ -163,13 +163,13 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) : m_cancelButton = new QToolButton(topFindWidget); m_cancelButton->setText(tr("Cancel")); m_cancelButton->setToolButtonStyle(Qt::ToolButtonTextOnly); - connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); + connect(m_cancelButton, &QAbstractButton::clicked, this, &SearchResultWidget::cancel); m_searchAgainButton = new QToolButton(topFindWidget); m_searchAgainButton->setToolTip(tr("Repeat the search with same parameters.")); m_searchAgainButton->setText(tr("Search again")); m_searchAgainButton->setToolButtonStyle(Qt::ToolButtonTextOnly); m_searchAgainButton->setVisible(false); - connect(m_searchAgainButton, SIGNAL(clicked()), this, SLOT(searchAgain())); + connect(m_searchAgainButton, &QAbstractButton::clicked, this, &SearchResultWidget::searchAgain); m_replaceLabel = new QLabel(tr("Replace with:"), m_topReplaceWidget); m_replaceTextEdit = new WideEnoughLineEdit(m_topReplaceWidget); @@ -187,7 +187,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) : if (FindPlugin * plugin = FindPlugin::instance()) { m_preserveCaseCheck->setChecked(plugin->hasFindFlag(FindPreserveCase)); - connect(m_preserveCaseCheck, SIGNAL(clicked(bool)), plugin, SLOT(setPreserveCase(bool))); + connect(m_preserveCaseCheck, &QAbstractButton::clicked, plugin, &FindPlugin::setPreserveCase); } m_matchesFoundLabel = new QLabel(topFindWidget); @@ -206,10 +206,12 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) : setShowReplaceUI(m_replaceSupported); setSupportPreserveCase(true); - connect(m_searchResultTreeView, SIGNAL(jumpToSearchResult(SearchResultItem)), - this, SLOT(handleJumpToSearchResult(SearchResultItem))); - connect(m_replaceTextEdit, SIGNAL(returnPressed()), this, SLOT(handleReplaceButton())); - connect(m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton())); + connect(m_searchResultTreeView, &SearchResultTreeView::jumpToSearchResult, + this, &SearchResultWidget::handleJumpToSearchResult); + connect(m_replaceTextEdit, &QLineEdit::returnPressed, + this, &SearchResultWidget::handleReplaceButton); + connect(m_replaceButton, &QAbstractButton::clicked, + this, &SearchResultWidget::handleReplaceButton); } SearchResultWidget::~SearchResultWidget() diff --git a/src/plugins/coreplugin/find/searchresultwidget.h b/src/plugins/coreplugin/find/searchresultwidget.h index 38f6b0a06e..2a671b1dee 100644 --- a/src/plugins/coreplugin/find/searchresultwidget.h +++ b/src/plugins/coreplugin/find/searchresultwidget.h @@ -104,13 +104,12 @@ signals: void navigateStateChanged(); -private slots: +private: void handleJumpToSearchResult(const SearchResultItem &item); void handleReplaceButton(); void cancel(); void searchAgain(); -private: void setShowReplaceUI(bool visible); void continueAfterSizeWarning(); void cancelAfterSizeWarning(); diff --git a/src/plugins/coreplugin/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp index aee3d2b55c..0031e5466a 100644 --- a/src/plugins/coreplugin/find/searchresultwindow.cpp +++ b/src/plugins/coreplugin/find/searchresultwindow.cpp @@ -141,8 +141,8 @@ namespace Internal { cmd->setAttribute(Command::CA_UpdateText); m_expandCollapseButton->setDefaultAction(cmd->action()); - connect(m_expandCollapseAction, &QAction::toggled, this, - &SearchResultWindowPrivate::handleExpandCollapseToolButton); + connect(m_expandCollapseAction, &QAction::toggled, + this, &SearchResultWindowPrivate::handleExpandCollapseToolButton); } diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 0734d298bf..996d3f5b0f 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -103,10 +103,10 @@ QWidget *GeneralSettings::widget() m_page->colorButton->setColor(StyleHelper::requestedBaseColor()); m_page->resetWarningsButton->setEnabled(canResetWarnings()); - connect(m_page->resetColorButton, SIGNAL(clicked()), - this, SLOT(resetInterfaceColor())); - connect(m_page->resetWarningsButton, SIGNAL(clicked()), - this, SLOT(resetWarnings())); + connect(m_page->resetColorButton, &QAbstractButton::clicked, + this, &GeneralSettings::resetInterfaceColor); + connect(m_page->resetWarningsButton, &QAbstractButton::clicked, + this, &GeneralSettings::resetWarnings); } return m_widget; } diff --git a/src/plugins/coreplugin/generalsettings.h b/src/plugins/coreplugin/generalsettings.h index 4c2d1db73c..5fbcaab636 100644 --- a/src/plugins/coreplugin/generalsettings.h +++ b/src/plugins/coreplugin/generalsettings.h @@ -49,12 +49,11 @@ public: void apply(); void finish(); -private slots: +private: void resetInterfaceColor(); void resetWarnings(); void resetLanguage(); -private: bool canResetWarnings() const; void fillLanguageBox() const; QString language() const; diff --git a/src/plugins/coreplugin/helpmanager.cpp b/src/plugins/coreplugin/helpmanager.cpp index 72f0e77eff..4cb07ed2bd 100644 --- a/src/plugins/coreplugin/helpmanager.cpp +++ b/src/plugins/coreplugin/helpmanager.cpp @@ -365,7 +365,7 @@ void HelpManager::addUserDefinedFilter(const QString &filter, const QStringList emit m_instance->collectionFileChanged(); } -// -- private slots +// -- private void HelpManager::setupHelpManager() { @@ -403,8 +403,6 @@ void HelpManager::setupHelpManager() emit m_instance->setupFinished(); } -// -- private - void HelpManagerPrivate::cleanUpDocumentation() { // mark documentation for removal for which there is no documentation file anymore diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 1510fca30c..5278a1e19e 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -315,14 +315,14 @@ ICore::ICore(MainWindow *mainwindow) m_instance = this; m_mainwindow = mainwindow; // Save settings once after all plugins are initialized: - connect(PluginManager::instance(), SIGNAL(initializationDone()), - this, SLOT(saveSettings())); + connect(PluginManager::instance(), &PluginManager::initializationDone, + this, &ICore::saveSettings); connect(PluginManager::instance(), &PluginManager::testsFinished, [this] (int failedTests) { emit coreAboutToClose(); QCoreApplication::exit(failedTests); }); - connect(m_mainwindow, SIGNAL(newItemDialogRunningChanged()), - this, SIGNAL(newItemDialogRunningChanged())); + connect(m_mainwindow, &MainWindow::newItemDialogRunningChanged, + this, &ICore::newItemDialogRunningChanged); } ICore::~ICore() diff --git a/src/plugins/coreplugin/infobar.cpp b/src/plugins/coreplugin/infobar.cpp index 32c14b7b3d..ec7cf9b366 100644 --- a/src/plugins/coreplugin/infobar.cpp +++ b/src/plugins/coreplugin/infobar.cpp @@ -172,8 +172,8 @@ void InfoBarDisplay::setInfoBar(InfoBar *infoBar) m_infoBar->disconnect(this); m_infoBar = infoBar; if (m_infoBar) { - connect(m_infoBar, SIGNAL(changed()), SLOT(update())); - connect(m_infoBar, SIGNAL(destroyed()), SLOT(infoBarDestroyed())); + connect(m_infoBar, &InfoBar::changed, this, &InfoBarDisplay::update); + connect(m_infoBar, &QObject::destroyed, this, &InfoBarDisplay::infoBarDestroyed); } update(); } @@ -258,7 +258,7 @@ void InfoBarDisplay::update() hbox->addWidget(infoWidgetSuppressButton); } - connect(infoWidget, SIGNAL(destroyed()), SLOT(widgetDestroyed())); + connect(infoWidget, &QObject::destroyed, this, &InfoBarDisplay::widgetDestroyed); m_boxLayout->insertWidget(m_boxIndex, infoWidget); m_infoWidgets << infoWidget; } diff --git a/src/plugins/coreplugin/infobar.h b/src/plugins/coreplugin/infobar.h index 01415ea096..e096e0e9db 100644 --- a/src/plugins/coreplugin/infobar.h +++ b/src/plugins/coreplugin/infobar.h @@ -108,12 +108,11 @@ public: void setTarget(QBoxLayout *layout, int index); void setInfoBar(InfoBar *infoBar); -private slots: +private: void update(); void infoBarDestroyed(); void widgetDestroyed(); -private: QList<QWidget *> m_infoWidgets; InfoBar *m_infoBar; QBoxLayout *m_boxLayout; diff --git a/src/plugins/coreplugin/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index 1bd38fd461..99dec707bd 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -159,7 +159,7 @@ QList<LocatorFilterEntry> BaseFileFilter::matchesFor(QFutureInterface<LocatorFil d->m_current.clear(); // free memory } else { d->m_current.iterator.clear(); - QTimer::singleShot(0, this, SLOT(updatePreviousResultData())); + QTimer::singleShot(0, this, &BaseFileFilter::updatePreviousResultData); } return betterEntries; } diff --git a/src/plugins/coreplugin/locator/basefilefilter.h b/src/plugins/coreplugin/locator/basefilefilter.h index a2ebbb7041..b472aadce4 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.h +++ b/src/plugins/coreplugin/locator/basefilefilter.h @@ -78,10 +78,9 @@ protected: void setFileIterator(Iterator *iterator); QSharedPointer<Iterator> fileIterator(); -private slots: +private: void updatePreviousResultData(); -private: Internal::BaseFileFilterPrivate *d; }; diff --git a/src/plugins/coreplugin/locator/directoryfilter.cpp b/src/plugins/coreplugin/locator/directoryfilter.cpp index 66613c87dc..79298fb874 100644 --- a/src/plugins/coreplugin/locator/directoryfilter.cpp +++ b/src/plugins/coreplugin/locator/directoryfilter.cpp @@ -183,7 +183,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future) QMutexLocker locker(&m_lock); if (m_directories.count() < 1) { m_files.clear(); - QTimer::singleShot(0, this, SLOT(updateFileIterator())); + QTimer::singleShot(0, this, &DirectoryFilter::updateFileIterator); future.setProgressRange(0, 1); future.setProgressValueAndText(1, tr("%1 filter update: 0 files").arg(displayName())); return; @@ -208,7 +208,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future) if (!future.isCanceled()) { QMutexLocker locker(&m_lock); m_files = filesFound; - QTimer::singleShot(0, this, SLOT(updateFileIterator())); + QTimer::singleShot(0, this, &DirectoryFilter::updateFileIterator); future.setProgressValue(subDirIterator.maxProgress()); } else { future.setProgressValueAndText(subDirIterator.currentProgress(), tr("%1 filter update: canceled").arg(displayName())); diff --git a/src/plugins/coreplugin/locator/directoryfilter.h b/src/plugins/coreplugin/locator/directoryfilter.h index 0aaf037073..ae9dfdb3fd 100644 --- a/src/plugins/coreplugin/locator/directoryfilter.h +++ b/src/plugins/coreplugin/locator/directoryfilter.h @@ -48,14 +48,13 @@ public: bool openConfigDialog(QWidget *parent, bool &needsRefresh); void refresh(QFutureInterface<void> &future); -private slots: +private: void addDirectory(); void editDirectory(); void removeDirectory(); void updateOptionButtons(); void updateFileIterator(); -private: QStringList m_directories; QStringList m_filters; // Our config dialog, uses in addDirectory and editDirectory diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp index ef76064fee..ce0636fe6b 100644 --- a/src/plugins/coreplugin/locator/executefilter.cpp +++ b/src/plugins/coreplugin/locator/executefilter.cpp @@ -44,13 +44,13 @@ ExecuteFilter::ExecuteFilter() m_process = new Utils::QtcProcess(this); m_process->setEnvironment(Utils::Environment::systemEnvironment()); - connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, - SLOT(finished(int,QProcess::ExitStatus))); - connect(m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandardOutput())); - connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); + connect(m_process, static_cast<void (QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), + this, &ExecuteFilter::finished); + connect(m_process, &QProcess::readyReadStandardOutput, this, &ExecuteFilter::readStandardOutput); + connect(m_process, &QProcess::readyReadStandardError, this, &ExecuteFilter::readStandardError); m_runTimer.setSingleShot(true); - connect(&m_runTimer, SIGNAL(timeout()), this, SLOT(runHeadCommand())); + connect(&m_runTimer, &QTimer::timeout, this, &ExecuteFilter::runHeadCommand); } QList<LocatorFilterEntry> ExecuteFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &future, diff --git a/src/plugins/coreplugin/locator/executefilter.h b/src/plugins/coreplugin/locator/executefilter.h index 07b2a11b61..988bb9b44c 100644 --- a/src/plugins/coreplugin/locator/executefilter.h +++ b/src/plugins/coreplugin/locator/executefilter.h @@ -55,16 +55,14 @@ public: void accept(LocatorFilterEntry selection) const; void refresh(QFutureInterface<void> &) {} -private slots: +private: void finished(int exitCode, QProcess::ExitStatus status); void readStandardOutput(); void readStandardError(); void runHeadCommand(); -private: QString headCommand() const; -private: QQueue<ExecuteData> m_taskQueue; QStringList m_commandHistory; Utils::QtcProcess *m_process; diff --git a/src/plugins/coreplugin/locator/locator.cpp b/src/plugins/coreplugin/locator/locator.cpp index aaf69e4611..04ec66bb2e 100644 --- a/src/plugins/coreplugin/locator/locator.cpp +++ b/src/plugins/coreplugin/locator/locator.cpp @@ -66,7 +66,7 @@ Locator::Locator() { m_corePlugin = 0; m_refreshTimer.setSingleShot(false); - connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); + connect(&m_refreshTimer, &QTimer::timeout, this, [this]() { refresh(); }); } Locator::~Locator() @@ -103,7 +103,8 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) Command *cmd = ActionManager::registerAction(action, Constants::LOCATE); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); connect(action, &QAction::triggered, this, &Locator::openLocator); - connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); + connect(cmd, &Command::keySequenceChanged, + this, [this, cmd]() { updatePlaceholderText(cmd); }); updatePlaceholderText(cmd); ActionContainer *mtools = ActionManager::actionContainer(Constants::M_TOOLS); @@ -128,13 +129,11 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) m_corePlugin->addAutoReleasedObject(new SpotlightLocatorFilter); #endif - connect(ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings())); + connect(ICore::instance(), &ICore::saveSettingsRequested, this, &Locator::saveSettings); } void Locator::updatePlaceholderText(Command *command) { - if (!command) - command = qobject_cast<Command *>(sender()); QTC_ASSERT(command, return); if (command->keySequence().isEmpty()) m_locatorWidget->setPlaceholderText(tr("Type to locate")); diff --git a/src/plugins/coreplugin/locator/locator.h b/src/plugins/coreplugin/locator/locator.h index e84e54c34e..c47dd2dc13 100644 --- a/src/plugins/coreplugin/locator/locator.h +++ b/src/plugins/coreplugin/locator/locator.h @@ -71,10 +71,8 @@ public slots: void saveSettings(); void openLocator(); -private slots: - void updatePlaceholderText(Core::Command *command = 0); - private: + void updatePlaceholderText(Core::Command *command); void loadSettings(); void updateEditorManagerPlaceholderText(); diff --git a/src/plugins/coreplugin/locator/locatorsettingspage.h b/src/plugins/coreplugin/locator/locatorsettingspage.h index 9169c5009d..e1648d9ad7 100644 --- a/src/plugins/coreplugin/locator/locatorsettingspage.h +++ b/src/plugins/coreplugin/locator/locatorsettingspage.h @@ -64,13 +64,11 @@ public: void apply(); void finish(); -private slots: +private: void updateButtonStates(); void configureFilter(const QModelIndex &proxyIndex); void addCustomFilter(); void removeCustomFilter(); - -private: void initializeModel(); void saveFilterStates(); void restoreFilterStates(); diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index 3ed9afcb9d..d5462459e5 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -271,12 +271,13 @@ LocatorWidget::LocatorWidget(Locator *qop) : m_fileLineEdit->setButtonMenu(Utils::FancyLineEdit::Left, m_filterMenu); - connect(m_refreshAction, SIGNAL(triggered()), m_locatorPlugin, SLOT(refresh())); - connect(m_configureAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog())); - connect(m_fileLineEdit, SIGNAL(textChanged(QString)), - this, SLOT(showPopup())); - connect(m_completionList, SIGNAL(activated(QModelIndex)), - this, SLOT(scheduleAcceptCurrentEntry())); + connect(m_refreshAction, &QAction::triggered, + m_locatorPlugin, [this]() { m_locatorPlugin->refresh(); }); + connect(m_configureAction, &QAction::triggered, this, &LocatorWidget::showConfigureDialog); + connect(m_fileLineEdit, &QLineEdit::textChanged, + this, &LocatorWidget::showPopup); + connect(m_completionList, &QAbstractItemView::activated, + this, &LocatorWidget::scheduleAcceptCurrentEntry); m_entriesWatcher = new QFutureWatcher<LocatorFilterEntry>(this); connect(m_entriesWatcher, &QFutureWatcher<LocatorFilterEntry>::resultsReadyAt, @@ -286,7 +287,7 @@ LocatorWidget::LocatorWidget(Locator *qop) : m_showPopupTimer.setInterval(100); m_showPopupTimer.setSingleShot(true); - connect(&m_showPopupTimer, SIGNAL(timeout()), SLOT(showPopupNow())); + connect(&m_showPopupTimer, &QTimer::timeout, this, &LocatorWidget::showPopupNow); m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicator::Small, m_fileLineEdit); @@ -324,7 +325,7 @@ void LocatorWidget::updateFilterList() action = new QAction(filter->displayName(), this); cmd = ActionManager::registerAction(action, locatorId); cmd->setAttribute(Command::CA_UpdateText); - connect(action, SIGNAL(triggered()), this, SLOT(filterSelected())); + connect(action, &QAction::triggered, this, &LocatorWidget::filterSelected); action->setData(qVariantFromValue(filter)); } else { action = actionCopy.take(filterId); @@ -415,7 +416,7 @@ bool LocatorWidget::eventFilter(QObject *obj, QEvent *event) case Qt::Key_Escape: if (!ke->modifiers()) { event->accept(); - QTimer::singleShot(0, this, SLOT(setFocusToCurrentMode())); + QTimer::singleShot(0, this, &LocatorWidget::setFocusToCurrentMode); return true; } case Qt::Key_Alt: diff --git a/src/plugins/coreplugin/locator/locatorwidget.h b/src/plugins/coreplugin/locator/locatorwidget.h index f0efb89a18..0ff07166c2 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.h +++ b/src/plugins/coreplugin/locator/locatorwidget.h @@ -60,7 +60,7 @@ public: void setPlaceholderText(const QString &text); -private slots: +private: void showPopup(); void showPopupNow(); void acceptCurrentEntry(); @@ -71,7 +71,6 @@ private slots: void scheduleAcceptCurrentEntry(); void setFocusToCurrentMode(); -private: bool eventFilter(QObject *obj, QEvent *event); void showCompletionList(); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 7838fdb726..1da372d3a1 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -191,8 +191,7 @@ MainWindow::MainWindow() : m_progressManager->progressView()->setParent(this); m_progressManager->progressView()->setReferenceWidget(m_modeStack->statusBar()); - connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), - this, SLOT(updateFocusWidget(QWidget*,QWidget*))); + connect(qApp, &QApplication::focusChanged, this, &MainWindow::updateFocusWidget); // Add a small Toolbutton for toggling the navigation widget statusBar()->insertPermanentWidget(0, m_toggleSideBarButton); @@ -354,8 +353,8 @@ void MainWindow::extensionsInitialized() emit m_coreImpl->coreAboutToOpen(); // Delay restoreWindowState, since it is overridden by LayoutRequest event - QTimer::singleShot(0, this, SLOT(restoreWindowState())); - QTimer::singleShot(0, m_coreImpl, SIGNAL(coreOpened())); + QTimer::singleShot(0, this, &MainWindow::restoreWindowState); + QTimer::singleShot(0, m_coreImpl, &ICore::coreOpened); } void MainWindow::closeEvent(QCloseEvent *event) @@ -493,7 +492,7 @@ void MainWindow::registerDefaultActions() m_focusToEditor = new QAction(tr("Return to Editor"), this); Command *cmd = ActionManager::registerAction(m_focusToEditor, Constants::S_RETURNTOEDITOR); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape)); - connect(m_focusToEditor, SIGNAL(triggered()), this, SLOT(setFocusToEditor())); + connect(m_focusToEditor, &QAction::triggered, this, &MainWindow::setFocusToEditor); // New File Action QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), Icons::NEWFILE.icon()); @@ -515,13 +514,13 @@ void MainWindow::registerDefaultActions() cmd = ActionManager::registerAction(m_openAction, Constants::OPEN); cmd->setDefaultKeySequence(QKeySequence::Open); mfile->addAction(cmd, Constants::G_FILE_OPEN); - connect(m_openAction, SIGNAL(triggered()), this, SLOT(openFile())); + connect(m_openAction, &QAction::triggered, this, &MainWindow::openFile); // Open With Action m_openWithAction = new QAction(tr("Open File &With..."), this); cmd = ActionManager::registerAction(m_openWithAction, Constants::OPEN_WITH); mfile->addAction(cmd, Constants::G_FILE_OPEN); - connect(m_openWithAction, SIGNAL(triggered()), this, SLOT(openFileWith())); + connect(m_openWithAction, &QAction::triggered, this, &MainWindow::openFileWith); // File->Recent Files Menu ActionContainer *ac = ActionManager::createMenu(Constants::M_FILE_RECENTFILES); @@ -554,7 +553,7 @@ void MainWindow::registerDefaultActions() cmd = ActionManager::registerAction(m_saveAllAction, Constants::SAVEALL); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("Ctrl+Shift+S"))); mfile->addAction(cmd, Constants::G_FILE_SAVE); - connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll())); + connect(m_saveAllAction, &QAction::triggered, this, &MainWindow::saveAll); // Print Action icon = QIcon::fromTheme(QLatin1String("document-print")); @@ -571,7 +570,7 @@ void MainWindow::registerDefaultActions() cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q"))); mfile->addAction(cmd, Constants::G_FILE_OTHER); - connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit())); + connect(m_exitAction, &QAction::triggered, this, &MainWindow::exit); // Undo Action icon = QIcon::fromTheme(QLatin1String("edit-undo"), Icons::UNDO.icon()); @@ -642,7 +641,7 @@ void MainWindow::registerDefaultActions() cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS); cmd->setDefaultKeySequence(QKeySequence::Preferences); mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS); - connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog())); + connect(m_optionsAction, &QAction::triggered, this, [this]() { showOptionsDialog(); }); mwindow->addSeparator(Constants::G_WINDOW_LIST); @@ -700,7 +699,8 @@ void MainWindow::registerDefaultActions() m_toggleModeSelectorAction = new QAction(tr("Show Mode Selector"), this); m_toggleModeSelectorAction->setCheckable(true); cmd = ActionManager::registerAction(m_toggleModeSelectorAction, Constants::TOGGLE_MODE_SELECTOR); - connect(m_toggleModeSelectorAction, &QAction::triggered, ModeManager::instance(), &ModeManager::setModeSelectorVisible); + connect(m_toggleModeSelectorAction, &QAction::triggered, + ModeManager::instance(), &ModeManager::setModeSelectorVisible); mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS); // Window->Views @@ -737,7 +737,7 @@ void MainWindow::registerDefaultActions() // cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT); // mhelp->addAction(cmd, Constants::G_HELP_ABOUT); // tmpaction->setEnabled(true); -// connect(tmpaction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); +// connect(tmpaction, &QAction::triggered, qApp, &QApplication::aboutQt); // About sep if (!HostOsInfo::isMacHost()) { // doesn't have the "About" actions in the Help menu tmpaction = new QAction(this); @@ -844,7 +844,7 @@ void MainWindow::exit() // since on close we are going to delete everything // so to prevent the deleting of that object we // just append it - QTimer::singleShot(0, this, SLOT(close())); + QTimer::singleShot(0, this, &QWidget::close); } void MainWindow::openFileWith() @@ -929,8 +929,7 @@ void MainWindow::updateContextObject(const QList<IContext *> &context) void MainWindow::aboutToShutdown() { - disconnect(QApplication::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), - this, SLOT(updateFocusWidget(QWidget*,QWidget*))); + disconnect(qApp, &QApplication::focusChanged, this, &MainWindow::updateFocusWidget); m_activeContext.clear(); hide(); } @@ -1136,7 +1135,7 @@ void MainWindow::newItemDialogFinished() { m_newAction->setEnabled(true); // fire signal when the dialog is actually destroyed - QTimer::singleShot(0, this, SIGNAL(newItemDialogRunningChanged())); + QTimer::singleShot(0, this, &MainWindow::newItemDialogRunningChanged); } } // namespace Internal diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 569170a5f4..0f1125f2f4 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -129,7 +129,7 @@ public slots: protected: virtual void closeEvent(QCloseEvent *event); -private slots: +private: void openFile(); void aboutToShowRecentFiles(); void setFocusToEditor(); @@ -143,7 +143,6 @@ private slots: void restoreWindowState(); void newItemDialogFinished(); -private: void updateContextObject(const QList<IContext *> &context); void updateContext(); diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 98c0689eff..55733e97f2 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -94,16 +94,18 @@ ModeManager::ModeManager(Internal::MainWindow *mainWindow, d->m_modeSelectorVisible = true; d->m_modeStack->setSelectionWidgetVisible(d->m_modeSelectorVisible); - connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int))); - connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int))); + connect(d->m_modeStack, &Internal::FancyTabWidget::currentAboutToShow, + this, &ModeManager::currentTabAboutToChange); + connect(d->m_modeStack, &Internal::FancyTabWidget::currentChanged, + this, &ModeManager::currentTabChanged); } void ModeManager::init() { - QObject::connect(ExtensionSystem::PluginManager::instance(), SIGNAL(objectAdded(QObject*)), - m_instance, SLOT(objectAdded(QObject*))); - QObject::connect(ExtensionSystem::PluginManager::instance(), SIGNAL(aboutToRemoveObject(QObject*)), - m_instance, SLOT(aboutToRemoveObject(QObject*))); + QObject::connect(ExtensionSystem::PluginManager::instance(), &ExtensionSystem::PluginManager::objectAdded, + m_instance, &ModeManager::objectAdded); + QObject::connect(ExtensionSystem::PluginManager::instance(), &ExtensionSystem::PluginManager::aboutToRemoveObject, + m_instance, &ModeManager::aboutToRemoveObject); } ModeManager::~ModeManager() @@ -160,7 +162,7 @@ void ModeManager::objectAdded(QObject *obj) Command *cmd = ActionManager::registerAction(action, actionId); d->m_modeCommands.insert(index, cmd); - connect(cmd, SIGNAL(keySequenceChanged()), m_instance, SLOT(updateModeToolTip())); + connect(cmd, &Command::keySequenceChanged, m_instance, &ModeManager::updateModeToolTip); for (int i = 0; i < d->m_modeCommands.size(); ++i) { Command *currentCmd = d->m_modeCommands.at(i); // we need this hack with currentlyHasDefaultSequence @@ -180,8 +182,8 @@ void ModeManager::objectAdded(QObject *obj) ICore::raiseWindow(d->m_modeStack); }); - connect(mode, SIGNAL(enabledStateChanged(bool)), - m_instance, SLOT(enabledStateChanged())); + connect(mode, &IMode::enabledStateChanged, + m_instance, &ModeManager::enabledStateChanged); } void ModeManager::updateModeToolTip() diff --git a/src/plugins/coreplugin/modemanager.h b/src/plugins/coreplugin/modemanager.h index e3e58b4a2c..0f73a12b79 100644 --- a/src/plugins/coreplugin/modemanager.h +++ b/src/plugins/coreplugin/modemanager.h @@ -69,7 +69,12 @@ signals: // the default argument '=0' is important for connects without the oldMode argument. void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode = 0); -private slots: +private: + explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack); + ~ModeManager(); + + static void init(); + void objectAdded(QObject *obj); void aboutToRemoveObject(QObject *obj); void currentTabAboutToChange(int index); @@ -77,12 +82,6 @@ private slots: void updateModeToolTip(); void enabledStateChanged(); -private: - explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack); - ~ModeManager(); - - static void init(); - friend class Core::Internal::MainWindow; }; diff --git a/src/plugins/coreplugin/navigationsubwidget.cpp b/src/plugins/coreplugin/navigationsubwidget.cpp index fd4f36e4b9..129db3d5fc 100644 --- a/src/plugins/coreplugin/navigationsubwidget.cpp +++ b/src/plugins/coreplugin/navigationsubwidget.cpp @@ -90,12 +90,13 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget, int pos setLayout(lay); lay->addWidget(m_toolBar); - connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(closeMe())); + connect(m_closeButton, &QAbstractButton::clicked, this, &NavigationSubWidget::closeMe); setFactoryIndex(factoryIndex); - connect(m_navigationComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(comboBoxIndexChanged(int))); + connect(m_navigationComboBox, + static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + this, &NavigationSubWidget::comboBoxIndexChanged); comboBoxIndexChanged(factoryIndex); } diff --git a/src/plugins/coreplugin/navigationsubwidget.h b/src/plugins/coreplugin/navigationsubwidget.h index 68114fcd95..2b945df780 100644 --- a/src/plugins/coreplugin/navigationsubwidget.h +++ b/src/plugins/coreplugin/navigationsubwidget.h @@ -73,10 +73,8 @@ signals: void splitMe(int factoryIndex); void closeMe(); -private slots: - void comboBoxIndexChanged(int); - private: + void comboBoxIndexChanged(int); void populateSplitMenu(); NavigationWidget *m_parentWidget; diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 93dc661852..ee64915484 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -181,10 +181,10 @@ void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> &fac foreach (INavigationWidgetFactory *factory, factories) { const Id id = factory->id(); - QAction *action = new QAction(tr("Activate %1 View").arg(factory->displayName()), this); - connect(action, SIGNAL(triggered()), this, SLOT(activateSubWidget())); d->m_actionMap.insert(action, id); + connect(action, &QAction::triggered, + this, [this, action]() { activateSubWidget(d->m_actionMap[action]); }); Command *cmd = ActionManager::registerAction(action, id.withPrefix("QtCreator.Sidebar."), navicontext); @@ -248,7 +248,7 @@ Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position,int Internal::NavigationSubWidget *nsw = new Internal::NavigationSubWidget(this, position, index); connect(nsw, &Internal::NavigationSubWidget::splitMe, this, &NavigationWidget::splitSubWidget); - connect(nsw, SIGNAL(closeMe()), this, SLOT(closeSubWidget())); + connect(nsw, &Internal::NavigationSubWidget::closeMe, this, &NavigationWidget::closeSubWidget); insertWidget(position, nsw); d->m_subWidgets.insert(position, nsw); d->m_subWidgets.at(0)->setCloseIcon(d->m_subWidgets.size() == 1 @@ -257,13 +257,6 @@ Internal::NavigationSubWidget *NavigationWidget::insertSubItem(int position,int return nsw; } -void NavigationWidget::activateSubWidget() -{ - QAction *original = qobject_cast<QAction *>(sender()); - Id id = d->m_actionMap[original]; - activateSubWidget(id); -} - QWidget *NavigationWidget::activateSubWidget(Id factoryId) { setShown(true); diff --git a/src/plugins/coreplugin/navigationwidget.h b/src/plugins/coreplugin/navigationwidget.h index 17d2bab4d3..444d2365d8 100644 --- a/src/plugins/coreplugin/navigationwidget.h +++ b/src/plugins/coreplugin/navigationwidget.h @@ -104,12 +104,9 @@ public: protected: void resizeEvent(QResizeEvent *); -private slots: - void activateSubWidget(); +private: void splitSubWidget(int factoryIndex); void closeSubWidget(); - -private: void updateToggleText(); Internal::NavigationSubWidget *insertSubItem(int position, int index); int factoryIndex(Id id); diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 28bb029bea..a0659b4f25 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -130,26 +130,26 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : m_clearAction = new QAction(this); m_clearAction->setIcon(Icons::CLEAN_PANE.icon()); m_clearAction->setText(tr("Clear")); - connect(m_clearAction, SIGNAL(triggered()), this, SLOT(clearPage())); + connect(m_clearAction, &QAction::triggered, this, &OutputPaneManager::clearPage); m_nextAction = new QAction(this); m_nextAction->setIcon(Icons::NEXT.icon()); m_nextAction->setText(tr("Next Item")); - connect(m_nextAction, SIGNAL(triggered()), this, SLOT(slotNext())); + connect(m_nextAction, &QAction::triggered, this, &OutputPaneManager::slotNext); m_prevAction = new QAction(this); m_prevAction->setIcon(Icons::PREV.icon()); m_prevAction->setText(tr("Previous Item")); - connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev())); + connect(m_prevAction, &QAction::triggered, this, &OutputPaneManager::slotPrev); m_minMaxAction = new QAction(this); m_minMaxAction->setIcon(m_maximizeIcon); m_minMaxAction->setText(tr("Maximize Output Pane")); m_closeButton->setIcon(Icons::CLOSE_SPLIT_BOTTOM.icon()); - connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide())); + connect(m_closeButton, &QAbstractButton::clicked, this, &OutputPaneManager::slotHide); - connect(ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings())); + connect(ICore::instance(), &ICore::saveSettingsRequested, this, &OutputPaneManager::saveSettings); QVBoxLayout *mainlayout = new QVBoxLayout; mainlayout->setSpacing(0); @@ -228,7 +228,7 @@ void OutputPaneManager::init() cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateIcon); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); - connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax())); + connect(m_minMaxAction, &QAction::triggered, this, &OutputPaneManager::slotMinMax); m_minMaxButton->setDefaultAction(cmd->action()); mpanes->addSeparator("Coreplugin.OutputPane.ActionsGroup"); @@ -249,12 +249,15 @@ void OutputPaneManager::init() const int idx = m_outputWidgetPane->addWidget(outPane->outputWidget(this)); QTC_CHECK(idx == i); - connect(outPane, SIGNAL(showPage(int)), this, SLOT(showPage(int))); - connect(outPane, SIGNAL(hidePage()), this, SLOT(slotHide())); - connect(outPane, SIGNAL(togglePage(int)), this, SLOT(togglePage(int))); - connect(outPane, SIGNAL(navigateStateUpdate()), this, SLOT(updateNavigateState())); - connect(outPane, SIGNAL(flashButton()), this, SLOT(flashButton())); - connect(outPane, SIGNAL(setBadgeNumber(int)), this, SLOT(setBadgeNumber(int))); + connect(outPane, &IOutputPane::showPage, this, [this, outPane](int flags) { + showPage(findIndexForPage(outPane), flags); + }); + connect(outPane, &IOutputPane::hidePage, this, &OutputPaneManager::slotHide); + connect(outPane, &IOutputPane::togglePage, this, &OutputPaneManager::togglePage); + connect(outPane, &IOutputPane::navigateStateUpdate, + this, &OutputPaneManager::updateNavigateState); + connect(outPane, &IOutputPane::flashButton, this, &OutputPaneManager::flashButton); + connect(outPane, &IOutputPane::setBadgeNumber, this, &OutputPaneManager::setBadgeNumber); QWidget *toolButtonsContainer = new QWidget(m_opToolBarWidgets); QHBoxLayout *toolButtonsLayout = new QHBoxLayout; @@ -285,19 +288,21 @@ void OutputPaneManager::init() ++shortcutNumber; m_buttonsWidget->layout()->addWidget(button); m_buttons.append(button); - connect(button, SIGNAL(clicked()), this, SLOT(buttonTriggered())); + connect(button, &QAbstractButton::clicked, this, [this, button]() { + buttonTriggered(m_buttons.indexOf(button)); + }); bool visible = outPane->priorityInStatusBar() != -1; button->setVisible(visible); m_buttonVisibility.insert(id, visible); - connect(action, SIGNAL(triggered()), this, SLOT(shortcutTriggered())); + connect(action, &QAction::triggered, this, &OutputPaneManager::shortcutTriggered); } m_titleLabel->setMinimumWidth(minTitleWidth + m_titleLabel->contentsMargins().left() + m_titleLabel->contentsMargins().right()); m_buttonsWidget->layout()->addWidget(m_manageButton); - connect(m_manageButton, SIGNAL(clicked()), this, SLOT(popupMenu())); + connect(m_manageButton, &QAbstractButton::clicked, this, &OutputPaneManager::popupMenu); readSettings(); } @@ -345,12 +350,6 @@ void OutputPaneManager::slotMinMax() : tr("Maximize Output Pane")); } -void OutputPaneManager::buttonTriggered() -{ - OutputPaneToggleButton *button = qobject_cast<OutputPaneToggleButton *>(sender()); - buttonTriggered(m_buttons.indexOf(button)); -} - void OutputPaneManager::buttonTriggered(int idx) { QTC_ASSERT(idx >= 0, return); @@ -456,13 +455,6 @@ void OutputPaneManager::setBadgeNumber(int number) m_buttons.value(idx)->setIconBadgeNumber(number); } -// Slot connected to showPage signal of each page -void OutputPaneManager::showPage(int flags) -{ - int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender())); - showPage(idx, flags); -} - void OutputPaneManager::showPage(int idx, int flags) { QTC_ASSERT(idx >= 0, return); @@ -626,13 +618,14 @@ OutputPaneToggleButton::OutputPaneToggleButton(int number, const QString &text, QFont fnt = QApplication::font(); setFont(fnt); if (m_action) - connect(m_action, SIGNAL(changed()), this, SLOT(updateToolTip())); + connect(m_action, &QAction::changed, this, &OutputPaneToggleButton::updateToolTip); m_flashTimer->setDirection(QTimeLine::Forward); m_flashTimer->setCurveShape(QTimeLine::SineCurve); m_flashTimer->setFrameRange(0, 92); - connect(m_flashTimer, SIGNAL(valueChanged(qreal)), this, SLOT(update())); - connect(m_flashTimer, SIGNAL(finished()), this, SLOT(update())); + auto updateSlot = static_cast<void (QWidget::*)()>(&QWidget::update); + connect(m_flashTimer, &QTimeLine::valueChanged, this, updateSlot); + connect(m_flashTimer, &QTimeLine::finished, this, updateSlot); } void OutputPaneToggleButton::updateToolTip() diff --git a/src/plugins/coreplugin/outputpanemanager.h b/src/plugins/coreplugin/outputpanemanager.h index 23ea441adb..81ff63e263 100644 --- a/src/plugins/coreplugin/outputpanemanager.h +++ b/src/plugins/coreplugin/outputpanemanager.h @@ -74,17 +74,6 @@ protected: void focusInEvent(QFocusEvent *e); void resizeEvent(QResizeEvent *e); -private slots: - void showPage(int flags); - void togglePage(int flags); - void clearPage(); - void buttonTriggered(); - void updateNavigateState(); - void popupMenu(); - void saveSettings() const; - void flashButton(); - void setBadgeNumber(int number); - private: // the only class that is allowed to create and destroy friend class MainWindow; @@ -96,6 +85,13 @@ private: explicit OutputPaneManager(QWidget *parent = 0); ~OutputPaneManager(); + void togglePage(int flags); + void clearPage(); + void updateNavigateState(); + void popupMenu(); + void saveSettings() const; + void flashButton(); + void setBadgeNumber(int number); void showPage(int idx, int flags); void ensurePageVisible(int idx); int findIndexForPage(IOutputPane *out); @@ -163,10 +159,8 @@ public: void flash(int count = 3); void setIconBadgeNumber(int number); -private slots: - void updateToolTip(); - private: + void updateToolTip(); void checkStateSet(); QString m_number; diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index 44137f25ad..fb2a1b8c14 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -110,17 +110,17 @@ OutputWindow::OutputWindow(Context context, QWidget *parent) ActionManager::registerAction(pasteAction, Constants::PASTE, context); ActionManager::registerAction(selectAllAction, Constants::SELECTALL, context); - connect(undoAction, SIGNAL(triggered()), this, SLOT(undo())); - connect(redoAction, SIGNAL(triggered()), this, SLOT(redo())); - connect(cutAction, SIGNAL(triggered()), this, SLOT(cut())); - connect(copyAction, SIGNAL(triggered()), this, SLOT(copy())); - connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste())); - connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll())); - - connect(this, SIGNAL(undoAvailable(bool)), undoAction, SLOT(setEnabled(bool))); - connect(this, SIGNAL(redoAvailable(bool)), redoAction, SLOT(setEnabled(bool))); - connect(this, SIGNAL(copyAvailable(bool)), cutAction, SLOT(setEnabled(bool))); // OutputWindow never read-only - connect(this, SIGNAL(copyAvailable(bool)), copyAction, SLOT(setEnabled(bool))); + connect(undoAction, &QAction::triggered, this, &QPlainTextEdit::undo); + connect(redoAction, &QAction::triggered, this, &QPlainTextEdit::redo); + connect(cutAction, &QAction::triggered, this, &QPlainTextEdit::cut); + connect(copyAction, &QAction::triggered, this, &QPlainTextEdit::copy); + connect(pasteAction, &QAction::triggered, this, &QPlainTextEdit::paste); + connect(selectAllAction, &QAction::triggered, this, &QPlainTextEdit::selectAll); + + connect(this, &QPlainTextEdit::undoAvailable, undoAction, &QAction::setEnabled); + connect(this, &QPlainTextEdit::redoAvailable, redoAction, &QAction::setEnabled); + connect(this, &QPlainTextEdit::copyAvailable, cutAction, &QAction::setEnabled); // OutputWindow never read-only + connect(this, &QPlainTextEdit::copyAvailable, copyAction, &QAction::setEnabled); undoAction->setEnabled(false); redoAction->setEnabled(false); diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.cpp b/src/plugins/coreplugin/progressmanager/futureprogress.cpp index 9c499a34a4..e06451eac6 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/futureprogress.cpp @@ -54,12 +54,10 @@ class FutureProgressPrivate : public QObject { Q_OBJECT -public slots: - void fadeAway(); - public: explicit FutureProgressPrivate(FutureProgress *q); + void fadeAway(); void tryToFadeAway(); QFutureWatcher<void> m_watcher; @@ -135,14 +133,16 @@ FutureProgress::FutureProgress(QWidget *parent) : d->m_widgetLayout->setContentsMargins(7, 0, 7, 2); d->m_widgetLayout->setSpacing(0); - connect(&d->m_watcher, SIGNAL(started()), this, SLOT(setStarted())); - connect(&d->m_watcher, SIGNAL(finished()), this, SLOT(setFinished())); - connect(&d->m_watcher, SIGNAL(canceled()), this, SIGNAL(canceled())); - connect(&d->m_watcher, SIGNAL(progressRangeChanged(int,int)), this, SLOT(setProgressRange(int,int))); - connect(&d->m_watcher, SIGNAL(progressValueChanged(int)), this, SLOT(setProgressValue(int))); - connect(&d->m_watcher, SIGNAL(progressTextChanged(QString)), - this, SLOT(setProgressText(QString))); - connect(d->m_progress, SIGNAL(clicked()), this, SLOT(cancel())); + connect(&d->m_watcher, &QFutureWatcherBase::started, this, &FutureProgress::setStarted); + connect(&d->m_watcher, &QFutureWatcherBase::finished, this, &FutureProgress::setFinished); + connect(&d->m_watcher, &QFutureWatcherBase::canceled, this, &FutureProgress::canceled); + connect(&d->m_watcher, &QFutureWatcherBase::progressRangeChanged, + this, &FutureProgress::setProgressRange); + connect(&d->m_watcher, &QFutureWatcherBase::progressValueChanged, + this, &FutureProgress::setProgressValue); + connect(&d->m_watcher, &QFutureWatcherBase::progressTextChanged, + this, &FutureProgress::setProgressText); + connect(d->m_progress, &Internal::ProgressBar::clicked, this, &FutureProgress::cancel); setMinimumWidth(100); setMaximumWidth(300); } @@ -212,7 +212,7 @@ bool FutureProgress::eventFilter(QObject *, QEvent *e) if (d->m_keep != KeepOnFinish && d->m_waitingForUserInteraction && (e->type() == QEvent::MouseMove || e->type() == QEvent::KeyPress)) { qApp->removeEventFilter(this); - QTimer::singleShot(notificationTimeout, d, SLOT(fadeAway())); + QTimer::singleShot(notificationTimeout, d, &FutureProgressPrivate::fadeAway); } return false; } @@ -245,7 +245,7 @@ void FutureProgressPrivate::tryToFadeAway() qApp->installEventFilter(m_q); m_fadeStarting = true; } else if (m_keep == FutureProgress::HideOnFinish) { - QTimer::singleShot(shortNotificationTimeout, this, SLOT(fadeAway())); + QTimer::singleShot(shortNotificationTimeout, this, &FutureProgressPrivate::fadeAway); m_fadeStarting = true; } } @@ -386,7 +386,7 @@ void FutureProgressPrivate::fadeAway() animation->setEndValue(0.0); group->addAnimation(animation); - connect(group, SIGNAL(finished()), m_q, SIGNAL(removeMe())); + connect(group, &QAbstractAnimation::finished, m_q, &FutureProgress::removeMe); group->start(QAbstractAnimation::DeleteWhenStopped); emit m_q->fadeStarted(); } diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.h b/src/plugins/coreplugin/progressmanager/futureprogress.h index 945f160a74..6647103009 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.h +++ b/src/plugins/coreplugin/progressmanager/futureprogress.h @@ -89,7 +89,7 @@ protected: void mousePressEvent(QMouseEvent *event); void paintEvent(QPaintEvent *); -private slots: +private: void updateToolTip(const QString &); void cancel(); void setStarted(); @@ -98,8 +98,6 @@ private slots: void setProgressValue(int val); void setProgressText(const QString &text); -private: - friend class FutureProgressPrivate; // for sending signal FutureProgressPrivate *d; }; diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index e6a08615cd..1b9c1f6fe5 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -275,8 +275,8 @@ ProgressManagerPrivate::ProgressManagerPrivate() m_instance = this; m_progressView = new ProgressView; // withDelay, so the statusBarWidget has the chance to get the enter event - connect(m_progressView, SIGNAL(hoveredChanged(bool)), this, SLOT(updateVisibilityWithDelay())); - connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(cancelAllRunningTasks())); + connect(m_progressView.data(), &ProgressView::hoveredChanged, this, &ProgressManagerPrivate::updateVisibilityWithDelay); + connect(ICore::instance(), &ICore::coreAboutToClose, this, &ProgressManagerPrivate::cancelAllRunningTasks); } ProgressManagerPrivate::~ProgressManagerPrivate() @@ -341,7 +341,8 @@ void ProgressManagerPrivate::init() cmd->setDefaultKeySequence(QKeySequence(HostOsInfo::isMacHost() ? tr("Ctrl+Shift+0") : tr("Alt+Shift+0"))); - connect(toggleProgressView, SIGNAL(toggled(bool)), this, SLOT(progressDetailsToggled(bool))); + connect(toggleProgressView, &QAction::toggled, + this, &ProgressManagerPrivate::progressDetailsToggled); toggleButton->setDefaultAction(cmd->action()); m_progressView->setVisible(m_progressViewPinned); @@ -359,7 +360,7 @@ void ProgressManagerPrivate::doCancelTasks(Id type) continue; } found = true; - disconnect(task.key(), SIGNAL(finished()), this, SLOT(taskFinished())); + disconnect(task.key(), &QFutureWatcherBase::finished, this, &ProgressManagerPrivate::taskFinished); if (m_applicationTask == task.key()) disconnectApplicationTask(); task.key()->cancel(); @@ -390,7 +391,7 @@ bool ProgressManagerPrivate::eventFilter(QObject *obj, QEvent *event) progress = m_taskList.last(); // don't send signal directly from an event filter, event filters should // do as little a possible - QTimer::singleShot(0, progress, SIGNAL(clicked())); + QTimer::singleShot(0, progress, &FutureProgress::clicked); event->accept(); return true; } @@ -402,7 +403,7 @@ void ProgressManagerPrivate::cancelAllRunningTasks() { QMap<QFutureWatcher<void> *, Id>::const_iterator task = m_runningTasks.constBegin(); while (task != m_runningTasks.constEnd()) { - disconnect(task.key(), SIGNAL(finished()), this, SLOT(taskFinished())); + disconnect(task.key(), &QFutureWatcherBase::finished, this, &ProgressManagerPrivate::taskFinished); if (m_applicationTask == task.key()) disconnectApplicationTask(); task.key()->cancel(); @@ -419,9 +420,11 @@ FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture<void> &future, c // watch QFutureWatcher<void> *watcher = new QFutureWatcher<void>(); m_runningTasks.insert(watcher, type); - connect(watcher, SIGNAL(progressRangeChanged(int,int)), this, SLOT(updateSummaryProgressBar())); - connect(watcher, SIGNAL(progressValueChanged(int)), this, SLOT(updateSummaryProgressBar())); - connect(watcher, SIGNAL(finished()), this, SLOT(taskFinished())); + connect(watcher, &QFutureWatcherBase::progressRangeChanged, + this, &ProgressManagerPrivate::updateSummaryProgressBar); + connect(watcher, &QFutureWatcherBase::progressValueChanged, + this, &ProgressManagerPrivate::updateSummaryProgressBar); + connect(watcher, &QFutureWatcherBase::finished, this, &ProgressManagerPrivate::taskFinished); watcher->setFuture(future); // handle application task @@ -431,10 +434,10 @@ FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture<void> &future, c m_applicationTask = watcher; setApplicationProgressRange(future.progressMinimum(), future.progressMaximum()); setApplicationProgressValue(future.progressValue()); - connect(m_applicationTask, SIGNAL(progressRangeChanged(int,int)), - this, SLOT(setApplicationProgressRange(int,int))); - connect(m_applicationTask, SIGNAL(progressValueChanged(int)), - this, SLOT(setApplicationProgressValue(int))); + connect(m_applicationTask, &QFutureWatcherBase::progressRangeChanged, + this, &ProgressManagerPrivate::setApplicationProgressRange); + connect(m_applicationTask, &QFutureWatcherBase::progressValueChanged, + this, &ProgressManagerPrivate::setApplicationProgressValue); setApplicationProgressVisible(true); } @@ -453,10 +456,13 @@ FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture<void> &future, c progress->setKeepOnFinish(FutureProgress::KeepOnFinishTillUserInteraction); else progress->setKeepOnFinish(FutureProgress::HideOnFinish); - connect(progress, SIGNAL(hasErrorChanged()), this, SLOT(updateSummaryProgressBar())); - connect(progress, SIGNAL(removeMe()), this, SLOT(slotRemoveTask())); - connect(progress, SIGNAL(fadeStarted()), this, SLOT(updateSummaryProgressBar())); - connect(progress, SIGNAL(statusBarWidgetChanged()), this, SLOT(updateStatusDetailsWidget())); + connect(progress, &FutureProgress::hasErrorChanged, + this, &ProgressManagerPrivate::updateSummaryProgressBar); + connect(progress, &FutureProgress::removeMe, this, &ProgressManagerPrivate::slotRemoveTask); + connect(progress, &FutureProgress::fadeStarted, + this, &ProgressManagerPrivate::updateSummaryProgressBar); + connect(progress, &FutureProgress::statusBarWidgetChanged, + this, &ProgressManagerPrivate::updateStatusDetailsWidget); updateStatusDetailsWidget(); emit taskStarted(type); @@ -486,10 +492,10 @@ void ProgressManagerPrivate::taskFinished() void ProgressManagerPrivate::disconnectApplicationTask() { - disconnect(m_applicationTask, SIGNAL(progressRangeChanged(int,int)), - this, SLOT(setApplicationProgressRange(int,int))); - disconnect(m_applicationTask, SIGNAL(progressValueChanged(int)), - this, SLOT(setApplicationProgressValue(int))); + disconnect(m_applicationTask, &QFutureWatcherBase::progressRangeChanged, + this, &ProgressManagerPrivate::setApplicationProgressRange); + disconnect(m_applicationTask, &QFutureWatcherBase::progressValueChanged, + this, &ProgressManagerPrivate::setApplicationProgressValue); setApplicationProgressVisible(false); m_applicationTask = 0; } @@ -529,7 +535,7 @@ void ProgressManagerPrivate::fadeAwaySummaryProgress() m_opacityAnimation = new QPropertyAnimation(m_opacityEffect, "opacity"); m_opacityAnimation->setDuration(StyleHelper::progressFadeAnimationDuration); m_opacityAnimation->setEndValue(0.); - connect(m_opacityAnimation, SIGNAL(finished()), this, SLOT(summaryProgressFinishedFading())); + connect(m_opacityAnimation.data(), &QAbstractAnimation::finished, this, &ProgressManagerPrivate::summaryProgressFinishedFading); m_opacityAnimation->start(QAbstractAnimation::DeleteWhenStopped); } @@ -647,7 +653,7 @@ void ProgressManagerPrivate::updateVisibility() void ProgressManagerPrivate::updateVisibilityWithDelay() { - QTimer::singleShot(150, this, SLOT(updateVisibility())); + QTimer::singleShot(150, this, &ProgressManagerPrivate::updateVisibility); } void ProgressManagerPrivate::updateStatusDetailsWidget() @@ -787,8 +793,8 @@ ProgressTimer::ProgressTimer(QObject *parent, m_futureInterface.setProgressValue(0); setInterval(1000); // 1 second - connect(this, SIGNAL(timeout()), this, SLOT(handleTimeout())); - connect(&m_futureWatcher, SIGNAL(started()), this, SLOT(start())); + connect(this, &QTimer::timeout, this, &ProgressTimer::handleTimeout); + connect(&m_futureWatcher, &QFutureWatcherBase::started, this, [this]() { start(); }); } void ProgressTimer::handleTimeout() diff --git a/src/plugins/coreplugin/progressmanager/progressmanager_p.h b/src/plugins/coreplugin/progressmanager/progressmanager_p.h index 1730c3ad97..5603bd750d 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager_p.h +++ b/src/plugins/coreplugin/progressmanager/progressmanager_p.h @@ -67,7 +67,7 @@ public slots: protected: bool eventFilter(QObject *obj, QEvent *event); -private slots: +private: void taskFinished(); void cancelAllRunningTasks(); void setApplicationProgressRange(int min, int max); @@ -83,7 +83,6 @@ private slots: void updateStatusDetailsWidget(); void slotRemoveTask(); -private: void readSettings(); void initInternal(); void stopFadeOfSummaryProgress(); @@ -130,10 +129,9 @@ class ProgressTimer : public QTimer public: ProgressTimer(QObject *parent, const QFutureInterface<void> &futureInterface, int expectedSeconds); -private slots: +private: void handleTimeout(); -private: QFutureInterface<void> m_futureInterface; QFutureWatcher<void> m_futureWatcher; int m_expectedTime; diff --git a/src/plugins/coreplugin/sidebar.cpp b/src/plugins/coreplugin/sidebar.cpp index 0ac55d71e4..94bec43b82 100644 --- a/src/plugins/coreplugin/sidebar.cpp +++ b/src/plugins/coreplugin/sidebar.cpp @@ -202,9 +202,9 @@ Internal::SideBarWidget *SideBar::insertSideBarWidget(int position, const QStrin d->m_widgets.at(0)->setCloseIcon(Icons::CLOSE_SPLIT_BOTTOM.icon()); Internal::SideBarWidget *item = new Internal::SideBarWidget(this, id); - connect(item, SIGNAL(splitMe()), this, SLOT(splitSubWidget())); - connect(item, SIGNAL(closeMe()), this, SLOT(closeSubWidget())); - connect(item, SIGNAL(currentWidgetChanged()), this, SLOT(updateWidgets())); + connect(item, &Internal::SideBarWidget::splitMe, this, &SideBar::splitSubWidget); + connect(item, &Internal::SideBarWidget::closeMe, this, &SideBar::closeSubWidget); + connect(item, &Internal::SideBarWidget::currentWidgetChanged, this, &SideBar::updateWidgets); insertWidget(position, item); d->m_widgets.insert(position, item); if (d->m_widgets.size() == 1) diff --git a/src/plugins/coreplugin/sidebar.h b/src/plugins/coreplugin/sidebar.h index a1da77998b..ab25daeea4 100644 --- a/src/plugins/coreplugin/sidebar.h +++ b/src/plugins/coreplugin/sidebar.h @@ -113,12 +113,11 @@ signals: void sideBarClosed(); void availableItemsChanged(); -private slots: +private: void splitSubWidget(); void closeSubWidget(); void updateWidgets(); -private: Internal::SideBarWidget *insertSideBarWidget(int position, const QString &title = QString()); void removeSideBarWidget(Internal::SideBarWidget *widget); diff --git a/src/plugins/coreplugin/sidebarwidget.cpp b/src/plugins/coreplugin/sidebarwidget.cpp index ecb2e73a8a..bb3b5b8187 100644 --- a/src/plugins/coreplugin/sidebarwidget.cpp +++ b/src/plugins/coreplugin/sidebarwidget.cpp @@ -73,13 +73,13 @@ SideBarWidget::SideBarWidget(SideBar *sideBar, const QString &id) m_splitAction = new QAction(tr("Split"), m_toolbar); m_splitAction->setToolTip(tr("Split")); m_splitAction->setIcon(Icons::SPLIT_HORIZONTAL.icon()); - connect(m_splitAction, SIGNAL(triggered()), this, SIGNAL(splitMe())); + connect(m_splitAction, &QAction::triggered, this, &SideBarWidget::splitMe); m_toolbar->addAction(m_splitAction); m_closeAction = new QAction(tr("Close"), m_toolbar); m_closeAction->setToolTip(tr("Close")); m_closeAction->setIcon(Icons::CLOSE_SPLIT_BOTTOM.icon()); - connect(m_closeAction, SIGNAL(triggered()), this, SIGNAL(closeMe())); + connect(m_closeAction, &QAction::triggered, this, &SideBarWidget::closeMe); m_toolbar->addAction(m_closeAction); QVBoxLayout *lay = new QVBoxLayout(); @@ -101,8 +101,8 @@ SideBarWidget::SideBarWidget(SideBar *sideBar, const QString &id) } setCurrentItem(t); - connect(m_comboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(setCurrentIndex(int))); + connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), + this, &SideBarWidget::setCurrentIndex); } SideBarWidget::~SideBarWidget() diff --git a/src/plugins/coreplugin/sidebarwidget.h b/src/plugins/coreplugin/sidebarwidget.h index 0735e64e33..ad5ab85848 100644 --- a/src/plugins/coreplugin/sidebarwidget.h +++ b/src/plugins/coreplugin/sidebarwidget.h @@ -66,10 +66,9 @@ signals: void closeMe(); void currentWidgetChanged(); -private slots: +private: void setCurrentIndex(int); -private: SideBarComboBox *m_comboBox; SideBarItem *m_currentItem; QToolBar *m_toolbar; diff --git a/src/plugins/coreplugin/statusbarmanager.cpp b/src/plugins/coreplugin/statusbarmanager.cpp index 622e44ba2e..33eaf62d71 100644 --- a/src/plugins/coreplugin/statusbarmanager.cpp +++ b/src/plugins/coreplugin/statusbarmanager.cpp @@ -90,11 +90,11 @@ StatusBarManager::~StatusBarManager() void StatusBarManager::init() { - connect(ExtensionSystem::PluginManager::instance(), SIGNAL(objectAdded(QObject*)), - this, SLOT(objectAdded(QObject*))); - connect(ExtensionSystem::PluginManager::instance(), SIGNAL(aboutToRemoveObject(QObject*)), - this, SLOT(aboutToRemoveObject(QObject*))); - connect(ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings())); + connect(ExtensionSystem::PluginManager::instance(), &ExtensionSystem::PluginManager::objectAdded, + this, &StatusBarManager::objectAdded); + connect(ExtensionSystem::PluginManager::instance(), &ExtensionSystem::PluginManager::aboutToRemoveObject, + this, &StatusBarManager::aboutToRemoveObject); + connect(ICore::instance(), &ICore::saveSettingsRequested, this, &StatusBarManager::saveSettings); } void StatusBarManager::objectAdded(QObject *obj) diff --git a/src/plugins/coreplugin/statusbarmanager.h b/src/plugins/coreplugin/statusbarmanager.h index f3d8330c0c..979df19ab9 100644 --- a/src/plugins/coreplugin/statusbarmanager.h +++ b/src/plugins/coreplugin/statusbarmanager.h @@ -63,12 +63,11 @@ public: void extensionsInitalized(); void restoreSettings(); -private slots: +private: void objectAdded(QObject *obj); void aboutToRemoveObject(QObject *obj); void saveSettings(); -private: MainWindow *m_mainWnd; QSplitter *m_splitter; QList<QWidget *> m_statusBarWidgets; diff --git a/src/plugins/coreplugin/systemsettings.cpp b/src/plugins/coreplugin/systemsettings.cpp index 3f24baa608..a66d88f319 100644 --- a/src/plugins/coreplugin/systemsettings.cpp +++ b/src/plugins/coreplugin/systemsettings.cpp @@ -27,6 +27,7 @@ #include "coreconstants.h" #include "editormanager/editormanager_p.h" #include "icore.h" +#include "iversioncontrol.h" #include "patchtool.h" #include "vcsmanager.h" @@ -99,11 +100,13 @@ QWidget *SystemSettings::widget() m_page->bigFilesLimitSpinBox->setValue(EditorManagerPrivate::bigFileSizeLimit()); if (HostOsInfo::isAnyUnixHost()) { - connect(m_page->resetTerminalButton, SIGNAL(clicked()), this, SLOT(resetTerminal())); + connect(m_page->resetTerminalButton, &QAbstractButton::clicked, + this, &SystemSettings::resetTerminal); if (!HostOsInfo::isMacHost()) { - connect(m_page->resetFileBrowserButton, SIGNAL(clicked()), this, SLOT(resetFileBrowser())); - connect(m_page->helpExternalFileBrowserButton, SIGNAL(clicked()), - this, SLOT(showHelpForFileBrowser())); + connect(m_page->resetFileBrowserButton, &QAbstractButton::clicked, + this, &SystemSettings::resetFileBrowser); + connect(m_page->helpExternalFileBrowserButton, &QAbstractButton::clicked, + this, &SystemSettings::showHelpForFileBrowser); } } @@ -134,8 +137,8 @@ QWidget *SystemSettings::widget() updatePath(); - connect(VcsManager::instance(), SIGNAL(configurationChanged(const IVersionControl*)), - this, SLOT(updatePath())); + connect(VcsManager::instance(), &VcsManager::configurationChanged, + this, &SystemSettings::updatePath); } return m_widget; } diff --git a/src/plugins/coreplugin/systemsettings.h b/src/plugins/coreplugin/systemsettings.h index ad31f00702..7645b29eb3 100644 --- a/src/plugins/coreplugin/systemsettings.h +++ b/src/plugins/coreplugin/systemsettings.h @@ -49,13 +49,12 @@ public: void apply(); void finish(); -private slots: +private: void showHelpForFileBrowser(); void resetFileBrowser(); void resetTerminal(); void updatePath(); -private: void variableHelpDialogCreator(const QString &helpText); Ui::SystemSettings *m_page; QPointer<QMessageBox> m_dialog; diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index f42d2aaee6..a420301303 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -550,7 +550,7 @@ static bool handleEscapePressed(QKeyEvent *ke, QWidget *widget) { if (ke->key() == Qt::Key_Escape && !ke->modifiers()) { ke->accept(); - QTimer::singleShot(0, widget, SLOT(close())); + QTimer::singleShot(0, widget, &QWidget::close); return true; } return false; diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index c4527c4e64..e2217c873c 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -204,12 +204,12 @@ void VcsManager::extensionsInitialized() { // Change signal connections foreach (IVersionControl *versionControl, versionControls()) { - connect(versionControl, SIGNAL(filesChanged(QStringList)), - DocumentManager::instance(), SIGNAL(filesChangedInternally(QStringList))); - connect(versionControl, SIGNAL(repositoryChanged(QString)), - m_instance, SIGNAL(repositoryChanged(QString))); - connect(versionControl, SIGNAL(configurationChanged()), - m_instance, SLOT(handleConfigurationChanges())); + connect(versionControl, &IVersionControl::filesChanged, + DocumentManager::instance(), &DocumentManager::filesChangedInternally); + connect(versionControl, &IVersionControl::repositoryChanged, + m_instance, &VcsManager::repositoryChanged); + connect(versionControl, &IVersionControl::configurationChanged, + m_instance, &VcsManager::handleConfigurationChanges); } } diff --git a/src/plugins/coreplugin/vcsmanager.h b/src/plugins/coreplugin/vcsmanager.h index bcb19bb1c9..51e559b4f9 100644 --- a/src/plugins/coreplugin/vcsmanager.h +++ b/src/plugins/coreplugin/vcsmanager.h @@ -100,13 +100,12 @@ signals: public slots: static void clearVersionControlCache(); -private slots: - void handleConfigurationChanges(); - private: explicit VcsManager(QObject *parent = 0); ~VcsManager(); + void handleConfigurationChanges(); + friend class Core::Internal::MainWindow; }; diff --git a/src/plugins/coreplugin/versiondialog.cpp b/src/plugins/coreplugin/versiondialog.cpp index a194032121..8ca808516c 100644 --- a/src/plugins/coreplugin/versiondialog.cpp +++ b/src/plugins/coreplugin/versiondialog.cpp @@ -98,7 +98,7 @@ VersionDialog::VersionDialog(QWidget *parent) QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close); QTC_CHECK(closeButton); buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole)); - connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject); QLabel *logoLabel = new QLabel; logoLabel->setPixmap(Icons::QTLOGO_128.pixmap()); diff --git a/src/plugins/coreplugin/windowsupport.cpp b/src/plugins/coreplugin/windowsupport.cpp index 8ce264953b..4af9d7343b 100644 --- a/src/plugins/coreplugin/windowsupport.cpp +++ b/src/plugins/coreplugin/windowsupport.cpp @@ -62,21 +62,21 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context) if (UseMacShortcuts) { m_minimizeAction = new QAction(this); ActionManager::registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, context); - connect(m_minimizeAction, SIGNAL(triggered()), m_window, SLOT(showMinimized())); + connect(m_minimizeAction, &QAction::triggered, m_window, &QWidget::showMinimized); m_zoomAction = new QAction(this); ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context); - connect(m_zoomAction, SIGNAL(triggered()), m_window, SLOT(showMaximized())); + connect(m_zoomAction, &QAction::triggered, m_window, &QWidget::showMaximized); m_closeAction = new QAction(this); ActionManager::registerAction(m_closeAction, Constants::CLOSE_WINDOW, context); - connect(m_closeAction, SIGNAL(triggered()), m_window, SLOT(close()), Qt::QueuedConnection); + connect(m_closeAction, &QAction::triggered, m_window, &QWidget::close, Qt::QueuedConnection); } m_toggleFullScreenAction = new QAction(this); updateFullScreenAction(); ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, context); - connect(m_toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen())); + connect(m_toggleFullScreenAction, &QAction::triggered, this, &WindowSupport::toggleFullScreen); WindowList::addWindow(window); diff --git a/src/plugins/coreplugin/windowsupport.h b/src/plugins/coreplugin/windowsupport.h index 4854cd8c14..a39a5707c2 100644 --- a/src/plugins/coreplugin/windowsupport.h +++ b/src/plugins/coreplugin/windowsupport.h @@ -69,11 +69,10 @@ public: protected: bool eventFilter(QObject *obj, QEvent *event); -private slots: +private: void toggleFullScreen(); void updateFullScreenAction(); -private: QWidget *m_window; IContext *m_contextObject; QAction *m_minimizeAction; |