Skip to content

Commit aac2622

Browse files
committed
Remove option to show label shadow rectangles from GUI
...and instead just make it #ifdef out
1 parent 4d5e753 commit aac2622

8 files changed

+48
-90
lines changed

python/core/qgspallabeling.sip

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,6 @@ class QgsPalLayerSettings
638638
int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
639639
int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
640640

641-
bool showingShadowRects; // whether to show debug rectangles for drop shadows
642641
};
643642

644643
class QgsLabelCandidate
@@ -764,9 +763,6 @@ class QgsPalLabeling : QgsLabelingEngineInterface
764763
bool isShowingCandidates() const;
765764
void setShowingCandidates( bool showing );
766765

767-
bool isShowingShadowRectangles() const;
768-
void setShowingShadowRectangles( bool showing );
769-
770766
bool isShowingAllLabels() const;
771767
void setShowingAllLabels( bool showing );
772768

src/app/qgslabelengineconfigdialog.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QWidget* parent )
4343

4444
chkShowCandidates->setChecked( lbl.isShowingCandidates() );
4545
chkShowAllLabels->setChecked( lbl.isShowingAllLabels() );
46-
mShadowDebugRectChkBox->setChecked( lbl.isShowingShadowRectangles() );
4746

4847
chkShowPartialsLabels->setChecked( lbl.isShowingPartialsLabels() );
4948
mDrawOutlinesChkBox->setChecked( lbl.isDrawingOutlineLabels() );
@@ -62,7 +61,6 @@ void QgsLabelEngineConfigDialog::onOK()
6261
spinCandPolygon->value() );
6362

6463
lbl.setShowingCandidates( chkShowCandidates->isChecked() );
65-
lbl.setShowingShadowRectangles( mShadowDebugRectChkBox->isChecked() );
6664
lbl.setShowingAllLabels( chkShowAllLabels->isChecked() );
6765
lbl.setShowingPartialsLabels( chkShowPartialsLabels->isChecked() );
6866
lbl.setDrawingOutlineLabels( mDrawOutlinesChkBox->isChecked() );
@@ -81,7 +79,6 @@ void QgsLabelEngineConfigDialog::setDefaults()
8179
spinCandPolygon->setValue( p.getPolyP() );
8280
chkShowCandidates->setChecked( false );
8381
chkShowAllLabels->setChecked( false );
84-
mShadowDebugRectChkBox->setChecked( false );
8582
chkShowPartialsLabels->setChecked( p.getShowPartial() );
8683
mDrawOutlinesChkBox->setChecked( true );
8784
}

src/core/qgslabelingengine.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ void QgsLabelingEngine::readSettingsFromProject()
349349
mFlags = 0;
350350
if ( prj->readBoolEntry( "PAL", "/ShowingCandidates", false, &saved ) ) mFlags |= DrawCandidates;
351351
if ( prj->readBoolEntry( "PAL", "/DrawRectOnly", false, &saved ) ) mFlags |= DrawLabelRectOnly;
352-
if ( prj->readBoolEntry( "PAL", "/ShowingShadowRects", false, &saved ) ) mFlags |= DrawShadowRects;
353352
if ( prj->readBoolEntry( "PAL", "/ShowingAllLabels", false, &saved ) ) mFlags |= UseAllLabels;
354353
if ( prj->readBoolEntry( "PAL", "/ShowingPartialsLabels", true, &saved ) ) mFlags |= UsePartialCandidates;
355354
if ( prj->readBoolEntry( "PAL", "/DrawOutlineLabels", true, &saved ) ) mFlags |= RenderOutlineLabels;
@@ -364,7 +363,6 @@ void QgsLabelingEngine::writeSettingsToProject()
364363

