mirai/src/qml/AppButton.qml

45 lines
1.1 KiB
QML
Raw Normal View History

2024-04-10 16:53:18 +02:00
/*
* Mirai. Copyright (C) 2024 Vyn
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Mirai
Button {
id: control
property bool noBackgroundColor: false
icon.color: MiraiColorPalette.buttonIcon
// I have a different behavior when setting padding for Android
padding: root.isPhone ? undefined : 8
contentItem: IconLabel {
spacing: control.spacing
mirrored: control.mirrored
display: control.display
icon: control.icon
text: control.text
font: control.font
color: MiraiColorPalette.text
}
2024-04-10 16:53:18 +02:00
background: Rectangle {
color: control.noBackgroundColor ? "transparent"
: mouse.hovered ? colorPalette.selected.buttonHovered
: colorPalette.selected.buttonBackground
radius: 4
}
HoverHandler {
id: mouse
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
cursorShape: Qt.PointingHandCursor
}
}