Restore mouseover events for items in windows

This commit is contained in:
Brad Davis 2016-07-14 17:45:49 -07:00
parent a6d71f508e
commit 43e045c22a
3 changed files with 7 additions and 19 deletions

View file

@ -20,19 +20,7 @@ Window {
width: content.width width: content.width
height: content.height height: content.height
// Disable this window from being able to call 'desktop.raise() and desktop.showDesktop' // Disable this window from being able to call 'desktop.raise() and desktop.showDesktop'
activator: MouseArea { activator: Item {}
width: frame.decoration ? frame.decoration.width : window.width
height: frame.decoration ? frame.decoration.height : window.height
x: frame.decoration ? frame.decoration.anchors.leftMargin : 0
y: frame.decoration ? frame.decoration.anchors.topMargin : 0
propagateComposedEvents: true
acceptedButtons: Qt.AllButtons
enabled: window.visible
hoverEnabled: true
onPressed: mouse.accepted = false;
onEntered: window.mouseEntered();
onExited: window.mouseExited();
}
property bool horizontal: true property bool horizontal: true
property real buttonSize: 50; property real buttonSize: 50;
property var buttons: [] property var buttons: []

View file

@ -43,15 +43,19 @@ Rectangle {
// Enable dragging of the window, // Enable dragging of the window,
// detect mouseover of the window (including decoration) // detect mouseover of the window (including decoration)
MouseArea { MouseArea {
id: decorationMouseArea
anchors.fill: parent anchors.fill: parent
drag.target: window drag.target: window
hoverEnabled: true
onEntered: window.mouseEntered();
onExited: window.mouseExited();
} }
Connections { Connections {
target: window target: window
onMouseEntered: { onMouseEntered: {
if (desktop.hmdHandMouseActive) { if (desktop.hmdHandMouseActive) {
root.inflateDecorations() root.inflateDecorations()
} }
} }
onMouseExited: root.deflateDecorations(); onMouseExited: root.deflateDecorations();
} }
@ -59,7 +63,7 @@ Rectangle {
target: desktop target: desktop
onHmdHandMouseActiveChanged: { onHmdHandMouseActiveChanged: {
if (desktop.hmdHandMouseActive) { if (desktop.hmdHandMouseActive) {
if (window.activator.containsMouse) { if (decorationMouseArea.containsMouse) {
root.inflateDecorations(); root.inflateDecorations();
} }
} else { } else {

View file

@ -115,14 +115,10 @@ Fadable {
propagateComposedEvents: true propagateComposedEvents: true
acceptedButtons: Qt.AllButtons acceptedButtons: Qt.AllButtons
enabled: window.visible enabled: window.visible
hoverEnabled: true
onPressed: { onPressed: {
//console.log("Pressed on activator area");
window.raise(); window.raise();
mouse.accepted = false; mouse.accepted = false;
} }
onEntered: window.mouseEntered();
onExited: window.mouseExited();
} }
// This mouse area serves to swallow mouse events while the mouse is over the window // This mouse area serves to swallow mouse events while the mouse is over the window