Two text area scroll with one Scroll Bar / view
-
I am trying to build a text compare editor and I need to scroll two text area with one scroll bar .
ScrollView {
id: _scrollview
width: parent.width * 0.8
height: parent.heightRow { width: parent.width height: parent.height Rectangle { id: _compareLeftBox width: parent.width * 0.5 height: parent.height color: "white" TextArea { id: _leftTextArea anchors.fill: parent readOnly: true textFormat: TextEdit.RichText wrapMode: TextArea.Wrap //verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff } } Rectangle { id: _compareRightBox width: parent.width * 0.5 height: parent.height color: "white" TextArea { id: _rightTextArea anchors.fill: parent readOnly: true textFormat: TextEdit.RichText wrapMode: TextArea.Wrap //verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff } } } } ScrollBar.vertical: ScrollBar { id: scrollBarY orientation: Qt.Vertical anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom // Bind ScrollBar position to ScrollView contentY onPositionChanged: { _leftTextArea.verticalScrollBar.position = scrollBarY.position _rightTextArea.verticalScrollBar.position = scrollBarY.position } } }
I am not sure whats going wrong here
-
A Adithya has marked this topic as solved on