Designer: Update C++ code model on an object name change in designer

We try to locate the old symbol name in the generated ui header and
rename the symbol in the background.

Task-number: QTCREATORBUG-1179
Change-Id: Iaf68e3922cd728cbc87d0dc97125e34b8bdaa6be
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-01-16 17:03:26 +01:00
parent b4b2600715
commit 0d909c353c
36 changed files with 470 additions and 63 deletions

View File

@@ -109,7 +109,8 @@ public:
ClangdFindReferences::ClangdFindReferences(ClangdClient *client, TextDocument *document,
const QTextCursor &cursor, const QString &searchTerm,
const std::optional<QString> &replacement, bool categorize)
const std::optional<QString> &replacement, const std::function<void()> &callback,
bool categorize)
: QObject(client), d(new ClangdFindReferences::Private(this))
{
d->categorize = categorize;
@@ -130,6 +131,7 @@ ClangdFindReferences::ClangdFindReferences(ClangdClient *client, TextDocument *d
replacement ? SearchResultWindow::SearchAndReplace : SearchResultWindow::SearchOnly,
SearchResultWindow::PreserveCaseDisabled,
"CppEditor");
d->search->makeNonInteractive(callback);
if (categorize)
d->search->setFilter(new CppSearchResultFilter);
if (d->replacementData) {
@@ -150,7 +152,8 @@ ClangdFindReferences::ClangdFindReferences(ClangdClient *client, TextDocument *d
connect(d->search, &SearchResult::activated, [](const SearchResultItem& item) {
EditorManager::openEditorAtSearchResult(item);
});
SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
if (d->search->isInteractive())
SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
const std::optional<MessageId> requestId = client->symbolSupport().findUsages(
document, cursor, [self = QPointer(this)](const QList<Location> &locations) {