Skip to content

Commit

Permalink
Merge pull request #57605 from elpaso/bugfix-ux-layout-legenditem-mut…
Browse files Browse the repository at this point in the history
…ex-style

[ux][layouts] Fix legend item style mutex
  • Loading branch information
troopa81 authored May 29, 2024
2 parents 36de34e + ba66775 commit c49afe9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/layout/qgslayoutlegendwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <QMenu>
#include <QMessageBox>
#include <QInputDialog>
#include <QActionGroup>

///@cond PRIVATE

Expand Down Expand Up @@ -1481,11 +1482,15 @@ QMenu *QgsLayoutLegendMenuProvider::createContextMenu()

QgsLegendStyle::Style currentStyle = QgsLegendRenderer::nodeLegendStyle( mView->currentNode(), mView->layerTreeModel() );

QActionGroup *styleGroup = new QActionGroup{ mWidget };
styleGroup->setExclusive( true );

QList<QgsLegendStyle::Style> lst;
lst << QgsLegendStyle::Hidden << QgsLegendStyle::Group << QgsLegendStyle::Subgroup;
for ( QgsLegendStyle::Style style : std::as_const( lst ) )
{
QAction *action = menu->addAction( QgsLegendStyle::styleLabel( style ), mWidget, &QgsLayoutLegendWidget::setCurrentNodeStyleFromAction );
action->setActionGroup( styleGroup );
action->setCheckable( true );
action->setChecked( currentStyle == style );
action->setData( static_cast< int >( style ) );
Expand Down

0 comments on commit c49afe9

Please sign in to comment.