In my QMainWindow
Constructor I read a database and fill my QListWidget
with the items. Apparently there is no item selected so I have to do it on my own. I also have a slot which will be called when I click on an item in the list.
I tried setCurrentRow( const int )
but if I do so the slot won't be called. I've seen the function setCurrentIndex( const QModelIndex & ) but I'm not familiar with the QModelIndex.
How do I tell my QListWidget to select the first item and call the on_list_clicked(const QModelIndex& index)
slot?
Edit:
Also, I cannot use any other slot than clicked because currentRowChanged(int)
and itemSelectionChanged()
both make my program crash when I remove a certain index from the list.
So somehow I need to perform a click on the list...