Permit the use of the QML debugger on non JS/QML files

Change-Id: I1574f553c937bd4759b20ca5f0d22582087800cb
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Jean Gressmann
2015-09-23 13:14:30 +02:00
committed by hjk
parent 08b62bcfd9
commit 378cd56d75
2 changed files with 17 additions and 7 deletions

View File

@@ -240,9 +240,17 @@ bool BreakpointParameters::isCppBreakpoint() const
return false; return false;
// Qml is currently only file. // Qml is currently only file.
if (type == BreakpointByFileAndLine) if (type == BreakpointByFileAndLine) {
return !fileName.endsWith(QLatin1String(".qml"), Qt::CaseInsensitive) auto qmlExtensionString = QString::fromLocal8Bit(qgetenv("QTC_QMLDEBUGGER_FILEEXTENSIONS"));
&& !fileName.endsWith(QLatin1String(".js"), Qt::CaseInsensitive); if (qmlExtensionString.isEmpty())
qmlExtensionString = QLatin1Literal(".qml;.js");
auto qmlFileExtensions = qmlExtensionString.split(QLatin1Literal(";"), QString::SkipEmptyParts);
foreach (QString extension, qmlFileExtensions) {
if (fileName.endsWith(extension, Qt::CaseInsensitive))
return false;
}
}
return true; return true;
} }

View File

@@ -125,6 +125,7 @@ struct LookupData
{ {
QByteArray iname; QByteArray iname;
QString name; QString name;
QByteArray exp;
}; };
typedef QMultiHash<int, LookupData> LookupItems; // id -> (iname, exp) typedef QMultiHash<int, LookupData> LookupItems; // id -> (iname, exp)
@@ -948,7 +949,7 @@ void QmlEngine::expandItem(const QByteArray &iname)
d->inspectorAgent.updateWatchData(*item); d->inspectorAgent.updateWatchData(*item);
} else { } else {
LookupItems items; LookupItems items;
items.insert(int(item->id), {item->iname, item->name}); items.insert(int(item->id), {item->iname, item->name, item->exp});
d->lookup(items); d->lookup(items);
} }
} }
@@ -2232,7 +2233,7 @@ void QmlEnginePrivate::handleFrame(const QVariantMap &response)
foreach (const QByteArray &iname, watchHandler->expandedINames()) { foreach (const QByteArray &iname, watchHandler->expandedINames()) {
const WatchItem *item = watchHandler->findItem(iname); const WatchItem *item = watchHandler->findItem(iname);
if (item && item->isLocal()) if (item && item->isLocal())
itemsToLookup.insert(int(item->id), {item->iname, item->name}); itemsToLookup.insert(int(item->id), {item->iname, item->name, item->exp});
} }
lookup(itemsToLookup); lookup(itemsToLookup);
} }
@@ -2288,7 +2289,7 @@ void QmlEnginePrivate::handleScope(const QVariantMap &response)
item->setHasChildren(localData.properties.count()); item->setHasChildren(localData.properties.count());
engine->watchHandler()->insertItem(item); engine->watchHandler()->insertItem(item);
} else { } else {
itemsToLookup.insert(int(item->id), {item->iname, item->name}); itemsToLookup.insert(int(item->id), {item->iname, item->name, item->exp});
} }
} }
lookup(itemsToLookup); lookup(itemsToLookup);
@@ -2424,7 +2425,7 @@ void QmlEnginePrivate::insertSubItems(WatchItem *parent, const QVariantList &pro
item->type = propertyData.type; item->type = propertyData.type;
item->value = propertyData.value.toString(); item->value = propertyData.value.toString();
if (item->type.isEmpty()) if (item->type.isEmpty())
itemsToLookup.insert(propertyData.handle, {item->iname, item->name}); itemsToLookup.insert(propertyData.handle, {item->iname, item->name, item->exp});
item->setHasChildren(propertyData.properties.count() > 0); item->setHasChildren(propertyData.properties.count() > 0);
parent->appendChild(item); parent->appendChild(item);
} }
@@ -2479,6 +2480,7 @@ void QmlEnginePrivate::handleLookup(const QVariantMap &response)
currentlyLookingUp.remove(handle); currentlyLookingUp.remove(handle);
foreach (const LookupData &res, vals) { foreach (const LookupData &res, vals) {
auto item = new WatchItem; auto item = new WatchItem;
item->exp = res.exp;
item->iname = res.iname; item->iname = res.iname;
item->name = res.name; item->name = res.name;
item->id = handle; item->id = handle;