mirror of
https://github.com/logos-storage/logos-storage-app-skeleton.git
synced 2026-06-16 13:29:32 +00:00
62 lines
1.5 KiB
QML
62 lines
1.5 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import Logos.Theme
|
|
|
|
// qmllint disable unqualified
|
|
Button {
|
|
id: control
|
|
padding: Theme.spacing.small
|
|
|
|
// "default" | "success"
|
|
property string variant: "default"
|
|
|
|
readonly property bool isSuccess: variant === "success"
|
|
|
|
contentItem: Text {
|
|
text: control.text
|
|
font.pixelSize: Theme.typography.primaryText
|
|
color: {
|
|
if (!control.enabled)
|
|
return Theme.palette.textMuted
|
|
if (control.isSuccess)
|
|
return Theme.palette.background
|
|
return Theme.palette.text
|
|
}
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
|
|
background: Rectangle {
|
|
color: {
|
|
if (!control.enabled) {
|
|
return Theme.palette.backgroundElevated
|
|
}
|
|
if (control.isSuccess) {
|
|
return Theme.palette.success
|
|
}
|
|
return Theme.palette.backgroundSecondary
|
|
}
|
|
border.width: 1
|
|
border.color: {
|
|
if (!control.enabled) {
|
|
return Theme.palette.border
|
|
}
|
|
if (control.isSuccess) {
|
|
return Theme.palette.success
|
|
}
|
|
return Theme.palette.border
|
|
}
|
|
radius: Theme.spacing.tiny
|
|
|
|
Behavior on color {
|
|
ColorAnimation {
|
|
duration: 150
|
|
}
|
|
}
|
|
}
|
|
|
|
HoverHandler {
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
}
|