Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QListWidgetItem activate first item



  • Hi,

    I am stuck in the activation of the first item from a QListWidget. I am using setCurrentRow method which already works for the rest of the items but not for the first one. Debugging I can know that the first item is already selected and activated but in the list widget is not highlighted in blue as it does when the item is activated.

    Thank you in advance



  • You could, when you open the Window, select it manually with this

    Return the first Element of that Widget as Pointer with QListWidget->takeItem() and set it to selected.



  • listWidget->selectionModel()->setCurrentIndex(listWidget->model()->index(0,0));



  • Thanks for your answers. Both solutions are working for the rest of the items but not for the first one... :(



  • Could you show your code?



  • I solved the problem. It was a bug...

    Thanks for your help and patience!!


Log in to reply