Add the url of each qml as on-screen debug info

This commit is contained in:
Gabriel Calero 2018-03-07 17:18:37 -03:00
parent 3f762c7900
commit 109fa1d832
2 changed files with 8 additions and 2 deletions

View file

@ -16,10 +16,11 @@ import "../js/Utils.js" as Utils
Item {
id: frame
objectName: "Frame"
HifiConstants { id: hifi }
default property var decoration
property string qmlFile: "N/A"
property bool gradientsSupported: desktop.gradientsSupported
readonly property int frameMarginLeft: frame.decoration ? frame.decoration.frameMarginLeft : 0
@ -44,7 +45,7 @@ Item {
id: debugZ
visible: DebugQML
color: "red"
text: (window ? "Z: " + window.z : "")
text: (window ? "Z: " + window.z : "") + " " + qmlFile
y: window ? window.height + 4 : 0
}

View file

@ -342,6 +342,11 @@ void OffscreenSurface::finishQmlLoad(QQmlComponent* qmlComponent,
// Make sure we make items focusable (critical for
// supporting keyboard shortcuts)
newItem->setFlag(QQuickItem::ItemIsFocusScope, true);
#ifdef DEBUG
for (auto frame : newObject->findChildren<QQuickItem *>("Frame")) {
frame->setProperty("qmlFile", qmlComponent->url());
}
#endif
}
bool rootCreated = getRootItem() != nullptr;