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