forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user