OTHER: scroll playlist to current entry

This commit is contained in:
Thomas Frauendorfer 2008-12-14 23:55:56 +01:00
parent 633de5b5ee
commit c682233749
6 changed files with 40 additions and 5 deletions

View file

@ -166,10 +166,21 @@ PlaylistView::removeSelected () {
}
void
PlaylistView::setModel (QAbstractItemModel *model) {
QListView::setModel (model);
PlaylistView::setModel (PlaylistModel *plmodel) {
if (model ()) disconnect (model (), 0, this, SLOT (currentPosChanged (QModelIndex)));
QListView::setModel (plmodel);
setModelColumn(0);
updateGeometry();
connect (plmodel, SIGNAL (currentPosChanged (QModelIndex)),
this, SLOT (currentPosChanged (QModelIndex)));
}
void
PlaylistView::currentPosChanged (QModelIndex index) {
QSettings s;
if (s.value ("playlist/scrolltocurrent", true).toBool ()) {
scrollTo (index);
}
}
void
@ -228,6 +239,8 @@ PlaylistView::settingsChanged ()
}
m_fontmetrics = new QFontMetrics (*m_font);
update ();
// Scroll to current pos, if enabled
currentPosChanged (qobject_cast<PlaylistModel *>(model())->currentPos ());
}
void