//开始播放
void QPlayer::on_playButton_clicked()
{
if(listWidget->count()>0)//判断播放列表是否为空
{
if(check==0)//判断'开始'按钮是否按过
{
QPlayer::showEvent(); //没有按过,则激活定时事件
check=1;
}
QSound tmp(listWidget->currentItem()->text());
tmp.play(); }
}
//顺序播放
void QPlayer::on_seqplayButton_clicked()
{
int i=listWidget->currentRow();//获得当前歌曲位置
int j=listWidget->count();//获取歌曲总数
int a;
for(a=i;a<j;a++)
{
listWidget->setCurrentRow(a);
QSound tmp(listWidget->currentItem()->text());
tmp.play();
}
}
我想让添加到列表里的歌曲顺序播放,应该如何写呀?那个FOR循环好像不对,点击顺序播放按钮它就跳到最后播放了。