mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
* Re-layout item grid when model changes.
This commit is contained in:
@@ -72,6 +72,8 @@ AlbumView::AlbumView( QWidget* parent )
|
|||||||
|
|
||||||
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
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( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
|
||||||
|
connect( proxyModel(), SIGNAL( modelReset() ), SLOT( layoutItems() ) );
|
||||||
// connect( m_contextMenu, SIGNAL( triggered( int ) ), SLOT( onMenuTriggered( int ) ) );
|
// connect( m_contextMenu, SIGNAL( triggered( int ) ), SLOT( onMenuTriggered( int ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +108,7 @@ AlbumView::setModel( QAbstractItemModel* model )
|
|||||||
void
|
void
|
||||||
AlbumView::setAlbumModel( AlbumModel* model )
|
AlbumView::setAlbumModel( AlbumModel* model )
|
||||||
{
|
{
|
||||||
|
m_inited = false;
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
|
||||||
if ( m_proxyModel )
|
if ( m_proxyModel )
|
||||||
@@ -194,7 +197,13 @@ void
|
|||||||
AlbumView::resizeEvent( QResizeEvent* event )
|
AlbumView::resizeEvent( QResizeEvent* event )
|
||||||
{
|
{
|
||||||
QListView::resizeEvent( event );
|
QListView::resizeEvent( event );
|
||||||
|
layoutItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AlbumView::layoutItems()
|
||||||
|
{
|
||||||
if ( autoFitItems() && m_model )
|
if ( autoFitItems() && m_model )
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
|
@@ -90,9 +90,9 @@ private slots:
|
|||||||
void onFilterChanged( const QString& filter );
|
void onFilterChanged( const QString& filter );
|
||||||
void onCustomContextMenu( const QPoint& pos );
|
void onCustomContextMenu( const QPoint& pos );
|
||||||
|
|
||||||
private:
|
void layoutItems();
|
||||||
void adjustItemSize( const QRect& rect );
|
|
||||||
|
|
||||||
|
private:
|
||||||
AlbumModel* m_model;
|
AlbumModel* m_model;
|
||||||
AlbumProxyModel* m_proxyModel;
|
AlbumProxyModel* m_proxyModel;
|
||||||
AlbumItemDelegate* m_delegate;
|
AlbumItemDelegate* m_delegate;
|
||||||
|
Reference in New Issue
Block a user