1
나는 ScrollView
안에 TextEdit
을 가지고 있습니다. 사용자가 위 또는 아래 화살표 키를 눌렀을 때 ScrollView
범위를 넘어서 텍스트를 이동할 때 ScrollView
이 움직 이도록 논리를 구현할 수 있습니까?위 키 및 아래 키를 사용하여 하위 QML 텍스트 편집을 탐색 할 때 QML ScrollView 탐색을 업데이트하는 방법
//qml
ScrollView {
id: palGenTextScrollView
property int scrollBarWidth: 15
anchors.fill: parent
MouseArea {
id: mouseArea
anchors.fill: parent
onWheel: {
if (wheel.modifiers & Qt.ControlModifier){
if (wheel.angleDelta.y > 0)
{
mainTextEdit.font.pixelSize++
}
else
{
mainTextEdit.font.pixelSize--
}
}
else{
wheel.accepted=false
}
}
}
TextEdit {
id: mainTextEdit
text: fileio.palFileText
font.family: "Courier"
wrapMode: TextEdit.Wrap
selectByMouse: true
//when going out of upward bounds: palGenTextScrollView.flickableItem.contentY--
//when going out of downward bounds: palGenTextScrollView.flickableItem.contentY++
}
}