TreeView: Fix mapping to source models in case ProxyModels are involved

Visible e.g. in context menu handling of the debugger's module view.

Change-Id: I342ed262c9e3dcdf98590003a7930cb8ef4ca0d2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2019-02-28 15:21:50 +01:00
parent 5ca9ac4777
commit f7c350d782
7 changed files with 34 additions and 9 deletions

View File

@@ -1661,8 +1661,8 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
// Delete by file: Find indices of breakpoints of the same file.
QList<Breakpoint> breakpointsInFile;
QString file;
if (Breakpoint bp = itemForIndexAtLevel<1>(ev.index())) {
const QModelIndex index = ev.index().sibling(ev.index().row(), BreakpointFileColumn);
if (Breakpoint bp = itemForIndexAtLevel<1>(ev.sourceModelIndex())) {
const QModelIndex index = ev.sourceModelIndex().sibling(ev.sourceModelIndex().row(), BreakpointFileColumn);
if (!file.isEmpty()) {
for (int i = 0; i != rowCount(); ++i)
if (index.data().toString() == file)
@@ -2626,7 +2626,7 @@ bool BreakpointManager::contextMenuEvent(const ItemViewEvent &ev)
// Delete by file: Find indices of breakpoints of the same file.
GlobalBreakpoints breakpointsInFile;
QString file;
if (GlobalBreakpoint gbp = itemForIndexAtLevel<1>(ev.index())) {
if (GlobalBreakpoint gbp = itemForIndexAtLevel<1>(ev.sourceModelIndex())) {
if (!file.isEmpty()) {
for (int i = 0; i != rowCount(); ++i)
if (gbp->markerFileName() == file)