fix(MembersTabPanel): Buttons in the Member tab do not work

- move the MouseArea into `background` so that it doesn't obscure the
potential action buttons
- fixup SB page

Fixes #16426
This commit is contained in:
Lukáš Tinkl 2024-10-02 14:28:20 +02:00 committed by Lukáš Tinkl
parent 100389aa8d
commit 2c46764829
3 changed files with 31 additions and 19 deletions

View File

@ -12,6 +12,7 @@ import Models 1.0
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
import Storybook 1.0 import Storybook 1.0
import StatusQ 0.1
import StatusQ.Core.Utils 0.1 as SQUtils import StatusQ.Core.Utils 0.1 as SQUtils
SplitView { SplitView {
@ -54,7 +55,7 @@ SplitView {
Global.userProfile = this Global.userProfile = this
} }
Component.onDestruction: { Component.onDestruction: {
Utils.userProfile = {} Global.userProfile = {}
} }
} }
@ -85,6 +86,10 @@ SplitView {
onDeclineRequestToJoin: { onDeclineRequestToJoin: {
logs.logEvent("MembersTabPanel::onDeclineRequestToJoin", ["id"], arguments) logs.logEvent("MembersTabPanel::onDeclineRequestToJoin", ["id"], arguments)
} }
onViewMemberMessagesClicked: {
logs.logEvent("MembersTabPanel::onViewMemberMessagesClicked", ["pubKey", "displayName"], arguments)
}
} }
UsersModel { UsersModel {
@ -104,16 +109,26 @@ SplitView {
sortRole: membersTabPanelPage.panelType sortRole: membersTabPanelPage.panelType
proxyRoles: [ proxyRoles: [
ExpressionRole { FastExpressionRole {
name: "membershipRequestState" name: "membershipRequestState"
expression: { expression: {
var memberStates = usersModelWithMembershipState.membershipStatePerView[membersTabPanelPage.panelType] var memberStates = usersModelWithMembershipState.membershipStatePerView[membersTabPanelPage.panelType]
return memberStates[model.index % (memberStates.length)] return memberStates[model.index % (memberStates.length)]
} }
expectedRoles: ["index"]
}, },
ExpressionRole { ConstantRole {
name: "requestToJoinLoading" name: "requestToJoinLoading"
expression: false value: false
},
FastExpressionRole {
function displayNameProxy(localNickname, ensName, displayName, aliasName) {
return ProfileUtils.displayName(localNickname, ensName, displayName, aliasName)
}
name: "preferredDisplayName"
expectedRoles: ["localNickname", "displayName", "ensName", "alias"]
expression: displayNameProxy(model.localNickname, model.ensName, model.displayName, model.alias)
} }
] ]
} }
@ -125,9 +140,7 @@ SplitView {
logsView.logText: logs.logText logsView.logText: logs.logText
ColumnLayout { ColumnLayout {
anchors.top: parent.top Layout.fillWidth: true
anchors.left: parent.left
anchors.right: parent.right
Label { Label {
text: "View state" text: "View state"
} }

View File

@ -170,6 +170,13 @@ ItemDelegate {
background: Rectangle { background: Rectangle {
color: root.color color: root.color
radius: 8 radius: 8
MouseArea {
anchors.fill: parent
cursorShape: root.enabled && root.hoverEnabled && root.hovered ? Qt.PointingHandCursor : undefined
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: root.clicked(mouse)
}
} }
contentItem: RowLayout { contentItem: RowLayout {
@ -268,13 +275,6 @@ ItemDelegate {
} }
} }
MouseArea {
anchors.fill: parent
cursorShape: root.enabled && root.hoverEnabled && root.hovered ? Qt.PointingHandCursor : undefined
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: root.clicked(mouse)
}
Component { Component {
id: statusContactVerificationIcons id: statusContactVerificationIcons
StatusContactVerificationIcons { StatusContactVerificationIcons {

View File

@ -1,6 +1,6 @@
import QtQuick 2.14 import QtQuick 2.15
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.15
import QtQuick.Controls 2.14 import QtQuick.Controls 2.15
import StatusQ 0.1 import StatusQ 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
@ -68,7 +68,6 @@ Item {
Layout.fillHeight: true Layout.fillHeight: true
model: SortFilterProxyModel { model: SortFilterProxyModel {
sourceModel: root.model sourceModel: root.model
sorters : [ sorters : [
@ -234,7 +233,7 @@ Item {
text: qsTr("View Messages") text: qsTr("View Messages")
visible: viewMessagesButtonVisible visible: viewMessagesButtonVisible
size: StatusBaseButton.Size.Small size: StatusBaseButton.Size.Small
onClicked: root.viewMemberMessagesClicked(model.pubKey, model.displayName) onClicked: root.viewMemberMessagesClicked(model.pubKey, memberItem.title)
}, },
StatusButton { StatusButton {