Skip to content

Commit b1d8068

Browse files
committedDec 23, 2018
Make geometry constraint configuration size fit the contents
(cherry picked from commit a3e99ca)
1 parent 2f64a3c commit b1d8068

File tree

3 files changed

+59
-21
lines changed

3 files changed

+59
-21
lines changed
 

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,33 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
407407
mGeometryPrecisionLineEdit->setEnabled( true );
408408
mGeometryPrecisionLineEdit->setValidator( new QDoubleValidator( mGeometryPrecisionLineEdit ) );
409409

410-
mRemoveDuplicateNodesCheckbox->setChecked( mLayer->geometryOptions()->removeDuplicateNodes() );
411410
double precision( mLayer->geometryOptions()->geometryPrecision() );
412411
bool ok = true;
413412
QString precisionStr( QLocale().toString( precision, ok ) );
414413
if ( precision == 0.0 || ! ok )
415414
precisionStr = QString();
416415
mGeometryPrecisionLineEdit->setText( precisionStr );
417416

417+
mRemoveDuplicateNodesManuallyActivated = mLayer->geometryOptions()->removeDuplicateNodes();
418+
mRemoveDuplicateNodesCheckbox->setChecked( mRemoveDuplicateNodesManuallyActivated );
419+
if ( !precisionStr.isNull() )
420+
mRemoveDuplicateNodesCheckbox->setEnabled( false );
421+
connect( mGeometryPrecisionLineEdit, &QLineEdit::textChanged, this, [this]
422+
{
423+
if ( !mGeometryPrecisionLineEdit->text().isEmpty() )
424+
{
425+
if ( mRemoveDuplicateNodesCheckbox->isEnabled() )
426+
mRemoveDuplicateNodesManuallyActivated = mRemoveDuplicateNodesCheckbox->isChecked();
427+
mRemoveDuplicateNodesCheckbox->setEnabled( false );
428+
mRemoveDuplicateNodesCheckbox->setChecked( true );
429+
}
430+
else
431+
{
432+
mRemoveDuplicateNodesCheckbox->setEnabled( true );
433+
mRemoveDuplicateNodesCheckbox->setChecked( mRemoveDuplicateNodesManuallyActivated );
434+
}
435+
} );
436+
418437
mPrecisionUnitsLabel->setText( QStringLiteral( "[%1]" ).arg( QgsUnitTypes::toAbbreviatedString( mLayer->crs().mapUnits() ) ) );
419438

420439
QLayout *geometryCheckLayout = new QVBoxLayout();
@@ -428,6 +447,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
428447
geometryCheckLayout->addWidget( cb );
429448
}
430449
mGeometryValidationGroupBox->setLayout( geometryCheckLayout );
450+
mGeometryValidationGroupBox->setVisible( !geometryCheckFactories.isEmpty() );
431451

