[SOLVED] Handle QListWidget click
-
Hello,
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()));@
-
Hi,
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
-
SOLVED!
@QModelIndex ind = ui->listWidget1->currentIndex();
if(!ind.isValid())
return;
playlist->setCurrentIndex(ind.row());@