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,11 +37,15 @@ Rectangle {
} }
} }
RowLayout {
id: layout
height: parent.height
spacing: 5
StatusSmartIdenticon { StatusSmartIdenticon {
id: iconOrImage id: iconOrImage
anchors.left: parent.left Layout.leftMargin: 5
anchors.leftMargin: 5
anchors.verticalCenter: parent.verticalCenter
image: root.image image: root.image
icon: root.icon icon: root.icon
name: root.title name: root.title
@ -49,29 +56,26 @@ Rectangle {
StatusBaseText { StatusBaseText {
id: titleText id: titleText
anchors.left: iconOrImage.right
anchors.leftMargin: 5
anchors.verticalCenter: parent.verticalCenter
color: Theme.palette.primaryColor1 color: Theme.palette.primaryColor1
text: root.title text: root.title
Layout.rightMargin: closeButtonVisible ? 0 : 5
} }
StatusIcon { StatusIcon {
id: closeIcon id: closeIcon
anchors.left: titleText.right
anchors.leftMargin: 5
anchors.verticalCenter: parent.verticalCenter
color: Theme.palette.primaryColor1 color: Theme.palette.primaryColor1
icon: "close-circle" icon: "close-circle"
} visible: closeButtonVisible
Layout.rightMargin: 5
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: closeIcon anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
root.clicked() root.clicked()
} }
} }
}
}
} }