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