status-desktop/ui/app/AppLayouts/Browser/components/BookmarkButton.qml

47 lines
1.2 KiB
QML
Raw Normal View History

2020-10-27 20:53:22 +00:00
import QtQuick 2.13
import "../../../../shared"
import "../../../../shared/status"
import "../../../../imports"
Item {
property url source
2020-10-27 20:53:22 +00:00
property string text
2020-10-29 20:07:52 +00:00
signal clicked(mouse: var)
signal rightClicked(mouse: var)
2020-10-27 20:53:22 +00:00
id: root
width: 74
height: bookmarkImage.height + bookmarkName.height + Style.current.halfPadding
SVGImage {
id: bookmarkImage
source: !!root.source && !!root.source.toString() ? root.source :"../../../img/compassActive.svg"
2020-10-27 20:53:22 +00:00
anchors.horizontalCenter: parent.horizontalCenter
width: 48
height: 48
}
StyledText {
id: bookmarkName
text: root.text
width: parent.width
anchors.top: bookmarkImage.bottom
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
anchors.topMargin: Style.current.halfPadding
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
2020-10-29 20:07:52 +00:00
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (mouse.button == Qt.RightButton) {
root.rightClicked(mouse)
} else {
root.clicked(mouse)
}
}
2020-10-27 20:53:22 +00:00
}
}