diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 573c57f6f80b9851a438bf73b9098f6d8ca30816..e3b52a9deecc07f8bb4f8448c681dd30076ae3b6 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -352,7 +352,6 @@ QString WatchData::shadowedName(const QString &name, int seen) WatchModel::WatchModel(WatchHandler *handler, WatchType type) : QAbstractItemModel(handler), m_handler(handler), m_type(type) { - m_inExtraLayoutChanged = false; m_root = new WatchItem; m_root->hasChildren = 1; m_root->state = 0; @@ -414,15 +413,6 @@ void WatchModel::endCycle() { removeOutdated(); emit enableUpdates(true); - // Prevent 'fetchMore()' from being triggered. - m_inExtraLayoutChanged = true; - emit layoutChanged(); - QTimer::singleShot(0, this, SLOT(resetExtraLayoutChanged())); -} - -void WatchModel::resetExtraLayoutChanged() -{ - m_inExtraLayoutChanged = false; } void WatchModel::dump() @@ -678,14 +668,11 @@ bool WatchModel::canFetchMore(const QModelIndex &index) const { WatchItem *item = watchItem(index); QTC_ASSERT(item, return false); - return !m_inExtraLayoutChanged && index.isValid() - && !m_fetchTriggered.contains(item->iname); + return index.isValid() && !m_fetchTriggered.contains(item->iname); } void WatchModel::fetchMore(const QModelIndex &index) { - if (m_inExtraLayoutChanged) - return; QTC_ASSERT(index.isValid(), return); WatchItem *item = watchItem(index); QTC_ASSERT(item, return); @@ -1019,8 +1006,8 @@ void WatchModel::insertData(const WatchData &data) } QModelIndex index = watchIndex(parent); if (WatchItem *oldItem = findItem(data.iname, parent)) { - // overwrite old entry - //MODEL_DEBUG("OVERWRITE : " << data.iname << data.value); + bool hadChildren = oldItem->hasChildren; + // Overwrite old entry. bool changed = !data.value.isEmpty() && data.value != oldItem->value && data.value != strNotInScope; @@ -1029,9 +1016,19 @@ void WatchModel::insertData(const WatchData &data) oldItem->generation = generationCounter; QModelIndex idx = watchIndex(oldItem); emit dataChanged(idx, idx.sibling(idx.row(), 2)); + + // This works around http://bugreports.qt.nokia.com/browse/QTBUG-7115 + // by creating and destroying a dummy child item. + if (!hadChildren && oldItem->hasChildren) { + WatchData dummy = data; + dummy.iname = data.iname + ".x"; + dummy.hasChildren = false; + dummy.setAllUnneeded(); + insertData(dummy); + destroyItem(findItem(dummy.iname, m_root)); + } } else { - // add new entry - //MODEL_DEBUG("ADD : " << data.iname << data.value); + // Add new entry. WatchItem *item = new WatchItem(data); item->parent = parent; item->generation = generationCounter; diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 5de2160cd9cccfad3d67647d6ab70e14145c198e..23d3f26f40c4ed26271e9533b51449e16dd30671 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -233,7 +233,6 @@ private: void dump(); void dumpHelper(WatchItem *item); void emitAllChanged(); - Q_SLOT void resetExtraLayoutChanged(); signals: void enableUpdates(bool); @@ -245,9 +244,6 @@ private: WatchType m_type; WatchItem *m_root; QSet<QByteArray> m_fetchTriggered; - // Part of the workaround to update the [+] marker when items - // are added to a container. - bool m_inExtraLayoutChanged; }; class WatchHandler : public QObject