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));
|
setItemDelegateForColumn(Playlist::Column_DateModified, new DateItemDelegate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistView::setModel(QAbstractItemModel *model) {
|
void PlaylistView::setModel(QAbstractItemModel *m) {
|
||||||
QTreeView::setModel(model);
|
if (model())
|
||||||
|
disconnect(model(), 0, this, 0);
|
||||||
|
|
||||||
|
QTreeView::setModel(m);
|
||||||
LoadGeometry();
|
LoadGeometry();
|
||||||
|
|
||||||
|
Playlist* playlist = qobject_cast<Playlist*>(m);
|
||||||
|
connect(playlist, SIGNAL(CurrentSongChanged(Song)), SLOT(MaybeAutoscroll()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistView::LoadGeometry() {
|
void PlaylistView::LoadGeometry() {
|
||||||
|
@ -348,12 +354,6 @@ void PlaylistView::InhibitAutoscrollTimeout() {
|
||||||
inhibit_autoscroll_ = false;
|
inhibit_autoscroll_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistView::dataChanged(const QModelIndex& topleft,
|
|
||||||
const QModelIndex& bottomright) {
|
|
||||||
QTreeView::dataChanged(topleft, bottomright);
|
|
||||||
MaybeAutoscroll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlaylistView::MaybeAutoscroll() {
|
void PlaylistView::MaybeAutoscroll() {
|
||||||
Playlist* playlist = qobject_cast<Playlist*>(model());
|
Playlist* playlist = qobject_cast<Playlist*>(model());
|
||||||
Q_ASSERT(playlist);
|
Q_ASSERT(playlist);
|
||||||
|
|
|
@ -56,19 +56,16 @@ class PlaylistView : public QTreeView {
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void scrollContentsBy(int dx, int dy);
|
void scrollContentsBy(int dx, int dy);
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void LoadGeometry();
|
void LoadGeometry();
|
||||||
void SaveGeometry();
|
void SaveGeometry();
|
||||||
void GlowIntensityChanged();
|
void GlowIntensityChanged();
|
||||||
void InhibitAutoscrollTimeout();
|
void InhibitAutoscrollTimeout();
|
||||||
|
void MaybeAutoscroll();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ReloadBarPixmaps();
|
void ReloadBarPixmaps();
|
||||||
QList<QPixmap> LoadBarPixmap(const QString& filename);
|
QList<QPixmap> LoadBarPixmap(const QString& filename);
|
||||||
void MaybeAutoscroll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char* kSettingsGroup;
|
static const char* kSettingsGroup;
|
||||||
|
|
Loading…
Reference in New Issue