/* * 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 icon.color: MiraiColorPalette.buttonIcon property bool noBackgroundColor: false contentItem: RowLayout { spacing: control.icon.source != "" ? 4 : 0 Component { id: buttonIcon AppIcon { icon.source: control.icon.source icon.color: control?.icon?.color } } Loader { sourceComponent: control.icon.source != "" ? buttonIcon : undefined } Text { text: control.text color: MiraiColorPalette.text leftPadding: 8 rightPadding: 8 } } 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 } }