Skip to content

Commit

Permalink
修复拖动sliderSong后在原位置继续显示一段时间的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
pzhlkj6612 committed Apr 24, 2019
1 parent d33f89a commit 9827fab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions BottomWidgets/BottomWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ void BottomWidget::durationChanged(qint64 duration)

void BottomWidget::positionChanged(int position)
{
qDebug()<<"void BottomWidget::positionChanged(int position="<<position<<")";

if(!AdjustingPos)
{
int pecentOfThousand = musicPlayer->duration() == 0? 0: int(1.0 * position / musicPlayer->duration() * 1000);
Expand Down
10 changes: 10 additions & 0 deletions Entities/MusicPlayer/musicPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,11 @@ void MusicPlayer::stop()
//跳到时间点播放(单位 毫秒)
void MusicPlayer::seek(quint64 pos)
{
if(m_positionUpdateTimer.isActive())
{
m_positionUpdateTimer.stop();
}

//先获得总长
quint64 total = duration();
if(pos > total)
Expand All @@ -899,6 +904,11 @@ void MusicPlayer::seek(quint64 pos)
}

playThread->seekToPos(pos);

if(!m_positionUpdateTimer.isActive())
{
m_positionUpdateTimer.start();
}
}

//往后跳(单位 毫秒)
Expand Down

0 comments on commit 9827fab

Please sign in to comment.