forked from Shinonome/dots-hyprland
44 lines
1.2 KiB
QML
44 lines
1.2 KiB
QML
import "root:/modules/common"
|
|
import "root:/modules/common/widgets"
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
Button {
|
|
id: button
|
|
property string buttonText: ""
|
|
property string tooltipText: ""
|
|
property bool forceCircle: false
|
|
|
|
implicitHeight: 30
|
|
implicitWidth: forceCircle ? implicitHeight : (contentItem.implicitWidth + 10 * 2)
|
|
Behavior on implicitWidth {
|
|
SmoothedAnimation {
|
|
velocity: Appearance.animation.elementMove.velocity
|
|
}
|
|
}
|
|
|
|
PointingHandInteraction {}
|
|
|
|
background: Rectangle {
|
|
anchors.fill: parent
|
|
radius: Appearance.rounding.full
|
|
color: (button.down) ? Appearance.colors.colLayer2Active : (button.hovered ? Appearance.colors.colLayer2Hover : Appearance.colors.colLayer2)
|
|
|
|
Behavior on color {
|
|
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
|
}
|
|
|
|
}
|
|
contentItem: StyledText {
|
|
text: buttonText
|
|
horizontalAlignment: Text.AlignHCenter
|
|
font.pixelSize: Appearance.font.pixelSize.larger
|
|
color: Appearance.colors.colOnLayer1
|
|
}
|
|
|
|
StyledToolTip {
|
|
content: tooltipText
|
|
extraVisibleCondition: tooltipText.length > 0
|
|
}
|
|
} |