Fix 'Scroll to current track' in table style play queue if track number column is hidden.

This commit is contained in:
Craig Drummond
2016-01-30 00:17:46 +00:00
committed by Craig Drummond
parent 6a3e1da91c
commit fa985de76a
3 changed files with 19 additions and 0 deletions

View File

@@ -10,6 +10,8 @@
2.0.1
-----
1. Delay creation of Jamendo and Magnatune DBs until required.
2. Fix 'Scroll to current track' in table style play queue if track number
column is hidden.
2.0.0
-----

View File

@@ -197,6 +197,22 @@ void TableView::saveHeader()
}
}
void TableView::scrollTo(const QModelIndex &index, ScrollHint hint)
{
QHeaderView *hdr=header();
// scrollTo does not work if column hidden, so find first one that is not.
if (hdr && hdr->isSectionHidden(index.column())) {
for (int i=0; i<model()->columnCount(); ++i) {
if (!hdr->isSectionHidden(i)) {
TreeView::scrollTo(model()->index(index.row(), i, index.parent()), hint);
return;
}
}
}
TreeView::scrollTo(index, hint);
}
void TableView::showMenu(const QPoint &pos)
{
menuIsForCol=header()->logicalIndexAt(pos);

View File

@@ -36,6 +36,7 @@ public:
void setModel(QAbstractItemModel *m);
void initHeader();
void saveHeader();
virtual void scrollTo(const QModelIndex &index, ScrollHint hint);
private Q_SLOTS:
void showMenu(const QPoint &pos);