Commit 5266f16c authored by hjk's avatar hjk
Browse files

debugger: new test case for char arrays

parent b4b23ea9
......@@ -149,6 +149,9 @@ DebuggerSettings *theDebuggerSettings()
item = new SavedAction(instance);
instance->insertItem(AssignValue, item);
item = new SavedAction(instance);
instance->insertItem(AssignType, item);
item = new SavedAction(instance);
instance->insertItem(ExpandItem, item);
item->setText(QObject::tr("Expand item"));
......
......@@ -86,6 +86,7 @@ enum DebuggerActionCode
WatchModelUpdate,
UseToolTips,
AssignValue,
AssignType,
ExpandItem,
CollapseItem,
......
......@@ -520,9 +520,11 @@ Qt::ItemFlags WatchHandler::flags(const QModelIndex &idx) const
const WatchData &data = m_displaySet.at(node);
if (data.isWatcher() && idx.column() == 0)
return editable; // watcher names are
if (idx.column() == 1)
return editable; // values are editable
return editable; // watcher names are editable
if (data.isWatcher() && idx.column() == 2)
return editable; // watcher types are
if (idx.column() == 1)
return editable; // locals and watcher values are editable
return notEditable;
}
......
......@@ -87,6 +87,9 @@ public:
if (index.column() == 1) {
// the value column
theDebuggerAction(AssignValue)->trigger(exp + '=' + value);
} else if (index.column() == 2) {
// the type column
theDebuggerAction(AssignType)->trigger(exp + '=' + value);
} else if (index.column() == 0) {
// the watcher name column
theDebuggerAction(RemoveWatchExpression)->trigger(exp);
......@@ -139,11 +142,16 @@ void WatchWindow::collapseNode(const QModelIndex &idx)
void WatchWindow::keyPressEvent(QKeyEvent *ev)
{
if (ev->key() == Qt::Key_Delete) {
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
QModelIndex idx = currentIndex();
QModelIndex idx1 = idx.sibling(idx.row(), 0);
QString exp = model()->data(idx1).toString();
theDebuggerAction(RemoveWatchExpression)->setValue(exp);
theDebuggerAction(RemoveWatchExpression)->trigger(exp);
} else if (ev->key() == Qt::Key_Return && m_type == LocalsType) {
QModelIndex idx = currentIndex();
QModelIndex idx1 = idx.sibling(idx.row(), 0);
QString exp = model()->data(idx1).toString();
theDebuggerAction(WatchExpression)->trigger(exp);
}
QTreeView::keyPressEvent(ev);
}
......
......@@ -116,6 +116,12 @@ private:
void testArray()
{
char c[20];
c[0] = 'a';
c[1] = 'b';
c[2] = 'c';
c[3] = 'd';
QString x[20];
x[0] = "a";
x[1] = "b";
......@@ -407,6 +413,10 @@ void testQObject(int &argc, char *argv[])
QAction act("xxx", &app);
QString t = act.text();
t += "y";
t += "y";
t += "y";
t += "y";
t += "y";
/*
QObject ob(&app);
......
......@@ -8,4 +8,4 @@ DESTDIR = ..
SOURCES += ../app.cpp
QT += network
mesage("this says <foo & bar>")
message("this says <foo & bar>")
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