qt - Qml listView mirroring layout currrent Index -


i working listview component , have trouble currentindex property. want action on

oncurrentindexchanged: 

but when use

layoutmirroring.enabled: true 

currentindex not updated anymore. there no action in oncurrentindexchanged , currentindex equal 0 time. i've tried use
layoutdirection: qt.righttoleft problem same ( no currentindex updates when listview moved).

i've read listview documentation , there information, if use

snapmode: listview.snaptoitem 

you need add

highlightrangemode:  listview.strictlyenforcerange   

in order currentindex update properly. maybe there similar mirror layout?

here whole code:

listview     {         id: id_couplingcontrolview          model: id_multicouplingmeasurepopup.p_icouplingscount         orientation: listview.horizontal             snapmode: listview.snaptoitem         highlightrangemode:  listview.strictlyenforcerange          //to update currentindex list moved         preferredhighlightbegin: id_multicouplingmeasurepopup.p_bviewrotated ? id_couplingcontrolview.width : id_couplingcontrolview.leftmargin         layoutmirroring.enabled:  id_multicouplingmeasurepopup.p_bviewrotated         //layoutdirection: id_multicouplingmeasurepopup.p_bviewrotated ? qt.righttoleft : qt.lefttoright          delegate: qmlshmulticouplingmeasurecontrol         {             id: id_couplingmeasurecontrol              p_iindex: index             component.oncompleted:             {                 initializecouplingcontrol ( id_couplingmeasurecontrol )             }         }          //need to here         oncurrentindexchanged:         {             console.log ( "oncurrentindexchanged:: " + id_couplingcontrolview.currentindex )             id_multicouplingmeasurepopup.updateminitraincouplinglist( id_couplingcontrolview.currentindex );         }     } 

so question is: need have currentindex updated while scrolling listview when using layoutmirroring.enabled: true or layoutdirection: qt.righttoleft.

ok got solution!

the problem beacuse of line:

preferredhighlightbegin: id_multicouplingmeasurepopup.p_bviewrotated ? id_couplingcontrolview.width : id_couplingcontrolview.leftmargin 

for rotated view setting preferredhighlightbegin wide width of listview itself. that's why currentindex not updated. mirroring listview had nothing it.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -