2020-08-17 15:52:41 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-08-17 15:52:41 +00:00
|
|
|
import "../../../../../shared"
|
|
|
|
|
|
|
|
Rectangle {
|
2021-09-28 15:04:06 +00:00
|
|
|
property url source: Style.svg("emojiBtn")
|
2020-08-17 15:52:41 +00:00
|
|
|
property bool hovered: false
|
|
|
|
property bool opened: false
|
|
|
|
property var close: function () {}
|
|
|
|
property var open: function () {}
|
|
|
|
|
|
|
|
id: root
|
2020-08-18 15:08:33 +00:00
|
|
|
width: this.visible ? buttonIcon.width + 4 + chatButtonsContainer.iconPadding * 2 : 0
|
|
|
|
height: this.visible ? buttonIcon.height + chatButtonsContainer.iconPadding * 2 : 0
|
2020-08-17 15:52:41 +00:00
|
|
|
radius: Style.current.radius
|
|
|
|
color: hovered ? Style.current.secondaryBackground : Style.current.transparent
|
2020-08-17 20:46:13 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-08-17 15:52:41 +00:00
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: buttonIcon
|
|
|
|
visible: txtData.length === 0
|
|
|
|
source: root.source
|
|
|
|
width: 20
|
|
|
|
height: 20
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: buttonIcon
|
|
|
|
source: buttonIcon
|
|
|
|
color: root.hovered || root.opened ? Style.current.blue : Style.current.darkGrey
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
root.hovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
root.hovered = false
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
if (root.opened) {
|
|
|
|
root.close()
|
|
|
|
} else {
|
|
|
|
root.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-18 15:08:33 +00:00
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorZoom:1.5}
|
|
|
|
}
|
|
|
|
##^##*/
|