bigscreen-tube/bigscreen_tube/ui/MediaControlButton.qml

49 lines
1.3 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15 as Controls
import QtQuick.Templates 2.12 as QQCT
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import BigScreenTube 1.0
Controls.Button {
property string iconSource
id: button
background: Rectangle {
color: button.activeFocus ? Kirigami.Theme.highlightColor : Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, .4)
radius: Kirigami.Units.iconSizes.large * .5 + Kirigami.Units.largeSpacing * 2
Behavior on color {
ColorAnimation {
duration: Kirigami.Units.longDuration
easing.type: Easing.OutCubic
}
}
}
topPadding: Kirigami.Units.largeSpacing * 2
bottomPadding: Kirigami.Units.largeSpacing * 2
leftPadding: Kirigami.Units.largeSpacing * 2
rightPadding: Kirigami.Units.largeSpacing * 2
icon.source: iconSource
width: Kirigami.Units.iconSizes.large
height: Kirigami.Units.iconSizes.large
icon.color: button.activeFocus ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
Behavior on icon.color {
ColorAnimation {
duration: Kirigami.Units.longDuration
easing.type: Easing.OutCubic
}
}
Keys.onReturnPressed: {
clicked()
}
}