1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import QtQuick 2.10
- import QtQuick.Controls 2.3
- import UM 1.5 as UM
- import Cura 1.6 as Cura
- Button
- {
-
-
-
-
-
-
- property string labelText: ""
- id: button
- hoverEnabled: true
- leftPadding: UM.Theme.getSize("default_margin").width
- implicitWidth: UM.Theme.getSize("menu").width
- implicitHeight: UM.Theme.getSize("menu").height + UM.Theme.getSize("narrow_margin").height
- background: Rectangle
- {
- height: button.height
- width: button.width
- color: button.hovered ? UM.Theme.getColor("background_2") : UM.Theme.getColor("background_1")
- }
-
- function replaceText(txt)
- {
- var index = txt.indexOf("&")
- if(index >= 0)
- {
- txt = txt.replace(txt.substr(index, 2), ("<u>" + txt.substr(index + 1, 1) + "</u>"))
- }
- return txt
- }
- contentItem: Item
- {
- height: button.height
- width: button.width
- UM.ColorImage
- {
- id: check
- height: UM.Theme.getSize("default_arrow").height
- width: height
- source: UM.Theme.getIcon("Check", "low")
- color: UM.Theme.getColor("setting_control_text")
- anchors.verticalCenter: parent.verticalCenter
- visible: button.checked
- }
- UM.Label
- {
- id: textLabel
- text: button.text != "" ? replaceText(button.text) : replaceText(button.labelText)
- height: contentHeight
- color: button.enabled ? UM.Theme.getColor("text") :UM.Theme.getColor("text_inactive")
- anchors.left: check.right
- anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
- anchors.verticalCenter: parent.verticalCenter
- }
- }
- }
|