Skip to content
Permalink
Browse files
Expose clipping blend modes for layers which are contained within group
layers
  • Loading branch information
nyalldawson committed Nov 25, 2021
1 parent ce408fc commit 711a3637986603dea26ecb12de0be895c4641e94
@@ -38,6 +38,14 @@ with sources which point to ``newPath``.
Returns ``True`` if any layers were updated as a result.
%End

static bool layerIsContainedInGroupLayer( QgsProject *project, QgsMapLayer *layer );
%Docstring
Returns ``True`` if the specified ``layer`` is a child layer from any :py:class:`QgsGroupLayer` in the given ``project``.

.. versionadded:: 3.24
%End


};


@@ -23,6 +23,8 @@
#include "qgsgui.h"
#include "qgsannotationitemguiregistry.h"
#include "qgspainteffect.h"
#include "qgsproject.h"
#include "qgsprojectutils.h"

#include <QStackedWidget>
#include <QHBoxLayout>
@@ -70,6 +72,7 @@ void QgsAnnotationItemPropertiesWidget::syncToLayer( QgsMapLayer *layer )

// opacity and blend modes
mBlockLayerUpdates = true;
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mLayer ) );
mBlendModeComboBox->setBlendMode( mLayer->blendMode() );
mOpacityWidget->setOpacity( mLayer->opacity() );
if ( mLayer->paintEffect() )
@@ -27,6 +27,8 @@
#include "qgsmaplayerconfigwidget.h"
#include "qgsdatumtransformdialog.h"
#include "qgspainteffect.h"
#include "qgsproject.h"
#include "qgsprojectutils.h"
#include <QFileDialog>
#include <QMenu>
#include <QMessageBox>
@@ -114,6 +116,7 @@ void QgsAnnotationLayerProperties::apply()
mLayer->setMinimumScale( mScaleRangeWidget->minimumScale() );

// set the blend mode and opacity for the layer
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mLayer ) );
mLayer->setBlendMode( mBlendModeComboBox->blendMode() );
mLayer->setOpacity( mOpacityWidget->opacity() );

@@ -21,6 +21,8 @@
#include "qgspainteffect.h"
#include "qgsmapcanvas.h"
#include "qgspainteffectregistry.h"
#include "qgsproject.h"
#include "qgsprojectutils.h"

#include <QStackedWidget>
#include <QHBoxLayout>
@@ -54,6 +56,7 @@ void QgsLayerTreeGroupPropertiesWidget::setMapLayerConfigWidgetContext( const Qg
if ( QgsGroupLayer *groupLayer = mLayerTreeGroup->groupLayer() )
{
mRenderAsGroupCheckBox->setChecked( true );
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), groupLayer ) );
mBlendModeComboBox->setBlendMode( groupLayer->blendMode() );
mOpacityWidget->setOpacity( groupLayer->opacity() );
if ( groupLayer->paintEffect() )
@@ -23,6 +23,8 @@
#include "qgsmeshdatasetgrouptreeview.h"
#include "qgsmeshrendereractivedatasetwidget.h"
#include "qgsmeshlayerutils.h"
#include "qgsproject.h"
#include "qgsprojectutils.h"

QgsRendererMeshPropertiesWidget::QgsRendererMeshPropertiesWidget( QgsMeshLayer *layer, QgsMapCanvas *canvas, QWidget *parent )
: QgsMapLayerConfigWidget( layer, canvas, parent )
@@ -48,6 +50,7 @@ QgsRendererMeshPropertiesWidget::QgsRendererMeshPropertiesWidget( QgsMeshLayer *
syncToLayer( mMeshLayer );

//blend mode
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mMeshLayer ) );
mBlendModeComboBox->setBlendMode( mMeshLayer->blendMode() );
connect( mBlendModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPanelWidget::widgetChanged );

@@ -28,6 +28,8 @@

#include "qgspointcloudrgbrenderer.h"
#include "qgslogger.h"
#include "qgsproject.h"
#include "qgsprojectutils.h"

static bool _initRenderer( const QString &name, QgsPointCloudRendererWidgetFunc f, const QString &iconName = QString() )
{
@@ -127,6 +129,7 @@ void QgsPointCloudRendererPropertiesWidget::syncToLayer( QgsMapLayer *layer )

mBlockChangedSignal = true;
mOpacityWidget->setOpacity( mLayer->opacity() );
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mLayer ) );
mBlendModeComboBox->setBlendMode( mLayer->blendMode() );

if ( mLayer->renderer() )
@@ -67,6 +67,7 @@
#include "qgsrasterlayertemporalproperties.h"
#include "qgsdoublevalidator.h"
#include "qgsmaplayerconfigwidgetfactory.h"
#include "qgsprojectutils.h"

#include "qgsrasterlayertemporalpropertieswidget.h"
#include "qgsprojecttimesettings.h"
@@ -385,6 +386,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv
}

//blend mode
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mRasterLayer ) );
mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );

//transparency band
@@ -31,7 +31,8 @@
#include "qgssinglebandgrayrenderer.h"
#include "qgsapplication.h"
#include "qgscolorrampimpl.h"

#include "qgsproject.h"
#include "qgsprojectutils.h"

#include "qgsmessagelog.h"

@@ -227,6 +228,7 @@ void QgsRendererRasterPropertiesWidget::syncToLayer( QgsRasterLayer *layer )
}

//blend mode
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mRasterLayer ) );
mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );

//set combo boxes to current resampling types
@@ -32,6 +32,8 @@
#include "qgsembeddedsymbolrendererwidget.h"
#include "qgspanelwidget.h"
#include "qgspainteffect.h"
#include "qgsproject.h"
#include "qgsprojectutils.h"

#include "qgsorderbydialog.h"
#include "qgsapplication.h"
@@ -344,6 +346,9 @@ void QgsRendererPropertiesDialog::openPanel( QgsPanelWidget *panel )

void QgsRendererPropertiesDialog::syncToLayer()
{
mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mLayer ) );
mFeatureBlendComboBox->setShowClippingModes( mBlendModeComboBox->showClippingModes() );

// Blend mode
mBlendModeComboBox->setBlendMode( mLayer->blendMode() );

0 comments on commit 711a363

Please sign in to comment.