【发布时间】:2016-11-04 21:12:01
【问题描述】:
我在ScrollView 中有一个TextEdit。当用户按下向上或向下箭头键并将文本移动到ScrollView 边界之外时,如何实现逻辑以使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++
}
}
【问题讨论】:
标签: qt qml qtquick2 qtquickcontrols