1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 13:47:26 +02:00

* Queue connections to prevent unwanted resizes/-paints.

This commit is contained in:
Christian Muehlhaeuser
2014-08-19 14:07:02 +02:00
parent 14f2549951
commit 1eb9375c49

View File

@@ -101,14 +101,14 @@ GridView::setProxyModel( PlayableProxyModel* model )
disconnect( m_proxyModel, SIGNAL( filterChanged( QString ) ), this, SLOT( onFilterChanged( QString ) ) ); disconnect( m_proxyModel, SIGNAL( filterChanged( QString ) ), this, SLOT( onFilterChanged( QString ) ) );
disconnect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( verifySize() ) ); disconnect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( verifySize() ) );
disconnect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( verifySize() ) ); disconnect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( verifySize() ) );
disconnect( proxyModel(), SIGNAL( modelReset() ), this, SLOT( layoutItems() ) ); disconnect( m_proxyModel, SIGNAL( modelReset() ), this, SLOT( layoutItems() ) );
} }
m_proxyModel = model; m_proxyModel = model;
connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) ); connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) );
connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( verifySize() ) ); connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( verifySize() ), Qt::QueuedConnection );
connect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ) ); connect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ), Qt::QueuedConnection );
connect( proxyModel(), SIGNAL( modelReset() ), SLOT( layoutItems() ), Qt::QueuedConnection ); connect( m_proxyModel, SIGNAL( modelReset() ), SLOT( layoutItems() ), Qt::QueuedConnection );
if ( m_delegate ) if ( m_delegate )
delete m_delegate; delete m_delegate;
@@ -283,13 +283,14 @@ GridView::layoutItems()
const int newItemWidth = itemWidth + extraSpace - spacing(); const int newItemWidth = itemWidth + extraSpace - spacing();
m_delegate->setItemSize( QSize( newItemWidth, newItemWidth + ( m_itemSize.height() - m_itemSize.width() ) ) ); m_delegate->setItemSize( QSize( newItemWidth, newItemWidth + ( m_itemSize.height() - m_itemSize.width() ) ) );
verifySize(); }
if ( !m_inited ) verifySize();
{
m_inited = true; if ( !m_inited )
repaint(); {
} m_inited = true;
repaint();
} }
} }