status-desktop/ui/shared/status/StatusChatCommandButton.qml
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

73 lines
2.0 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../shared"
Button {
id: control
property int iconRotation: 0
implicitWidth: 168
implicitHeight: 95
icon.width: 12
icon.height: 12
onIconChanged: {
icon.source = icon.name ? Style.svg(icon.name) : ""
}
contentItem: Item {
anchors.fill: parent
Rectangle {
radius: 50
width: 40
height: 40
color: control.icon.color
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.smallPadding
SVGImage {
id: iconImage
source: control.icon.source
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: control.icon.width
height: control.icon.height
fillMode: Image.PreserveAspectFit
rotation: control.iconRotation
antialiasing: true
}
ColorOverlay {
anchors.fill: iconImage
source: iconImage
color: Style.current.white
rotation: control.iconRotation
antialiasing: true
}
}
StyledText {
text: control.text
anchors.left: parent.left
anchors.leftMargin: Style.current.smallPadding
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.smallPadding
font.weight: Font.Medium
font.pixelSize: 13
}
}
background: Rectangle {
radius: 16
color: Utils.setColorAlpha(icon.color, 0.2)
}
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onPressed: mouse.accepted = false
}
}