forked from qt-creator/qt-creator
CppEditor: Add context object into connections
Change-Id: I1a74f62b0a42ea4971b14fb82213f662b5fe4736 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -82,7 +82,7 @@ CppCodeModelSettingsWidget::CppCodeModelSettingsWidget(CppCodeModelSettings *s)
|
|||||||
m_ignorePatternTextEdit->setToolTip(m_ignoreFilesCheckBox->toolTip());
|
m_ignorePatternTextEdit->setToolTip(m_ignoreFilesCheckBox->toolTip());
|
||||||
m_ignorePatternTextEdit->setEnabled(m_ignoreFilesCheckBox->isChecked());
|
m_ignorePatternTextEdit->setEnabled(m_ignoreFilesCheckBox->isChecked());
|
||||||
|
|
||||||
connect(m_ignoreFilesCheckBox, &QCheckBox::stateChanged, [this] {
|
connect(m_ignoreFilesCheckBox, &QCheckBox::stateChanged, this, [this] {
|
||||||
m_ignorePatternTextEdit->setEnabled(m_ignoreFilesCheckBox->isChecked());
|
m_ignorePatternTextEdit->setEnabled(m_ignoreFilesCheckBox->isChecked());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -388,8 +388,7 @@ BaseEditorDocumentProcessor *CppEditorDocument::processor()
|
|||||||
{
|
{
|
||||||
if (!m_processor) {
|
if (!m_processor) {
|
||||||
m_processor.reset(CppModelManager::createEditorDocumentProcessor(this));
|
m_processor.reset(CppModelManager::createEditorDocumentProcessor(this));
|
||||||
connect(m_processor.data(),
|
connect(m_processor.data(), &BaseEditorDocumentProcessor::projectPartInfoUpdated, this,
|
||||||
&BaseEditorDocumentProcessor::projectPartInfoUpdated,
|
|
||||||
[this](const ProjectPartInfo &info) {
|
[this](const ProjectPartInfo &info) {
|
||||||
const bool hasProjectPart = !(info.hints & ProjectPartInfo::IsFallbackMatch);
|
const bool hasProjectPart = !(info.hints & ProjectPartInfo::IsFallbackMatch);
|
||||||
minimizableInfoBars()->setInfoVisible(NO_PROJECT_CONFIGURATION, !hasProjectPart);
|
minimizableInfoBars()->setInfoVisible(NO_PROJECT_CONFIGURATION, !hasProjectPart);
|
||||||
@@ -398,15 +397,15 @@ BaseEditorDocumentProcessor *CppEditorDocument::processor()
|
|||||||
const bool isProjectFile = info.hints & ProjectPartInfo::IsFromProjectMatch;
|
const bool isProjectFile = info.hints & ProjectPartInfo::IsFromProjectMatch;
|
||||||
showHideInfoBarAboutMultipleParseContexts(isAmbiguous && isProjectFile);
|
showHideInfoBarAboutMultipleParseContexts(isAmbiguous && isProjectFile);
|
||||||
});
|
});
|
||||||
connect(m_processor.data(), &BaseEditorDocumentProcessor::codeWarningsUpdated,
|
connect(m_processor.data(), &BaseEditorDocumentProcessor::codeWarningsUpdated, this,
|
||||||
[this] (unsigned revision,
|
[this](unsigned revision,
|
||||||
const QList<QTextEdit::ExtraSelection> selections,
|
const QList<QTextEdit::ExtraSelection> selections,
|
||||||
const TextEditor::RefactorMarkers &refactorMarkers) {
|
const TextEditor::RefactorMarkers &refactorMarkers) {
|
||||||
emit codeWarningsUpdated(revision, selections, refactorMarkers);
|
emit codeWarningsUpdated(revision, selections, refactorMarkers);
|
||||||
});
|
});
|
||||||
connect(m_processor.data(), &BaseEditorDocumentProcessor::ifdefedOutBlocksUpdated,
|
connect(m_processor.data(), &BaseEditorDocumentProcessor::ifdefedOutBlocksUpdated,
|
||||||
this, &CppEditorDocument::ifdefedOutBlocksUpdated);
|
this, &CppEditorDocument::ifdefedOutBlocksUpdated);
|
||||||
connect(m_processor.data(), &BaseEditorDocumentProcessor::cppDocumentUpdated,
|
connect(m_processor.data(), &BaseEditorDocumentProcessor::cppDocumentUpdated, this,
|
||||||
[this](const CPlusPlus::Document::Ptr document) {
|
[this](const CPlusPlus::Document::Ptr document) {
|
||||||
// Update syntax highlighter
|
// Update syntax highlighter
|
||||||
auto *highlighter = qobject_cast<CppHighlighter *>(syntaxHighlighter());
|
auto *highlighter = qobject_cast<CppHighlighter *>(syntaxHighlighter());
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ void CppEditorWidget::finalizeInitialization()
|
|||||||
|
|
||||||
connect(document(), &QTextDocument::contentsChange,
|
connect(document(), &QTextDocument::contentsChange,
|
||||||
&d->m_localRenaming, &CppLocalRenaming::onContentsChangeOfEditorWidgetDocument);
|
&d->m_localRenaming, &CppLocalRenaming::onContentsChangeOfEditorWidgetDocument);
|
||||||
connect(&d->m_localRenaming, &CppLocalRenaming::finished, [this] {
|
connect(&d->m_localRenaming, &CppLocalRenaming::finished, this, [this] {
|
||||||
cppEditorDocument()->recalculateSemanticInfoDetached();
|
cppEditorDocument()->recalculateSemanticInfoDetached();
|
||||||
});
|
});
|
||||||
connect(&d->m_localRenaming, &CppLocalRenaming::processKeyPressNormally,
|
connect(&d->m_localRenaming, &CppLocalRenaming::processKeyPressNormally,
|
||||||
|
|||||||
@@ -1048,7 +1048,7 @@ void InsertVirtualMethodsDialog::initGui()
|
|||||||
auto clearUserAddedReplacements = new QAction(this);
|
auto clearUserAddedReplacements = new QAction(this);
|
||||||
clearUserAddedReplacements->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
|
clearUserAddedReplacements->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
|
||||||
clearUserAddedReplacements->setText(Tr::tr("Clear Added \"override\" Equivalents"));
|
clearUserAddedReplacements->setText(Tr::tr("Clear Added \"override\" Equivalents"));
|
||||||
connect(clearUserAddedReplacements, &QAction::triggered, [this] {
|
connect(clearUserAddedReplacements, &QAction::triggered, this, [this] {
|
||||||
m_availableOverrideReplacements = defaultOverrideReplacements();
|
m_availableOverrideReplacements = defaultOverrideReplacements();
|
||||||
updateOverrideReplacementsComboBox();
|
updateOverrideReplacementsComboBox();
|
||||||
m_clearUserAddedReplacementsButton->setEnabled(false);
|
m_clearUserAddedReplacementsButton->setEnabled(false);
|
||||||
|
|||||||
@@ -8907,9 +8907,8 @@ public:
|
|||||||
QSizePolicy labelSizePolicy = errorLabel->sizePolicy();
|
QSizePolicy labelSizePolicy = errorLabel->sizePolicy();
|
||||||
labelSizePolicy.setRetainSizeWhenHidden(true);
|
labelSizePolicy.setRetainSizeWhenHidden(true);
|
||||||
errorLabel->setSizePolicy(labelSizePolicy);
|
errorLabel->setSizePolicy(labelSizePolicy);
|
||||||
connect(constructorParamsModel,
|
connect(constructorParamsModel, &ConstructorParams::validOrder, this,
|
||||||
&ConstructorParams::validOrder,
|
[errorLabel, button = buttonBox->button(QDialogButtonBox::Ok)](bool valid) {
|
||||||
[=, button = buttonBox->button(QDialogButtonBox::Ok)](bool valid) {
|
|
||||||
button->setEnabled(valid);
|
button->setEnabled(valid);
|
||||||
errorLabel->setVisible(!valid);
|
errorLabel->setVisible(!valid);
|
||||||
});
|
});
|
||||||
@@ -8917,7 +8916,8 @@ public:
|
|||||||
// setup select all/none checkbox
|
// setup select all/none checkbox
|
||||||
QCheckBox *const checkBox = new QCheckBox(Tr::tr("Initialize all members"));
|
QCheckBox *const checkBox = new QCheckBox(Tr::tr("Initialize all members"));
|
||||||
checkBox->setChecked(true);
|
checkBox->setChecked(true);
|
||||||
connect(checkBox, &QCheckBox::stateChanged, [model = constructorParamsModel](int state) {
|
connect(checkBox, &QCheckBox::stateChanged, this,
|
||||||
|
[model = constructorParamsModel](int state) {
|
||||||
if (state != Qt::PartiallyChecked) {
|
if (state != Qt::PartiallyChecked) {
|
||||||
for (int i = 0; i < model->rowCount(); ++i)
|
for (int i = 0; i < model->rowCount(); ++i)
|
||||||
model->setData(model->index(i, ConstructorParams::ShouldInitColumn),
|
model->setData(model->index(i, ConstructorParams::ShouldInitColumn),
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ CppQuickFixProjectsSettings::CppQuickFixProjectsSettings(ProjectExplorer::Projec
|
|||||||
m_useGlobalSettings = true;
|
m_useGlobalSettings = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connect(project, &ProjectExplorer::Project::aboutToSaveSettings, [this] {
|
connect(project, &ProjectExplorer::Project::aboutToSaveSettings, this, [this] {
|
||||||
auto settings = m_project->namedSettings(QUICK_FIX_SETTINGS_ID).toMap();
|
auto settings = m_project->namedSettings(QUICK_FIX_SETTINGS_ID).toMap();
|
||||||
settings.insert(USE_GLOBAL_SETTINGS, m_useGlobalSettings);
|
settings.insert(USE_GLOBAL_SETTINGS, m_useGlobalSettings);
|
||||||
m_project->setNamedSettings(QUICK_FIX_SETTINGS_ID, settings);
|
m_project->setNamedSettings(QUICK_FIX_SETTINGS_ID, settings);
|
||||||
|
|||||||
@@ -190,24 +190,24 @@ e.g. name = "m_test_foo_":
|
|||||||
connect(m_listWidget_customTemplates, &QListWidget::currentItemChanged,
|
connect(m_listWidget_customTemplates, &QListWidget::currentItemChanged,
|
||||||
this, &CppQuickFixSettingsWidget::currentCustomItemChanged);
|
this, &CppQuickFixSettingsWidget::currentCustomItemChanged);
|
||||||
|
|
||||||
connect(pushButton_addValueType, &QPushButton::clicked, [this] {
|
connect(pushButton_addValueType, &QPushButton::clicked, this, [this] {
|
||||||
auto item = new QListWidgetItem("<type>", m_valueTypes);
|
auto item = new QListWidgetItem("<type>", m_valueTypes);
|
||||||
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled
|
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled
|
||||||
| Qt::ItemNeverHasChildren);
|
| Qt::ItemNeverHasChildren);
|
||||||
m_valueTypes->scrollToItem(item);
|
m_valueTypes->scrollToItem(item);
|
||||||
item->setSelected(true);
|
item->setSelected(true);
|
||||||
});
|
});
|
||||||
connect(pushButton_addCustomTemplate, &QPushButton::clicked, [this] {
|
connect(pushButton_addCustomTemplate, &QPushButton::clicked, this, [this] {
|
||||||
auto item = new QListWidgetItem("<type>", m_listWidget_customTemplates);
|
auto item = new QListWidgetItem("<type>", m_listWidget_customTemplates);
|
||||||
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren);
|
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren);
|
||||||
m_listWidget_customTemplates->scrollToItem(item);
|
m_listWidget_customTemplates->scrollToItem(item);
|
||||||
m_listWidget_customTemplates->setCurrentItem(item);
|
m_listWidget_customTemplates->setCurrentItem(item);
|
||||||
m_lineEdit_customTemplateTypes->setText("<type>");
|
m_lineEdit_customTemplateTypes->setText("<type>");
|
||||||
});
|
});
|
||||||
connect(m_pushButton_removeCustomTemplate, &QPushButton::clicked, [this] {
|
connect(m_pushButton_removeCustomTemplate, &QPushButton::clicked, this, [this] {
|
||||||
delete m_listWidget_customTemplates->currentItem();
|
delete m_listWidget_customTemplates->currentItem();
|
||||||
});
|
});
|
||||||
connect(pushButton_removeValueType, &QPushButton::clicked, [this] {
|
connect(pushButton_removeValueType, &QPushButton::clicked, this, [this] {
|
||||||
delete m_valueTypes->currentItem();
|
delete m_valueTypes->currentItem();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
|||||||
QObject::connect(&t, &QTimer::timeout, &l, &QEventLoop::quit);
|
QObject::connect(&t, &QTimer::timeout, &l, &QEventLoop::quit);
|
||||||
const IAssistProposal *immediateProposal = nullptr;
|
const IAssistProposal *immediateProposal = nullptr;
|
||||||
const IAssistProposal *finalProposal = nullptr;
|
const IAssistProposal *finalProposal = nullptr;
|
||||||
QObject::connect(initialTestFile->m_editorWidget, &CppEditorWidget::proposalsReady,
|
QObject::connect(initialTestFile->m_editorWidget, &CppEditorWidget::proposalsReady, &l,
|
||||||
[&](const IAssistProposal *i, const IAssistProposal *f) {
|
[&](const IAssistProposal *i, const IAssistProposal *f) {
|
||||||
immediateProposal = i;
|
immediateProposal = i;
|
||||||
finalProposal = f;
|
finalProposal = f;
|
||||||
|
|||||||
Reference in New Issue
Block a user