Important: Please read the Qt Code of Conduct -

QT Phonon Tick Slot not triggering, please help.

  • Hello Everybody,

    I have a problem with using Phonon inside QT. I am trying to connect the tick signal to a tick slot. But when a media file is playing.. the tick slot is never called. This very simple example doesn't work. I see in my output window from the debug call that the Player is started, also i hear the musicl. But i dont see the tick slot getting triggered. What am i doing wrong??

    Please help.

    Best Regards,


    Here is my header (musicplayer.h)

    @#include <QMainWindow>
    #include <phonon/audiooutput.h>
    #include <phonon/seekslider.h>
    #include <phonon/mediaobject.h>
    #include <phonon/volumeslider.h>
    #include <phonon/backendcapabilities.h>
    #include <QList>

    class QTime;

    class musicplayer : public QObject

    explicit musicplayer(QObject *parent = 0);

    void Init();

    private slots:
    void tick(qint64 iTime);


    #endif // MUSICPLAYER_H@

    Here is my class (musicplayer.c)

    @#include "musicplayer.h"
    #include <QtDebug>

    musicplayer::musicplayer(QObject *parent) : QObject(parent)

    void musicplayer::Init()
    Phonon::MediaObject *mediaObject = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource("test.mp3"));

    connect(mediaObject, SIGNAL(tick(qint64)),this, SLOT(tick(qint64)));
    qDebug() << "Player started";


    void musicplayer::tick(qint64 iTime)
    qDebug() << iTime;

Log in to reply