ListView Size problem
-
wrote on 12 Feb 2019, 19:15 last edited by
@dheerendra @J-Hilk @LeLev @Yunus
When i click down-arrow of keyboard then focus get changed and it shows next listview element, but problem here is, initially it is showing 2 Listelement but as i go down so after 2 listelement it's height is getting increased and when i go at last element, it's height comes back to original.
what is the problem here, why the height is changing as i am going from 1 element to last element ???
import QtQuick 2.6 import QtQuick.Window 2.2 Rectangle { id:top visible: true width: 100 height: 150 ListModel { id:time ListElement{time_scale:"30 MIN"} ListElement{time_scale:"1 HOUR"} ListElement{time_scale:"2 HOUR"} ListElement{time_scale:"3 HOUR"} ListElement{time_scale:"4 HOUR"} ListElement{time_scale:"5 HOUR"} ListElement{time_scale:"6 HOUR"} } Component { id:comp Rectangle { width: parent.width height: 40 color:"gray" border.width: 1 Text { text:time_scale anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter } } } Component { id:high Rectangle { width: parent.width height: 40 color:Qt.rgba(0,0,255,0.1) z:5 /*opacity: 0.5 this will also work */ } } Rectangle { id:master width: parent.width height: parent.height/2 anchors.centerIn: parent color: "red" ListView { id:ge spacing:0 height: parent.height width: parent.width model:time delegate: comp highlight: high focus:true } } }
-
wrote on 13 Feb 2019, 01:31 last edited by
@Bhushan_Sure Hello. I don't know your final application, but if you change the height of master component (eliminate the "/2") the problem fix? I test this solution and the change of height was eliminated...
-
@Bhushan_Sure Hello. I don't know your final application, but if you change the height of master component (eliminate the "/2") the problem fix? I test this solution and the change of height was eliminated...
wrote on 13 Feb 2019, 05:22 last edited by@oria66 if i eliminate master height(/2) , then it will take windows height then in that case it is working fine, But i don't have to give window's height, i want some specific height only. Only i case of parent height it is working fine.
-
wrote on 13 Feb 2019, 07:34 last edited by
Hi! setting clip property of listview to true would eliminate the visibility of unwanted delegate. But, I'm not sure whether this is the correct solution. Clip operation is a costly operation, would impact the performance.
-
Hi! setting clip property of listview to true would eliminate the visibility of unwanted delegate. But, I'm not sure whether this is the correct solution. Clip operation is a costly operation, would impact the performance.
wrote on 13 Feb 2019, 08:55 last edited by@Yashpal It work's fine for me, Thank you Yashpal :)
1/5