QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
25 connect(
this,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutComboBox::indexChanged );
31 mModel->deleteLater();
33 mProxyModel->deleteLater();
37 mProxyModel->setSourceModel( mModel );
39 connect( mProxyModel, &QAbstractItemModel::rowsInserted,
this, &QgsLayoutComboBox::rowsChanged );
40 connect( mProxyModel, &QAbstractItemModel::rowsRemoved,
this, &QgsLayoutComboBox::rowsChanged );
41 setModel( mProxyModel );
42 mProxyModel->sort( 0, Qt::AscendingOrder );
73 QModelIndex proxyIdx = mProxyModel->mapFromSource( idx );
74 if ( proxyIdx.isValid() )
76 setCurrentIndex( proxyIdx.row() );
85 return layout( currentIndex() );
88 void QgsLayoutComboBox::indexChanged(
int i )
94 void QgsLayoutComboBox::rowsChanged()
101 else if ( count() == 0 )
109 const QModelIndex proxyIndex = mProxyModel->index( index, 0 );
110 if ( !proxyIndex.isValid() )
115 QModelIndex sourceIndex = mProxyModel->mapToSource( proxyIndex );
116 if ( !sourceIndex.isValid() )
Manages storage of a set of layouts.
void setAllowEmptyLayout(bool allowEmpty)
Sets whether an optional empty layout ("not set") option is present in the combobox.
QgsLayoutManagerProxyModel::Filters filters() const
Returns the current filters used for filtering available layouts.
bool allowEmptyLayout() const
Returns true if the model allows the empty layout ("not set") choice.
void setFilters(QgsLayoutManagerProxyModel::Filters filters)
Sets the current filters used for filtering available layouts.
bool allowEmptyLayout() const
Returns true if the combobox includes the empty layout ("not set") choice.
QgsMasterLayoutInterface * layoutFromIndex(const QModelIndex &index) const
Returns the layout at the corresponding index.
QgsLayoutComboBox(QWidget *parent=nullptr, QgsLayoutManager *manager=nullptr)
QgsLayoutComboBox creates a combo box to display a list of items in a layout manager.
List model representing the print layouts and reports available in a layout manager.
QgsLayoutManagerProxyModel::Filters filters() const
Returns the current filters used for filtering available layouts.
QgsMasterLayoutInterface * layout(int index) const
Returns the layout at the specified index.
QModelIndex indexFromLayout(QgsMasterLayoutInterface *layout) const
Returns the model index corresponding to a layout.
void setCurrentLayout(QgsMasterLayoutInterface *layout)
Sets the currently selected layout in the combo box.
void setAllowEmptyLayout(bool allowEmpty)
Sets whether an optional empty layout ("not set") option is present in the model.
void layoutChanged(QgsMasterLayoutInterface *layout)
Emitted whenever the currently selected layout changes.
QSortFilterProxyModel subclass for QgsLayoutManagerModel.
void setLayoutManager(QgsLayoutManager *manager)
Sets the layout manager containing the layouts to list in the combo box.
void setFilters(QgsLayoutManagerProxyModel::Filters filters)
Sets the current filters used for filtering available layouts.
Interface for master layout type objects, such as print layouts and reports.
QgsMasterLayoutInterface * currentLayout() const
Returns the layout currently selected in the combo box.