[Qt-interest] How to get index of a QListView when no selection

Bo Thorsen bo at fioniasoftware.dk
Sun May 22 21:29:40 CEST 2011


Den 22-05-2011 07:33, Aaron Lewis skrev:
> Hi,
> 	How can i get the index of arbitrary entry in a QListView ?
>
> 	When there's no selection , currentIndex().row() always returns -1.
>
> 	I need to retrieve the contents of the first entry in a QListView ,
> 	basically i retrieve it withe a custom index , but in this case ,
> 	how can i find a valid index ?

view()->index(0, 0) or one of the specific index() functions of the models.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Qt-interest-old mailing list