Fix track seeking with mouse wheel
This commit is contained in:
parent
40db9f7020
commit
7bcd5ba14c
@ -708,7 +708,16 @@ void PlaylistView::mousePressEvent(QMouseEvent *event) {
|
||||
return;
|
||||
}
|
||||
|
||||
QTreeView::mousePressEvent(event);
|
||||
QModelIndex idx = indexAt(event->pos());
|
||||
if (event->button() == Qt::XButton1 && idx.isValid()) {
|
||||
app_->player()->Previous();
|
||||
}
|
||||
else if (event->button() == Qt::XButton2 && idx.isValid()) {
|
||||
app_->player()->Next();
|
||||
}
|
||||
else {
|
||||
QTreeView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
inhibit_autoscroll_ = true;
|
||||
inhibit_autoscroll_timer_->start();
|
||||
|
@ -63,6 +63,10 @@ TrackSlider::TrackSlider(QWidget* parent)
|
||||
connect(ui_->slider, SIGNAL(sliderMoved(int)), SIGNAL(ValueChanged(int)));
|
||||
connect(ui_->slider, SIGNAL(valueChanged(int)), SLOT(ValueMaybeChanged(int)));
|
||||
connect(ui_->remaining, SIGNAL(Clicked()), SLOT(ToggleTimeDisplay()));
|
||||
connect(ui_->slider, SIGNAL(SeekForward()), SIGNAL(SeekForward()));
|
||||
connect(ui_->slider, SIGNAL(SeekBackward()), SIGNAL(SeekBackward()));
|
||||
connect(ui_->slider, SIGNAL(Previous()), SIGNAL(Previous()));
|
||||
connect(ui_->slider, SIGNAL(Next()), SIGNAL(Next()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,11 @@ class TrackSlider : public QWidget {
|
||||
void ValueChanged(int value);
|
||||
void ValueChangedSeconds(int value);
|
||||
|
||||
void SeekForward();
|
||||
void SeekBackward();
|
||||
void Next();
|
||||
void Previous();
|
||||
|
||||
private slots:
|
||||
void ValueMaybeChanged(int value);
|
||||
void ToggleTimeDisplay();
|
||||
|
@ -70,6 +70,13 @@ void TrackSliderSlider::mousePressEvent(QMouseEvent* e) {
|
||||
|
||||
void TrackSliderSlider::mouseReleaseEvent(QMouseEvent* e) {
|
||||
QSlider::mouseReleaseEvent(e);
|
||||
if (e->button() == Qt::XButton1) {
|
||||
emit Previous();
|
||||
}
|
||||
else if (e->button() == Qt::XButton2) {
|
||||
emit Next();
|
||||
}
|
||||
e->accept();
|
||||
}
|
||||
|
||||
void TrackSliderSlider::mouseMoveEvent(QMouseEvent* e) {
|
||||
|
@ -45,6 +45,8 @@ class TrackSliderSlider : public QSlider {
|
||||
signals:
|
||||
void SeekForward();
|
||||
void SeekBackward();
|
||||
void Previous();
|
||||
void Next();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user