Don't inhibit autoscrolling when we scrolled as a result of autoscrolling. See issue #124
This commit is contained in:
parent
ce43638586
commit
24463136b9
@ -41,6 +41,7 @@ PlaylistView::PlaylistView(QWidget *parent)
|
|||||||
glow_intensity_step_(0),
|
glow_intensity_step_(0),
|
||||||
inhibit_autoscroll_timer_(new QTimer(this)),
|
inhibit_autoscroll_timer_(new QTimer(this)),
|
||||||
inhibit_autoscroll_(false),
|
inhibit_autoscroll_(false),
|
||||||
|
currently_autoscrolling_(false),
|
||||||
row_height_(-1),
|
row_height_(-1),
|
||||||
currenttrack_play_(":currenttrack_play.png"),
|
currenttrack_play_(":currenttrack_play.png"),
|
||||||
currenttrack_pause_(":currenttrack_pause.png")
|
currenttrack_pause_(":currenttrack_pause.png")
|
||||||
@ -344,8 +345,12 @@ void PlaylistView::mousePressEvent(QMouseEvent *event) {
|
|||||||
|
|
||||||
void PlaylistView::scrollContentsBy(int dx, int dy) {
|
void PlaylistView::scrollContentsBy(int dx, int dy) {
|
||||||
QTreeView::scrollContentsBy(dx, dy);
|
QTreeView::scrollContentsBy(dx, dy);
|
||||||
inhibit_autoscroll_ = true;
|
|
||||||
inhibit_autoscroll_timer_->start();
|
if (!currently_autoscrolling_) {
|
||||||
|
// We only want to do this if the scroll was initiated by the user
|
||||||
|
inhibit_autoscroll_ = true;
|
||||||
|
inhibit_autoscroll_timer_->start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistView::InhibitAutoscrollTimeout() {
|
void PlaylistView::InhibitAutoscrollTimeout() {
|
||||||
@ -365,5 +370,7 @@ void PlaylistView::MaybeAutoscroll() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QModelIndex current = playlist->index(playlist->current_index(), 0);
|
QModelIndex current = playlist->index(playlist->current_index(), 0);
|
||||||
|
currently_autoscrolling_ = true;
|
||||||
scrollTo(current, QAbstractItemView::PositionAtCenter);
|
scrollTo(current, QAbstractItemView::PositionAtCenter);
|
||||||
|
currently_autoscrolling_ = false;
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ class PlaylistView : public QTreeView {
|
|||||||
|
|
||||||
QTimer* inhibit_autoscroll_timer_;
|
QTimer* inhibit_autoscroll_timer_;
|
||||||
bool inhibit_autoscroll_;
|
bool inhibit_autoscroll_;
|
||||||
|
bool currently_autoscrolling_;
|
||||||
|
|
||||||
int row_height_; // Used to invalidate the currenttrack_bar pixmaps
|
int row_height_; // Used to invalidate the currenttrack_bar pixmaps
|
||||||
QList<QPixmap> currenttrack_bar_left_;
|
QList<QPixmap> currenttrack_bar_left_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user