1
我在我的應用程序中添加了一個簡單的TextArea
。不幸的是,即使其contentHeight
繞過其height
,我也無法滾動文本。
下面是代碼:QML TextArea不會滾動
import QtQuick 2.7
import QtQuick.Controls 2.0
ApplicationWindow {
id: appWindow
visible: true
width: 480
height: 640
TextArea{
anchors.fill: parent
anchors.margins: 100
wrapMode: TextEdit.Wrap
Component.onCompleted: {
console.log("width:", width)
console.log("contentWidth:", contentWidth)
console.log("height:", height)
console.log("contentHeight:", contentHeight)
}
onTextChanged: {
console.log("width:", width)
console.log("contentWidth:", contentWidth)
console.log("height:", height)
console.log("contentHeight:", contentHeight)
}
}
}
我最初想用一個Label從我的服務器獲取預定義的文本。即使使用Flickable,我也無法滾動瀏覽標籤:/ –
您可以在「Flickable」中包含「Label」代碼,我可以在答案中滾動瀏覽代碼嗎? –
將'Flickable :: contentHeight'綁定到標籤的高度。 – jpnurmi