debugger: remove needless indirection

This commit is contained in:
hjk
2010-11-25 18:49:26 +01:00
parent 59c5359213
commit a9f825fc2e
3 changed files with 3 additions and 22 deletions

View File

@@ -580,17 +580,6 @@ static inline QString expression(const WatchItem *item)
QVariant WatchModel::data(const QModelIndex &idx, int role) const QVariant WatchModel::data(const QModelIndex &idx, int role) const
{ {
switch (role) {
case EngineCapabilitiesRole:
return engine()->debuggerCapabilities();
case EngineActionsEnabledRole:
return engine()->debuggerActionsEnabled();
case EngineStateRole:
return QVariant(int(engine()->state()));
}
const WatchItem *item = watchItem(idx); const WatchItem *item = watchItem(idx);
const WatchItem &data = *item; const WatchItem &data = *item;

View File

@@ -334,12 +334,11 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
individualFormatMenu.setEnabled(false); individualFormatMenu.setEnabled(false);
} }
const bool actionsEnabled = modelData(EngineActionsEnabledRole).toBool(); const bool actionsEnabled = engine->debuggerActionsEnabled();
const unsigned engineCapabilities = modelData(EngineCapabilitiesRole).toUInt(); const unsigned engineCapabilities = engine->debuggerCapabilities();
const bool canHandleWatches = const bool canHandleWatches =
actionsEnabled && (engineCapabilities & AddWatcherCapability); actionsEnabled && (engineCapabilities & AddWatcherCapability);
const DebuggerState state = const DebuggerState state = engine->state();
static_cast<DebuggerState>(modelData(EngineStateRole).toInt());
QMenu menu; QMenu menu;
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item")); QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item"));
@@ -592,12 +591,6 @@ void WatchWindow::setModelData
model()->setData(index, value, role); model()->setData(index, value, role);
} }
QVariant WatchWindow::modelData(int role, const QModelIndex &index)
{
QTC_ASSERT(model(), return QVariant());
return model()->data(index, role);
}
void WatchWindow::setWatchpoint(quint64 address) void WatchWindow::setWatchpoint(quint64 address)
{ {
breakHandler()->setWatchpointByAddress(address); breakHandler()->setWatchpointByAddress(address);

View File

@@ -79,7 +79,6 @@ private:
void setModelData(int role, const QVariant &value = QVariant(), void setModelData(int role, const QVariant &value = QVariant(),
const QModelIndex &index = QModelIndex()); const QModelIndex &index = QModelIndex());
QVariant modelData(int role, const QModelIndex &index = QModelIndex());
bool m_alwaysResizeColumnsToContents; bool m_alwaysResizeColumnsToContents;
Type m_type; Type m_type;