Debugger: Re-enable item selection in watches for core dump

In 7de7eb6bca the behavior on Unrunnable
state was changed, probably by mistake.

AddWatcherWhileRunningCapability should allow adding watchers while
running, but it should not prevent selection when not supported and
the inferior is not running.

Another missing part was that Unrunnable was considered running,
although it shouldn't.

Change-Id: I7d27b81977a6921919327b3122a865b7ffa2d0bd
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2016-03-20 12:27:51 +02:00
committed by Orgad Shaneh
parent 9ddf44cb9a
commit 658d29335b

View File

@@ -1078,16 +1078,24 @@ Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
const Qt::ItemFlags notEditable = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
const Qt::ItemFlags editable = notEditable | Qt::ItemIsEditable;
bool isRunning = true;
switch (state) {
case InferiorStopOk:
case InferiorUnrunnable:
case DebuggerNotReady:
case DebuggerFinished:
isRunning = false;
break;
default:
break;
}
if (item->isWatcher()) {
if (state == InferiorUnrunnable)
return (column == 0 && item->iname.count('.') == 1) ? editable : notEditable;
if (state != InferiorStopOk
&& state != DebuggerNotReady
&& state != DebuggerFinished
&& !m_engine->hasCapability(AddWatcherWhileRunningCapability))
return Qt::ItemFlags();
if (isRunning && !m_engine->hasCapability(AddWatcherWhileRunningCapability))
return notEditable;
if (column == 0 && item->iname.count('.') == 1)
return editable; // Watcher names are editable.
if (column == 1 && item->arrayIndex >= 0)
@@ -1101,8 +1109,10 @@ Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
return editable; // Watcher values are sometimes editable.
}
} else if (item->isLocal()) {
if (state != InferiorStopOk && !m_engine->hasCapability(AddWatcherWhileRunningCapability))
return Qt::ItemFlags();
if (state == InferiorUnrunnable)
return notEditable;
if (isRunning && !m_engine->hasCapability(AddWatcherWhileRunningCapability))
return notEditable;
if (column == 1 && item->valueEditable && !item->elided)
return editable; // Locals values are sometimes editable.
if (column == 1 && item->arrayIndex >= 0)