2
votes

how can i remove the line which appears under a text area in qml? is it even possible? because groove music has such a thing without a line! what is that? if not what other component should i use instead?

thanks in advance

TextArea{
            id:search
            placeholderText: qsTr("Search")
            x:7
            width: parent.width - 25
            onFocusChanged: border.color= "gray"

        }

(as in groove music search box or telegram which has no line and only a place holder text)

Screenshot:

enter image description here

1
What Qt version? What OS? What a line? I have no line in me TextArea. - folibis
5.9 - windows - can't upload image to show you what i mean - Soroush Hosseinpour
If you can not upload it directly here upload it to another place and share the link - eyllanesc
You could share a reproducible and complete example, since I have executed the code and it does not generate that error - eyllanesc

1 Answers

3
votes

That looks like the Material style. You can disable the line by setting the background to null:

import QtQuick 2.7
import QtQuick.Controls 2.0

ApplicationWindow {
    visible: true
    width: 640
    height: 480

    TextArea {
        placeholderText: qsTr("Search")
        focus: true
        background: null
        anchors.centerIn: parent
    }
}