Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added user interface for changing ShowPartialsLabels setting value
  • Loading branch information
yellow-sky committed Sep 15, 2013
1 parent 983edc9 commit 54bcef6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/app/qgslabelengineconfigdialog.cpp
Expand Up @@ -43,6 +43,8 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWi
mShadowDebugRectChkBox->setChecked( mLBL->isShowingShadowRectangles() );

mSaveWithProjectChkBox->setChecked( mLBL->isStoredWithProject() );

chkShowPartialsLabels->setChecked( mLBL-> isShowingPartialsLabels() );
}


Expand All @@ -58,6 +60,7 @@ void QgsLabelEngineConfigDialog::onOK()
mLBL->setShowingCandidates( chkShowCandidates->isChecked() );
mLBL->setShowingShadowRectangles( mShadowDebugRectChkBox->isChecked() );
mLBL->setShowingAllLabels( chkShowAllLabels->isChecked() );
mLBL->setShowingPartialsLabels( chkShowPartialsLabels->isChecked() );

if ( mSaveWithProjectChkBox->isChecked() )
{
Expand All @@ -80,4 +83,5 @@ void QgsLabelEngineConfigDialog::setDefaults()
chkShowCandidates->setChecked( false );
chkShowAllLabels->setChecked( false );
mShadowDebugRectChkBox->setChecked( false );
chkShowPartialsLabels->setChecked( p.getShowPartial() );
}
7 changes: 7 additions & 0 deletions src/core/qgspallabeling.cpp
Expand Up @@ -3444,6 +3444,8 @@ void QgsPalLabeling::init( QgsMapRenderer* mr )
mPal->setLineP( mCandLine );
mPal->setPolyP( mCandPolygon );

mPal->setShowPartial( mShowingPartialsLabels );

clearActiveLayers(); // free any previous QgsDataDefined objects
mActiveDiagramLayers.clear();
}
Expand Down Expand Up @@ -4812,6 +4814,8 @@ void QgsPalLabeling::loadEngineSettings()
"PAL", "/ShowingShadowRects", false, &saved );
mShowingAllLabels = QgsProject::instance()->readBoolEntry(
"PAL", "/ShowingAllLabels", false, &saved );
mShowingPartialsLabels = QgsProject::instance()->readBoolEntry(
"PAL", "/ShowingPartialsLabels", p.getShowPartial(), &saved );
mSavedWithProject = saved;
}

Expand All @@ -4824,6 +4828,7 @@ void QgsPalLabeling::saveEngineSettings()
QgsProject::instance()->writeEntry( "PAL", "/ShowingCandidates", mShowingCandidates );
QgsProject::instance()->writeEntry( "PAL", "/ShowingShadowRects", mShowingShadowRects );
QgsProject::instance()->writeEntry( "PAL", "/ShowingAllLabels", mShowingAllLabels );
QgsProject::instance()->writeEntry( "PAL", "/ShowingPartialsLabels", mShowingPartialsLabels );
mSavedWithProject = true;
}

Expand All @@ -4836,6 +4841,7 @@ void QgsPalLabeling::clearEngineSettings()
QgsProject::instance()->removeEntry( "PAL", "/ShowingCandidates" );
QgsProject::instance()->removeEntry( "PAL", "/ShowingShadowRects" );
QgsProject::instance()->removeEntry( "PAL", "/ShowingAllLabels" );
QgsProject::instance()->removeEntry( "PAL", "/ShowingPartialsLabels" );
mSavedWithProject = false;
}

Expand All @@ -4845,5 +4851,6 @@ QgsLabelingEngineInterface* QgsPalLabeling::clone()
lbl->mShowingAllLabels = mShowingAllLabels;
lbl->mShowingCandidates = mShowingCandidates;
lbl->mShowingShadowRects = mShowingShadowRects;
lbl->mShowingPartialsLabels = mShowingPartialsLabels;
return lbl;
}
4 changes: 4 additions & 0 deletions src/core/qgspallabeling.h
Expand Up @@ -685,6 +685,9 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
bool isShowingAllLabels() const { return mShowingAllLabels; }
void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing; }

bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }

// implemented methods from labeling engine interface

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

QgsLabelSearchTree* mLabelSearchTree;
};
Expand Down
23 changes: 15 additions & 8 deletions src/ui/qgsengineconfigdialog.ui
Expand Up @@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Labeling engine settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand Down Expand Up @@ -215,7 +215,7 @@
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="1" column="0">
<item row="2" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -231,7 +231,7 @@
</property>
</spacer>
</item>
<item row="0" column="0" colspan="3">
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="chkShowAllLabels">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
Expand All @@ -244,7 +244,7 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="mSaveWithProjectChkBox">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
Expand All @@ -257,14 +257,14 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="chkShowCandidates">
<property name="text">
<string>Show candidates (for debugging)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
Expand All @@ -277,7 +277,7 @@
</property>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -290,13 +290,20 @@
</property>
</spacer>
</item>
<item row="3" column="0" colspan="3">
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="mShadowDebugRectChkBox">
<property name="text">
<string>Show shadow rectangles (for debugging)</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="chkShowPartialsLabels">
<property name="text">
<string>Show partials labels</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down

0 comments on commit 54bcef6

Please sign in to comment.