432452
QLayout *topologyCheckLayout = new QVBoxLayout();
433453
const QList<QgsGeometryCheckFactory *> topologyCheckFactories = QgsAnalysis::instance()->geometryCheckRegistry()->geometryCheckFactories( mLayer, QgsGeometryCheck::LayerCheck, QgsGeometryCheck::Flag::AvailableInValidation );
@@ -440,6 +460,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
440460
topologyCheckLayout->addWidget( cb );
441461
}
442462
mTopologyChecksGroupBox->setLayout( topologyCheckLayout );
463+
mTopologyChecksGroupBox->setVisible( !topologyCheckFactories.isEmpty() );
443464
}
444465
else
445466
{

‎src/app/qgsvectorlayerproperties.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
245245

246246
QHash<QCheckBox *, QString> mGeometryCheckFactoriesGroupBoxes;
247247

248+
bool mRemoveDuplicateNodesManuallyActivated = false;
249+
248250
private slots:
249251
void openPanel( QgsPanelWidget *panel );
250252

‎src/ui/qgsvectorlayerpropertiesbase.ui

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@
433433
<rect>
434434
<x>0</x>
435435
<y>0</y>
436-
<width>325</width>
437-
<height>389</height>
436+
<width>315</width>
437+
<height>403</height>
438438
</rect>
439439
</property>
440440
<layout class="QVBoxLayout" name="verticalLayout_9">
@@ -907,8 +907,8 @@ border-radius: 2px;</string>
907907
<rect>
908908
<x>0</x>
909909
<y>0</y>
910-
<width>104</width>
911-
<height>102</height>
910+
<width>185</width>
911+
<height>112</height>
912912
</rect>
913913
</property>
914914
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -1504,8 +1504,8 @@ border-radius: 2px;</string>
15041504
<rect>
15051505
<x>0</x>
15061506
<y>0</y>
1507-
<width>685</width>
1508-
<height>346</height>
1507+
<width>734</width>
1508+
<height>372</height>
15091509
</rect>
15101510
</property>
15111511
<layout class="QVBoxLayout" name="verticalLayout_32">
@@ -1961,8 +1961,8 @@ border-radius: 2px;</string>
19611961
<rect>
19621962
<x>0</x>
19631963
<y>0</y>
1964-
<width>340</width>
1965-
<height>630</height>
1964+
<width>378</width>
1965+
<height>678</height>
19661966
</rect>
19671967
</property>
19681968
<layout class="QVBoxLayout" name="verticalLayout_13">
@@ -2367,8 +2367,8 @@ border-radius: 2px;</string>
23672367
<rect>
23682368
<x>0</x>
23692369
<y>0</y>
2370-
<width>651</width>
2371-
<height>804</height>
2370+
<width>658</width>
2371+
<height>800</height>
23722372
</rect>
23732373
</property>
23742374
<layout class="QVBoxLayout" name="verticalLayout_20">
@@ -2377,8 +2377,15 @@ border-radius: 2px;</string>
23772377
<property name="title">
23782378
<string>Automatic Fixes</string>
23792379
</property>
2380-
<layout class="QFormLayout" name="formLayout">
2381-
<item row="2" column="0">
2380+
<layout class="QGridLayout" name="gridLayout">
2381+
<item row="0" column="0" colspan="2">
2382+
<widget class="QCheckBox" name="mRemoveDuplicateNodesCheckbox">
2383+
<property name="text">
2384+
<string>Remove duplicate nodes</string>
2385+
</property>
2386+
</widget>
2387+
</item>
2388+
<item row="1" column="0">
23822389
<widget class="QLabel" name="label">
23832390
<property name="toolTip">
23842391
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The geometry precision defines the maximum precision to of geometry coordinates that should be stored on this layer. A snap to grid algorithm will be applied on every geometry entering this layer, resulting in coordinates being rounded to multiples of this value. The operation is applied in this layer's coordinate reference system.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -2388,14 +2395,7 @@ border-radius: 2px;</string>
23882395
</property>
23892396
</widget>
23902397
</item>
2391-
<item row="0" column="0" colspan="2">
2392-
<widget class="QCheckBox" name="mRemoveDuplicateNodesCheckbox">
2393-
<property name="text">
2394-
<string>Remove duplicate nodes</string>
2395-
</property>
2396-
</widget>
2397-
</item>
2398-
<item row="2" column="1">
2398+
<item row="1" column="1">
23992399
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0,0">
24002400
<item>
24012401
<widget class="QLabel" name="mPrecisionUnitsLabel">
@@ -2436,6 +2436,19 @@ border-radius: 2px;</string>
24362436
</property>
24372437
</widget>
24382438
</item>
2439+
<item>
2440+
<spacer name="verticalSpacer_4">
2441+
<property name="orientation">
2442+
<enum>Qt::Vertical</enum>
2443+
</property>
2444+
<property name="sizeHint" stdset="0">
2445+
<size>
2446+
<width>20</width>
2447+
<height>40</height>
2448+
</size>
2449+
</property>
2450+
</spacer>
2451+
</item>
24392452
</layout>
24402453
</widget>
24412454
</widget>
@@ -2653,6 +2666,8 @@ border-radius: 2px;</string>
26532666
<include location="../../images/images.qrc"/>
26542667
<include location="../../images/images.qrc"/>
26552668
<include location="../../images/images.qrc"/>
2669+
<include location="../../images/images.qrc"/>
2670+
<include location="../../images/images.qrc"/>
26562671
</resources>
26572672
<connections>
26582673
<connection>

0 commit comments

Comments
 (0)
Please sign in to comment.