[SOLVED]How to click the first row in Qlistview by default ?
-
I have some items in the qlistview . I want the first row to be clicked by default (no column in listview)
i have used signal clicked if the user click the items . But i want item0 to be clicked by default.connect(ui->listView_Messages,SIGNAL(clicked(QModelIndex)),this,SLOT(listViewClicked(QModelIndex)));
-
Hi,
Do you mean selected ? If so use QItemSelectionModel::select
You can retrieve the selection model directly from your QListView.Hope it helps
-
The correct way to select an item is using the selection model. The clicked signal is emitted on mouse interaction.
-
Silly question but is Index valid ?