Warning, /rolisteam/rolisteam/src/libraries/mindmap/resources/qml/Link.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick
0002 import QtQuick.Controls
0003 import mindmap
0004 import Customization
0005 
0006 MindLink {
0007     id: root
0008     property QtObject style: Theme.styleSheet("Controls")
0009     property alias text: label.text
0010     property bool editable: false
0011     property alias visibleLabel: label.visible
0012     property alias opacityLabel: label.opacity
0013     property color colorBorder: root.style.borderColor
0014     property int borderWidth: 1
0015     property color backgroundLabel: root.style.backgroundColor
0016     property int radius: 5
0017     signal textEdited(var text)
0018 
0019     color: root.style.textColor
0020 
0021     FocusScope {
0022         id: focusScope
0023         anchors.fill: parent
0024         TextField {
0025             id: label
0026             x: root.horizontalOffset - width/2
0027             y: root.verticalOffset - height/2
0028             readOnly: !root.editable
0029             onReadOnlyChanged: focus = root.editable
0030             onEditingFinished: {
0031               console.log("mindlink: "+label.text)
0032               root.editable = false
0033               root.textEdited(label.text)
0034             }
0035             color: root.color
0036 
0037             background: Rectangle {
0038                 border.width: root.borderWidth
0039                 border.color: root.colorBorder
0040                 color: label.readOnly ? Qt.darker(root.backgroundLabel) : root.backgroundLabel
0041                 radius: root.radius
0042                 opacity: root.opacityLabel
0043 
0044             }
0045             MouseArea {
0046                 id: mouse
0047                 anchors.fill: parent
0048                 acceptedButtons: label.readOnly ? Qt.LeftButton : Qt.NoButton
0049                 enabled: label.readOnly
0050                 propagateComposedEvents: true
0051                 onDoubleClicked: {
0052                     root.editable = true
0053                     focusScope.focus = true
0054                     label.focus = true
0055                 }
0056             }
0057         }
0058     }
0059 }