mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
Fix loss of layout item combo box filters
This commit is contained in:
parent
41d8a9c20b
commit
d890084f63
@ -28,6 +28,7 @@ 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 );
|
||||
@ -35,6 +36,8 @@ void QgsLayoutItemComboBox::setCurrentLayout( QgsLayout *layout )
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user