Commit a704f59b authored by Michael Pyne's avatar Michael Pyne

More column-handling bugfixes in Playlist.

- The showColumn/hideColumn functions work on visual indices, not
logical indices, so converting a visual index to a logical one is both
wrong and extra work.
- The "Show Columns" menu was just flatly checking every column, even
the ones that weren't shown.
parent 4fdf370c
......@@ -1200,9 +1200,9 @@ void Playlist::hideColumn(int c, bool updateSearch)
if(isColumnHidden(c))
return;
QTreeWidget::hideColumn(c);
if(c == m_leftColumn) {
updatePlaying();
m_leftColumn = leftMostVisibleColumn();
......@@ -1302,7 +1302,7 @@ void Playlist::slotInitialize()
showAction = new QAction(headerItem()->text(i), m_headerMenu);
showAction->setData(i);
showAction->setCheckable(true);
showAction->setChecked(true);
showAction->setChecked(!isColumnHidden(i));
m_headerMenu->addAction(showAction);
resizeColumnToContents(i);
......@@ -1527,10 +1527,10 @@ bool Playlist::playing() const
int Playlist::leftMostVisibleColumn() const
{
int i = 0;
while(isColumnHidden(header()->visualIndex(i)) && i < PlaylistItem::lastColumn())
while(i < PlaylistItem::lastColumn() && isColumnHidden(i))
i++;
return header()->visualIndex(i);
return i < PlaylistItem::lastColumn() ? i : 0;
}
PlaylistItemList Playlist::items(QTreeWidgetItemIterator::IteratorFlags flags)
......
......@@ -517,7 +517,7 @@ private:
/**
* Returns the index of the left most visible column in the playlist.
*
* \see isColumnVisible()
* \see isColumnHidden()
*/
int leftMostVisibleColumn() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment