[SOLVED] How to select item 3 of listwidget in 1 line?
-
i just want to select item 3 of listwidget and it seems that
@ui->listwidget->setCurrentItem(3);@won't work.
I know a way to do it if i create a list of the items but it is about in 6 lines just to select an item.. -
You might try via the selectionModel().
-
could you please be a little more detailed? at list one link to know where to look up...?
-
Check [[doc:QAbstractItemModel]] for the selectionModel() method, and [[doc:QItemSelectionModel]] for the documentation of the selection model itself.
-
Well i prefered doing it this way as 1 row has 1 item:
@
ui->listWidget_2->setFocus();
ui->listWidget_2->setCurrentRow(2);@:)