Debian Codegraph @

resources/qml/components/TextButton.qml

raw
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 import "../ui"
6 import QtQuick 2.15
7 import QtQuick.Controls 2.15
8 import im.nheko 1.0 // for cursor shape
9
10 AbstractButton {
11 id: button
12
13 property alias cursor: mouseArea.cursorShape
14 property color highlightColor: palette.highlight
15 property color buttonTextColor: palette.buttonText
16
17 focusPolicy: Qt.NoFocus
18 width: buttonText.implicitWidth
19 height: buttonText.implicitHeight
20 implicitWidth: buttonText.implicitWidth
21 implicitHeight: buttonText.implicitHeight
22
23 Label {
24 id: buttonText
25
26 anchors.centerIn: parent
27 padding: 0
28 text: button.text
29 color: button.hovered ? highlightColor : buttonTextColor
30 font: button.font
31 verticalAlignment: Text.AlignVCenter
32 horizontalAlignment: Text.AlignHCenter
33 }
34
35 NhekoCursorShape {
36 id: mouseArea
37
38 anchors.fill: parent
39 cursorShape: Qt.PointingHandCursor
40 }
41
42 Ripple {
43 color: Qt.rgba(buttonTextColor.r, buttonTextColor.g, buttonTextColor.b, 0.5)
44 }
45
46 }