365364
QgsProject::instance()->writeEntry( "PAL", "/ShowingCandidates", mFlags.testFlag( DrawCandidates ) );
366365
QgsProject::instance()->writeEntry( "PAL", "/DrawRectOnly", mFlags.testFlag( DrawLabelRectOnly ) );
367-
QgsProject::instance()->writeEntry( "PAL", "/ShowingShadowRects", mFlags.testFlag( DrawShadowRects ) );
368366
QgsProject::instance()->writeEntry( "PAL", "/ShowingAllLabels", mFlags.testFlag( UseAllLabels ) );
369367
QgsProject::instance()->writeEntry( "PAL", "/ShowingPartialsLabels", mFlags.testFlag( UsePartialCandidates ) );
370368
QgsProject::instance()->writeEntry( "PAL", "/DrawOutlineLabels", mFlags.testFlag( RenderOutlineLabels ) );

src/core/qgslabelingengine.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ class CORE_EXPORT QgsLabelingEngine
172172
RenderOutlineLabels = 1 << 3, //!< Whether to render labels as text or outlines
173173
DrawLabelRectOnly = 1 << 4, //!< Whether to only draw the label rect and not the actual label text (used for unit tests)
174174
DrawCandidates = 1 << 5, //!< Whether to draw rectangles of generated candidates (good for debugging)
175-
DrawShadowRects = 1 << 6, //!< Whether to show debugging rectangles for drop shadows
176175
};
177176
Q_DECLARE_FLAGS( Flags, Flag )
178177

src/core/qgspallabeling.cpp

Lines changed: 41 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ QgsPalLayerSettings::QgsPalLayerSettings()
290290
mDataDefinedNames.insert( Show, QPair<QString, int>( "Show", 15 ) );
291291
mDataDefinedNames.insert( AlwaysShow, QPair<QString, int>( "AlwaysShow", 20 ) );
292292

293-
// temp stuff for when drawing label components (don't copy)
294-
showingShadowRects = false;
295293
}
296294

297295
QgsPalLayerSettings::QgsPalLayerSettings( const QgsPalLayerSettings& s )
@@ -302,7 +300,6 @@ QgsPalLayerSettings::QgsPalLayerSettings( const QgsPalLayerSettings& s )
302300
, mFeaturesToLabel( 0 )
303301
, mFeatsSendingToPal( 0 )
304302
, mFeatsRegPal( 0 )
305-
, showingShadowRects( false )
306303
, expression( nullptr )
307304
{
308305
*this = s;
@@ -3983,16 +3980,6 @@ void QgsPalLabeling::setShowingCandidates( bool showing )
39833980
mEngine->setFlag( QgsLabelingEngine::DrawCandidates, showing );
39843981
}
39853982

