QGIS API Documentation 3.43.0-Master (56aa1fd18d7)
qgslabelremoveduplicatesettingswidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgslabelremoveduplicatessettingswidget.h
3 ----------------------
4 begin : December 2019
5 copyright : (C) 2019 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16
18#include "moc_qgslabelremoveduplicatesettingswidget.cpp"
20
22 : QgsLabelSettingsWidgetBase( parent, layer )
23{
24 setupUi( this );
25
26 setPanelTitle( tr( "Duplicate Removal" ) );
27
29
30 connect( mNoRepeatDistSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [=]( double ) {
31 if ( !mBlockSignals )
32 emit changed();
33 } );
34 connect( mNoRepeatDistUnitWidget, &QgsUnitSelectionWidget::changed, this, [=] {
35 if ( !mBlockSignals )
36 emit changed();
37 } );
38
40}
41
43{
44 mSettings = settings;
45 mBlockSignals = true;
46
47 mNoRepeatDistSpinBox->setValue( mSettings.minimumDistanceToDuplicate() );
48 mNoRepeatDistUnitWidget->setUnit( mSettings.minimumDistanceToDuplicateUnit() );
49 mNoRepeatDistUnitWidget->setMapUnitScale( mSettings.minimumDistanceToDuplicateMapUnitScale() );
50
51 mBlockSignals = false;
52}
53
55{
56 mSettings.setMinimumDistanceToDuplicate( mNoRepeatDistSpinBox->value() );
57 mSettings.setMinimumDistanceToDuplicateUnit( mNoRepeatDistUnitWidget->unit() );
58 mSettings.setMinimumDistanceToDuplicateMapUnitScale( mNoRepeatDistUnitWidget->getMapUnitScale() );
59 return mSettings;
60}
61
65
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:337
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes)
@ MapUnits
Map units.
@ MetersInMapUnits
Meters value as Map units.
void setSettings(const QgsLabelThinningSettings &settings)
Sets the thinning settings to show in the widget.
QgsLabelRemoveDuplicatesSettingsWidget(QWidget *parent=nullptr, QgsMapLayer *layer=nullptr)
Constructor for QgsLabelRemoveDuplicatesSettingsWidget.
QgsLabelThinningSettings settings() const
Returns the thinning settings defined by the widget.
void updateDataDefinedProperties(QgsPropertyCollection &properties) override
Updates a data defined properties collection, correctly setting the values for any properties related...
void setGeometryType(Qgis::GeometryType type) override
Sets the geometry type of the features to customize the widget accordingly.
Base class for widgets which allow customization of label engine properties, such as label placement ...
void changed()
Emitted when any of the settings described by the widget are changed.
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsPalLayerSettings::Property key)
Registers a data defined override button.
QgsPropertyCollection mDataDefinedProperties
Contains the data defined properties defined by the widget.
Contains settings related to how the label engine removes candidate label positions and reduces the n...
void setMinimumDistanceToDuplicate(double distance)
Sets the minimum distance to labels with duplicate text.
void setMinimumDistanceToDuplicateMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum distance to labels with duplicate text.
const QgsMapUnitScale & minimumDistanceToDuplicateMapUnitScale() const
Returns the map unit scale for the minimum distance to labels with duplicate text.
void setMinimumDistanceToDuplicateUnit(Qgis::RenderUnit unit)
Sets the unit for the minimum distance to labels with duplicate text.
double minimumDistanceToDuplicate() const
Returns the minimum distance to labels with duplicate text.
Qgis::RenderUnit minimumDistanceToDuplicateUnit() const
Returns the units for the minimum distance to labels with duplicate text.
Base class for all map layer types.
Definition qgsmaplayer.h:77
@ RemoveDuplicateLabelDistance
Minimum distance from labels for this feature to other labels with duplicate text.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
QgsProperty property(int key) const final
Returns a matching property from the collection, if one exists.
void changed()
Emitted when the selected unit is changed, or the definition of the map unit scale is changed.
QList< Qgis::RenderUnit > RenderUnitList
List of render units.