mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
Defer mask source widget population (fixes #34942)
This commit is contained in:
parent
0e2c858723
commit
1237d94405
@ -14,6 +14,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
#include "qgsmaskingwidget.h"
|
#include "qgsmaskingwidget.h"
|
||||||
#include "qgsmasksourceselectionwidget.h"
|
#include "qgsmasksourceselectionwidget.h"
|
||||||
@ -42,6 +43,14 @@ QgsMaskingWidget::QgsMaskingWidget( QWidget *parent ) :
|
|||||||
{
|
{
|
||||||
emit widgetChanged();
|
emit widgetChanged();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
connect( mEditMaskSettingsGroup, &QGroupBox::toggled, this, [&]( bool on )
|
||||||
|
{
|
||||||
|
if ( on && mLayer )
|
||||||
|
{
|
||||||
|
populate();
|
||||||
|
}
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,8 +142,16 @@ QList<QPair<QgsSymbolLayerId, QList<QgsSymbolLayerReference>>> symbolLayerMasks(
|
|||||||
void QgsMaskingWidget::setLayer( QgsVectorLayer *layer )
|
void QgsMaskingWidget::setLayer( QgsVectorLayer *layer )
|
||||||
{
|
{
|
||||||
mLayer = layer;
|
mLayer = layer;
|
||||||
|
if ( mEditMaskSettingsGroup->isChecked() )
|
||||||
|
{
|
||||||
|
populate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsMaskingWidget::populate()
|
||||||
|
{
|
||||||
mMaskSourcesWidget->update();
|
mMaskSourcesWidget->update();
|
||||||
mMaskTargetsWidget->setLayer( layer );
|
mMaskTargetsWidget->setLayer( mLayer );
|
||||||
|
|
||||||
// collect masks and filter on those which have the current layer as destination
|
// collect masks and filter on those which have the current layer as destination
|
||||||
QSet<QgsSymbolLayerId> maskedSymbolLayers;
|
QSet<QgsSymbolLayerId> maskedSymbolLayers;
|
||||||
|
|||||||
@ -48,7 +48,9 @@ class GUI_EXPORT QgsMaskingWidget: public QgsPanelWidget, private Ui::QgsMasking
|
|||||||
void widgetChanged();
|
void widgetChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsVectorLayer *mLayer;
|
QgsVectorLayer *mLayer = nullptr;
|
||||||
|
//! Populate the mask source and target widgets
|
||||||
|
void populate();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -63,6 +63,7 @@ QgsMaskSourceSelectionWidget::QgsMaskSourceSelectionWidget( QWidget *parent )
|
|||||||
|
|
||||||
// place the tree in a layout
|
// place the tree in a layout
|
||||||
QVBoxLayout *vbox = new QVBoxLayout();
|
QVBoxLayout *vbox = new QVBoxLayout();
|
||||||
|
vbox->setContentsMargins( 0, 0, 0, 0 );
|
||||||
vbox->addWidget( mTree );
|
vbox->addWidget( mTree );
|
||||||
|
|
||||||
setLayout( vbox );
|
setLayout( vbox );
|
||||||
|
|||||||
@ -37,6 +37,7 @@ QgsSymbolLayerSelectionWidget::QgsSymbolLayerSelectionWidget( QWidget *parent )
|
|||||||
|
|
||||||
// place the tree in a layout
|
// place the tree in a layout
|
||||||
QVBoxLayout *vbox = new QVBoxLayout();
|
QVBoxLayout *vbox = new QVBoxLayout();
|
||||||
|
vbox->setContentsMargins( 0, 0, 0, 0 );
|
||||||
vbox->addWidget( mTree );
|
vbox->addWidget( mTree );
|
||||||
|
|
||||||
setLayout( vbox );
|
setLayout( vbox );
|
||||||
|
|||||||
@ -6,51 +6,54 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>637</width>
|
<width>863</width>
|
||||||
<height>409</height>
|
<height>461</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QGroupBox" name="mEditMaskSettingsGroup">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>Masked symbol layers</string>
|
<string>Edit mask settings</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="checkable">
|
||||||
</item>
|
<bool>true</bool>
|
||||||
<item>
|
|
||||||
<widget class="QgsSymbolLayerSelectionWidget" name="mMaskTargetsWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Mask sources</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="checked">
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QgsMaskSourceSelectionWidget" name="mMaskSourcesWidget" native="true">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Masked symbol layers</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QgsSymbolLayerSelectionWidget" name="mMaskTargetsWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Mask sources</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QgsMaskSourceSelectionWidget" name="mMaskSourcesWidget" native="true">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user