Debian Codegraph @

src/GUI/qml/TabButton.qml

raw
1 // SPDX-FileCopyrightText: 2017 James Turner
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 import QtQuick 2.4
5 import FlightGear 1.0
6
7 Rectangle {
8 id: root
9
10 property alias text: buttonText.text
11 property bool active: false
12 property bool enabled: true
13
14 signal clicked
15
16 width: buttonText.width + (radius * 2)
17 height: buttonText.height + (radius * 2)
18 radius: 6
19
20 color: mouse.containsMouse ? Style.activeColor : (active ? Style.themeColor : Style.backgroundColor)
21
22 StyledText {
23 id: buttonText
24 anchors.centerIn: parent
25 color: root.enabled ? ((active | mouse.containsMouse) ? Style.themeContrastTextColor : Style.baseTextColor) : Style.disabledTextColor
26 }
27
28 MouseArea {
29 id: mouse
30 anchors.fill: parent
31 hoverEnabled: root.enabled
32 enabled: root.enabled
33
34 onClicked: {
35 root.clicked();
36 }
37
38 }
39 }