3986-
bool QgsPalLabeling::isShowingShadowRectangles() const
3987-
{
3988-
return mEngine->testFlag( QgsLabelingEngine::DrawShadowRects );
3989-
}
3990-
3991-
void QgsPalLabeling::setShowingShadowRectangles( bool showing )
3992-
{
3993-
mEngine->setFlag( QgsLabelingEngine::DrawShadowRects, showing );
3994-
}
3995-
39963983
bool QgsPalLabeling::isShowingAllLabels() const
39973984
{
39983985
return mEngine->testFlag( QgsLabelingEngine::UseAllLabels );
@@ -4510,19 +4497,18 @@ void QgsPalLabeling::drawLabelShadow( QgsRenderContext& context,
45104497
QgsSymbolLayerUtils::blurImageInPlace( blurImg, blurImg.rect(), radius, shadow.blurAlphaOnly() );
45114498
}
45124499

4513-
if ( tmpLyr.showingShadowRects ) // engine setting, not per layer
4514-
{
4515-
// debug rect for QImage shadow registration and clipping visualization
4516-
QPainter picti;
4517-
picti.begin( &blurImg );
4518-
picti.setBrush( Qt::Dense7Pattern );
4519-
QPen imgPen( QColor( 0, 0, 255, 255 ) );
4520-
imgPen.setWidth( 1 );
4521-
picti.setPen( imgPen );
4522-
picti.setOpacity( 0.1 );
4523-
picti.drawRect( 0, 0, blurImg.width(), blurImg.height() );
4524-
picti.end();
4525-
}
4500+
#if 0
4501+
// debug rect for QImage shadow registration and clipping visualization
4502+
QPainter picti;
4503+
picti.begin( &blurImg );
4504+
picti.setBrush( Qt::Dense7Pattern );
4505+
QPen imgPen( QColor( 0, 0, 255, 255 ) );
4506+
imgPen.setWidth( 1 );
4507+
picti.setPen( imgPen );
4508+
picti.setOpacity( 0.1 );
4509+
picti.drawRect( 0, 0, blurImg.width(), blurImg.height() );
4510+
picti.end();
4511+
#endif
45264512

45274513
double offsetDist = QgsTextRenderer::scaleToPixelContext( shadow.offsetDistance(), context,
45284514
shadow.offsetUnit(), true, shadow.offsetMapUnitScale() );
@@ -4562,39 +4548,38 @@ void QgsPalLabeling::drawLabelShadow( QgsRenderContext& context,
45624548
p->restore();
45634549

45644550
// debug rects
4565-
if ( tmpLyr.showingShadowRects ) // engine setting, not per layer
4551+
#if 0
4552+
// draw debug rect for QImage painting registration
4553+
p->save();
4554+
p->setBrush( Qt::NoBrush );
4555+
QPen imgPen( QColor( 255, 0, 0, 10 ) );
4556+
imgPen.setWidth( 2 );
4557+
imgPen.setStyle( Qt::DashLine );
4558+
p->setPen( imgPen );
4559+
p->scale( scale, scale );
4560+
if ( component.useOrigin() )
45664561
{
4567-
// draw debug rect for QImage painting registration
4568-
p->save();
4569-
p->setBrush( Qt::NoBrush );
4570-
QPen imgPen( QColor( 255, 0, 0, 10 ) );
4571-
imgPen.setWidth( 2 );
4572-
imgPen.setStyle( Qt::DashLine );
4573-
p->setPen( imgPen );
4574-
p->scale( scale, scale );
4575-
if ( component.useOrigin() )
4576-
{
4577-
p->translate( component.origin().x(), component.origin().y() );
4578-
}
4579-
p->translate( transPt );
4580-
p->translate( -imgOffset.x(),
4581-
-imgOffset.y() );
4582-
p->drawRect( 0, 0, blurImg.width(), blurImg.height() );
4583-
p->restore();
4562+
p->translate( component.origin().x(), component.origin().y() );
4563+
}
4564+
p->translate( transPt );
4565+
p->translate( -imgOffset.x(),
4566+
-imgOffset.y() );
4567+
p->drawRect( 0, 0, blurImg.width(), blurImg.height() );
4568+
p->restore();
45844569

4585-
// draw debug rect for passed in component dimensions
4586-
p->save();
4587-
p->setBrush( Qt::NoBrush );
4588-
QPen componentRectPen( QColor( 0, 255, 0, 70 ) );
4589-
componentRectPen.setWidth( 1 );
4590-
if ( component.useOrigin() )
4591-
{
4592-
p->translate( component.origin().x(), component.origin().y() );
4593-
}
4594-
p->setPen( componentRectPen );
4595-
p->drawRect( QRect( -xOffset, -componentHeight - yOffset, componentWidth, componentHeight ) );
4596-
p->restore();
4570+
// draw debug rect for passed in component dimensions
4571+
p->save();
4572+
p->setBrush( Qt::NoBrush );
4573+
QPen componentRectPen( QColor( 0, 255, 0, 70 ) );
4574+
componentRectPen.setWidth( 1 );
4575+
if ( component.useOrigin() )
4576+
{
4577+
p->translate( component.origin().x(), component.origin().y() );
45974578
}
4579+
p->setPen( componentRectPen );
4580+
p->drawRect( QRect( -xOffset, -componentHeight - yOffset, componentWidth, componentHeight ) );
4581+
p->restore();
4582+
#endif
45984583
}
45994584

46004585
void QgsPalLabeling::loadEngineSettings()
@@ -4614,7 +4599,6 @@ void QgsPalLabeling::clearEngineSettings()
46144599
QgsProject::instance()->removeEntry( "PAL", "/CandidatesLine" );
46154600
QgsProject::instance()->removeEntry( "PAL", "/CandidatesPolygon" );
46164601
QgsProject::instance()->removeEntry( "PAL", "/ShowingCandidates" );
4617-
QgsProject::instance()->removeEntry( "PAL", "/ShowingShadowRects" );
46184602
QgsProject::instance()->removeEntry( "PAL", "/ShowingAllLabels" );
46194603
QgsProject::instance()->removeEntry( "PAL", "/ShowingPartialsLabels" );
46204604
QgsProject::instance()->removeEntry( "PAL", "/DrawOutlineLabels" );
@@ -4626,7 +4610,6 @@ QgsPalLabeling* QgsPalLabeling::clone()
46264610
lbl->setShowingAllLabels( isShowingAllLabels() );
46274611
lbl->setShowingCandidates( isShowingCandidates() );
46284612
lbl->setDrawLabelRectOnly( drawLabelRectOnly() );
4629-
lbl->setShowingShadowRectangles( isShowingShadowRectangles() );
46304613
lbl->setShowingPartialsLabels( isShowingPartialsLabels() );
46314614
lbl->setDrawingOutlineLabels( isDrawingOutlineLabels() );
46324615
return lbl;

src/core/qgspallabeling.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,6 @@ class CORE_EXPORT QgsPalLayerSettings
658658
int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
659659
int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
660660

661-
bool showingShadowRects; // whether to show debug rectangles for drop shadows
662-
663661
private:
664662

665663
void readDataDefinedPropertyMap( QgsVectorLayer* layer, QDomElement* parentElem,
@@ -890,9 +888,6 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
890888
bool isShowingCandidates() const;
891889
void setShowingCandidates( bool showing );
892890

893-
bool isShowingShadowRectangles() const;
894-
void setShowingShadowRectangles( bool showing );
895-
896891
bool isShowingAllLabels() const;
897892
void setShowingAllLabels( bool showing );
898893

src/core/qgsvectorlayerlabelprovider.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ void QgsVectorLayerLabelProvider::drawLabel( QgsRenderContext& context, pal::Lab
456456
// update tmpLyr with any data defined drop shadow values
457457
QgsPalLabeling::dataDefinedDropShadow( tmpLyr, ddValues );
458458

459-
tmpLyr.showingShadowRects = mEngine->testFlag( QgsLabelingEngine::DrawShadowRects );
460-
461459
// Render the components of a label in reverse order
462460
// (backgrounds -> text)
463461

src/ui/qgsengineconfigdialog.ui

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,6 @@
215215
<property name="verticalSpacing">
216216
<number>6</number>
217217
</property>
218-
<item row="1" column="0" colspan="3">
219-
<widget class="QCheckBox" name="chkShowPartialsLabels">
220-
<property name="text">
221-
<string>Show partials labels</string>
222-
</property>
223-
</widget>
224-
</item>
225-
<item row="5" column="0" colspan="3">
226-
<widget class="QCheckBox" name="mShadowDebugRectChkBox">
227-
<property name="text">
228-
<string>Show shadow rectangles (for debugging)</string>
229-
</property>
230-
</widget>
231-
</item>
232218
<item row="3" column="2">
233219
<spacer name="horizontalSpacer_4">
234220
<property name="orientation">
@@ -298,6 +284,13 @@
298284
</property>
299285
</widget>
300286
</item>
287+
<item row="1" column="0" colspan="3">
288+
<widget class="QCheckBox" name="chkShowPartialsLabels">
289+
<property name="text">
290+
<string>Show partials labels</string>
291+
</property>
292+
</widget>
293+
</item>
301294
</layout>
302295
</item>
303296
<item>
@@ -334,7 +327,6 @@
334327
<tabstop>chkShowPartialsLabels</tabstop>
335328
<tabstop>chkShowAllLabels</tabstop>
336329
<tabstop>chkShowCandidates</tabstop>
337-
<tabstop>mShadowDebugRectChkBox</tabstop>
338330
<tabstop>buttonBox</tabstop>
339331
</tabstops>
340332
<resources/>

0 commit comments

Comments
 (0)