blob: e89ee990ec13682a271daf934a2f2b7f3e20d251 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
import QtQuick
// A titlebar's round icon button: no box, a round tint on hover, red for a
// danger one (close). Keystone's titlebar and the assistant card's.
Rectangle {
id: btn
property string icon: ""
property bool danger: false
signal clicked()
width: 28
height: 28
radius: 14
color: area.containsMouse ? Qt.alpha(btn.danger ? Theme.red : Theme.accent, 0.25) : "transparent"
Text {
anchors.centerIn: parent
text: btn.icon
font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 }
color: Theme.text
}
MouseArea {
id: area
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: btn.clicked()
}
}
|