헤더 고정 테이블을 만들고 싶습니다. 지금 내가 가지고있는 아이디어는 두 개의 ScrollView를 사용하는 것입니다. 하나는 헤더 (RowLayout), 하나는 본문 (GridLayout)입니다. 이 두 가지를 가로 방향으로 연결하는 간단한 방법이 있습니까? 하나는 스크롤하고 다른 하나는 동일하게 스크롤합니까?
나는 그것을 수행하는 방법을 모르는 낮은 수행 QtQuick.Controls 1.x
하지만,이 QtQuick.Controls 2.0
ScrollBar
속성이있다 position
.
따라서 여기서 트릭은 ScrollBar
스크롤 할 각 항목에 대해 하나씩 두 개의를 만들고 각 항목의 위치를 다른 항목에 바인딩하는 것입니다.
ApplicationWindow {
visible: true
width: 300
height: 120
title: qsTr("Hello World")
Column {
anchors.fill: parent
Flickable {
id: flick1
width: parent.width
height: parent.height / 2
contentHeight: 2 * height
contentWidth: 2 * width
Item {
anchors.fill: parent
Rectangle {
width: parent.height
height: parent.width
anchors.centerIn: parent
rotation: 90
gradient: Gradient {
GradientStop { position: 1; color: 'black' }
GradientStop { position: 0; color: 'white' }
}
}
}
ScrollBar.horizontal: scrl1
}
Flickable {
id: flick2
width: parent.width
height: parent.height / 2
contentHeight: 2 * height
contentWidth: 2 * width
clip: true
Item {
anchors.fill: parent
Rectangle {
width: parent.height
height: parent.width
anchors.centerIn: parent
rotation: 90
gradient: Gradient {
GradientStop { position: 0; color: 'black' }
GradientStop { position: 1; color: 'white' }
}
}
}
ScrollBar.horizontal: scrl2
}
}
ScrollBar {
id: scrl1
orientation: Qt.Horizontal
}
ScrollBar {
id: scrl2
orientation: Qt.Horizontal
}
Binding {
target: scrl2
property: 'position'
value: scrl1.position
}
Binding {
target: scrl1
property: 'position'
value: scrl2.position
}
}
ScrollBar
거의 모든 것에 s 를 붙이는 방법은 이 질문에 대한 답에서 찾을 수 있습니다. 나는 그렇게 일하지 않기 Layouts
때문에 그들에 대해 더 구체적으로 말할 수 없습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다