0

I want to connect the QProgressBar to the QMediaPlayer for Song Progress in QT5. How can i do that? Any help will be appreciated. Thanks.

Pascal3366
  • 91
  • 6

1 Answers1

1

Connect the QProgressBar to QMediaPlayer like this:

connect(player, durationChanged(qint64), progressBar, setMaximum(int));
connect(player, positionChanged(qint64), progressBar, setValue(int));

You can also create a slot to normalize int64 to int.

See: http://doc.qt.io/qt-5/qtwinextras-musicplayer-example.html

rflobao
  • 562
  • 2
  • 8