everybody. I'm rewriting my qt4 music player in qt5. And i cant make an proper seek slider, like in phonon. Do you have an simple example of realization that part of UI?
UPD: here is my way to do that:
//mainwindow.cpp
connect(ui->seekSlider,SIGNAL(sliderMoved(int)),music,SLOT(setPosition(int)));
connect(music,SIGNAL(newPosition(qint64)),this,SLOT(positionChanged(qint64)));
connect(music,SIGNAL(newRange(qint64)),this,SLOT(durationChanged(qint64)));
void MainWindow::positionChanged(qint64 position)
{
ui->seekSlider->setValue(position);
}
void MainWindow::durationChanged(qint64 duration)
{
ui->seekSlider->setRange(0,duration);
}
//music class realization
player = new QMediaPlayer;
connect(player,SIGNAL(positionChanged(qint64)),this,SIGNAL(newPosition(qint64)));
connect(player,SIGNAL(durationChanged(qint64)),this,SIGNAL(newRange(qint64)));
void MusicControl::setPosition(int position)
{
player->setPosition(position);
}