[Interest] Listview keeping highlight constant

Bo Thorsen bo at fioniasoftware.dk
Fri Oct 26 12:38:43 CEST 2012


I have implemented exactly this by placing the menu in the back and a 
highlight over it.

Menu {
   y: 0 - currentIndex * itemHeight
}
Highlight {
   y: 0
   z: 1
}

If you make sure the currentIndex is always a number that describes the 
chosen item, the menu will move automatically for you. Put an animation 
object on Menu.y and you have a pretty nice solution with minimum code.

Bo.

Den 26-10-2012 10:47, Satya Praveen Ganapathi skrev:
>
> Hi,
>
> I have a listview with highlight following current listitem.
>
> I need one small change to this listview, on key up/down pressed I 
> want to keep the highlight constant and move list items up and down 
> respectively.
>
> Do we have any property setting for such functionality in Qt 5.0 ? I 
> tried "move" in listview but it dint work for me.
>
> Please share the links if any......!
>
> Do  share code samples if any.
>
> Example:
>
> List Item 1 ß Highlight (constant)
>
> List Item 2
>
> List Item 3
>
>                 List Item 4
>
> On key up pressed
>
> List Item 2 ß-- Highlight (constant)
>
> List Item 3
>
>                 List Item 4
>
>                 List Item 5
>
> On key down pressed
>
> List Item 0 ß-- Highlight (constant)
>
> List Item 1
>
>                 List Item 2
>
>                 List Item 3
>
> Thanks
>
> Regards,
>
> Satya Praveen
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


-- 
Bo Thorsen.

Come by my DevDays talk in Berlin - "Designing for testability". Learn how to build and run your unit tests with the Qt application.

Fionia Software - Qt experts for hire.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121026/ea3292d4/attachment.html>


More information about the Interest mailing list