May 2019
Intermediate to advanced
542 pages
13h 37m
English
At this point, our soundboard can load and play samples, but it would be nice to see and control the position of playback, particularly for long samples. QMediaPlayer allows us to retrieve and control the playback position through signals and slots, so let's look into that from our GUI.
Start by creating a QSlider widget, as follows:
self.position = qtw.QSlider( minimum=0, orientation=qtc.Qt.Horizontal) self.layout().addWidget(self.position, 1, 0, 1, 2)
QSlider is a widget that we haven't looked at yet; it's just a slider control that can be used to input integers between a minimum and maximum value.
Now connect the slider and player, as follows:
self.player.positionChanged.connect(self.position.setSliderPosition) ...
Read now
Unlock full access