forked from qt-creator/qt-creator
QmlDebugger: Watchers
Reviewed-by: hjk
This commit is contained in:
@@ -1844,6 +1844,7 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine)
|
|||||||
m_threadBox->setModel(engine->threadsModel());
|
m_threadBox->setModel(engine->threadsModel());
|
||||||
m_threadBox->setModelColumn(ThreadData::NameColumn);
|
m_threadBox->setModelColumn(ThreadData::NameColumn);
|
||||||
m_watchersWindow->setModel(engine->watchersModel());
|
m_watchersWindow->setModel(engine->watchersModel());
|
||||||
|
engine->watchHandler()->rebuildModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void changeFontSize(QWidget *widget, qreal size)
|
static void changeFontSize(QWidget *widget, qreal size)
|
||||||
|
@@ -231,6 +231,8 @@ void QmlEngine::connectionEstablished()
|
|||||||
|
|
||||||
showMessage(tr("QML Debugger connected."), StatusBar);
|
showMessage(tr("QML Debugger connected."), StatusBar);
|
||||||
|
|
||||||
|
synchronizeWatchers();
|
||||||
|
|
||||||
notifyEngineRunAndInferiorRunOk();
|
notifyEngineRunAndInferiorRunOk();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -687,10 +689,20 @@ void QmlEngine::updateWatchData(const WatchData &data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!data.name.isEmpty() && data.isChildrenNeeded()
|
if (!data.name.isEmpty() && data.isChildrenNeeded()
|
||||||
&& watchHandler()->isExpandedIName(data.iname))
|
&& watchHandler()->isExpandedIName(data.iname)) {
|
||||||
expandObject(data.iname, data.id);
|
expandObject(data.iname, data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronizeWatchers();
|
||||||
|
|
||||||
|
if (!data.isSomethingNeeded())
|
||||||
|
watchHandler()->insertData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlEngine::synchronizeWatchers()
|
||||||
{
|
{
|
||||||
|
if (!watchHandler()->watcherNames().isEmpty()) {
|
||||||
|
// send watchers list
|
||||||
QByteArray reply;
|
QByteArray reply;
|
||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "WATCH_EXPRESSIONS";
|
QByteArray cmd = "WATCH_EXPRESSIONS";
|
||||||
@@ -700,9 +712,6 @@ void QmlEngine::updateWatchData(const WatchData &data,
|
|||||||
QString(cmd), watchHandler()->watchedExpressions().join(", ")));
|
QString(cmd), watchHandler()->watchedExpressions().join(", ")));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.isSomethingNeeded())
|
|
||||||
watchHandler()->insertData(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::expandObject(const QByteArray &iname, quint64 objectId)
|
void QmlEngine::expandObject(const QByteArray &iname, quint64 objectId)
|
||||||
|
@@ -146,6 +146,8 @@ private:
|
|||||||
const QString &oldBasePath, const QString &newBasePath) const;
|
const QString &oldBasePath, const QString &newBasePath) const;
|
||||||
QString qmlImportPath() const;
|
QString qmlImportPath() const;
|
||||||
|
|
||||||
|
void synchronizeWatchers();
|
||||||
|
|
||||||
enum LogDirection {
|
enum LogDirection {
|
||||||
LogSend,
|
LogSend,
|
||||||
LogReceive
|
LogReceive
|
||||||
|
@@ -1656,5 +1656,26 @@ void WatchHandler::removeTooltip()
|
|||||||
m_tooltips->emitAllChanged();
|
m_tooltips->emitAllChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchHandler::rebuildModel()
|
||||||
|
{
|
||||||
|
beginCycle();
|
||||||
|
|
||||||
|
const QList<WatchItem *> watches = m_watchers->rootItem()->children;
|
||||||
|
for (int i = watches.size() - 1; i >= 0; i--)
|
||||||
|
m_watchers->destroyItem(watches.at(i));
|
||||||
|
|
||||||
|
foreach (const QString &exp, watchedExpressions()) {
|
||||||
|
WatchData data;
|
||||||
|
data.exp = exp.toLatin1();
|
||||||
|
data.name = exp;
|
||||||
|
data.iname = watcherName(data.exp);
|
||||||
|
data.setAllUnneeded();
|
||||||
|
|
||||||
|
insertData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
endCycle();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -163,6 +163,7 @@ public:
|
|||||||
void loadSessionData();
|
void loadSessionData();
|
||||||
void saveSessionData();
|
void saveSessionData();
|
||||||
void removeTooltip();
|
void removeTooltip();
|
||||||
|
void rebuildModel();
|
||||||
|
|
||||||
bool isExpandedIName(const QByteArray &iname) const
|
bool isExpandedIName(const QByteArray &iname) const
|
||||||
{ return m_expandedINames.contains(iname); }
|
{ return m_expandedINames.contains(iname); }
|
||||||
|
Reference in New Issue
Block a user