[SOLVED] Handle QListWidget click
I have would like to handle a click in QListWidget. When I click on some other song, current song should stop playing and clicked one should start.
I connected SIGNAL clicked with my slot, but don't know how to get index of clicked item and then send that to player...
@connect(ui->listWidget1, SIGNAL(clicked(QModelIndex)), this, SLOT(updateSong()));@
the QModelIndex does exactly that, it allows you to retrieve the information from the model.
Have a look at the Model/View documentation to see how it can be used
@QModelIndex ind = ui->listWidget1->currentIndex();