mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 10:13:42 +00:00
first commit
This commit is contained in:
commit
3e7d8b4b70
43 changed files with 2681 additions and 0 deletions
51
src/qml/AppButton.qml
Normal file
51
src/qml/AppButton.qml
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue