1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Use a proxy model that doesn't sort, so we preserve the ranking order

This commit is contained in:
Casey Link
2011-08-21 13:48:07 -05:00
parent 68d3783b26
commit c6a104af93
2 changed files with 13 additions and 1 deletions

View File

@@ -28,6 +28,7 @@
#include "audio/audioengine.h" #include "audio/audioengine.h"
#include "playlist/playlistmodel.h" #include "playlist/playlistmodel.h"
#include "playlist/treeproxymodel.h"
#include "widgets/overlaywidget.h" #include "widgets/overlaywidget.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "utils/logger.h" #include "utils/logger.h"
@@ -62,9 +63,18 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
ui->tracksView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->tracksView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
m_artistsModel = new TreeModel( ui->artistsView); m_artistsModel = new TreeModel( ui->artistsView );
m_artistsModel->setColumnStyle( TreeModel::TrackOnly ); m_artistsModel->setColumnStyle( TreeModel::TrackOnly );
m_artistsProxy = new TreeProxyModel( ui->artistsView );
m_artistsProxy->setFilterCaseSensitivity( Qt::CaseInsensitive );
m_artistsProxy->setDynamicSortFilter( true );
ui->artistsView->setProxyModel( m_artistsProxy );
ui->artistsView->setTreeModel( m_artistsModel ); ui->artistsView->setTreeModel( m_artistsModel );
m_artistsProxy->sort( -1 ); // disable sorting, must be called after artistsView->setTreeModel
ui->artistsView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->artistsView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
ui->artistsView->header()->setVisible( false ); ui->artistsView->header()->setVisible( false );

View File

@@ -36,6 +36,7 @@
class TreeModel; class TreeModel;
class PlaylistModel; class PlaylistModel;
class OverlayWidget; class OverlayWidget;
class TreeProxyModel;
namespace Ui namespace Ui
{ {
@@ -79,6 +80,7 @@ private:
PlaylistModel* m_tracksModel; PlaylistModel* m_tracksModel;
TreeModel* m_artistsModel; TreeModel* m_artistsModel;
TreeProxyModel* m_artistsProxy;
QTimer* m_timer; QTimer* m_timer;
}; };