fix(StatusExpandibleItem): add missing hover indicator in `Secondary` type

Fixes #478
This commit is contained in:
Pascal Precht 2021-11-03 11:54:26 +01:00 committed by r4bbit.eth
parent fecfb2a7e9
commit e23dc533bd
1 changed files with 115 additions and 92 deletions

View File

@ -58,12 +58,20 @@ Rectangle {
}
Rectangle {
id: header
anchors.top: parent.top
width: parent.width
height: 64
radius: (statusExpandableItem.type === StatusExpandableItem.Type.Secondary) ? 8 : 0
color: statusExpandableItem.type === StatusExpandableItem.Type.Secondary && sensor.containsMouse ? Theme.palette.baseColor2 : "transparent"
StatusSmartIdenticon {
id: identicon
anchors.top: parent.top
anchors.topMargin: 25
anchors.topMargin: (statusExpandableItem.type === StatusExpandableItem.Type.Secondary) ? 12.5 : 25
anchors.left: parent.left
anchors.leftMargin: (statusExpandableItem.type === StatusExpandableItem.Type.Secondary) ? 0 : 11
anchors.leftMargin: (statusExpandableItem.type === StatusExpandableItem.Type.Secondary) ? 16 : 11
image: statusExpandableItem.image
icon: statusExpandableItem.icon
name: primaryText.text
@ -136,7 +144,19 @@ Rectangle {
primaryText.verticalCenter : identicon.verticalCenter
anchors.verticalCenterOffset:(statusExpandableItem.type === StatusExpandableItem.Type.Tertiary) ? -3 : -1
anchors.right: parent.right
anchors.rightMargin: (statusExpandableItem.type === StatusExpandableItem.Type.Primary) ? 23 : 6
anchors.rightMargin: {
switch (statusExpandableItem.type) {
case StatusExpandableItem.Type.Primary:
return 23
break;
case StatusExpandableItem.Type.Secondary:
return 16
break;
default:
return 6
}
}
visible: expandable && !button.visible
color: (statusExpandableItem.type === StatusExpandableItem.Type.Tertiary) ?
Theme.palette.baseColor1 :
@ -144,6 +164,7 @@ Rectangle {
}
MouseArea {
id: sensor
anchors.fill: parent
onClicked: {
if(expandable) {
@ -152,11 +173,13 @@ Rectangle {
}
cursorShape: Qt.PointingHandCursor
visible: !button.visible && expandable
hoverEnabled: true
}
}
Loader {
id: expandableRegion
anchors.top: !!secondaryText.text ? secondaryText.bottom: primaryText.bottom
anchors.top: header.bottom
anchors.topMargin: 16
anchors.left: parent.left
anchors.leftMargin: (statusExpandableItem.type === StatusExpandableItem.Type.Primary) ? 48 : 0