Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[layouts] Make legend's filter by map extent widget a check box
  • Loading branch information
nirvn committed Nov 26, 2019
1 parent a225ec0 commit b700e6d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
9 changes: 4 additions & 5 deletions src/app/layout/qgslayoutlegendwidget.cpp
Expand Up @@ -107,7 +107,7 @@ QgsLayoutLegendWidget::QgsLayoutLegendWidget( QgsLayoutItemLegend *legend )
connect( mCountToolButton, &QToolButton::clicked, this, &QgsLayoutLegendWidget::mCountToolButton_clicked );
connect( mExpressionFilterButton, &QgsLegendFilterButton::toggled, this, &QgsLayoutLegendWidget::mExpressionFilterButton_toggled );
connect( mLayerExpressionButton, &QToolButton::clicked, this, &QgsLayoutLegendWidget::mLayerExpressionButton_clicked );
connect( mFilterByMapToolButton, &QToolButton::toggled, this, &QgsLayoutLegendWidget::mFilterByMapToolButton_toggled );
connect( mFilterByMapCheckBox, &QCheckBox::toggled, this, &QgsLayoutLegendWidget::mFilterByMapCheckBox_toggled );
connect( mUpdateAllPushButton, &QToolButton::clicked, this, &QgsLayoutLegendWidget::mUpdateAllPushButton_clicked );
connect( mAddGroupToolButton, &QToolButton::clicked, this, &QgsLayoutLegendWidget::mAddGroupToolButton_clicked );
connect( mFilterLegendByAtlasCheckBox, &QCheckBox::toggled, this, &QgsLayoutLegendWidget::mFilterLegendByAtlasCheckBox_toggled );
Expand Down Expand Up @@ -148,7 +148,6 @@ QgsLayoutLegendWidget::QgsLayoutLegendWidget( QgsLayoutItemLegend *legend )
mRemoveToolButton->setIconSize( QgisApp::instance()->iconSize( true ) );
mEditPushButton->setIconSize( QgisApp::instance()->iconSize( true ) );
mCountToolButton->setIconSize( QgisApp::instance()->iconSize( true ) );
mFilterByMapToolButton->setIconSize( QgisApp::instance()->iconSize( true ) );
mExpressionFilterButton->setIconSize( QgisApp::instance()->iconSize( true ) );
mLayerExpressionButton->setIconSize( QgisApp::instance()->iconSize( true ) );

Expand Down Expand Up @@ -214,7 +213,7 @@ void QgsLayoutLegendWidget::setGuiElements()
whileBlocking( mSubgroupAlignCombo )->setCurrentAlignment( mLegend->style( QgsLegendStyle::Subgroup ).alignment() );
whileBlocking( mItemAlignCombo )->setCurrentAlignment( mLegend->style( QgsLegendStyle::SymbolLabel ).alignment() );
whileBlocking( mArrangementCombo )->setCurrentAlignment( mLegend->symbolAlignment() );
mFilterByMapToolButton->setChecked( mLegend->legendFilterByMapEnabled() );
mFilterByMapCheckBox->setChecked( mLegend->legendFilterByMapEnabled() );
mColumnCountSpinBox->setValue( mLegend->columnCount() );
mSplitLayerCheckBox->setChecked( mLegend->splitLayer() );
mEqualColumnWidthCheckBox->setChecked( mLegend->equalColumnWidth() );
Expand Down Expand Up @@ -978,7 +977,7 @@ void QgsLayoutLegendWidget::mCountToolButton_clicked( bool checked )
mLegend->endCommand();
}

void QgsLayoutLegendWidget::mFilterByMapToolButton_toggled( bool checked )
void QgsLayoutLegendWidget::mFilterByMapCheckBox_toggled( bool checked )
{
mLegend->beginCommand( tr( "Update Legend" ) );
mLegend->setLegendFilterByMapEnabled( checked );
Expand Down Expand Up @@ -1160,7 +1159,7 @@ void QgsLayoutLegendWidget::blockAllSignals( bool b )
mItemTreeView->blockSignals( b );
mCheckBoxAutoUpdate->blockSignals( b );
mMapComboBox->blockSignals( b );
mFilterByMapToolButton->blockSignals( b );
mFilterByMapCheckBox->blockSignals( b );
mColumnCountSpinBox->blockSignals( b );
mSplitLayerCheckBox->blockSignals( b );
mEqualColumnWidthCheckBox->blockSignals( b );
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout/qgslayoutlegendwidget.h
Expand Up @@ -82,7 +82,7 @@ class QgsLayoutLegendWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayo
void mEditPushButton_clicked();
void mCountToolButton_clicked( bool checked );
void mExpressionFilterButton_toggled( bool checked );
void mFilterByMapToolButton_toggled( bool checked );
void mFilterByMapCheckBox_toggled( bool checked );
void resetLayerNodeToDefaults();
void mUpdateAllPushButton_clicked();
void mAddGroupToolButton_clicked();
Expand Down
32 changes: 11 additions & 21 deletions src/ui/layout/qgslayoutlegendwidgetbase.ui
Expand Up @@ -364,26 +364,6 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="mFilterByMapToolButton">
<property name="toolTip">
<string>Filter Legend by Map Content</string>
</property>
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFilter2.svg</normaloff>:/images/themes/default/mActionFilter2.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QgsLegendFilterButton" name="mExpressionFilterButton">
<property name="text">
Expand Down Expand Up @@ -433,6 +413,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="mFilterByMapCheckBox">
<property name="toolTip">
<string>Filter out legend elements that lie outside the linked map item.</string>
</property>
<property name="text">
<string>Only show items inside linked map</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mFilterLegendByAtlasCheckBox">
<property name="toolTip">
Expand Down Expand Up @@ -1283,8 +1273,8 @@
<tabstop>mRemoveToolButton</tabstop>
<tabstop>mEditPushButton</tabstop>
<tabstop>mCountToolButton</tabstop>
<tabstop>mFilterByMapToolButton</tabstop>
<tabstop>mExpressionFilterButton</tabstop>
<tabstop>mFilterByMapCheckBox</tabstop>
<tabstop>mFilterLegendByAtlasCheckBox</tabstop>
<tabstop>mFontsColGroupBox</tabstop>
<tabstop>mTitleFontButton</tabstop>
Expand Down

0 comments on commit b700e6d

Please sign in to comment.