Show name of song on Qlabel

202 views Asked by At

I am new to Qt and I'm trying is to create a media player with library phonon. I'm doing in here: http://doc.qt.io/qt-4.8/qt-phonon-qmusicplayer-example.html. I do not know how to present the songs on Qlabel name. How to give name of song to on label.

1

There are 1 answers

0
Mailerdaimon On

In Function:

metaStateChanged(Phonon::State newState, Phonon::State /* oldState */)

Set the text of your label:

QString title = metaData.value("TITLE");
if (title == "")
    title = metaInformationResolver->currentSource().fileName();
myLabel->setText(title);

And try reading the fantastic documentation that qt offers beside the examples: http://doc.qt.io/qt-4.8/index.html