Skip to content
Permalink
Browse files

Fix loss of layout item combo box filters

  • Loading branch information
nyalldawson committed Mar 11, 2019
1 parent 41d8a9c commit d890084f637d4e4b776ae493a07973600150d93e
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/gui/layout/qgslayoutitemcombobox.cpp
@@ -28,13 +28,16 @@ QgsLayoutItemComboBox::QgsLayoutItemComboBox( QWidget *parent, QgsLayout *layout
void QgsLayoutItemComboBox::setCurrentLayout( QgsLayout *layout )
{
const bool prevAllowEmpty = mProxyModel && mProxyModel->allowEmptyItem();
int itemType = mProxyModel ? mProxyModel->filterType() : -1;
mProxyModel = qgis::make_unique< QgsLayoutProxyModel >( layout, this );
connect( mProxyModel.get(), &QAbstractItemModel::rowsInserted, this, &QgsLayoutItemComboBox::rowsChanged );
connect( mProxyModel.get(), &QAbstractItemModel::rowsRemoved, this, &QgsLayoutItemComboBox::rowsChanged );
setModel( mProxyModel.get() );
setModelColumn( QgsLayoutModel::ItemId );
mProxyModel->sort( QgsLayoutModel::ItemId, Qt::AscendingOrder );
mProxyModel->setAllowEmptyItem( prevAllowEmpty );
if ( itemType >= 0 )
mProxyModel->setFilterType( static_cast< QgsLayoutItemRegistry::ItemType >( itemType ) );
}

QgsLayout *QgsLayoutItemComboBox::currentLayout()

0 comments on commit d890084

Please sign in to comment.
You can’t perform that action at this time.