selectList->connect(selectList, SIGNAL(currentRowChanged(int)), this, SLOT(ChangeEffect())); void MainWindow::ChangeEffect() { soundfile = playItems.at(selectList->currentRow()); player->setMedia(QUrl::fromLocalFile(soundfile)); }