开发者

qt slider problem c++

开发者 https://www.devze.com 2023-03-05 08:42 出处:网络
the following code plays the song while a button is pressed (onclick). I have created a horizontalSlider UI but it is not sliding. I got the documen开发者_JS百科t from http://wiki.forum.nokia.com/inde

the following code plays the song while a button is pressed (onclick). I have created a horizontalSlider UI but it is not sliding. I got the documen开发者_JS百科t from http://wiki.forum.nokia.com/index.php/Streaming_Audio_with_Qt

Please help me to make the slider work.

Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);

Phonon::AudioOutput *audioOutput =
new Phonon::AudioOutput(Phonon::MusicCategory, this);

Phonon::createPath(mediaObject, audioOutput);

const QString url("c://example.mp3");

mediaObject->setCurrentSource(url);

mediaObject->play();

volumeSlider = new Phonon::VolumeSlider(ui->horizontalSlider);
volumeSlider->setAudioOutput(audioOutput);
volumeSlider->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);


Probably you didn't bind the corresponding media object to the slider.

See a small example here.

0

精彩评论

暂无评论...
验证码 换一张
取 消