1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 21:57:41 +02:00

* TrackView should restore externally set alternating-row-color setting.

This commit is contained in:
Christian Muehlhaeuser
2013-06-07 08:56:30 +02:00
parent 162610bae5
commit 096331016e
2 changed files with 15 additions and 3 deletions

View File

@@ -57,6 +57,7 @@ TrackView::TrackView( QWidget* parent )
, m_resizing( false ) , m_resizing( false )
, m_dragging( false ) , m_dragging( false )
, m_updateContextView( true ) , m_updateContextView( true )
, m_alternatingRowColors( true )
, m_contextMenu( new ContextMenu( this ) ) , m_contextMenu( new ContextMenu( this ) )
{ {
setFrameShape( QFrame::NoFrame ); setFrameShape( QFrame::NoFrame );
@@ -233,7 +234,7 @@ TrackView::setEmptyTip( const QString& tip )
void void
TrackView::onModelFilling() TrackView::onModelFilling()
{ {
setAlternatingRowColors( true ); QTreeView::setAlternatingRowColors( m_alternatingRowColors );
} }
@@ -241,7 +242,7 @@ void
TrackView::onModelEmptyCheck() TrackView::onModelEmptyCheck()
{ {
if ( !m_proxyModel->rowCount( QModelIndex() ) ) if ( !m_proxyModel->rowCount( QModelIndex() ) )
setAlternatingRowColors( false ); QTreeView::setAlternatingRowColors( false );
} }
@@ -429,7 +430,7 @@ TrackView::resizeEvent( QResizeEvent* event )
int sortSection = m_header->sortIndicatorSection(); int sortSection = m_header->sortIndicatorSection();
Qt::SortOrder sortOrder = m_header->sortIndicatorOrder(); Qt::SortOrder sortOrder = m_header->sortIndicatorOrder();
tDebug() << Q_FUNC_INFO << width(); // tDebug() << Q_FUNC_INFO << width();
if ( m_header->checkState() && sortSection >= 0 ) if ( m_header->checkState() && sortSection >= 0 )
{ {
@@ -795,3 +796,11 @@ TrackView::setAutoResize( bool b )
if ( m_autoResize ) if ( m_autoResize )
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
} }
void
TrackView::setAlternatingRowColors( bool enable )
{
m_alternatingRowColors = enable;
QTreeView::setAlternatingRowColors( enable );
}

View File

@@ -84,6 +84,8 @@ public:
bool autoResize() const { return m_autoResize; } bool autoResize() const { return m_autoResize; }
void setAutoResize( bool b ); void setAutoResize( bool b );
void setAlternatingRowColors( bool enable );
// Starts playing from the beginning if resolved, or waits until a track is playable // Starts playing from the beginning if resolved, or waits until a track is playable
void startPlayingFromStart(); void startPlayingFromStart();
@@ -150,6 +152,7 @@ private:
bool m_updateContextView; bool m_updateContextView;
bool m_autoResize; bool m_autoResize;
bool m_alternatingRowColors;
QModelIndex m_contextMenuIndex; QModelIndex m_contextMenuIndex;