37 mFilterLineEdit->setShowClearButton(
true );
38 mFilterLineEdit->setShowSearchIcon(
true );
41 listMapLayers->setModel( mModel );
42 const QModelIndex firstLayer = mModel->index( 0, 0 );
43 listMapLayers->selectionModel()->select( firstLayer, QItemSelectionModel::Select );
45 connect( listMapLayers, &QListView::doubleClicked,
this, &QgsLayoutLegendLayersDialog::accept );
48 connect( mCheckBoxVisibleLayers, &QCheckBox::toggled,
this, &QgsLayoutLegendLayersDialog::filterVisible );
49 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsLayoutLegendLayersDialog::showHelp );
51 mFilterLineEdit->setFocus();
61 QList<QgsMapLayer *> layers;
63 const QModelIndexList selection = listMapLayers->selectionModel()->selectedIndexes();
64 for (
const QModelIndex &index : selection )
66 const QModelIndex sourceIndex = mModel->mapToSource( index );
67 if ( !sourceIndex.isValid() )
72 QgsMapLayer *layer = mModel->sourceLayerModel()->layerFromIndex( sourceIndex );