forked from qt-creator/qt-creator
CppEditor: Use Qt5-style connects
The heavy lifting was done by clazy. Change-Id: I5ee3678f8293486cccfc634aaab5c75b066ed011 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
3b669a37cd
commit
928ba8aa84
@@ -130,13 +130,11 @@ public:
|
||||
QItemSelectionModel *selectionModel() const;
|
||||
void selectIndex(const QModelIndex &index);
|
||||
void resizeColumns(int columnCount);
|
||||
void clearFilter();
|
||||
|
||||
signals:
|
||||
void filterChanged(const QString &filterText);
|
||||
|
||||
public slots:
|
||||
void clearFilter();
|
||||
|
||||
private:
|
||||
QTreeView *view;
|
||||
QLineEdit *lineEdit;
|
||||
@@ -152,13 +150,13 @@ FilterableView::FilterableView(QWidget *parent)
|
||||
|
||||
lineEdit = new QLineEdit(this);
|
||||
lineEdit->setPlaceholderText(QLatin1String("File Path"));
|
||||
QObject::connect(lineEdit, SIGNAL(textChanged(QString)), SIGNAL(filterChanged(QString)));
|
||||
QObject::connect(lineEdit, &QLineEdit::textChanged, this, &FilterableView::filterChanged);
|
||||
|
||||
QLabel *label = new QLabel(QLatin1String("&Filter:"), this);
|
||||
label->setBuddy(lineEdit);
|
||||
|
||||
QPushButton *clearButton = new QPushButton(QLatin1String("&Clear"), this);
|
||||
QObject::connect(clearButton, SIGNAL(clicked()), SLOT(clearFilter()));
|
||||
QObject::connect(clearButton, &QAbstractButton::clicked, this, &FilterableView::clearFilter);
|
||||
|
||||
QHBoxLayout *filterBarLayout = new QHBoxLayout();
|
||||
filterBarLayout->addWidget(label);
|
||||
@@ -1185,7 +1183,7 @@ CppCodeModelInspectorDialog::CppCodeModelInspectorDialog(QWidget *parent)
|
||||
m_ui->workingCopySplitter->insertWidget(0, m_workingCopyView);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()), SLOT(close()));
|
||||
connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose, this, &QWidget::close);
|
||||
|
||||
m_proxySnapshotModel->setSourceModel(m_snapshotModel);
|
||||
m_proxySnapshotModel->setFilterKeyColumn(SnapshotModel::FilePathColumn);
|
||||
@@ -1207,31 +1205,32 @@ CppCodeModelInspectorDialog::CppCodeModelInspectorDialog(QWidget *parent)
|
||||
m_workingCopyView->setModel(m_proxyWorkingCopyModel);
|
||||
|
||||
connect(m_snapshotView->selectionModel(),
|
||||
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
SLOT(onDocumentSelected(QModelIndex,QModelIndex)));
|
||||
connect(m_snapshotView, SIGNAL(filterChanged(QString)),
|
||||
SLOT(onSnapshotFilterChanged(QString)));
|
||||
connect(m_ui->snapshotSelector, SIGNAL(currentIndexChanged(int)),
|
||||
SLOT(onSnapshotSelected(int)));
|
||||
connect(m_ui->docSymbolsView, SIGNAL(expanded(QModelIndex)),
|
||||
SLOT(onSymbolsViewExpandedOrCollapsed(QModelIndex)));
|
||||
connect(m_ui->docSymbolsView, SIGNAL(collapsed(QModelIndex)),
|
||||
SLOT(onSymbolsViewExpandedOrCollapsed(QModelIndex)));
|
||||
&QItemSelectionModel::currentRowChanged,
|
||||
this, &CppCodeModelInspectorDialog::onDocumentSelected);
|
||||
connect(m_snapshotView, &FilterableView::filterChanged,
|
||||
this, &CppCodeModelInspectorDialog::onSnapshotFilterChanged);
|
||||
connect(m_ui->snapshotSelector,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &CppCodeModelInspectorDialog::onSnapshotSelected);
|
||||
connect(m_ui->docSymbolsView, &QTreeView::expanded,
|
||||
this, &CppCodeModelInspectorDialog::onSymbolsViewExpandedOrCollapsed);
|
||||
connect(m_ui->docSymbolsView, &QTreeView::collapsed,
|
||||
this, &CppCodeModelInspectorDialog::onSymbolsViewExpandedOrCollapsed);
|
||||
|
||||
connect(m_projectPartsView->selectionModel(),
|
||||
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
SLOT(onProjectPartSelected(QModelIndex,QModelIndex)));
|
||||
connect(m_projectPartsView, SIGNAL(filterChanged(QString)),
|
||||
SLOT(onProjectPartFilterChanged(QString)));
|
||||
&QItemSelectionModel::currentRowChanged,
|
||||
this, &CppCodeModelInspectorDialog::onProjectPartSelected);
|
||||
connect(m_projectPartsView, &FilterableView::filterChanged,
|
||||
this, &CppCodeModelInspectorDialog::onProjectPartFilterChanged);
|
||||
|
||||
connect(m_workingCopyView->selectionModel(),
|
||||
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
SLOT(onWorkingCopyDocumentSelected(QModelIndex,QModelIndex)));
|
||||
connect(m_workingCopyView, SIGNAL(filterChanged(QString)),
|
||||
SLOT(onWorkingCopyFilterChanged(QString)));
|
||||
&QItemSelectionModel::currentRowChanged,
|
||||
this, &CppCodeModelInspectorDialog::onWorkingCopyDocumentSelected);
|
||||
connect(m_workingCopyView, &FilterableView::filterChanged,
|
||||
this, &CppCodeModelInspectorDialog::onWorkingCopyFilterChanged);
|
||||
|
||||
connect(m_ui->refreshButton, SIGNAL(clicked()), SLOT(onRefreshRequested()));
|
||||
connect(m_ui->closeButton, SIGNAL(clicked()), SLOT(close()));
|
||||
connect(m_ui->refreshButton, &QAbstractButton::clicked, this, &CppCodeModelInspectorDialog::onRefreshRequested);
|
||||
connect(m_ui->closeButton, &QAbstractButton::clicked, this, &QWidget::close);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
explicit CppCodeModelInspectorDialog(QWidget *parent = 0);
|
||||
~CppCodeModelInspectorDialog();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void onRefreshRequested();
|
||||
|
||||
void onSnapshotFilterChanged(const QString &pattern);
|
||||
@@ -80,7 +80,6 @@ private slots:
|
||||
void onWorkingCopyFilterChanged(const QString &pattern);
|
||||
void onWorkingCopyDocumentSelected(const QModelIndex ¤t, const QModelIndex &);
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
|
||||
void clearDocumentData();
|
||||
|
||||
@@ -160,18 +160,18 @@ void CppEditorWidget::finalizeInitialization()
|
||||
this, &CppEditorWidget::onCodeWarningsUpdated);
|
||||
connect(d->m_cppEditorDocument, &CppEditorDocument::ifdefedOutBlocksUpdated,
|
||||
this, &CppEditorWidget::onIfdefedOutBlocksUpdated);
|
||||
connect(d->m_cppEditorDocument, SIGNAL(cppDocumentUpdated(CPlusPlus::Document::Ptr)),
|
||||
this, SLOT(onCppDocumentUpdated()));
|
||||
connect(d->m_cppEditorDocument, SIGNAL(semanticInfoUpdated(CppTools::SemanticInfo)),
|
||||
this, SLOT(updateSemanticInfo(CppTools::SemanticInfo)));
|
||||
connect(d->m_cppEditorDocument, &CppEditorDocument::cppDocumentUpdated,
|
||||
this, &CppEditorWidget::onCppDocumentUpdated);
|
||||
connect(d->m_cppEditorDocument, &CppEditorDocument::semanticInfoUpdated,
|
||||
this, [this](const CppTools::SemanticInfo &info) { updateSemanticInfo(info); });
|
||||
|
||||
connect(d->m_declDefLinkFinder, SIGNAL(foundLink(QSharedPointer<FunctionDeclDefLink>)),
|
||||
this, SLOT(onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefLink>)));
|
||||
connect(d->m_declDefLinkFinder, &FunctionDeclDefLinkFinder::foundLink,
|
||||
this, &CppEditorWidget::onFunctionDeclDefLinkFound);
|
||||
|
||||
connect(&d->m_useSelectionsUpdater,
|
||||
SIGNAL(selectionsForVariableUnderCursorUpdated(QList<QTextEdit::ExtraSelection>)),
|
||||
&CppUseSelectionsUpdater::selectionsForVariableUnderCursorUpdated,
|
||||
&d->m_localRenaming,
|
||||
SLOT(updateSelectionsForVariableUnderCursor(QList<QTextEdit::ExtraSelection>)));
|
||||
&CppLocalRenaming::updateSelectionsForVariableUnderCursor);
|
||||
|
||||
connect(&d->m_useSelectionsUpdater, &CppUseSelectionsUpdater::finished,
|
||||
[this] (SemanticInfo::LocalUseMap localUses) {
|
||||
@@ -180,15 +180,15 @@ void CppEditorWidget::finalizeInitialization()
|
||||
d->m_lastSemanticInfo.localUses = localUses;
|
||||
});
|
||||
|
||||
connect(document(), SIGNAL(contentsChange(int,int,int)),
|
||||
&d->m_localRenaming, SLOT(onContentsChangeOfEditorWidgetDocument(int,int,int)));
|
||||
connect(document(), &QTextDocument::contentsChange,
|
||||
&d->m_localRenaming, &CppLocalRenaming::onContentsChangeOfEditorWidgetDocument);
|
||||
connect(&d->m_localRenaming, &CppLocalRenaming::finished, [this] {
|
||||
cppEditorDocument()->recalculateSemanticInfoDetached();
|
||||
});
|
||||
connect(&d->m_localRenaming, &CppLocalRenaming::processKeyPressNormally,
|
||||
this, &CppEditorWidget::processKeyNormally);
|
||||
connect(this, SIGNAL(cursorPositionChanged()),
|
||||
d->m_cppEditorOutline, SLOT(updateIndex()));
|
||||
connect(this, &QPlainTextEdit::cursorPositionChanged,
|
||||
d->m_cppEditorOutline, &CppEditorOutline::updateIndex);
|
||||
|
||||
connect(cppEditorDocument(), &CppEditorDocument::preprocessorSettingsChanged,
|
||||
[this](bool customSettings) {
|
||||
@@ -199,10 +199,10 @@ void CppEditorWidget::finalizeInitialization()
|
||||
// set up function declaration - definition link
|
||||
d->m_updateFunctionDeclDefLinkTimer.setSingleShot(true);
|
||||
d->m_updateFunctionDeclDefLinkTimer.setInterval(UPDATE_FUNCTION_DECL_DEF_LINK_INTERVAL);
|
||||
connect(&d->m_updateFunctionDeclDefLinkTimer, SIGNAL(timeout()),
|
||||
this, SLOT(updateFunctionDeclDefLinkNow()));
|
||||
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateFunctionDeclDefLink()));
|
||||
connect(this, SIGNAL(textChanged()), this, SLOT(updateFunctionDeclDefLink()));
|
||||
connect(&d->m_updateFunctionDeclDefLinkTimer, &QTimer::timeout,
|
||||
this, &CppEditorWidget::updateFunctionDeclDefLinkNow);
|
||||
connect(this, &QPlainTextEdit::cursorPositionChanged, this, &CppEditorWidget::updateFunctionDeclDefLink);
|
||||
connect(this, &QPlainTextEdit::textChanged, this, &CppEditorWidget::updateFunctionDeclDefLink);
|
||||
|
||||
// set up the use highlighitng
|
||||
connect(this, &CppEditorWidget::cursorPositionChanged, [this]() {
|
||||
@@ -217,9 +217,9 @@ void CppEditorWidget::finalizeInitialization()
|
||||
d->m_preprocessorButton = new QToolButton(this);
|
||||
d->m_preprocessorButton->setText(QLatin1String("#"));
|
||||
Command *cmd = ActionManager::command(Constants::OPEN_PREPROCESSOR_DIALOG);
|
||||
connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePreprocessorButtonTooltip()));
|
||||
connect(cmd, &Command::keySequenceChanged, this, &CppEditorWidget::updatePreprocessorButtonTooltip);
|
||||
updatePreprocessorButtonTooltip();
|
||||
connect(d->m_preprocessorButton, SIGNAL(clicked()), this, SLOT(showPreProcessorWidget()));
|
||||
connect(d->m_preprocessorButton, &QAbstractButton::clicked, this, &CppEditorWidget::showPreProcessorWidget);
|
||||
insertExtraToolBarWidget(TextEditorWidget::Left, d->m_preprocessorButton);
|
||||
insertExtraToolBarWidget(TextEditorWidget::Left, d->m_cppEditorOutline->widget());
|
||||
}
|
||||
@@ -558,7 +558,8 @@ void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e)
|
||||
quickFixMenu->addAction(ActionManager::command(Constants::RENAME_SYMBOL_UNDER_CURSOR)->action());
|
||||
|
||||
QSignalMapper mapper;
|
||||
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
|
||||
connect(&mapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped),
|
||||
this, &CppEditorWidget::performQuickFix);
|
||||
if (isSemanticInfoValidExceptLocalUses()) {
|
||||
d->m_useSelectionsUpdater.update(CppUseSelectionsUpdater::Synchronous);
|
||||
AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
|
||||
@@ -574,7 +575,8 @@ void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e)
|
||||
d->m_quickFixes.append(op);
|
||||
QAction *action = quickFixMenu->addAction(op->description());
|
||||
mapper.setMapping(action, index);
|
||||
connect(action, SIGNAL(triggered()), &mapper, SLOT(map()));
|
||||
connect(action, &QAction::triggered,
|
||||
&mapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
}
|
||||
delete model;
|
||||
}
|
||||
@@ -775,8 +777,8 @@ void CppEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL
|
||||
IDocument *targetDocument = DocumentModel::documentForFilePath( d->m_declDefLink->targetFile->fileName());
|
||||
if (textDocument() != targetDocument) {
|
||||
if (auto textDocument = qobject_cast<BaseTextDocument *>(targetDocument))
|
||||
connect(textDocument, SIGNAL(contentsChanged()),
|
||||
this, SLOT(abortDeclDefLink()));
|
||||
connect(textDocument, &IDocument::contentsChanged,
|
||||
this, &CppEditorWidget::abortDeclDefLink);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -811,8 +813,8 @@ void CppEditorWidget::abortDeclDefLink()
|
||||
IDocument *targetDocument = DocumentModel::documentForFilePath(d->m_declDefLink->targetFile->fileName());
|
||||
if (textDocument() != targetDocument) {
|
||||
if (auto textDocument = qobject_cast<BaseTextDocument *>(targetDocument))
|
||||
disconnect(textDocument, SIGNAL(contentsChanged()),
|
||||
this, SLOT(abortDeclDefLink()));
|
||||
disconnect(textDocument, &IDocument::contentsChanged,
|
||||
this, &CppEditorWidget::abortDeclDefLink);
|
||||
}
|
||||
|
||||
d->m_declDefLink->hideMarker(this);
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
|
||||
void encourageApply() override;
|
||||
|
||||
public slots:
|
||||
void paste() override;
|
||||
void cut() override;
|
||||
void selectAll() override;
|
||||
@@ -105,10 +104,9 @@ protected:
|
||||
|
||||
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker) override;
|
||||
|
||||
protected slots:
|
||||
void slotCodeStyleSettingsChanged(const QVariant &) override;
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void updateFunctionDeclDefLink();
|
||||
void updateFunctionDeclDefLinkNow();
|
||||
void abortDeclDefLink();
|
||||
@@ -130,7 +128,6 @@ private slots:
|
||||
|
||||
void processKeyNormally(QKeyEvent *e);
|
||||
|
||||
private:
|
||||
void finalizeInitialization() override;
|
||||
void finalizeInitializationAfterDuplication(TextEditorWidget *other) override;
|
||||
|
||||
|
||||
@@ -102,11 +102,15 @@ CppEditorDocument::CppEditorDocument()
|
||||
setSyntaxHighlighter(new CppHighlighter);
|
||||
setIndenter(new CppTools::CppQtStyleIndenter);
|
||||
|
||||
connect(this, SIGNAL(tabSettingsChanged()), this, SLOT(invalidateFormatterCache()));
|
||||
connect(this, SIGNAL(mimeTypeChanged()), this, SLOT(onMimeTypeChanged()));
|
||||
connect(this, &TextEditor::TextDocument::tabSettingsChanged,
|
||||
this, &CppEditorDocument::invalidateFormatterCache);
|
||||
connect(this, &Core::IDocument::mimeTypeChanged,
|
||||
this, &CppEditorDocument::onMimeTypeChanged);
|
||||
|
||||
connect(this, SIGNAL(aboutToReload()), this, SLOT(onAboutToReload()));
|
||||
connect(this, SIGNAL(reloadFinished(bool)), this, SLOT(onReloadFinished()));
|
||||
connect(this, &Core::IDocument::aboutToReload,
|
||||
this, &CppEditorDocument::onAboutToReload);
|
||||
connect(this, &Core::IDocument::reloadFinished,
|
||||
this, &CppEditorDocument::onReloadFinished);
|
||||
connect(this, &IDocument::filePathChanged,
|
||||
this, &CppEditorDocument::onFilePathChanged);
|
||||
|
||||
@@ -208,8 +212,8 @@ void CppEditorDocument::onFilePathChanged(const Utils::FileName &oldPath,
|
||||
Utils::MimeDatabase mdb;
|
||||
setMimeType(mdb.mimeTypeForFile(newPath.toFileInfo()).name());
|
||||
|
||||
disconnect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
||||
connect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
||||
disconnect(this, &Core::IDocument::contentsChanged, this, &CppEditorDocument::scheduleProcessDocument);
|
||||
connect(this, &Core::IDocument::contentsChanged, this, &CppEditorDocument::scheduleProcessDocument);
|
||||
|
||||
// Un-Register/Register in ModelManager
|
||||
m_editorDocumentHandle.reset();
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
|
||||
void setPreprocessorSettings(const CppTools::ProjectPart::Ptr &projectPart,
|
||||
const QByteArray &defines);
|
||||
void scheduleProcessDocument();
|
||||
|
||||
signals:
|
||||
void codeWarningsUpdated(unsigned contentsRevision,
|
||||
@@ -71,13 +72,10 @@ signals:
|
||||
|
||||
void preprocessorSettingsChanged(bool customSettings);
|
||||
|
||||
public slots:
|
||||
void scheduleProcessDocument();
|
||||
|
||||
protected:
|
||||
void applyFontSettings() override;
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void invalidateFormatterCache();
|
||||
void onFilePathChanged(const Utils::FileName &oldPath, const Utils::FileName &newPath);
|
||||
void onMimeTypeChanged();
|
||||
@@ -87,7 +85,6 @@ private slots:
|
||||
|
||||
void processDocument();
|
||||
|
||||
private:
|
||||
QByteArray contentsText() const;
|
||||
unsigned contentsRevision() const;
|
||||
|
||||
|
||||
@@ -170,15 +170,15 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
cmd = ActionManager::registerAction(openPreprocessorDialog,
|
||||
Constants::OPEN_PREPROCESSOR_DIALOG, context);
|
||||
cmd->setDefaultKeySequence(QKeySequence());
|
||||
connect(openPreprocessorDialog, SIGNAL(triggered()), this, SLOT(showPreProcessorDialog()));
|
||||
connect(openPreprocessorDialog, &QAction::triggered, this, &CppEditorPlugin::showPreProcessorDialog);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Function Declaration/Definition"), this);
|
||||
cmd = ActionManager::registerAction(switchDeclarationDefinition,
|
||||
Constants::SWITCH_DECLARATION_DEFINITION, context, true);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2")));
|
||||
connect(switchDeclarationDefinition, SIGNAL(triggered()),
|
||||
this, SLOT(switchDeclarationDefinition()));
|
||||
connect(switchDeclarationDefinition, &QAction::triggered,
|
||||
this, &CppEditorPlugin::switchDeclarationDefinition);
|
||||
contextMenu->addAction(cmd);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
@@ -192,28 +192,28 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
cmd->setDefaultKeySequence(QKeySequence(HostOsInfo::isMacHost()
|
||||
? tr("Meta+E, Shift+F2")
|
||||
: tr("Ctrl+E, Shift+F2")));
|
||||
connect(openDeclarationDefinitionInNextSplit, SIGNAL(triggered()),
|
||||
this, SLOT(openDeclarationDefinitionInNextSplit()));
|
||||
connect(openDeclarationDefinitionInNextSplit, &QAction::triggered,
|
||||
this, &CppEditorPlugin::openDeclarationDefinitionInNextSplit);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
m_findUsagesAction = new QAction(tr("Find Usages"), this);
|
||||
cmd = ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
|
||||
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
|
||||
connect(m_findUsagesAction, &QAction::triggered, this, &CppEditorPlugin::findUsages);
|
||||
contextMenu->addAction(cmd);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this);
|
||||
cmd = ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context);
|
||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+T") : tr("Ctrl+Shift+T")));
|
||||
connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy()));
|
||||
connect(m_openTypeHierarchyAction, &QAction::triggered, this, &CppEditorPlugin::openTypeHierarchy);
|
||||
contextMenu->addAction(cmd);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
m_openIncludeHierarchyAction = new QAction(tr("Open Include Hierarchy"), this);
|
||||
cmd = ActionManager::registerAction(m_openIncludeHierarchyAction, Constants::OPEN_INCLUDE_HIERARCHY, context);
|
||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+I") : tr("Ctrl+Shift+I")));
|
||||
connect(m_openIncludeHierarchyAction, SIGNAL(triggered()), this, SLOT(openIncludeHierarchy()));
|
||||
connect(m_openIncludeHierarchyAction, &QAction::triggered, this, &CppEditorPlugin::openIncludeHierarchy);
|
||||
contextMenu->addAction(cmd);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
@@ -228,8 +228,8 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
Constants::RENAME_SYMBOL_UNDER_CURSOR,
|
||||
context);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R")));
|
||||
connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()),
|
||||
this, SLOT(renameSymbolUnderCursor()));
|
||||
connect(m_renameSymbolUnderCursorAction, &QAction::triggered,
|
||||
this, &CppEditorPlugin::renameSymbolUnderCursor);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
// Update context in global context
|
||||
@@ -237,14 +237,14 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
m_reparseExternallyChangedFiles = new QAction(tr("Reparse Externally Changed Files"), this);
|
||||
cmd = ActionManager::registerAction(m_reparseExternallyChangedFiles, Constants::UPDATE_CODEMODEL);
|
||||
CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance();
|
||||
connect(m_reparseExternallyChangedFiles, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
|
||||
connect(m_reparseExternallyChangedFiles, &QAction::triggered, cppModelManager, &CppTools::CppModelManager::updateModifiedSourceFiles);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
cppToolsMenu->addSeparator();
|
||||
QAction *inspectCppCodeModel = new QAction(tr("Inspect C++ Code Model..."), this);
|
||||
cmd = ActionManager::registerAction(inspectCppCodeModel, Constants::INSPECT_CPP_CODEMODEL);
|
||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+F12") : tr("Ctrl+Shift+F12")));
|
||||
connect(inspectCppCodeModel, SIGNAL(triggered()), this, SLOT(inspectCppCodeModel()));
|
||||
connect(inspectCppCodeModel, &QAction::triggered, this, &CppEditorPlugin::inspectCppCodeModel);
|
||||
cppToolsMenu->addAction(cmd);
|
||||
|
||||
contextMenu->addSeparator(context);
|
||||
@@ -255,10 +255,10 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
cmd = ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
|
||||
contextMenu->addAction(cmd);
|
||||
|
||||
connect(ProgressManager::instance(), SIGNAL(taskStarted(Core::Id)),
|
||||
this, SLOT(onTaskStarted(Core::Id)));
|
||||
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
|
||||
this, SLOT(onAllTasksFinished(Core::Id)));
|
||||
connect(ProgressManager::instance(), &ProgressManager::taskStarted,
|
||||
this, &CppEditorPlugin::onTaskStarted);
|
||||
connect(ProgressManager::instance(), &ProgressManager::allTasksFinished,
|
||||
this, &CppEditorPlugin::onAllTasksFinished);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ signals:
|
||||
void typeHierarchyRequested();
|
||||
void includeHierarchyRequested();
|
||||
|
||||
public slots:
|
||||
public:
|
||||
void openDeclarationDefinitionInNextSplit();
|
||||
void openTypeHierarchy();
|
||||
void openIncludeHierarchy();
|
||||
@@ -73,7 +73,7 @@ public slots:
|
||||
void renameSymbolUnderCursor();
|
||||
void switchDeclarationDefinition();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void onTaskStarted(Core::Id type);
|
||||
void onAllTasksFinished(Core::Id type);
|
||||
void inspectCppCodeModel();
|
||||
|
||||
@@ -255,7 +255,7 @@ void FunctionDeclDefLinkFinder::startFindLinkAt(
|
||||
|
||||
// handle the rest in a thread
|
||||
m_watcher.reset(new QFutureWatcher<QSharedPointer<FunctionDeclDefLink> >());
|
||||
connect(m_watcher.data(), SIGNAL(finished()), this, SLOT(onFutureDone()));
|
||||
connect(m_watcher.data(), &QFutureWatcherBase::finished, this, &FunctionDeclDefLinkFinder::onFutureDone);
|
||||
m_watcher->setFuture(Utils::runAsync(findLinkHelper, result, refactoringChanges));
|
||||
}
|
||||
|
||||
|
||||
@@ -56,10 +56,9 @@ public:
|
||||
signals:
|
||||
void foundLink(QSharedPointer<FunctionDeclDefLink> link);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void onFutureDone();
|
||||
|
||||
private:
|
||||
QTextCursor m_scannedSelection;
|
||||
QTextCursor m_nameSelection;
|
||||
QScopedPointer<QFutureWatcher<QSharedPointer<FunctionDeclDefLink> > > m_watcher;
|
||||
|
||||
@@ -73,7 +73,7 @@ CppIncludeHierarchyWidget::CppIncludeHierarchyWidget() :
|
||||
m_treeView->setModel(m_model);
|
||||
m_treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
m_treeView->setItemDelegate(m_delegate);
|
||||
connect(m_treeView, SIGNAL(activated(QModelIndex)), this, SLOT(onItemActivated(QModelIndex)));
|
||||
connect(m_treeView, &QAbstractItemView::activated, this, &CppIncludeHierarchyWidget::onItemActivated);
|
||||
|
||||
m_includeHierarchyInfoLabel = new QLabel(tr("No include hierarchy available"), this);
|
||||
m_includeHierarchyInfoLabel->setAlignment(Qt::AlignCenter);
|
||||
@@ -92,9 +92,10 @@ CppIncludeHierarchyWidget::CppIncludeHierarchyWidget() :
|
||||
layout->addWidget(m_includeHierarchyInfoLabel);
|
||||
setLayout(layout);
|
||||
|
||||
connect(CppEditorPlugin::instance(), SIGNAL(includeHierarchyRequested()), SLOT(perform()));
|
||||
connect(Core::EditorManager::instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)),
|
||||
this, SLOT(editorsClosed(QList<Core::IEditor*>)));
|
||||
connect(CppEditorPlugin::instance(), &CppEditorPlugin::includeHierarchyRequested,
|
||||
this, &CppIncludeHierarchyWidget::perform);
|
||||
connect(Core::EditorManager::instance(), &Core::EditorManager::editorsClosed,
|
||||
this, &CppIncludeHierarchyWidget::editorsClosed);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -66,14 +66,11 @@ public:
|
||||
CppIncludeHierarchyWidget();
|
||||
virtual ~CppIncludeHierarchyWidget();
|
||||
|
||||
public slots:
|
||||
void perform();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void onItemActivated(const QModelIndex &index);
|
||||
void editorsClosed(QList<Core::IEditor *> editors);
|
||||
|
||||
private:
|
||||
void showNoIncludeHierarchyLabel();
|
||||
void showIncludeHierarchy();
|
||||
|
||||
|
||||
@@ -108,10 +108,8 @@ protected:
|
||||
void setInsertOverrideReplacement(bool insert);
|
||||
void setOverrideReplacement(const QString &replacements);
|
||||
|
||||
private slots:
|
||||
void setHideReimplementedFunctions(bool hide);
|
||||
|
||||
private:
|
||||
void setHideReimplementedFunctions(bool hide);
|
||||
void updateOverrideReplacementsComboBox();
|
||||
|
||||
private:
|
||||
@@ -1050,16 +1048,16 @@ void InsertVirtualMethodsDialog::initGui()
|
||||
// Bottom button box
|
||||
m_buttons = new QDialogButtonBox(this);
|
||||
m_buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(m_buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(m_buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(m_buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
globalVerticalLayout->addWidget(groupBoxView, 9);
|
||||
globalVerticalLayout->addWidget(groupBoxImplementation, 0);
|
||||
globalVerticalLayout->addWidget(m_buttons, 0);
|
||||
setLayout(globalVerticalLayout);
|
||||
|
||||
connect(m_hideReimplementedFunctions, SIGNAL(toggled(bool)),
|
||||
this, SLOT(setHideReimplementedFunctions(bool)));
|
||||
connect(m_hideReimplementedFunctions, &QAbstractButton::toggled,
|
||||
this, &InsertVirtualMethodsDialog::setHideReimplementedFunctions);
|
||||
connect(m_filter, &QLineEdit::textChanged,
|
||||
classFunctionFilterModel, &QSortFilterProxyModel::setFilterWildcard);
|
||||
}
|
||||
|
||||
@@ -57,17 +57,14 @@ public:
|
||||
bool handleKeyPressEvent(QKeyEvent *e);
|
||||
|
||||
bool encourageApply();
|
||||
void onContentsChangeOfEditorWidgetDocument(int position, int charsRemoved, int charsAdded);
|
||||
|
||||
public slots:
|
||||
void updateSelectionsForVariableUnderCursor(const QList<QTextEdit::ExtraSelection> &selections);
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
void processKeyPressNormally(QKeyEvent *e);
|
||||
|
||||
private slots:
|
||||
void onContentsChangeOfEditorWidgetDocument(int position, int charsRemoved, int charsAdded);
|
||||
|
||||
private:
|
||||
CppLocalRenaming();
|
||||
|
||||
|
||||
@@ -61,8 +61,10 @@ void CppOutlineTreeView::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
QMenu contextMenu;
|
||||
|
||||
contextMenu.addAction(tr("Expand All"), this, SLOT(expandAll()));
|
||||
contextMenu.addAction(tr("Collapse All"), this, SLOT(collapseAll()));
|
||||
QAction *action = contextMenu.addAction(tr("Expand All"));
|
||||
connect(action, &QAction::triggered, this, &QTreeView::expandAll);
|
||||
action = contextMenu.addAction(tr("Collapse All"));
|
||||
connect(action, &QAction::triggered, this, &QTreeView::collapseAll);
|
||||
|
||||
contextMenu.exec(event->globalPos());
|
||||
|
||||
@@ -115,13 +117,13 @@ CppOutlineWidget::CppOutlineWidget(CppEditorWidget *editor) :
|
||||
m_treeView->setModel(m_proxyModel);
|
||||
setFocusProxy(m_treeView);
|
||||
|
||||
connect(m_model, SIGNAL(modelReset()), this, SLOT(modelUpdated()));
|
||||
connect(m_model, &QAbstractItemModel::modelReset, this, &CppOutlineWidget::modelUpdated);
|
||||
modelUpdated();
|
||||
|
||||
connect(m_editor->outline(), SIGNAL(modelIndexChanged(QModelIndex)),
|
||||
this, SLOT(updateSelectionInTree(QModelIndex)));
|
||||
connect(m_treeView, SIGNAL(activated(QModelIndex)),
|
||||
this, SLOT(onItemActivated(QModelIndex)));
|
||||
connect(m_editor->outline(), &CppTools::CppEditorOutline::modelIndexChanged,
|
||||
this, &CppOutlineWidget::updateSelectionInTree);
|
||||
connect(m_treeView, &QAbstractItemView::activated,
|
||||
this, &CppOutlineWidget::onItemActivated);
|
||||
}
|
||||
|
||||
QList<QAction*> CppOutlineWidget::filterMenuActions() const
|
||||
|
||||
@@ -70,13 +70,11 @@ public:
|
||||
virtual QList<QAction*> filterMenuActions() const;
|
||||
virtual void setCursorSynchronization(bool syncWithCursor);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void modelUpdated();
|
||||
void updateSelectionInTree(const QModelIndex &index);
|
||||
void updateTextCursor(const QModelIndex &index);
|
||||
void onItemActivated(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
bool syncCursor();
|
||||
|
||||
private:
|
||||
|
||||
@@ -75,8 +75,10 @@ CppPreProcessorDialog::CppPreProcessorDialog(QWidget *parent, const QString &fil
|
||||
m_ui->projectComboBox->setCurrentIndex(currentIndex);
|
||||
m_ui->editWidget->setPlainText(m_partAdditions.value(currentIndex).additionalDirectives);
|
||||
|
||||
connect(m_ui->projectComboBox, SIGNAL(currentIndexChanged(int)), SLOT(projectChanged(int)));
|
||||
connect(m_ui->editWidget, SIGNAL(textChanged()), SLOT(textChanged()));
|
||||
connect(m_ui->projectComboBox,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &CppPreProcessorDialog::projectChanged);
|
||||
connect(m_ui->editWidget, &QPlainTextEdit::textChanged, this, &CppPreProcessorDialog::textChanged);
|
||||
}
|
||||
|
||||
CppPreProcessorDialog::~CppPreProcessorDialog()
|
||||
|
||||
@@ -47,11 +47,10 @@ public:
|
||||
CppTools::ProjectPart::Ptr projectPart() const;
|
||||
QString additionalPreProcessorDirectives() const;
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void projectChanged(int index);
|
||||
void textChanged();
|
||||
|
||||
private:
|
||||
struct ProjectPartAddition {
|
||||
CppTools::ProjectPart::Ptr projectPart;
|
||||
QString additionalDirectives;
|
||||
|
||||
@@ -129,7 +129,7 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget() :
|
||||
m_stackLayout->setCurrentWidget(m_noTypeHierarchyAvailableLabel);
|
||||
setLayout(m_stackLayout);
|
||||
|
||||
connect(CppEditorPlugin::instance(), SIGNAL(typeHierarchyRequested()), SLOT(perform()));
|
||||
connect(CppEditorPlugin::instance(), &CppEditorPlugin::typeHierarchyRequested, this, &CppTypeHierarchyWidget::perform);
|
||||
}
|
||||
|
||||
CppTypeHierarchyWidget::~CppTypeHierarchyWidget()
|
||||
|
||||
@@ -76,7 +76,6 @@ public:
|
||||
CppTypeHierarchyWidget();
|
||||
virtual ~CppTypeHierarchyWidget();
|
||||
|
||||
public slots:
|
||||
void perform();
|
||||
|
||||
private:
|
||||
|
||||
@@ -235,7 +235,7 @@ CppUseSelectionsUpdater::CppUseSelectionsUpdater(TextEditor::TextEditorWidget *e
|
||||
{
|
||||
m_timer.setSingleShot(true);
|
||||
m_timer.setInterval(updateUseSelectionsInternalInMs);
|
||||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
connect(&m_timer, &QTimer::timeout, this, [this]() { update(); });
|
||||
}
|
||||
|
||||
void CppUseSelectionsUpdater::scheduleUpdate()
|
||||
@@ -344,7 +344,7 @@ void CppUseSelectionsUpdater::handleSymbolCaseAsynchronously(const Document::Ptr
|
||||
if (m_findUsesWatcher)
|
||||
m_findUsesWatcher->cancel();
|
||||
m_findUsesWatcher.reset(new QFutureWatcher<UseSelectionsResult>);
|
||||
connect(m_findUsesWatcher.data(), SIGNAL(finished()), this, SLOT(onFindUsesFinished()));
|
||||
connect(m_findUsesWatcher.data(), &QFutureWatcherBase::finished, this, &CppUseSelectionsUpdater::onFindUsesFinished);
|
||||
|
||||
m_findUsesRevision = textDocument()->revision();
|
||||
m_findUsesCursorPosition = m_editorWidget->position();
|
||||
|
||||
@@ -65,7 +65,6 @@ public:
|
||||
|
||||
enum CallType { Synchronous, Asynchronous };
|
||||
|
||||
public slots:
|
||||
void scheduleUpdate();
|
||||
void abortSchedule();
|
||||
void update(CallType callType = Asynchronous);
|
||||
@@ -74,12 +73,10 @@ signals:
|
||||
void finished(CppTools::SemanticInfo::LocalUseMap localUses);
|
||||
void selectionsForVariableUnderCursorUpdated(const QList<QTextEdit::ExtraSelection> &);
|
||||
|
||||
private slots:
|
||||
void onFindUsesFinished();
|
||||
|
||||
private:
|
||||
CppUseSelectionsUpdater();
|
||||
|
||||
void onFindUsesFinished();
|
||||
bool handleMacroCase(const CPlusPlus::Document::Ptr document);
|
||||
void handleSymbolCaseAsynchronously(const CPlusPlus::Document::Ptr document,
|
||||
const CPlusPlus::Snapshot &snapshot);
|
||||
|
||||
@@ -419,7 +419,7 @@ void InvokeCompletionTokenAction::run(CppEditorWidget *editorWidget)
|
||||
{
|
||||
// Invoke assistant and wait until it is finished
|
||||
QEventLoop loop;
|
||||
QObject::connect(editorWidget, SIGNAL(assistFinished()), &loop, SLOT(quit()));
|
||||
QObject::connect(editorWidget, &TextEditorWidget::assistFinished, &loop, &QEventLoop::quit);
|
||||
editorWidget->invokeAssist(Completion);
|
||||
loop.exec();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user