Navigation Menu

Skip to content

Commit

Permalink
Fix crash with hidden dock widget
Browse files Browse the repository at this point in the history
Fixes #17357
Fixes #17279
Fixes #17317
  • Loading branch information
m-kuhn committed Nov 3, 2017
1 parent 10c9bb6 commit 71eeda7
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions src/gui/qgsbrowserdockwidget.cpp
Expand Up @@ -271,44 +271,46 @@ void QgsBrowserDockWidget::removeFavorite()

void QgsBrowserDockWidget::refresh()
{
if ( mModel )
refreshModel( QModelIndex() );
refreshModel( QModelIndex() );
}

void QgsBrowserDockWidget::refreshModel( const QModelIndex &index )
{
QgsDataItem *item = mModel->dataItem( index );
if ( item )
{
QgsDebugMsg( "path = " + item->path() );
}
else
{
QgsDebugMsg( "invalid item" );
}

if ( item && ( item->capabilities2() & QgsDataItem::Fertile ) )
{
mModel->refresh( index );
}

for ( int i = 0; i < mModel->rowCount( index ); i++ )
if ( mModel && mProxyModel )
{
QModelIndex idx = mModel->index( i, 0, index );
QModelIndex proxyIdx = mProxyModel->mapFromSource( idx );
QgsDataItem *child = mModel->dataItem( idx );

// Check also expanded descendants so that the whole expanded path does not get collapsed if one item is collapsed.
// Fast items (usually root items) are refreshed so that when collapsed, it is obvious they are if empty (no expand symbol).
if ( mBrowserView->isExpanded( proxyIdx ) || mBrowserView->hasExpandedDescendant( proxyIdx ) || ( child && child->capabilities2() & QgsDataItem::Fast ) )
QgsDataItem *item = mModel->dataItem( index );
if ( item )
{
refreshModel( idx );
QgsDebugMsg( "path = " + item->path() );
}
else
{
if ( child && ( child->capabilities2() & QgsDataItem::Fertile ) )
QgsDebugMsg( "invalid item" );
}

if ( item && ( item->capabilities2() & QgsDataItem::Fertile ) )
{
mModel->refresh( index );
}

for ( int i = 0; i < mModel->rowCount( index ); i++ )
{
QModelIndex idx = mModel->index( i, 0, index );
QModelIndex proxyIdx = mProxyModel->mapFromSource( idx );
QgsDataItem *child = mModel->dataItem( idx );

// Check also expanded descendants so that the whole expanded path does not get collapsed if one item is collapsed.
// Fast items (usually root items) are refreshed so that when collapsed, it is obvious they are if empty (no expand symbol).
if ( mBrowserView->isExpanded( proxyIdx ) || mBrowserView->hasExpandedDescendant( proxyIdx ) || ( child && child->capabilities2() & QgsDataItem::Fast ) )
{
refreshModel( idx );
}
else
{
child->depopulate();
if ( child && ( child->capabilities2() & QgsDataItem::Fertile ) )
{
child->depopulate();
}
}
}
}
Expand Down

0 comments on commit 71eeda7

Please sign in to comment.