summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/registerwindow.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-09-22 17:30:22 +0200
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-09-22 17:30:22 +0200
commitca808cc7b45a552228ab9768e5170b37e5410dcf (patch)
tree9942e8c5231447823737df7cb50aee9f6fc91cae /src/plugins/debugger/registerwindow.cpp
parent596e60305add6521d1a946e4ca1e50d291ca8d52 (diff)
downloadqt-creator-ca808cc7b45a552228ab9768e5170b37e5410dcf.tar.gz
Debugger: Add special widgets for editing watch values.
Create delegate widgets with validation for bool/int/float types, using a QVariant-type modelData property. Also fix register editing to be validated for quint64 values and editing longer values as hex bigints. Anything else is not editable.
Diffstat (limited to 'src/plugins/debugger/registerwindow.cpp')
-rw-r--r--src/plugins/debugger/registerwindow.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp
index a8c3c0acf5..3431157d24 100644
--- a/src/plugins/debugger/registerwindow.cpp
+++ b/src/plugins/debugger/registerwindow.cpp
@@ -32,6 +32,8 @@
#include "debuggeractions.h"
#include "debuggerconstants.h"
+#include "watchdelegatewidgets.h"
+
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
@@ -66,31 +68,31 @@ public:
{}
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
- const QModelIndex &) const
+ const QModelIndex &index) const
{
- QLineEdit *lineEdit = new QLineEdit(parent);
+ IntegerWatchLineEdit *lineEdit = new IntegerWatchLineEdit(parent);
+ lineEdit->setBase(index.data(RegisterNumberBaseRole).toInt());
+ lineEdit->setBigInt(index.data(RegisterBigNumberRole).toBool());
+ lineEdit->setSigned(false);
+
lineEdit->setAlignment(Qt::AlignRight);
return lineEdit;
}
void setEditorData(QWidget *editor, const QModelIndex &index) const
{
- QLineEdit *lineEdit = qobject_cast<QLineEdit *>(editor);
+ IntegerWatchLineEdit *lineEdit = qobject_cast<IntegerWatchLineEdit *>(editor);
QTC_ASSERT(lineEdit, return);
- lineEdit->setText(index.data(Qt::EditRole).toString());
+ lineEdit->setModelData(index.data(Qt::EditRole));
}
- void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const
+ void setModelData(QWidget *editor, QAbstractItemModel *, const QModelIndex &index) const
{
- Q_UNUSED(model);
- //qDebug() << "SET MODEL DATA";
- QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
+ if (index.column() != 1)
+ return;
+ IntegerWatchLineEdit *lineEdit = qobject_cast<IntegerWatchLineEdit*>(editor);
QTC_ASSERT(lineEdit, return);
- QString value = lineEdit->text();
- //model->setData(index, value, Qt::EditRole);
- if (index.column() == 1)
- m_owner->model()->setData(index, value, RequestSetRegisterRole);
+ m_owner->model()->setData(index, lineEdit->modelData(), RequestSetRegisterRole);
}
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,