Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select first item in qlistview by default

Can anyone tell me how i can set the first item of the qlistview every time i click an item ? I am using qfilesystemmodel along with qListView. Basically I want the first item shown by the model to get selected by default.

like image 790
prakashpun Avatar asked Apr 01 '11 10:04

prakashpun


1 Answers

This should do the job.

view->setCurrentIndex(fsModel->index(0, 0));

Hope this helps.

like image 74
zkunov Avatar answered Sep 19 '22 21:09

zkunov