mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-27 15:02:50 -05:00
refactor: create DankActionButton and implement
This commit is contained in:
44
Widgets/DankActionButton.qml
Normal file
44
Widgets/DankActionButton.qml
Normal file
@@ -0,0 +1,44 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property string iconName: ""
|
||||
property int iconSize: Theme.iconSize - 4
|
||||
property color iconColor: Theme.surfaceText
|
||||
property color hoverColor: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
|
||||
property color backgroundColor: "transparent"
|
||||
property bool circular: true
|
||||
property int buttonSize: 32
|
||||
|
||||
signal clicked()
|
||||
|
||||
width: buttonSize
|
||||
height: buttonSize
|
||||
radius: circular ? buttonSize / 2 : Theme.cornerRadius
|
||||
color: mouseArea.containsMouse ? hoverColor : backgroundColor
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: root.iconName
|
||||
size: root.iconSize
|
||||
color: root.iconColor
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.clicked()
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user