aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2023-05-05 12:26:48 +0200
committerDavid Schulz <david.schulz@qt.io>2023-05-08 07:46:00 +0000
commit78fe0c315ee18358f0aa2bc3452d3d19efac73b4 (patch)
tree98e1090eeeeac8daf7880ed118e1f6a26046c41d
parent82b5cc89cb1e1c5e539c7a7961079b213dbcffe5 (diff)
Debugger: fix vanishing editor tooltip on expand
fetchMore is called multiple times before expandNode and seems to invalidate the index that is passed to expandNode. Since we only need to fetch more when we want to expand the item we might as well just integrate the code of fetch more into expandNode. Fixes: QTCREATORBUG-29083 Change-Id: I0e60e9bb03b53de2e86eea232fb5bb98046bbb80 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index f5e9933fbe..70e5235586 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -266,9 +266,20 @@ public:
void expandNode(const QModelIndex &idx)
{
+ if (!m_engine)
+ return;
+
m_expandedINames.insert(idx.data(LocalsINameRole).toString());
- if (canFetchMore(idx))
- fetchMore(idx);
+ if (canFetchMore(idx)) {
+ if (!idx.isValid())
+ return;
+
+ if (auto item = dynamic_cast<ToolTipWatchItem *>(itemForIndex(idx))) {
+ WatchItem *it = m_engine->watchHandler()->findItem(item->iname);
+ if (QTC_GUARD(it))
+ it->model()->fetchMore(it->index());
+ }
+ }
}
void collapseNode(const QModelIndex &idx)
@@ -276,22 +287,6 @@ public:
m_expandedINames.remove(idx.data(LocalsINameRole).toString());
}
- void fetchMore(const QModelIndex &idx) override
- {
- if (!idx.isValid())
- return;
- auto item = dynamic_cast<ToolTipWatchItem *>(itemForIndex(idx));
- if (!item)
- return;
- QString iname = item->iname;
- if (!m_engine)
- return;
-
- WatchItem *it = m_engine->watchHandler()->findItem(iname);
- QTC_ASSERT(it, return);
- it->model()->fetchMore(it->index());
- }
-
void restoreTreeModel(QXmlStreamReader &r);
QPointer<DebuggerEngine> m_engine;