mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
[processing] Fix occasional crash in Processing gui unit test cleanup
This commit is contained in:
parent
39f2121063
commit
7833162ca0
@ -28,11 +28,13 @@ Processing map layer combo box.
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsProcessingMapLayerComboBox( QgsProcessingParameterDefinition *parameter, QWidget *parent = 0 );
|
||||
QgsProcessingMapLayerComboBox( const QgsProcessingParameterDefinition *parameter, QWidget *parent = 0 );
|
||||
%Docstring
|
||||
Constructor for QgsProcessingMapLayerComboBox, with the specified ``parameter`` definition.
|
||||
%End
|
||||
|
||||
~QgsProcessingMapLayerComboBox();
|
||||
|
||||
void setLayer( QgsMapLayer *layer );
|
||||
%Docstring
|
||||
Sets the combo box to the specified ``layer``, if ``layer`` is compatible with the
|
||||
|
@ -28,9 +28,9 @@
|
||||
|
||||
///@cond PRIVATE
|
||||
|
||||
QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( QgsProcessingParameterDefinition *parameter, QWidget *parent )
|
||||
QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( const QgsProcessingParameterDefinition *parameter, QWidget *parent )
|
||||
: QWidget( parent )
|
||||
, mParameter( parameter )
|
||||
, mParameter( parameter->clone() )
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout();
|
||||
layout->setMargin( 0 );
|
||||
@ -68,9 +68,9 @@ QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( QgsProcessingParam
|
||||
{
|
||||
QList<int> dataTypes;
|
||||
if ( mParameter->type() == QgsProcessingParameterFeatureSource::typeName() )
|
||||
dataTypes = static_cast< QgsProcessingParameterFeatureSource *>( mParameter )->dataTypes();
|
||||
dataTypes = static_cast< QgsProcessingParameterFeatureSource *>( mParameter.get() )->dataTypes();
|
||||
else if ( mParameter->type() == QgsProcessingParameterVectorLayer::typeName() )
|
||||
dataTypes = static_cast< QgsProcessingParameterVectorLayer *>( mParameter )->dataTypes();
|
||||
dataTypes = static_cast< QgsProcessingParameterVectorLayer *>( mParameter.get() )->dataTypes();
|
||||
|
||||
if ( dataTypes.contains( QgsProcessing::TypeVectorAnyGeometry ) || dataTypes.isEmpty() )
|
||||
filters = QgsMapLayerProxyModel::HasGeometry;
|
||||
@ -119,6 +119,8 @@ QgsProcessingMapLayerComboBox::QgsProcessingMapLayerComboBox( QgsProcessingParam
|
||||
setAcceptDrops( true );
|
||||
}
|
||||
|
||||
QgsProcessingMapLayerComboBox::~QgsProcessingMapLayerComboBox() = default;
|
||||
|
||||
void QgsProcessingMapLayerComboBox::setLayer( QgsMapLayer *layer )
|
||||
{
|
||||
if ( layer || mParameter->flags() & QgsProcessingParameterDefinition::FlagOptional )
|
||||
@ -276,8 +278,8 @@ QString QgsProcessingMapLayerComboBox::compatibleUriFromMimeData( const QMimeDat
|
||||
|| mParameter->type() == QgsProcessingParameterMapLayer::typeName() )
|
||||
&& u.layerType == QLatin1String( "vector" ) && u.providerKey == QLatin1String( "ogr" ) )
|
||||
{
|
||||
QList< int > dataTypes = mParameter->type() == QgsProcessingParameterFeatureSource::typeName() ? static_cast< QgsProcessingParameterFeatureSource * >( mParameter )->dataTypes()
|
||||
: ( mParameter->type() == QgsProcessingParameterVectorLayer::typeName() ? static_cast<QgsProcessingParameterVectorLayer *>( mParameter )->dataTypes()
|
||||
QList< int > dataTypes = mParameter->type() == QgsProcessingParameterFeatureSource::typeName() ? static_cast< QgsProcessingParameterFeatureSource * >( mParameter.get() )->dataTypes()
|
||||
: ( mParameter->type() == QgsProcessingParameterVectorLayer::typeName() ? static_cast<QgsProcessingParameterVectorLayer *>( mParameter.get() )->dataTypes()
|
||||
: QList< int >() );
|
||||
switch ( QgsWkbTypes::geometryType( u.wkbType ) )
|
||||
{
|
||||
|
@ -47,7 +47,9 @@ class GUI_EXPORT QgsProcessingMapLayerComboBox : public QWidget
|
||||
/**
|
||||
* Constructor for QgsProcessingMapLayerComboBox, with the specified \a parameter definition.
|
||||
*/
|
||||
QgsProcessingMapLayerComboBox( QgsProcessingParameterDefinition *parameter, QWidget *parent = nullptr );
|
||||
QgsProcessingMapLayerComboBox( const QgsProcessingParameterDefinition *parameter, QWidget *parent = nullptr );
|
||||
|
||||
~QgsProcessingMapLayerComboBox() override;
|
||||
|
||||
/**
|
||||
* Sets the combo box to the specified \a layer, if \a layer is compatible with the
|
||||
@ -115,7 +117,7 @@ class GUI_EXPORT QgsProcessingMapLayerComboBox : public QWidget
|
||||
void selectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect );
|
||||
|
||||
private:
|
||||
QgsProcessingParameterDefinition *mParameter = nullptr;
|
||||
std::unique_ptr< QgsProcessingParameterDefinition > mParameter;
|
||||
QgsMapLayerComboBox *mCombo = nullptr;
|
||||
QToolButton *mSelectButton = nullptr;
|
||||
QCheckBox *mUseSelectionCheckBox = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user