Debian Codegraph @

src/qml/CTabButton.qml

raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2025 Juan Palacios <[email protected]>
3
4 import QtQuick 2.15
5 import QtQuick.Controls 2.15
6 import QtQuick.Layouts 1.15
7 import "Style.js" as Style
8
9 TabButton {
10 id: btn
11 property bool active: true
12
13 contentItem: Text {
14 text: btn.text
15 font: btn.font
16 color: btn.checked ? Style.Theme.accent
17 : Style.Theme.foreground
18 horizontalAlignment: Text.AlignHCenter
19 verticalAlignment: Text.AlignVCenter
20 elide: Text.ElideRight
21 }
22
23 background: ColumnLayout {
24 anchors.fill: parent
25 spacing: 0
26
27 // content
28 Rectangle {
29 color: btn.hovered ? Style.TabBar.Button.background_alt
30 : Style.TabBar.Button.background
31 Layout.fillWidth: true
32 Layout.fillHeight: true
33 }
34 // active accent
35 Rectangle {
36 visible: btn.checked
37 color: btn.enabled && btn.active ? Style.Theme.accent
38 : Style.Theme.accent_alt
39 Layout.preferredHeight: Style.TabBar.Button.accent_size
40 Layout.fillWidth: true
41 }
42 }
43 }