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

@ -121,6 +121,7 @@ PlaylistModel::handle_update_pos (const Xmms::Dict &posdict)
if (changed_pl == m_name) {
uint32_t pos = posdict.get<uint32_t> ("position");
m_current_pos = pos;
emit currentPosChanged (index (pos, 0));
emit dataChanged(index (pos, 0), index (pos, m_columns.size ()));
}
return true;
@ -130,6 +131,7 @@ bool
PlaylistModel::handle_update_pos (const uint32_t &pos)
{
m_current_pos = pos;
emit currentPosChanged (index (pos, 0));
emit dataChanged(index (pos, 0), index (pos, m_columns.size ()));
return true;
}

View file

@ -65,7 +65,9 @@ class PlaylistModel : public QAbstractItemModel
bool dropMimeData (const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
Qt::DropActions supportedDropActions () const;
QStringList mimeTypes () const;
QModelIndex currentPos () {return index (m_current_pos, 0);}
/**
* Set the columns that should be shown in the view.
* @param columns A list of property keys. i.e. "artist", "album"
@ -122,6 +124,7 @@ class PlaylistModel : public QAbstractItemModel
signals:
void entryMoved (const QModelIndex &, const QModelIndex &);
void currentPosChanged (QModelIndex);
public slots:
void got_connection (XClient *);