안녕하세요. ListView Repeater 에 관련해 궁금한 것이 있어 질문을 남깁니다.
Row를 가변으로 만들고, 그 가변 정보에 model 데이터를 넣고 싶어 질문을 드립니다.
ListModel {
id:ref
ListElement {
name: "Bill Smith"
number: "555 3264"
cost : 1
}
ListElement {
name: "John Brown"
number: "555 8426"
cost : 1
}
ListElement {
name: "Sam Wise"
number: "555 0473"
cost : 1
}
}
ListView {
anchors.fill: parent
model: ref
delegate: Rectangle{
id : del
width: parent.width
height: 100
Row{
Repeater{
model : 3;
Rectangle{
width:100 ; height : 40
border.width: 1
color:"yellow"
Text {
anchors.centerIn: parent
text: ref.get(index) ......
}
}
}
}
}
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
focus: true
}
구조는 위와같은 형식으로 되어 있으며
Repeater 안에
Rectangle 데이터를 모델의 name, number , cost 등을 순차적으로 넣고싶은데,
혹시 방법이 있을까요?
2021.07.06 17:27
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
5 | qtquick.Controls 1.x Label 사용 이유 [1] | 플랑크 | 2021.10.20 | 662 |
4 | Qml 파일 c++ 라이브러리을 헤더파일에 추가 방법 | 플랑크 | 2021.11.01 | 1010 |
3 | GridView 안에 Scrollbar | System | 2022.02.23 | 414 |
2 | 외주할 때 어디서 하세요? | 커피모카 | 2022.06.28 | 252 |
1 | qml에서 cpp객체의 함수호출시 js함수를 콜백으로 넘기는 방법 [1] | 데브스카이 | 2022.12.05 | 1109 |
listview 첫번째 인덱스에
델리게이트, name, number, cost row를 가변으로 만들고 그 해당값을 넣어주고 싶습니다
( row 로 몇개가 될진 알수가 없습니다....)
첫번째 인덱스 Bill Smith , 555 3264 , 1
두번째 인덱스 John Brown , 555 8426 , 1