Select and execute the MIDI files displayed on QListWidget in Qt
-
How to select and execute the MIDI files shown QListWidget in Qt so it can be played by a MIDI player?
I've made a MIDI file player, but can only play songs that are determined directly from the source code. My Source Code still can not select from the table shown by QListWidget.Here is the source code for QListWidget and the integration of midi player with a menu created with Qt.
@gbe::gbe(QWidget *parent) : QMainWindow(parent), ui(new Ui::gbe)
{
ui->setupUi(this);
QDir myPath("/home/prom/playlist/");myPath.setFilter((QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)); myPlaylist = myPath.entryList(); ui->listWidget->addItems(myPlaylist);}
void gbe::on_btnPlay_clicked()
{
process.kill();
process.start("/home/prom/QTGBE/gbe/midiplayer", QStringList() << "/home/prom/playlist/coldplay-magic.mid");}
@Please be specific in your answer i will appreciate that,thank you
-
Hi and welcome to devnet,
You can use QListWidget's currentItem method to retrieve the data you need to feed your QProcess.
Hope it helps