Autoscroll when the current song is changed, rather than any data. See issue #124
This commit is contained in:
parent
b97151e9b3
commit
ce43638586
|
@ -77,9 +77,15 @@ void PlaylistView::setItemDelegates(Library* library) {
|
|||
setItemDelegateForColumn(Playlist::Column_DateModified, new DateItemDelegate(this));
|
||||
}
|
||||
|
||||
void PlaylistView::setModel(QAbstractItemModel *model) {
|
||||
QTreeView::setModel(model);
|
||||
void PlaylistView::setModel(QAbstractItemModel *m) {
|
||||
if (model())
|
||||
disconnect(model(), 0, this, 0);
|
||||
|
||||
QTreeView::setModel(m);
|
||||
LoadGeometry();
|
||||
|
||||
Playlist* playlist = qobject_cast<Playlist*>(m);
|
||||
connect(playlist, SIGNAL(CurrentSongChanged(Song)), SLOT(MaybeAutoscroll()));
|
||||
}
|
||||
|
||||
void PlaylistView::LoadGeometry() {
|
||||
|
@ -348,12 +354,6 @@ void PlaylistView::InhibitAutoscrollTimeout() {
|
|||
inhibit_autoscroll_ = false;
|
||||
}
|
||||
|
||||
void PlaylistView::dataChanged(const QModelIndex& topleft,
|
||||
const QModelIndex& bottomright) {
|
||||
QTreeView::dataChanged(topleft, bottomright);
|
||||
MaybeAutoscroll();
|
||||
}
|
||||
|
||||
void PlaylistView::MaybeAutoscroll() {
|
||||
Playlist* playlist = qobject_cast<Playlist*>(model());
|
||||
Q_ASSERT(playlist);
|
||||
|
|
|
@ -56,19 +56,16 @@ class PlaylistView : public QTreeView {
|
|||
void mousePressEvent(QMouseEvent *event);
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
|
||||
protected slots:
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
|
||||
private slots:
|
||||
void LoadGeometry();
|
||||
void SaveGeometry();
|
||||
void GlowIntensityChanged();
|
||||
void InhibitAutoscrollTimeout();
|
||||
void MaybeAutoscroll();
|
||||
|
||||
private:
|
||||
void ReloadBarPixmaps();
|
||||
QList<QPixmap> LoadBarPixmap(const QString& filename);
|
||||
void MaybeAutoscroll();
|
||||
|
||||
private:
|
||||
static const char* kSettingsGroup;
|
||||
|
|
Loading…
Reference in New Issue