mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kutils: set KMediaWidget position independant of the value
now it works as expected when the arrow keys are pressed or when its position is changed by clicking while having the mouse cursor on either side of the current position Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
aef479ab03
commit
a0254bdc68
2 changed files with 3 additions and 9 deletions
|
@ -110,8 +110,8 @@ KMediaWidget::KMediaWidget(QWidget *parent, KMediaOptions options)
|
|||
d->m_volumeline.setDirection(QTimeLine::Forward);
|
||||
|
||||
connect(d->m_ui->w_play, SIGNAL(clicked()), this, SLOT(setPlay()));
|
||||
// connect(d->m_ui->w_position, SIGNAL(sliderMoved(int)), this, SLOT(_setPosition(int)));
|
||||
connect(d->m_ui->w_position, SIGNAL(sliderReleased()), this, SLOT(_setPosition()));
|
||||
d->m_ui->w_position->setTracking(false);
|
||||
connect(d->m_ui->w_position, SIGNAL(valueChanged(int)), this, SLOT(setPosition(int)));
|
||||
connect(d->m_ui->w_volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
|
||||
|
||||
connect(d->m_player, SIGNAL(paused(bool)), this, SLOT(_updatePlay(bool)));
|
||||
|
@ -268,16 +268,11 @@ void KMediaWidget::_updateSeekable(const bool seekable)
|
|||
d->m_ui->w_position->setMaximum(d->m_player->totalTime());
|
||||
}
|
||||
|
||||
void KMediaWidget::_setPosition()
|
||||
{
|
||||
d->m_player->seek(d->m_ui->w_position->value());
|
||||
}
|
||||
|
||||
void KMediaWidget::_updatePosition(const double seconds)
|
||||
{
|
||||
// do not update the slider while it's dragged by the user
|
||||
if (!d->m_ui->w_position->isSliderDown()) {
|
||||
d->m_ui->w_position->setValue(seconds);
|
||||
d->m_ui->w_position->setSliderPosition(qRound(seconds));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,6 @@ public Q_SLOTS:
|
|||
|
||||
private Q_SLOTS:
|
||||
void _updatePlay(const bool paused);
|
||||
void _setPosition();
|
||||
void _updateSeekable(const bool seekable);
|
||||
void _updatePosition(const double seconds);
|
||||
void _updateLoaded();
|
||||
|
|
Loading…
Add table
Reference in a new issue