Fix 'Scroll to current track' in table style play queue if track number column is hidden.
This commit is contained in:
committed by
Craig Drummond
parent
6a3e1da91c
commit
fa985de76a
@@ -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
|
||||
-----
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user