Problem with Timer in Media Player app
-
Hi,
It is me again with my stupidity. When i finished my media player, with database of already played videos, i´ve got an idea, to add timer.
I tried it 22 times, then i realised that i´ll need some help again.
CODE: https://mega.nz/#F!SEhxkbTL!mA2yUpYqNFaglQZKhlsn2w
Here is my code when you can see that media player is working really well, but there is no timer. I´ve created QLabel as permanent widget, and QTimer which starts when program starts. But that is it, that is wrong. I need to start timer when i start a video, and when it ends, timer have to stop.
Problem is that I am not able to connect timer, label which will show that time, and video/music that will be played.
If there is someone who is willing to help me :)
I would be really greatful.
Regards
Qinyx
-
-
Add another member function to your main window:
void onPlayerPositionChanged(qint64 position);
// in headervoid MainWindow::onPlayerPositionChanged(qint64 position) { const auto text = QString("Position: %1 ms").arg(position); ui->yourLabel.setText(text); }
Then connect the player's signal to this function :-)
-
Hi there,
i am sorry for late reply, i´ve had kynology competition. But i have been able to complete my project thanks to your help. I am really greatful.
There is my code for comparasing: https://mega.nz/#F!ndwmxDgJ!LoX2SUHA2wIkSaFSXbQntA
Thanks a lot again :)
Regards
Qinyx