File: ReadOnlyTextArea.qml

package info (click to toggle)
cura 5.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 122,920 kB
  • sloc: python: 44,572; sh: 81; xml: 32; makefile: 16
file content (44 lines) | stat: -rw-r--r-- 928 bytes parent folder | download | duplicates (2)
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
// Copyright (c) 2016 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.1
import QtQuick.Controls 2.15
import UM 1.5 as UM

ScrollView
{
    id: base

    property alias text: textArea.text
    property alias wrapMode: textArea.wrapMode

    signal editingFinished();

    property bool readOnly: false

    TextArea
    {
        id: textArea

        enabled: !base.readOnly
        selectByMouse: true

        background: UM.UnderlineBackground { id: backgroundRectangle }

        color: UM.Theme.getColor("text")
        selectionColor: UM.Theme.getColor("text_selection")
        font: UM.Theme.getFont("default")

        Keys.onReturnPressed:  base.editingFinished()

        Keys.onEnterPressed: base.editingFinished()

        onActiveFocusChanged:
        {
            if(!activeFocus)
            {
                base.editingFinished()
            }
        }
    }
}