1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-29 19:23:40 +02:00

conf: fix participant menu focus

Superposing a MouseArea and a hover in a child
component may cause focus problems.
This replaces MouseArea for a HoverHandler
in the participant moderator menu.

Change-Id: Ic4eb763c79f04198d3a2a2f24636fb2a09dca172
GitLab: #601
This commit is contained in:
agsantos 2022-01-05 08:43:13 -05:00
parent b3dcabb9ea
commit fcd8a907e4
3 changed files with 58 additions and 56 deletions

View file

@ -61,8 +61,6 @@ Item {
} }
} }
z: 1
function setAvatar(show, uri, isLocal) { function setAvatar(show, uri, isLocal) {
if (!show) if (!show)
avatar.active = false avatar.active = false
@ -136,47 +134,56 @@ Item {
} }
} }
// Participant background and buttons for moderation HoverHandler {
MouseArea { onPointChanged: {
id: participantRect
anchors.fill: parent
opacity: 0
z: 1
propagateComposedEvents: true
hoverEnabled: true
onPositionChanged: {
participantRect.opacity = 1 participantRect.opacity = 1
fadeOutTimer.restart() fadeOutTimer.restart()
// Here we could call: root.parent.positionChanged(mouse)
// to relay the event to a main overlay mouse area, either
// as a parent object or some property passed in. But, this
// will still fail when hovering over menus, etc.
}
onExited: {
root.z = 1
participantRect.opacity = 0
}
onEntered: {
root.z = 2
participantRect.opacity = 1
} }
// Timer to decide when ParticipantOverlay fade out onHoveredChanged: {
Timer { if (overlayMenu.hovered) {
id: fadeOutTimer participantRect.opacity = 1
interval: JamiTheme.overlayFadeDelay fadeOutTimer.restart()
onTriggered: { return
if (overlayMenu.hovered)
return
participantRect.opacity = 0
} }
participantRect.opacity = hovered ? 1 : 0
} }
}
// Timer to decide when ParticipantOverlay fade out
Timer {
id: fadeOutTimer
interval: JamiTheme.overlayFadeDelay
onTriggered: {
if (overlayMenu.hovered) {
fadeOutTimer.restart()
return
}
participantRect.opacity = 0
}
}
// Participant background and buttons for moderation
Rectangle {
id: participantRect
width: parent.width
height: parent.height
color: "transparent"
opacity: 0
ParticipantOverlayMenu { ParticipantOverlayMenu {
id: overlayMenu id: overlayMenu
visible: isMe || meModerator visible: isMe || meModerator
onHoveredChanged: {
if (hovered) {
participantRect.opacity = 1
fadeOutTimer.restart()
} else {
participantRect.opacity = 0
}
}
} }
// Participant footer with host, moderator and mute indicators // Participant footer with host, moderator and mute indicators

View file

@ -32,6 +32,7 @@ PushButton {
pressedColor: JamiTheme.buttonConferencePressed pressedColor: JamiTheme.buttonConferencePressed
imageColor: JamiTheme.whiteColor imageColor: JamiTheme.whiteColor
hoverEnabled: false
Rectangle { Rectangle {
id: toolTipRect id: toolTipRect
@ -44,7 +45,7 @@ PushButton {
} }
color : isBarLayout? JamiTheme.darkGreyColorOpacity color : isBarLayout? JamiTheme.darkGreyColorOpacity
: "transparent" : "transparent"
visible: root.hovered && !isSmall visible: hover.hovered && !isSmall
radius: 2 radius: 2
Text { Text {
@ -55,4 +56,9 @@ PushButton {
font.pointSize: JamiTheme.tinyFontSize font.pointSize: JamiTheme.tinyFontSize
} }
} }
Item {
anchors.fill: parent
HoverHandler { id: hover }
}
} }

View file

@ -49,10 +49,12 @@ Item {
property int buttonPreferredSize: 24 property int buttonPreferredSize: 24
property int iconButtonPreferredSize: 16 property int iconButtonPreferredSize: 16
property bool hovered: false property alias hovered: hover.hovered
anchors.fill: parent anchors.fill: parent
HoverHandler { id: hover }
Loader { sourceComponent: isBarLayout ? barComponent : rectComponent } Loader { sourceComponent: isBarLayout ? barComponent : rectComponent }
Component { Component {
@ -61,8 +63,7 @@ Item {
Control { Control {
width: root.width width: root.width
height: root.height height: root.height
hoverEnabled: false
onHoveredChanged: root.hovered = hovered
background: Rectangle { background: Rectangle {
property int buttonsSize: buttonsRect.visibleButtons * 24 + 8 * 2 property int buttonsSize: buttonsRect.visibleButtons * 24 + 8 * 2
@ -77,16 +78,9 @@ Item {
height: isOverlayRect ? 80 : parent.height height: isOverlayRect ? 80 : parent.height
} }
ColumnLayout { ParticipantControlLayout {
id: buttonsRect
anchors.centerIn: parent anchors.centerIn: parent
ParticipantControlLayout {
id: buttonsRect
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.preferredWidth: implicitWidth
Layout.preferredHeight: shapeHeight
}
} }
} }
} }
@ -95,18 +89,17 @@ Item {
id: barComponent id: barComponent
Control { Control {
width: buttonsRect.implicitWidth width: barButtons.implicitWidth
height: shapeHeight height: shapeHeight
hoverEnabled: false
onHoveredChanged: root.hovered = hovered
background: Item { background: Item {
clip: true clip: true
Rectangle { Rectangle {
color: JamiTheme.darkGreyColorOpacity color: JamiTheme.darkGreyColorOpacity
radius: shapeRadius radius: shapeRadius
width: parent.width + radius width: parent.width + 2 * radius
height: parent.height + radius height: parent.height + 2 * radius
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: -radius anchors.leftMargin: -radius
anchors.topMargin: -radius anchors.topMargin: -radius
@ -114,11 +107,7 @@ Item {
} }
ParticipantControlLayout { ParticipantControlLayout {
id: buttonsRect id: barButtons
Layout.rightMargin: 8
Layout.preferredWidth: implicitWidth
Layout.preferredHeight: shapeHeight
} }
} }
} }