我TextArea
在应用程序中添加了一个简单的代码。不幸的是,即使它contentHeight
绕过了,我也无法滚动浏览该文本height
。
这是代码:
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)
}
}
}
TextArea
是默认情况下不可滚动的,主要是为了使多行编辑器可以作为可滚动页面的一部分而没有嵌套Flickable
s,这通常会给用户带来次佳的体验。为了使独立TextArea
滚动成为可能,您可以将其附加到文档中Flickable
所示的上。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句