From 42cab19ab2b14feaef66bbf41ebe1eaf1916deac Mon Sep 17 00:00:00 2001 From: druiz17 Date: Wed, 11 Oct 2017 16:04:35 -0700 Subject: [PATCH] generialze window search --- interface/resources/qml/AvatarInputs.qml | 1 + interface/resources/qml/Stats.qml | 9 ++++++--- interface/resources/qml/desktop/Desktop.qml | 16 ++++++++-------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/interface/resources/qml/AvatarInputs.qml b/interface/resources/qml/AvatarInputs.qml index d86d4fd022..be4bf03465 100644 --- a/interface/resources/qml/AvatarInputs.qml +++ b/interface/resources/qml/AvatarInputs.qml @@ -17,6 +17,7 @@ import "./hifi/audio" as HifiAudio Hifi.AvatarInputs { id: root; objectName: "AvatarInputs" + property int modality: Qt.NonModal width: audio.width; height: audio.height; x: 10; y: 5; diff --git a/interface/resources/qml/Stats.qml b/interface/resources/qml/Stats.qml index 3ac37545d9..4626d9bcda 100644 --- a/interface/resources/qml/Stats.qml +++ b/interface/resources/qml/Stats.qml @@ -8,7 +8,9 @@ Item { anchors.leftMargin: 300 objectName: "StatsItem" - property var statsObject: root + property int modality: Qt.NonModal + implicitHeight: row.height + implicitWidth: row.width Component.onCompleted: { stats.parentChanged.connect(fill); @@ -19,8 +21,9 @@ Item { } function fill() { - // Explicitly fill in order to avoid warnings at shutdown - anchors.fill = parent; + // This will cause a warning at shutdown, need to find another way to remove + // the warning other than filling the anchors to the parent + anchors.horizontalCenter = parent.horizontalCenter } Hifi.Stats { diff --git a/interface/resources/qml/desktop/Desktop.qml b/interface/resources/qml/desktop/Desktop.qml index a5b1b8eb7c..a93dd3cdd7 100644 --- a/interface/resources/qml/desktop/Desktop.qml +++ b/interface/resources/qml/desktop/Desktop.qml @@ -301,17 +301,17 @@ FocusScope { function isPointOnWindow(point) { for (var i = 0; i < desktop.visibleChildren.length; i++) { var child = desktop.visibleChildren[i]; - var childName = child.objectName; if (child.hasOwnProperty("modality")) { var mappedPoint = child.mapFromGlobal(point.x, point.y); - var outLine = child.frame.children[2]; - var framePoint = outLine.mapFromGlobal(point.x, point.y); - if (child.contains(mappedPoint) || outLine.contains(framePoint)) { - return true; + if (child.hasOwnProperty("frame")) { + var outLine = child.frame.children[2]; + var framePoint = outLine.mapFromGlobal(point.x, point.y); + if (child.contains(mappedPoint) || outLine.contains(framePoint)) { + return true; + } } - } else if (childName === "StatsItem") { - var mappedPoint = child.statsObject.mapFromGlobal(point.x, point.y); - if (child.statsObject.contains(mappedPoint)) { + + if (child.contains(mappedPoint)) { return true; } }