diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 0342f22c7e395d209f14aedf01288fc4ec12c621..e8bb8d5fe5e7957346a49b7fef903a44da951da3 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -751,7 +751,8 @@ void WatchHandler::rebuildModel() m_inChange = true; //qDebug() << "WATCHHANDLER: RESET ABOUT TO EMIT"; - emit reset(); + //emit reset(); + emit layoutChanged(); //qDebug() << "WATCHHANDLER: RESET EMITTED"; m_inChange = false; diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 55759b1462c6c01f0dd84d582bba7d72a218fc50..e10d39319b68f80f7b2619ea542e19d8df444f99 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -215,16 +215,13 @@ void WatchWindow::editItem(const QModelIndex &idx) void WatchWindow::reset() { + QTreeView::reset(); int row = 0; if (m_type == TooltipType) row = 1; else if (m_type == WatchersType) row = 2; - //qDebug() << "WATCHWINDOW::RESET" << row; - QTreeView::reset(); setRootIndex(model()->index(row, 0, model()->index(0, 0))); - //setRootIndex(model()->index(0, 0)); - resetHelper(model()->index(0, 0)); } void WatchWindow::setModel(QAbstractItemModel *model) @@ -236,16 +233,27 @@ void WatchWindow::setModel(QAbstractItemModel *model) header()->setResizeMode(QHeaderView::ResizeToContents); if (m_type != LocalsType) header()->hide(); + + connect(model, SIGNAL(layoutChanged()), this, SLOT(resetHelper())); +} + +void WatchWindow::resetHelper() +{ + resetHelper(model()->index(0, 0)); } void WatchWindow::resetHelper(const QModelIndex &idx) { if (model()->data(idx, ExpandedRole).toBool()) { + //qDebug() << "EXPANDING " << model()->data(idx, INameRole); expand(idx); for (int i = 0, n = model()->rowCount(idx); i != n; ++i) { QModelIndex idx1 = model()->index(i, 0, idx); resetHelper(idx1); } + } else { + //qDebug() << "COLLAPSING " << model()->data(idx, INameRole); + collapse(idx); } } diff --git a/src/plugins/debugger/watchwindow.h b/src/plugins/debugger/watchwindow.h index ff26a693362bb6a18283f46c925619d6599186bd..715507f8b16df9cef441cebd960581a11e02d9e4 100644 --- a/src/plugins/debugger/watchwindow.h +++ b/src/plugins/debugger/watchwindow.h @@ -60,6 +60,7 @@ public slots: private: Q_SLOT void expandNode(const QModelIndex &index); Q_SLOT void collapseNode(const QModelIndex &index); + Q_SLOT void resetHelper(); void keyPressEvent(QKeyEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);