blob: b454fd929ab963ea58227d56e0c70f722b389237 (
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
67
68
69
70
71
|
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.1 as UM
import Cura 1.0 as Cura
Button
{
id: objectItemButton
width: parent.width
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("thin_margin").width
rightPadding: UM.Theme.getSize("thin_margin").width
checkable: true
hoverEnabled: true
contentItem: Item
{
width: objectItemButton.width - objectItemButton.leftPadding
height: UM.Theme.getSize("action_button").height
Label
{
id: buttonText
anchors
{
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
text: objectItemButton.text
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text_scene")
visible: text != ""
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
background: Rectangle
{
id: backgroundRect
color: objectItemButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
radius: UM.Theme.getSize("action_button_radius").width
border.width: UM.Theme.getSize("default_lining").width
border.color: objectItemButton.checked ? UM.Theme.getColor("primary") : "transparent"
}
TextMetrics
{
id: buttonTextMetrics
text: buttonText.text
font: buttonText.font
elide: buttonText.elide
elideWidth: buttonText.width
}
Cura.ToolTip
{
id: tooltip
tooltipText: objectItemButton.text
visible: objectItemButton.hovered && buttonTextMetrics.elidedText != buttonText.text
}
onClicked: Cura.SceneController.changeSelection(index)
}
|