fix(StatusListItemTag): Fix for allignment in StatusListItemTag and option to make close button invisible

This commit is contained in:
Khushboo Mehta 2022-03-22 18:38:55 +01:00 committed by r4bbit.eth
parent 6ce9f9bd86
commit bbc0177a66
1 changed files with 43 additions and 39 deletions

View File

@ -6,12 +6,15 @@ import StatusQ.Core.Theme 0.1
Rectangle { Rectangle {
id: root id: root
width: titleText.contentWidth + 60 width: layout.width
height: 30 height: 30
color: Theme.palette.primaryColor3 color: Theme.palette.primaryColor3
radius: 15 radius: 15
property alias titleText: titleText
property string title: "" property string title: ""
property bool closeButtonVisible: true
signal clicked() signal clicked()
property StatusImageSettings image: StatusImageSettings { property StatusImageSettings image: StatusImageSettings {
@ -34,44 +37,45 @@ Rectangle {
} }
} }
StatusSmartIdenticon { RowLayout {
id: iconOrImage id: layout
anchors.left: parent.left
anchors.leftMargin: 5
anchors.verticalCenter: parent.verticalCenter
image: root.image
icon: root.icon
name: root.title
active: root.icon.isLetterIdenticon ||
!!root.icon.name ||
!!root.image.source.toString()
}
StatusBaseText { height: parent.height
id: titleText spacing: 5
anchors.left: iconOrImage.right
anchors.leftMargin: 5
anchors.verticalCenter: parent.verticalCenter
color: Theme.palette.primaryColor1
text: root.title
}
StatusIcon { StatusSmartIdenticon {
id: closeIcon id: iconOrImage
anchors.left: titleText.right Layout.leftMargin: 5
anchors.leftMargin: 5 image: root.image
anchors.verticalCenter: parent.verticalCenter icon: root.icon
color: Theme.palette.primaryColor1 name: root.title
icon: "close-circle" active: root.icon.isLetterIdenticon ||
} !!root.icon.name ||
!!root.image.source.toString()
}
MouseArea { StatusBaseText {
id: mouseArea id: titleText
anchors.fill: closeIcon color: Theme.palette.primaryColor1
hoverEnabled: true text: root.title
cursorShape: Qt.PointingHandCursor Layout.rightMargin: closeButtonVisible ? 0 : 5
onClicked: { }
root.clicked()
StatusIcon {
id: closeIcon
color: Theme.palette.primaryColor1
icon: "close-circle"
visible: closeButtonVisible
Layout.rightMargin: 5
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.clicked()
}
}
} }
} }
} }