CppEditor: Populate the refactor menu on demand

That is, collect the quickfixes only when the refactor menu is expanded,
not when opening the context menu.

Task-number: QTCREATORBUG-29611
Change-Id: Ib827940ecbe8878e0b695e4f453926f759b05572
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Christian Kandeler
2023-09-20 14:31:46 +02:00
parent 979e446e84
commit 493d1873d2

View File

@@ -1089,11 +1089,15 @@ protected:
QMenu *CppEditorWidget::createRefactorMenu(QWidget *parent) const
{
auto *menu = new QMenu(Tr::tr("&Refactor"), parent);
connect(menu, &QMenu::aboutToShow, this, [this, menu] {
menu->disconnect(this);
// ### enable
// updateSemanticInfo(m_semanticHighlighter->semanticInfo(currentSource()));
// ### enable
// updateSemanticInfo(m_semanticHighlighter->semanticInfo(currentSource()));
if (!isSemanticInfoValidExceptLocalUses())
return;
if (isSemanticInfoValidExceptLocalUses()) {
d->m_useSelectionsUpdater.abortSchedule();
const CppUseSelectionsUpdater::RunnerInfo runnerInfo = d->m_useSelectionsUpdater.update();
@@ -1118,7 +1122,7 @@ QMenu *CppEditorWidget::createRefactorMenu(QWidget *parent) const
case CppUseSelectionsUpdater::RunnerInfo::Invalid:
QTC_CHECK(false && "Unexpected CppUseSelectionsUpdater runner result");
}
}
});
return menu;
}