From 1eb9375c498738de880f4b30b889dc59ee310eb7 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 19 Aug 2014 14:07:02 +0200 Subject: [PATCH] * Queue connections to prevent unwanted resizes/-paints. --- src/libtomahawk/playlist/GridView.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libtomahawk/playlist/GridView.cpp b/src/libtomahawk/playlist/GridView.cpp index e867d2a4b..60ee71c3b 100644 --- a/src/libtomahawk/playlist/GridView.cpp +++ b/src/libtomahawk/playlist/GridView.cpp @@ -101,14 +101,14 @@ GridView::setProxyModel( PlayableProxyModel* model ) 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( 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; connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) ); - connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( verifySize() ) ); - connect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ) ); - connect( proxyModel(), SIGNAL( modelReset() ), SLOT( layoutItems() ), Qt::QueuedConnection ); + connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( verifySize() ), Qt::QueuedConnection ); + connect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ), Qt::QueuedConnection ); + connect( m_proxyModel, SIGNAL( modelReset() ), SLOT( layoutItems() ), Qt::QueuedConnection ); if ( m_delegate ) delete m_delegate; @@ -283,13 +283,14 @@ GridView::layoutItems() const int newItemWidth = itemWidth + extraSpace - spacing(); m_delegate->setItemSize( QSize( newItemWidth, newItemWidth + ( m_itemSize.height() - m_itemSize.width() ) ) ); - verifySize(); + } - if ( !m_inited ) - { - m_inited = true; - repaint(); - } + verifySize(); + + if ( !m_inited ) + { + m_inited = true; + repaint(); } }