Important: Please read the Qt Code of Conduct -

How to update other widgets with media's current time from QMediaWidget object

  • I'm trying to give other widgets an idea of what the current time of the media is. I need it to update at a rate of about every 15 milliseconds. I'm looking at the qmediaplayer demo in qt/demos/qmediaplayer.

    I've noticed that there's a signal/slot setup that looks like it would help. Whenever a tick() is emitted, updateTime() is triggered. This appears to be the only way that the current time is updated inside the example. I set up my own signal that's emitted inside the updateTime() slot. Unfortunately, tick() is only emitted at strange intervals. At first, it's emitted relatively frequently, and then decreases in frequency (apparently exponentially) over time. I have no idea how the clock is updated so perfectly, but it continues to tick steadily somehow.

    I've tried setting the tick interval using setTickInterval() in several locations to keep it steady, but to no avail, it's still inconsistent (and too slow for my needs).

    If anyone could help me figure this out, I'd really appreciate it.

Log in to reply