Skip to content

Commit 54bcef6

Browse files
committed
Added user interface for changing ShowPartialsLabels setting value
1 parent 983edc9 commit 54bcef6

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

src/app/qgslabelengineconfigdialog.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWi
4343
mShadowDebugRectChkBox->setChecked( mLBL->isShowingShadowRectangles() );
4444

4545
mSaveWithProjectChkBox->setChecked( mLBL->isStoredWithProject() );
46+
47+
chkShowPartialsLabels->setChecked( mLBL-> isShowingPartialsLabels() );
4648
}
4749

4850

@@ -58,6 +60,7 @@ void QgsLabelEngineConfigDialog::onOK()
5860
mLBL->setShowingCandidates( chkShowCandidates->isChecked() );
5961
mLBL->setShowingShadowRectangles( mShadowDebugRectChkBox->isChecked() );
6062
mLBL->setShowingAllLabels( chkShowAllLabels->isChecked() );
63+
mLBL->setShowingPartialsLabels( chkShowPartialsLabels->isChecked() );
6164

6265
if ( mSaveWithProjectChkBox->isChecked() )
6366
{
@@ -80,4 +83,5 @@ void QgsLabelEngineConfigDialog::setDefaults()
8083
chkShowCandidates->setChecked( false );
8184
chkShowAllLabels->setChecked( false );
8285
mShadowDebugRectChkBox->setChecked( false );
86+
chkShowPartialsLabels->setChecked( p.getShowPartial() );
8387
}

src/core/qgspallabeling.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -3444,6 +3444,8 @@ void QgsPalLabeling::init( QgsMapRenderer* mr )
34443444
mPal->setLineP( mCandLine );
34453445
mPal->setPolyP( mCandPolygon );
34463446

3447+
mPal->setShowPartial( mShowingPartialsLabels );
3448+
34473449
clearActiveLayers(); // free any previous QgsDataDefined objects
34483450
mActiveDiagramLayers.clear();
34493451
}
@@ -4812,6 +4814,8 @@ void QgsPalLabeling::loadEngineSettings()
48124814
"PAL", "/ShowingShadowRects", false, &saved );
48134815
mShowingAllLabels = QgsProject::instance()->readBoolEntry(
48144816
"PAL", "/ShowingAllLabels", false, &saved );
4817+
mShowingPartialsLabels = QgsProject::instance()->readBoolEntry(
4818+
"PAL", "/ShowingPartialsLabels", p.getShowPartial(), &saved );
48154819
mSavedWithProject = saved;
48164820
}
48174821

@@ -4824,6 +4828,7 @@ void QgsPalLabeling::saveEngineSettings()
48244828
QgsProject::instance()->writeEntry( "PAL", "/ShowingCandidates", mShowingCandidates );
48254829
QgsProject::instance()->writeEntry( "PAL", "/ShowingShadowRects", mShowingShadowRects );
48264830
QgsProject::instance()->writeEntry( "PAL", "/ShowingAllLabels", mShowingAllLabels );
4831+
QgsProject::instance()->writeEntry( "PAL", "/ShowingPartialsLabels", mShowingPartialsLabels );
48274832
mSavedWithProject = true;
48284833
}
48294834

@@ -4836,6 +4841,7 @@ void QgsPalLabeling::clearEngineSettings()
48364841
QgsProject::instance()->removeEntry( "PAL", "/ShowingCandidates" );
48374842
QgsProject::instance()->removeEntry( "PAL", "/ShowingShadowRects" );
48384843
QgsProject::instance()->removeEntry( "PAL", "/ShowingAllLabels" );
4844+
QgsProject::instance()->removeEntry( "PAL", "/ShowingPartialsLabels" );
48394845
mSavedWithProject = false;
48404846
}
48414847

