Qt annot get metadata from audio file while loading it -
i have problem getting metadata file while loading disk. can play etc. can’t metadata while loading it.
here loading function:
btw. “ui->playlistview” element qtablewidget.
void mainwindow::on_actionopen_triggered() { qfiledialog *filedialog = new qfiledialog(this); qstringlist selectedfiles; selectedfiles.clear(); selectedfiles = filedialog->getopenfilenames(this, "select songs", qdir::homepath(), "mp3 files (*.mp3)"); if(!selectedfiles.empty()){ playlist->clear(); ui->playlistview->clear(); ui->playlistview->setcolumncount(3); ui->playlistview->sethorizontalheaderitem(0, new qtablewidgetitem("title")); ui->playlistview->sethorizontalheaderitem(1, new qtablewidgetitem("artist")); ui->playlistview->sethorizontalheaderitem(2, new qtablewidgetitem("album")); ui->playlistview->setrowcount(selectedfiles.count()); for(int = 0; < selectedfiles.count(); i++){ playlist->addmedia(qurl::fromlocalfile(selectedfiles.at(i))); player->setmedia(qurl::fromlocalfile(selectedfiles.at(i))); ui->playlistview->setitem(i, 0, new qtablewidgetitem(player->metadata("").tostring())); ui->playlistview->setitem(i, 1, new qtablewidgetitem(player->metadata("").tostring())); ui->playlistview->setitem(i, 2, new qtablewidgetitem(player->metadata("albumtitle").tostring())); } } player->setplaylist(playlist); playlist->setcurrentindex(0); }
thanks help. :)
Comments
Post a Comment