1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01:00

* Re-layout item grid when model changes.

This commit is contained in:
Christian Muehlhaeuser 2012-05-23 17:13:58 +02:00
parent 7af615dbf8
commit 0fb1511904
2 changed files with 11 additions and 2 deletions

View File

@ -72,6 +72,8 @@ AlbumView::AlbumView( QWidget* parent )
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
connect( proxyModel(), SIGNAL( modelReset() ), SLOT( layoutItems() ) );
// connect( m_contextMenu, SIGNAL( triggered( int ) ), SLOT( onMenuTriggered( int ) ) );
}
@ -106,6 +108,7 @@ AlbumView::setModel( QAbstractItemModel* model )
void
AlbumView::setAlbumModel( AlbumModel* model )
{
m_inited = false;
m_model = model;
if ( m_proxyModel )
@ -194,7 +197,13 @@ void
AlbumView::resizeEvent( QResizeEvent* event )
{
QListView::resizeEvent( event );
layoutItems();
}
void
AlbumView::layoutItems()
{
if ( autoFitItems() && m_model )
{
#ifdef Q_WS_X11

View File

@ -90,9 +90,9 @@ private slots:
void onFilterChanged( const QString& filter );
void onCustomContextMenu( const QPoint& pos );
private:
void adjustItemSize( const QRect& rect );
void layoutItems();
private:
AlbumModel* m_model;
AlbumProxyModel* m_proxyModel;
AlbumItemDelegate* m_delegate;