blob: 9a6ff17af9de69ef4dbb52d9be4f45865458829b (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import Style 1.0
Button {
id: root
property string imageSource: ""
property string imageSourceHover: ""
property Image iconItem: icon
property string toolTipText: ""
property color textColor: Style.ncTextColor
property color textColorHovered: textColor
property alias bgColor: bgRectangle.color
property bool bold: false
property real bgOpacity: 0.3
background: Rectangle {
id: bgRectangle
color: "transparent"
opacity: parent.hovered ? 1.0 : bgOpacity
radius: width / 2
}
leftPadding: root.text === "" ? 5 : 10
rightPadding: root.text === "" ? 5 : 10
NCToolTip {
text: root.toolTipText
visible: root.toolTipText !== "" && root.hovered
}
contentItem: RowLayout {
Image {
id: icon
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
source: root.hovered ? root.imageSourceHover : root.imageSource
fillMode: Image.PreserveAspectFit
}
Label {
Layout.maximumWidth: icon.width > 0 ? parent.width - icon.width - parent.spacing : parent.width
Layout.fillWidth: icon.status !== Image.Ready
text: root.text
font.bold: root.bold
visible: root.text !== ""
color: root.hovered ? root.textColorHovered : root.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
}
|