@@ -4845,5 +4851,6 @@ QgsLabelingEngineInterface* QgsPalLabeling::clone()
48454851
lbl->mShowingAllLabels = mShowingAllLabels;
48464852
lbl->mShowingCandidates = mShowingCandidates;
48474853
lbl->mShowingShadowRects = mShowingShadowRects;
4854+
lbl->mShowingPartialsLabels = mShowingPartialsLabels;
48484855
return lbl;
48494856
}

src/core/qgspallabeling.h

+4
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
685685
bool isShowingAllLabels() const { return mShowingAllLabels; }
686686
void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing; }
687687

688+
bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
689+
void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }
690+
688691
// implemented methods from labeling engine interface
689692

690693
//! called when we're going to start with rendering
@@ -781,6 +784,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
781784
bool mShowingAllLabels; // whether to avoid collisions or not
782785
bool mSavedWithProject; // whether engine settings have been read from project file
783786
bool mShowingShadowRects; // whether to show debugging rectangles for drop shadows
787+
bool mShowingPartialsLabels; // whether to avoid partials labels or not
784788

785789
QgsLabelSearchTree* mLabelSearchTree;
786790
};

src/ui/qgsengineconfigdialog.ui

+15-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</size>
1818
</property>
1919
<property name="windowTitle">
20-
<string>Dialog</string>
20+
<string>Labeling engine settings</string>
2121
</property>
2222
<layout class="QVBoxLayout" name="verticalLayout">
2323
<item>
@@ -215,7 +215,7 @@
215215
<property name="verticalSpacing">
216216
<number>6</number>
217217
</property>
218-
<item row="1" column="0">
218+
<item row="2" column="0">
219219
<spacer name="horizontalSpacer_3">
220220
<property name="orientation">
221221
<enum>Qt::Horizontal</enum>
@@ -231,7 +231,7 @@
231231
</property>
232232
</spacer>
233233
</item>
234-
<item row="0" column="0" colspan="3">
234+
<item row="1" column="0" colspan="3">
235235
<widget class="QCheckBox" name="chkShowAllLabels">
236236
<property name="sizePolicy">
237237
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -244,7 +244,7 @@
244244
</property>
245245
</widget>
246246
</item>
247-
<item row="4" column="0" colspan="3">
247+
<item row="5" column="0" colspan="3">
248248
<widget class="QCheckBox" name="mSaveWithProjectChkBox">
249249
<property name="layoutDirection">
250250
<enum>Qt::LeftToRight</enum>
@@ -257,14 +257,14 @@
257257
</property>
258258
</widget>
259259
</item>
260-
<item row="2" column="0" colspan="3">
260+
<item row="3" column="0" colspan="3">
261261
<widget class="QCheckBox" name="chkShowCandidates">
262262
<property name="text">
263263
<string>Show candidates (for debugging)</string>
264264
</property>
265265
</widget>
266266
</item>
267-
<item row="1" column="1">
267+
<item row="2" column="1">
268268
<widget class="QLabel" name="label_6">
269269
<property name="sizePolicy">
270270
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -277,7 +277,7 @@
277277
</property>
278278
</widget>
279279
</item>
280-
<item row="1" column="2">
280+
<item row="2" column="2">
281281
<spacer name="horizontalSpacer_4">
282282
<property name="orientation">
283283
<enum>Qt::Horizontal</enum>
@@ -290,13 +290,20 @@
290290
</property>
291291
</spacer>
292292
</item>
293-
<item row="3" column="0" colspan="3">
293+
<item row="4" column="0" colspan="3">
294294
<widget class="QCheckBox" name="mShadowDebugRectChkBox">
295295
<property name="text">
296296
<string>Show shadow rectangles (for debugging)</string>
297297
</property>
298298
</widget>
299299
</item>
300+
<item row="0" column="0" colspan="3">
301+
<widget class="QCheckBox" name="chkShowPartialsLabels">
302+
<property name="text">
303+
<string>Show partials labels</string>
304+
</property>
305+
</widget>
306+
</item>
300307
</layout>
301308
</item>
302309
<item>

0 commit comments

Comments
 (0)