1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 16:29:43 +01: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
src/libtomahawk/widgets

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

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