Commit 45e7ccc0 authored by hjk's avatar hjk
Browse files

debugger: make assignment of simple types work again

parent 00be6870
......@@ -966,7 +966,10 @@ void DebuggerManager::exitDebugger()
void DebuggerManager::assignValueInDebugger()
{
if (QAction *action = qobject_cast<QAction *>(sender())) {
qDebug() << "HANDLING " << action->data().toString();
QString str = action->data().toString();
int i = str.indexOf('=');
if (i != -1)
assignValueInDebugger(str.left(i), str.mid(i + 1));
}
}
void DebuggerManager::assignValueInDebugger(const QString &expr, const QString &value)
......
......@@ -440,9 +440,6 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
const WatchData &data = m_displaySet.at(node);
switch (role) {
case Qt::EditRole:
return data.exp;
case Qt::DisplayRole: {
switch (idx.column()) {
case 0: return data.name;
......@@ -496,6 +493,9 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
break;
}
case ExpressionRole:
return data.exp;
case INameRole:
return data.iname;
......
......@@ -132,7 +132,7 @@ public:
bool changed;
};
enum { INameRole = Qt::UserRole, VisualRole, ExpandedRole };
enum { INameRole = Qt::UserRole, ExpressionRole, VisualRole, ExpandedRole };
class WatchHandler : public QAbstractItemModel
......
......@@ -54,7 +54,7 @@ using namespace Debugger::Internal;
//
/////////////////////////////////////////////////////////////////////
enum { INameRole = Qt::UserRole, VisualRole, ExpandedRole };
enum { INameRole = Qt::UserRole, ExpressionRole, VisualRole, ExpandedRole };
class WatchDelegate : public QItemDelegate
{
......@@ -71,7 +71,10 @@ public:
{
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(editor);
QTC_ASSERT(lineEdit, return);
lineEdit->setText(index.model()->data(index, Qt::EditRole).toString());
if (index.column() == 1)
lineEdit->setText(index.model()->data(index, Qt::DisplayRole).toString());
else
lineEdit->setText(index.model()->data(index, ExpressionRole).toString());
}
void setModelData(QWidget *editor, QAbstractItemModel *,
......@@ -80,7 +83,7 @@ public:
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
QTC_ASSERT(lineEdit, return);
QString value = lineEdit->text();
QString exp = index.model()->data(index, Qt::EditRole).toString();
QString exp = index.model()->data(index, ExpressionRole).toString();
if (index.column() == 1) {
// the value column
theDebuggerSetting(AssignValue)->trigger(exp + '=' + value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment