Replace MouseAreas by input handlers

This commit is contained in:
miruka 2019-07-12 18:02:14 -04:00
parent cb0d7e8a77
commit cc937b38c4
2 changed files with 7 additions and 12 deletions

View File

@ -1,7 +1,7 @@
// Copyright 2019 miruka // Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3. // This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.7 import QtQuick 2.12
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import "../Base" import "../Base"
import "../utils.js" as Utils import "../utils.js" as Utils
@ -48,16 +48,13 @@ HRectangle {
sourceSize.width: dimension sourceSize.width: dimension
sourceSize.height: dimension sourceSize.height: dimension
MouseArea { HoverHandler {
id: imageMouseArea id: hoverHandler
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
} }
HToolTip { HToolTip {
id: avatarToolTip id: avatarToolTip
visible: imageMouseArea.containsMouse visible: hoverHandler.hovered
width: 128 width: 128
height: 128 height: 128

View File

@ -1,4 +1,4 @@
import QtQuick 2.7 import QtQuick 2.12
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
ToolTip { ToolTip {
@ -16,9 +16,7 @@ ToolTip {
HNumberAnimation { property: "opacity"; from: 1.0; to: 0.0 } HNumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
} }
MouseArea { TapHandler {
anchors.fill: parent onTapped: { toolTip.hide() }
propagateComposedEvents: true
onClicked: { toolTip.close(); mouse.accepted = false }
} }
} }