簡體   English   中英

QML中的TextArea樣式

[英]TextArea styles in QML

我想更改TextArea對象的顏色,但我不知道屬性如何實現。

我嘗試過

TextArea {
    styles: TextAreaStyle {
        borderColor : "green"
    }
}

要么

TextArea {
    TextArea.border.color : "green"
}

但是這兩個例子都行不通。 我找不到QA引用中TextArea的單個屬性來更改邊框顏色。 這可能嗎?我該怎么辦?

謝謝!

正如我所說的, TextAreaStyle沒有borderColor 但是您可以通過“棘手”的方式來做到這一點:

Rectangle {
    color: "green"
    anchors.fill: parent
    anchors.margins: 20

    TextArea {
        anchors.fill: parent
        anchors.margins: 1
        style: TextAreaStyle {
            backgroundColor : "yellow"
        }

    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM