1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 19:31:02 +01:00

Don't inhibit autoscrolling when we scrolled as a result of autoscrolling. See issue #124

This commit is contained in:
David Sansome 2010-04-14 13:11:39 +00:00
parent ce43638586
commit 24463136b9
2 changed files with 10 additions and 2 deletions

View File

@ -41,6 +41,7 @@ PlaylistView::PlaylistView(QWidget *parent)
glow_intensity_step_(0),
inhibit_autoscroll_timer_(new QTimer(this)),
inhibit_autoscroll_(false),
currently_autoscrolling_(false),
row_height_(-1),
currenttrack_play_(":currenttrack_play.png"),
currenttrack_pause_(":currenttrack_pause.png")
@ -344,8 +345,12 @@ void PlaylistView::mousePressEvent(QMouseEvent *event) {
void PlaylistView::scrollContentsBy(int dx, int 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() {
@ -365,5 +370,7 @@ void PlaylistView::MaybeAutoscroll() {
return;
QModelIndex current = playlist->index(playlist->current_index(), 0);
currently_autoscrolling_ = true;
scrollTo(current, QAbstractItemView::PositionAtCenter);
currently_autoscrolling_ = false;
}

View File

@ -84,6 +84,7 @@ class PlaylistView : public QTreeView {
QTimer* inhibit_autoscroll_timer_;
bool inhibit_autoscroll_;
bool currently_autoscrolling_;
int row_height_; // Used to invalidate the currenttrack_bar pixmaps
QList<QPixmap> currenttrack_bar_left_;