Q:

newline symbol in qml Textfield, text property not working

Is there a possibility to insert a newline character into the text property of a TextField component:
import QtQuick 2.6
import QtQuick.Controls 1.2
import QtQuick.Window 2.2

Window {
    visible: true
    width: 640
    height: 480

    Grid {
        TextField {
            text: "Text\nhere"
        }
    }
}

prints a blank instead of a newline in the Textfield

A:

According to the docs:

TextField is used to accept a line of text input. [...]

Therefore you can not have multiple lines in that item. You must use another item like TextArea
import QtQuick 2.6
import QtQuick.Controls 1.2
import QtQuick.Window 2.2

Window {
    visible: true
    width: 640
    height: 480

    Grid {
        TextArea {
            text: "Text\nshere"
        }
    }
}

