forked from qt-creator/qt-creator
debugger: keep row selection in watchersview after expand/collapse
Task-number: 233285
This commit is contained in:
@@ -751,7 +751,8 @@ void WatchHandler::rebuildModel()
|
|||||||
|
|
||||||
m_inChange = true;
|
m_inChange = true;
|
||||||
//qDebug() << "WATCHHANDLER: RESET ABOUT TO EMIT";
|
//qDebug() << "WATCHHANDLER: RESET ABOUT TO EMIT";
|
||||||
emit reset();
|
//emit reset();
|
||||||
|
emit layoutChanged();
|
||||||
//qDebug() << "WATCHHANDLER: RESET EMITTED";
|
//qDebug() << "WATCHHANDLER: RESET EMITTED";
|
||||||
m_inChange = false;
|
m_inChange = false;
|
||||||
|
|
||||||
|
|||||||
@@ -215,16 +215,13 @@ void WatchWindow::editItem(const QModelIndex &idx)
|
|||||||
|
|
||||||
void WatchWindow::reset()
|
void WatchWindow::reset()
|
||||||
{
|
{
|
||||||
|
QTreeView::reset();
|
||||||
int row = 0;
|
int row = 0;
|
||||||
if (m_type == TooltipType)
|
if (m_type == TooltipType)
|
||||||
row = 1;
|
row = 1;
|
||||||
else if (m_type == WatchersType)
|
else if (m_type == WatchersType)
|
||||||
row = 2;
|
row = 2;
|
||||||
//qDebug() << "WATCHWINDOW::RESET" << row;
|
|
||||||
QTreeView::reset();
|
|
||||||
setRootIndex(model()->index(row, 0, model()->index(0, 0)));
|
setRootIndex(model()->index(row, 0, model()->index(0, 0)));
|
||||||
//setRootIndex(model()->index(0, 0));
|
|
||||||
resetHelper(model()->index(0, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::setModel(QAbstractItemModel *model)
|
void WatchWindow::setModel(QAbstractItemModel *model)
|
||||||
@@ -236,16 +233,27 @@ void WatchWindow::setModel(QAbstractItemModel *model)
|
|||||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
if (m_type != LocalsType)
|
if (m_type != LocalsType)
|
||||||
header()->hide();
|
header()->hide();
|
||||||
|
|
||||||
|
connect(model, SIGNAL(layoutChanged()), this, SLOT(resetHelper()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchWindow::resetHelper()
|
||||||
|
{
|
||||||
|
resetHelper(model()->index(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::resetHelper(const QModelIndex &idx)
|
void WatchWindow::resetHelper(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
if (model()->data(idx, ExpandedRole).toBool()) {
|
if (model()->data(idx, ExpandedRole).toBool()) {
|
||||||
|
//qDebug() << "EXPANDING " << model()->data(idx, INameRole);
|
||||||
expand(idx);
|
expand(idx);
|
||||||
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
||||||
QModelIndex idx1 = model()->index(i, 0, idx);
|
QModelIndex idx1 = model()->index(i, 0, idx);
|
||||||
resetHelper(idx1);
|
resetHelper(idx1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//qDebug() << "COLLAPSING " << model()->data(idx, INameRole);
|
||||||
|
collapse(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
Q_SLOT void expandNode(const QModelIndex &index);
|
Q_SLOT void expandNode(const QModelIndex &index);
|
||||||
Q_SLOT void collapseNode(const QModelIndex &index);
|
Q_SLOT void collapseNode(const QModelIndex &index);
|
||||||
|
Q_SLOT void resetHelper();
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent *ev);
|
void keyPressEvent(QKeyEvent *ev);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
|
|||||||
Reference in New Issue
Block a user