Alexandra Betouni 4ee21ada05 feat(desktop) Added image function in Style
Introduced Style.svg() Style.png() Style.emoji() and
Style.icon() in Style.qml. Those should be used to
set the source in Images instead of using relative
paths. Usage:
Image {
   source: Style.svg("check)
   ....

Also moved all Singletons inside a new "utils"
folder and made it a QML module, to use
import utils 1.0 instead of relative paths

Closes #3678
2021-09-28 15:28:00 -04:00

62 lines
1.5 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../../shared"
Rectangle {
property url source: Style.svg("emojiBtn")
property bool hovered: false
property bool opened: false
property var close: function () {}
property var open: function () {}
id: root
width: this.visible ? buttonIcon.width + 4 + chatButtonsContainer.iconPadding * 2 : 0
height: this.visible ? buttonIcon.height + chatButtonsContainer.iconPadding * 2 : 0
radius: Style.current.radius
color: hovered ? Style.current.secondaryBackground : Style.current.transparent
anchors.verticalCenter: parent.verticalCenter
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()
}
}
}
}
/*##^##
Designer {
D{i:0;formeditorZoom:1.5}
}
##^##*/