diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp index 242eaf1b49164964f6a89ae6b7ecab44d81bc55d..7a878e5d180ec0fde14fa83f0dcdf02467f4680d 100644 --- a/src/plugins/debugger/watchdata.cpp +++ b/src/plugins/debugger/watchdata.cpp @@ -383,8 +383,7 @@ QString WatchData::toToolTip() const formatToolTipRow(str, tr("Referencing Address"), QString::fromAscii(hexReferencingAddress())); if (size) - formatToolTipRow(str, tr("Size"), - QString::number(size)); + formatToolTipRow(str, tr("Size"), QString::number(size)); formatToolTipRow(str, tr("Internal ID"), iname); formatToolTipRow(str, tr("Generation"), QString::number(generation)); @@ -437,6 +436,11 @@ QByteArray WatchData::hexReferencingAddress() const return QByteArray(); } +bool WatchData::hasChanged(const WatchData &old) const +{ + return !value.isEmpty() && value != old.value && value != msgNotInScope(); +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/watchdata.h b/src/plugins/debugger/watchdata.h index 0492f3b9a4f2c638d82d4297084b6deb777f9cc8..15a66b08f540cb53cfe02cee6e8a3a79bc2a74f5 100644 --- a/src/plugins/debugger/watchdata.h +++ b/src/plugins/debugger/watchdata.h @@ -113,6 +113,7 @@ public: quint64 coreAddress() const; QByteArray hexAddress() const; QByteArray hexReferencingAddress() const; + bool hasChanged(const WatchData &old) const; public: quint64 id; // Token for the engine for internal mapping diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 0dceeacb4f9ef8dab15c89f588357b2146d755b4..e6eb4a7e535bee2d636ae905846d168743ee9246 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -71,9 +71,6 @@ enum { debugModel = 0 }; #define MODEL_DEBUG(s) do { if (debugModel) qDebug() << s; } while (0) #define MODEL_DEBUGX(s) qDebug() << s -static const QString strNotInScope = - QCoreApplication::translate("Debugger::Internal::WatchData", "<not in scope>"); - static int watcherCounter = 0; static int generationCounter = 0; @@ -1008,11 +1005,8 @@ void WatchModel::insertData(const WatchData &data) if (WatchItem *oldItem = findItem(data.iname, parent)) { bool hadChildren = oldItem->hasChildren; // Overwrite old entry. - bool changed = !data.value.isEmpty() - && data.value != oldItem->value - && data.value != strNotInScope; oldItem->setData(data); - oldItem->changed = changed; + oldItem->changed = data.hasChanged(*oldItem); oldItem->generation = generationCounter; QModelIndex idx = watchIndex(oldItem); emit dataChanged(idx, idx.sibling(idx.row(), 2)); @@ -1096,10 +1090,7 @@ void WatchModel::insertBulkData(const QList<WatchData> &list) data.generation = generationCounter; newList.insert(oldSortKey, data); } else { - bool changed = !it->value.isEmpty() - && it->value != oldItem->value - && it->value != strNotInScope; - it->changed = changed; + it->changed = it->hasChanged(*oldItem); if (it->generation == -1) it->generation = generationCounter; }