QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgspainteffectwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgspainteffectwidget.cpp
3  ------------------------
4  begin : January 2015
5  copyright : (C) 2015 by Nyall Dawson
6  email : nyall dot dawson at gmail.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 
17 #include "qgspainteffectwidget.h"
18 #include "qgslogger.h"
19 #include "qgspainteffect.h"
20 #include "qgsshadoweffect.h"
21 #include "qgsblureffect.h"
22 #include "qgsgloweffect.h"
23 #include "qgstransformeffect.h"
24 #include "qgscoloreffect.h"
25 #include "qgsstyle.h"
26 #include "qgscolorramp.h"
27 #include "qgscolorrampbutton.h"
28 
29 //
30 // draw source
31 //
32 
34  : QgsPaintEffectWidget( parent )
35 
36 {
37  setupUi( this );
38  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsDrawSourceWidget::mDrawModeComboBox_currentIndexChanged );
39  connect( mBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsDrawSourceWidget::mBlendCmbBx_currentIndexChanged );
40  initGui();
41 }
42 
43 
45 {
46  if ( !effect || effect->type() != QLatin1String( "drawSource" ) )
47  return;
48 
49  mEffect = static_cast<QgsDrawSourceEffect *>( effect );
50  initGui();
51 
52  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsDrawSourceWidget::opacityChanged );
53 }
54 
55 void QgsDrawSourceWidget::initGui()
56 {
57  if ( !mEffect )
58  {
59  return;
60  }
61 
62  blockSignals( true );
63 
64  mOpacityWidget->setOpacity( mEffect->opacity() );
65  mBlendCmbBx->setBlendMode( mEffect->blendMode() );
66  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
67 
68  blockSignals( false );
69 }
70 
71 void QgsDrawSourceWidget::blockSignals( const bool block )
72 {
73  mOpacityWidget->blockSignals( block );
74  mBlendCmbBx->blockSignals( block );
75  mDrawModeComboBox->blockSignals( block );
76 }
77 
78 void QgsDrawSourceWidget::opacityChanged( double value )
79 {
80  if ( !mEffect )
81  return;
82 
83  mEffect->setOpacity( value );
84  emit changed();
85 }
86 
87 void QgsDrawSourceWidget::mDrawModeComboBox_currentIndexChanged( int index )
88 {
89  Q_UNUSED( index )
90 
91  if ( !mEffect )
92  return;
93 
94  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
95  emit changed();
96 }
97 
98 void QgsDrawSourceWidget::mBlendCmbBx_currentIndexChanged( int index )
99 {
100  Q_UNUSED( index )
101 
102  if ( !mEffect )
103  return;
104 
105  mEffect->setBlendMode( mBlendCmbBx->blendMode() );
106  emit changed();
107 }
108 
109 
110 //
111 // blur
112 //
113 
115  : QgsPaintEffectWidget( parent )
116 
117 {
118  setupUi( this );
119  connect( mBlurTypeCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsBlurWidget::mBlurTypeCombo_currentIndexChanged );
120  connect( mBlurStrengthSpnBx, static_cast< void ( QDoubleSpinBox::* )( double ) >( &QDoubleSpinBox::valueChanged ), this, &QgsBlurWidget::mBlurStrengthSpnBx_valueChanged );
121  connect( mBlurUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsBlurWidget::mBlurUnitWidget_changed );
122  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsBlurWidget::mDrawModeComboBox_currentIndexChanged );
123  connect( mBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsBlurWidget::mBlendCmbBx_currentIndexChanged );
124 
125  mBlurTypeCombo->addItem( tr( "Stack Blur (fast, doesn't support high dpi)" ), QgsBlurEffect::StackBlur );
126  mBlurTypeCombo->addItem( tr( "Gaussian Blur (quality, supports high dpi)" ), QgsBlurEffect::GaussianBlur );
127 
130 
131  initGui();
132  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsBlurWidget::opacityChanged );
133 }
134 
135 
137 {
138  if ( !effect || effect->type() != QLatin1String( "blur" ) )
139  return;
140 
141  mEffect = static_cast<QgsBlurEffect *>( effect );
142  initGui();
143 }
144 
145 void QgsBlurWidget::initGui()
146 {
147  if ( !mEffect )
148  {
149  return;
150  }
151 
152  blockSignals( true );
153 
154  mBlurTypeCombo->setCurrentIndex( mBlurTypeCombo->findData( mEffect->blurMethod() ) );
155  mBlurStrengthSpnBx->setValue( mEffect->blurLevel() );
156  mOpacityWidget->setOpacity( mEffect->opacity() );
157  mBlendCmbBx->setBlendMode( mEffect->blendMode() );
158  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
159 
160  mBlurUnitWidget->setUnit( mEffect->blurUnit() );
161  mBlurUnitWidget->setMapUnitScale( mEffect->blurMapUnitScale() );
162 
163  blockSignals( false );
164 }
165 
166 void QgsBlurWidget::blockSignals( const bool block )
167 {
168  mBlurTypeCombo->blockSignals( block );
169  mBlurStrengthSpnBx->blockSignals( block );
170  mOpacityWidget->blockSignals( block );
171  mBlendCmbBx->blockSignals( block );
172  mDrawModeComboBox->blockSignals( block );
173 }
174 
175 void QgsBlurWidget::mBlurTypeCombo_currentIndexChanged( int index )
176 {
177  if ( !mEffect )
178  return;
179 
180  QgsBlurEffect::BlurMethod method = ( QgsBlurEffect::BlurMethod ) mBlurTypeCombo->itemData( index ).toInt();
181  mEffect->setBlurMethod( method );
182 
183  //also update max radius
184  switch ( method )
185  {
187  mBlurStrengthSpnBx->setMaximum( 16 );
188  break;
190  mBlurStrengthSpnBx->setMaximum( 200 );
191  break;
192  }
193 
194  emit changed();
195 }
196 
197 void QgsBlurWidget::mBlurStrengthSpnBx_valueChanged( double value )
198 {
199  if ( !mEffect )
200  return;
201 
202  mEffect->setBlurLevel( value );
203  emit changed();
204 }
205 
206 void QgsBlurWidget::mBlurUnitWidget_changed()
207 {
208  if ( !mEffect )
209  {
210  return;
211  }
212 
213  mEffect->setBlurUnit( mBlurUnitWidget->unit() );
214  mEffect->setBlurMapUnitScale( mBlurUnitWidget->getMapUnitScale() );
215  emit changed();
216 }
217 
218 void QgsBlurWidget::opacityChanged( double value )
219 {
220  if ( !mEffect )
221  return;
222 
223  mEffect->setOpacity( value );
224  emit changed();
225 }
226 
227 void QgsBlurWidget::mDrawModeComboBox_currentIndexChanged( int index )
228 {
229  Q_UNUSED( index )
230 
231  if ( !mEffect )
232  return;
233 
234  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
235  emit changed();
236 }
237 
238 void QgsBlurWidget::mBlendCmbBx_currentIndexChanged( int index )
239 {
240  Q_UNUSED( index )
241 
242  if ( !mEffect )
243  return;
244 
245  mEffect->setBlendMode( mBlendCmbBx->blendMode() );
246  emit changed();
247 }
248 
249 
250 //
251 // Drop Shadow
252 //
253 
255  : QgsPaintEffectWidget( parent )
256 
257 {
258  setupUi( this );
259  connect( mShadowOffsetAngleSpnBx, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsShadowEffectWidget::mShadowOffsetAngleSpnBx_valueChanged );
260  connect( mShadowOffsetAngleDial, &QDial::valueChanged, this, &QgsShadowEffectWidget::mShadowOffsetAngleDial_valueChanged );
261  connect( mShadowOffsetSpnBx, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsShadowEffectWidget::mShadowOffsetSpnBx_valueChanged );
262  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsShadowEffectWidget::mOffsetUnitWidget_changed );
263  connect( mShadowColorBtn, &QgsColorButton::colorChanged, this, &QgsShadowEffectWidget::mShadowColorBtn_colorChanged );
264  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsShadowEffectWidget::mDrawModeComboBox_currentIndexChanged );
265  connect( mShadowBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsShadowEffectWidget::mShadowBlendCmbBx_currentIndexChanged );
266  connect( mShadowRadiuSpnBx, static_cast< void ( QDoubleSpinBox::* )( double ) >( &QDoubleSpinBox::valueChanged ), this, &QgsShadowEffectWidget::mShadowRadiuSpnBx_valueChanged );
267  connect( mBlurUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsShadowEffectWidget::mBlurUnitWidget_changed );
268 
269  mShadowColorBtn->setAllowOpacity( false );
270  mShadowColorBtn->setColorDialogTitle( tr( "Select Shadow Color" ) );
271  mShadowColorBtn->setContext( QStringLiteral( "symbology" ) );
272  mShadowOffsetAngleSpnBx->setClearValue( 0 );
273 
278 
279  initGui();
280 
281  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsShadowEffectWidget::opacityChanged );
282 }
283 
285 {
286  if ( !effect || ( effect->type() != QLatin1String( "dropShadow" ) && effect->type() != QLatin1String( "innerShadow" ) ) )
287  return;
288 
289  mEffect = static_cast<QgsShadowEffect *>( effect );
290  initGui();
291 }
292 
293 void QgsShadowEffectWidget::initGui()
294 {
295  if ( !mEffect )
296  {
297  return;
298  }
299 
300  blockSignals( true );
301 
302  mShadowOffsetAngleSpnBx->setValue( mEffect->offsetAngle() );
303  mShadowOffsetAngleDial->setValue( mEffect->offsetAngle() );
304  mShadowOffsetSpnBx->setValue( mEffect->offsetDistance() );
305  mOffsetUnitWidget->setUnit( mEffect->offsetUnit() );
306  mOffsetUnitWidget->setMapUnitScale( mEffect->offsetMapUnitScale() );
307  mShadowRadiuSpnBx->setValue( mEffect->blurLevel() );
308  mBlurUnitWidget->setUnit( mEffect->blurUnit() );
309  mBlurUnitWidget->setMapUnitScale( mEffect->blurMapUnitScale() );
310  mOpacityWidget->setOpacity( mEffect->opacity() );
311  mShadowColorBtn->setColor( mEffect->color() );
312  mShadowBlendCmbBx->setBlendMode( mEffect->blendMode() );
313  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
314 
315  blockSignals( false );
316 }
317 
318 void QgsShadowEffectWidget::blockSignals( const bool block )
319 {
320  mShadowOffsetAngleSpnBx->blockSignals( block );
321  mShadowOffsetAngleDial->blockSignals( block );
322  mShadowOffsetSpnBx->blockSignals( block );
323  mOffsetUnitWidget->blockSignals( block );
324  mShadowRadiuSpnBx->blockSignals( block );
325  mBlurUnitWidget->blockSignals( block );
326  mOpacityWidget->blockSignals( block );
327  mShadowColorBtn->blockSignals( block );
328  mShadowBlendCmbBx->blockSignals( block );
329  mDrawModeComboBox->blockSignals( block );
330 }
331 
332 void QgsShadowEffectWidget::mShadowOffsetAngleSpnBx_valueChanged( int value )
333 {
334  mShadowOffsetAngleDial->blockSignals( true );
335  mShadowOffsetAngleDial->setValue( value );
336  mShadowOffsetAngleDial->blockSignals( false );
337 
338  if ( !mEffect )
339  return;
340 
341  mEffect->setOffsetAngle( value );
342  emit changed();
343 }
344 
345 void QgsShadowEffectWidget::mShadowOffsetAngleDial_valueChanged( int value )
346 {
347  mShadowOffsetAngleSpnBx->setValue( value );
348 }
349 
350 void QgsShadowEffectWidget::mShadowOffsetSpnBx_valueChanged( double value )
351 {
352  if ( !mEffect )
353  return;
354 
355  mEffect->setOffsetDistance( value );
356  emit changed();
357 }
358 
359 void QgsShadowEffectWidget::mOffsetUnitWidget_changed()
360 {
361  if ( !mEffect )
362  {
363  return;
364  }
365 
366  mEffect->setOffsetUnit( mOffsetUnitWidget->unit() );
367  mEffect->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
368  emit changed();
369 }
370 
371 void QgsShadowEffectWidget::opacityChanged( double value )
372 {
373  if ( !mEffect )
374  return;
375 
376  mEffect->setOpacity( value );
377  emit changed();
378 }
379 
380 void QgsShadowEffectWidget::mShadowColorBtn_colorChanged( const QColor &color )
381 {
382  if ( !mEffect )
383  return;
384 
385  mEffect->setColor( color );
386  emit changed();
387 }
388 
389 void QgsShadowEffectWidget::mShadowRadiuSpnBx_valueChanged( double value )
390 {
391  if ( !mEffect )
392  return;
393 
394  mEffect->setBlurLevel( value );
395  emit changed();
396 }
397 
398 void QgsShadowEffectWidget::mBlurUnitWidget_changed()
399 {
400  if ( !mEffect )
401  {
402  return;
403  }
404 
405  mEffect->setBlurUnit( mBlurUnitWidget->unit() );
406  mEffect->setBlurMapUnitScale( mBlurUnitWidget->getMapUnitScale() );
407  emit changed();
408 }
409 
410 void QgsShadowEffectWidget::mDrawModeComboBox_currentIndexChanged( int index )
411 {
412  Q_UNUSED( index )
413 
414  if ( !mEffect )
415  return;
416 
417  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
418  emit changed();
419 }
420 
421 void QgsShadowEffectWidget::mShadowBlendCmbBx_currentIndexChanged( int index )
422 {
423  Q_UNUSED( index )
424 
425  if ( !mEffect )
426  return;
427 
428  mEffect->setBlendMode( mShadowBlendCmbBx->blendMode() );
429  emit changed();
430 }
431 
432 
433 
434 //
435 // glow
436 //
437 
439  : QgsPaintEffectWidget( parent )
440 
441 {
442  setupUi( this );
443  connect( mSpreadSpnBx, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGlowWidget::mSpreadSpnBx_valueChanged );
444  connect( mSpreadUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsGlowWidget::mSpreadUnitWidget_changed );
445  connect( mColorBtn, &QgsColorButton::colorChanged, this, &QgsGlowWidget::mColorBtn_colorChanged );
446  connect( mBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGlowWidget::mBlendCmbBx_currentIndexChanged );
447  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGlowWidget::mDrawModeComboBox_currentIndexChanged );
448  connect( mBlurRadiusSpnBx, static_cast< void ( QDoubleSpinBox::* )( double ) >( &QDoubleSpinBox::valueChanged ), this, &QgsGlowWidget::mBlurRadiusSpnBx_valueChanged );
449  connect( mBlurUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsGlowWidget::mBlurUnitWidget_changed );
450 
451  mColorBtn->setAllowOpacity( false );
452  mColorBtn->setColorDialogTitle( tr( "Select Glow Color" ) );
453  mColorBtn->setContext( QStringLiteral( "symbology" ) );
454 
459 
460  btnColorRamp->setShowGradientOnly( true );
461 
462  initGui();
463 
464  connect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsGlowWidget::applyColorRamp );
465  connect( radioSingleColor, &QAbstractButton::toggled, this, &QgsGlowWidget::colorModeChanged );
466  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsGlowWidget::opacityChanged );
467 }
468 
470 {
471  if ( !effect || ( effect->type() != QLatin1String( "outerGlow" ) && effect->type() != QLatin1String( "innerGlow" ) ) )
472  return;
473 
474  mEffect = static_cast<QgsGlowEffect *>( effect );
475  initGui();
476 }
477 
478 void QgsGlowWidget::initGui()
479 {
480  if ( !mEffect )
481  {
482  return;
483  }
484 
485  blockSignals( true );
486 
487  mSpreadSpnBx->setValue( mEffect->spread() );
488  mSpreadUnitWidget->setUnit( mEffect->spreadUnit() );
489  mSpreadUnitWidget->setMapUnitScale( mEffect->spreadMapUnitScale() );
490  mBlurRadiusSpnBx->setValue( mEffect->blurLevel() );
491  mBlurUnitWidget->setUnit( mEffect->blurUnit() );
492  mBlurUnitWidget->setMapUnitScale( mEffect->blurMapUnitScale() );
493  mOpacityWidget->setOpacity( mEffect->opacity() );
494  mColorBtn->setColor( mEffect->color() );
495  mBlendCmbBx->setBlendMode( mEffect->blendMode() );
496 
497  if ( mEffect->ramp() )
498  {
499  btnColorRamp->setColorRamp( mEffect->ramp() );
500  }
501 
502  radioSingleColor->setChecked( mEffect->colorType() == QgsGlowEffect::SingleColor );
503  mColorBtn->setEnabled( mEffect->colorType() == QgsGlowEffect::SingleColor );
504  radioColorRamp->setChecked( mEffect->colorType() == QgsGlowEffect::ColorRamp );
505  btnColorRamp->setEnabled( mEffect->colorType() == QgsGlowEffect::ColorRamp );
506  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
507 
508  blockSignals( false );
509 }
510 
511 void QgsGlowWidget::blockSignals( const bool block )
512 {
513  mSpreadSpnBx->blockSignals( block );
514  mSpreadUnitWidget->blockSignals( block );
515  mBlurRadiusSpnBx->blockSignals( block );
516  mOpacityWidget->blockSignals( block );
517  mColorBtn->blockSignals( block );
518  mBlendCmbBx->blockSignals( block );
519  btnColorRamp->blockSignals( block );
520  radioSingleColor->blockSignals( block );
521  radioColorRamp->blockSignals( block );
522  mDrawModeComboBox->blockSignals( block );
523 }
524 
525 void QgsGlowWidget::colorModeChanged()
526 {
527  if ( !mEffect )
528  {
529  return;
530  }
531 
532  if ( radioSingleColor->isChecked() )
533  {
535  }
536  else
537  {
539  mEffect->setRamp( btnColorRamp->colorRamp() );
540  }
541  emit changed();
542 }
543 
544 void QgsGlowWidget::mSpreadSpnBx_valueChanged( double value )
545 {
546  if ( !mEffect )
547  return;
548 
549  mEffect->setSpread( value );
550  emit changed();
551 }
552 
553 void QgsGlowWidget::mSpreadUnitWidget_changed()
554 {
555  if ( !mEffect )
556  {
557  return;
558  }
559 
560  mEffect->setSpreadUnit( mSpreadUnitWidget->unit() );
561  mEffect->setSpreadMapUnitScale( mSpreadUnitWidget->getMapUnitScale() );
562  emit changed();
563 }
564 
565 void QgsGlowWidget::opacityChanged( double value )
566 {
567  if ( !mEffect )
568  return;
569 
570  mEffect->setOpacity( value );
571  emit changed();
572 }
573 
574 void QgsGlowWidget::mColorBtn_colorChanged( const QColor &color )
575 {
576  if ( !mEffect )
577  return;
578 
579  mEffect->setColor( color );
580  emit changed();
581 }
582 
583 void QgsGlowWidget::mBlurRadiusSpnBx_valueChanged( double value )
584 {
585  if ( !mEffect )
586  return;
587 
588  mEffect->setBlurLevel( value );
589  emit changed();
590 }
591 
592 void QgsGlowWidget::mBlurUnitWidget_changed()
593 {
594  if ( !mEffect )
595  {
596  return;
597  }
598 
599  mEffect->setBlurUnit( mBlurUnitWidget->unit() );
600  mEffect->setBlurMapUnitScale( mBlurUnitWidget->getMapUnitScale() );
601  emit changed();
602 }
603 
604 void QgsGlowWidget::mBlendCmbBx_currentIndexChanged( int index )
605 {
606  Q_UNUSED( index )
607 
608  if ( !mEffect )
609  return;
610 
611  mEffect->setBlendMode( mBlendCmbBx->blendMode() );
612  emit changed();
613 }
614 
615 void QgsGlowWidget::mDrawModeComboBox_currentIndexChanged( int index )
616 {
617  Q_UNUSED( index )
618 
619  if ( !mEffect )
620  return;
621 
622  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
623  emit changed();
624 }
625 
626 void QgsGlowWidget::applyColorRamp()
627 {
628  if ( !mEffect )
629  {
630  return;
631  }
632 
633  QgsColorRamp *ramp = btnColorRamp->colorRamp();
634  if ( !ramp )
635  return;
636 
637  mEffect->setRamp( ramp );
638  emit changed();
639 }
640 
641 //
642 // transform
643 //
644 
646  : QgsPaintEffectWidget( parent )
647 
648 {
649  setupUi( this );
650  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsTransformWidget::mDrawModeComboBox_currentIndexChanged );
651  connect( mSpinTranslateX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinTranslateX_valueChanged );
652  connect( mSpinTranslateY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinTranslateY_valueChanged );
653  connect( mTranslateUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsTransformWidget::mTranslateUnitWidget_changed );
654  connect( mReflectXCheckBox, &QCheckBox::stateChanged, this, &QgsTransformWidget::mReflectXCheckBox_stateChanged );
655  connect( mReflectYCheckBox, &QCheckBox::stateChanged, this, &QgsTransformWidget::mReflectYCheckBox_stateChanged );
656  connect( mSpinShearX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinShearX_valueChanged );
657  connect( mSpinShearY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinShearY_valueChanged );
658  connect( mSpinScaleX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinScaleX_valueChanged );
659  connect( mSpinScaleY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinScaleY_valueChanged );
660  connect( mRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mRotationSpinBox_valueChanged );
661 
664  mSpinTranslateX->setClearValue( 0 );
665  mSpinTranslateY->setClearValue( 0 );
666  mRotationSpinBox->setClearValue( 0 );
667  mSpinShearX->setClearValue( 0 );
668  mSpinShearY->setClearValue( 0 );
669  mSpinScaleX->setClearValue( 100.0 );
670  mSpinScaleY->setClearValue( 100.0 );
671 
672  initGui();
673 }
674 
675 
677 {
678  if ( !effect || effect->type() != QLatin1String( "transform" ) )
679  return;
680 
681  mEffect = static_cast<QgsTransformEffect *>( effect );
682  initGui();
683 }
684 
685 void QgsTransformWidget::initGui()
686 {
687  if ( !mEffect )
688  {
689  return;
690  }
691 
692  blockSignals( true );
693 
694  mReflectXCheckBox->setChecked( mEffect->reflectX() );
695  mReflectYCheckBox->setChecked( mEffect->reflectY() );
696  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
697  mSpinTranslateX->setValue( mEffect->translateX() );
698  mSpinTranslateY->setValue( mEffect->translateY() );
699  mTranslateUnitWidget->setUnit( mEffect->translateUnit() );
700  mTranslateUnitWidget->setMapUnitScale( mEffect->translateMapUnitScale() );
701  mSpinShearX->setValue( mEffect->shearX() );
702  mSpinShearY->setValue( mEffect->shearY() );
703  mSpinScaleX->setValue( mEffect->scaleX() * 100.0 );
704  mSpinScaleY->setValue( mEffect->scaleY() * 100.0 );
705  mRotationSpinBox->setValue( mEffect->rotation() );
706 
707  blockSignals( false );
708 }
709 
710 void QgsTransformWidget::blockSignals( const bool block )
711 {
712  mDrawModeComboBox->blockSignals( block );
713  mTranslateUnitWidget->blockSignals( block );
714  mSpinTranslateX->blockSignals( block );
715  mSpinTranslateY->blockSignals( block );
716  mReflectXCheckBox->blockSignals( block );
717  mReflectYCheckBox->blockSignals( block );
718  mSpinShearX->blockSignals( block );
719  mSpinShearY->blockSignals( block );
720  mSpinScaleX->blockSignals( block );
721  mSpinScaleY->blockSignals( block );
722  mRotationSpinBox->blockSignals( block );
723 }
724 
725 
726 void QgsTransformWidget::mDrawModeComboBox_currentIndexChanged( int index )
727 {
728  Q_UNUSED( index )
729 
730  if ( !mEffect )
731  return;
732 
733  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
734  emit changed();
735 }
736 
737 void QgsTransformWidget::mSpinTranslateX_valueChanged( double value )
738 {
739  if ( !mEffect )
740  return;
741 
742  mEffect->setTranslateX( value );
743  emit changed();
744 }
745 
746 void QgsTransformWidget::mSpinTranslateY_valueChanged( double value )
747 {
748  if ( !mEffect )
749  return;
750 
751  mEffect->setTranslateY( value );
752  emit changed();
753 }
754 
755 void QgsTransformWidget::mTranslateUnitWidget_changed()
756 {
757  if ( !mEffect )
758  {
759  return;
760  }
761 
762  mEffect->setTranslateUnit( mTranslateUnitWidget->unit() );
763  mEffect->setTranslateMapUnitScale( mTranslateUnitWidget->getMapUnitScale() );
764  emit changed();
765 }
766 
767 void QgsTransformWidget::mReflectXCheckBox_stateChanged( int state )
768 {
769  if ( !mEffect )
770  return;
771 
772  mEffect->setReflectX( state == Qt::Checked );
773  emit changed();
774 }
775 
776 void QgsTransformWidget::mReflectYCheckBox_stateChanged( int state )
777 {
778  if ( !mEffect )
779  return;
780 
781  mEffect->setReflectY( state == Qt::Checked );
782  emit changed();
783 }
784 
785 void QgsTransformWidget::mSpinShearX_valueChanged( double value )
786 {
787  if ( !mEffect )
788  return;
789 
790  mEffect->setShearX( value );
791  emit changed();
792 }
793 
794 void QgsTransformWidget::mSpinShearY_valueChanged( double value )
795 {
796  if ( !mEffect )
797  return;
798 
799  mEffect->setShearY( value );
800  emit changed();
801 }
802 
803 void QgsTransformWidget::mSpinScaleX_valueChanged( double value )
804 {
805  if ( !mEffect )
806  return;
807 
808  mEffect->setScaleX( value / 100.0 );
809  emit changed();
810 }
811 
812 void QgsTransformWidget::mSpinScaleY_valueChanged( double value )
813 {
814  if ( !mEffect )
815  return;
816 
817  mEffect->setScaleY( value / 100.0 );
818  emit changed();
819 }
820 
821 void QgsTransformWidget::mRotationSpinBox_valueChanged( double value )
822 {
823  if ( !mEffect )
824  return;
825 
826  mEffect->setRotation( value );
827  emit changed();
828 }
829 
830 
831 //
832 // color effect
833 //
834 
836  : QgsPaintEffectWidget( parent )
837 
838 {
839  setupUi( this );
840  connect( mBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsColorEffectWidget::mBlendCmbBx_currentIndexChanged );
841  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsColorEffectWidget::mDrawModeComboBox_currentIndexChanged );
842  connect( mBrightnessSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mBrightnessSpinBox_valueChanged );
843  connect( mContrastSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mContrastSpinBox_valueChanged );
844  connect( mSaturationSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mSaturationSpinBox_valueChanged );
845  connect( mColorizeStrengthSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mColorizeStrengthSpinBox_valueChanged );
846  connect( mColorizeCheck, &QCheckBox::stateChanged, this, &QgsColorEffectWidget::mColorizeCheck_stateChanged );
847  connect( mColorizeColorButton, &QgsColorButton::colorChanged, this, &QgsColorEffectWidget::mColorizeColorButton_colorChanged );
848  connect( mGrayscaleCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsColorEffectWidget::mGrayscaleCombo_currentIndexChanged );
849 
850  mBrightnessSpinBox->setClearValue( 0 );
851  mContrastSpinBox->setClearValue( 0 );
852  mSaturationSpinBox->setClearValue( 0 );
853  mColorizeStrengthSpinBox->setClearValue( 100 );
854  mColorizeColorButton->setAllowOpacity( false );
855 
856  mGrayscaleCombo->addItem( tr( "Off" ), QgsImageOperation::GrayscaleOff );
857  mGrayscaleCombo->addItem( tr( "By Lightness" ), QgsImageOperation::GrayscaleLightness );
858  mGrayscaleCombo->addItem( tr( "By Luminosity" ), QgsImageOperation::GrayscaleLuminosity );
859  mGrayscaleCombo->addItem( tr( "By Average" ), QgsImageOperation::GrayscaleAverage );
860 
861  initGui();
862 
863  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsColorEffectWidget::opacityChanged );
864 }
865 
867 {
868  if ( !effect || effect->type() != QLatin1String( "color" ) )
869  return;
870 
871  mEffect = static_cast<QgsColorEffect *>( effect );
872  initGui();
873 }
874 
875 void QgsColorEffectWidget::initGui()
876 {
877  if ( !mEffect )
878  {
879  return;
880  }
881 
882  blockSignals( true );
883 
884  mSliderBrightness->setValue( mEffect->brightness() );
885  mSliderContrast->setValue( mEffect->contrast() );
886  mSliderSaturation->setValue( ( mEffect->saturation() - 1.0 ) * 100.0 );
887  mColorizeCheck->setChecked( mEffect->colorizeOn() );
888  mSliderColorizeStrength->setValue( mEffect->colorizeStrength() );
889  mColorizeColorButton->setColor( mEffect->colorizeColor() );
890  int grayscaleIdx = mGrayscaleCombo->findData( QVariant( ( int ) mEffect->grayscaleMode() ) );
891  mGrayscaleCombo->setCurrentIndex( grayscaleIdx == -1 ? 0 : grayscaleIdx );
892  mOpacityWidget->setOpacity( mEffect->opacity() );
893  mBlendCmbBx->setBlendMode( mEffect->blendMode() );
894  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
895  enableColorizeControls( mEffect->colorizeOn() );
896 
897  blockSignals( false );
898 }
899 
900 void QgsColorEffectWidget::blockSignals( const bool block )
901 {
902  mBrightnessSpinBox->blockSignals( block );
903  mContrastSpinBox->blockSignals( block );
904  mSaturationSpinBox->blockSignals( block );
905  mColorizeStrengthSpinBox->blockSignals( block );
906  mColorizeCheck->blockSignals( block );
907  mColorizeColorButton->blockSignals( block );
908  mGrayscaleCombo->blockSignals( block );
909  mOpacityWidget->blockSignals( block );
910  mBlendCmbBx->blockSignals( block );
911  mDrawModeComboBox->blockSignals( block );
912 }
913 
914 void QgsColorEffectWidget::enableColorizeControls( const bool enable )
915 {
916  mSliderColorizeStrength->setEnabled( enable );
917  mColorizeStrengthSpinBox->setEnabled( enable );
918  mColorizeColorButton->setEnabled( enable );
919 }
920 
921 void QgsColorEffectWidget::opacityChanged( double value )
922 {
923  if ( !mEffect )
924  return;
925 
926  mEffect->setOpacity( value );
927  emit changed();
928 }
929 
930 void QgsColorEffectWidget::mBlendCmbBx_currentIndexChanged( int index )
931 {
932  Q_UNUSED( index )
933 
934  if ( !mEffect )
935  return;
936 
937  mEffect->setBlendMode( mBlendCmbBx->blendMode() );
938  emit changed();
939 }
940 
941 void QgsColorEffectWidget::mDrawModeComboBox_currentIndexChanged( int index )
942 {
943  Q_UNUSED( index )
944 
945  if ( !mEffect )
946  return;
947 
948  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
949  emit changed();
950 }
951 
952 void QgsColorEffectWidget::mBrightnessSpinBox_valueChanged( int value )
953 {
954  if ( !mEffect )
955  return;
956 
957  mEffect->setBrightness( value );
958  emit changed();
959 }
960 
961 void QgsColorEffectWidget::mContrastSpinBox_valueChanged( int value )
962 {
963  if ( !mEffect )
964  return;
965 
966  mEffect->setContrast( value );
967  emit changed();
968 }
969 
970 void QgsColorEffectWidget::mSaturationSpinBox_valueChanged( int value )
971 {
972  if ( !mEffect )
973  return;
974 
975  mEffect->setSaturation( value / 100.0 + 1 );
976  emit changed();
977 }
978 
979 void QgsColorEffectWidget::mColorizeStrengthSpinBox_valueChanged( int value )
980 {
981  if ( !mEffect )
982  return;
983 
984  mEffect->setColorizeStrength( value );
985  emit changed();
986 }
987 
988 void QgsColorEffectWidget::mColorizeCheck_stateChanged( int state )
989 {
990  if ( !mEffect )
991  return;
992 
993  mEffect->setColorizeOn( state == Qt::Checked );
994  enableColorizeControls( state == Qt::Checked );
995  emit changed();
996 }
997 
998 void QgsColorEffectWidget::mColorizeColorButton_colorChanged( const QColor &color )
999 {
1000  if ( !mEffect )
1001  return;
1002 
1003  mEffect->setColorizeColor( color );
1004  emit changed();
1005 }
1006 
1007 void QgsColorEffectWidget::mGrayscaleCombo_currentIndexChanged( int index )
1008 {
1009  Q_UNUSED( index )
1010 
1011  if ( !mEffect )
1012  return;
1013 
1014  mEffect->setGrayscaleMode( ( QgsImageOperation::GrayscaleMode ) mGrayscaleCombo->currentData().toInt() );
1015  emit changed();
1016 }
QgsColorEffect::opacity
double opacity() const
Returns the opacity for the effect.
Definition: qgscoloreffect.h:194
QgsShadowEffect::setBlurUnit
void setBlurUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the shadow blur level (radius).
Definition: qgsshadoweffect.h:72
QgsTransformEffect::setTranslateMapUnitScale
void setTranslateMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the transform translation.
Definition: qgstransformeffect.h:126
QgsBlurWidget::QgsBlurWidget
QgsBlurWidget(QWidget *parent=nullptr)
Definition: qgspainteffectwidget.cpp:114
QgsOpacityWidget::opacityChanged
void opacityChanged(double opacity)
Emitted when the opacity is changed in the widget, where opacity ranges from 0.0 (transparent) to 1....
QgsColorRamp
Abstract base class for color ramps.
Definition: qgscolorramp.h:32
QgsGlowEffect::blendMode
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
Definition: qgsgloweffect.h:238
QgsUnitTypes::RenderInches
@ RenderInches
Inches.
Definition: qgsunittypes.h:173
QgsColorEffect::setOpacity
void setOpacity(const double opacity)
Sets the opacity for the effect.
Definition: qgscoloreffect.h:186
QgsGlowEffect::blurMapUnitScale
const QgsMapUnitScale & blurMapUnitScale() const
Returns the map unit scale used for the glow blur strength (radius).
Definition: qgsgloweffect.h:168
QgsTransformEffect::translateUnit
QgsUnitTypes::RenderUnit translateUnit() const
Returns the units used for the transform translation.
Definition: qgstransformeffect.h:116
QgsBlurEffect::blendMode
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
Definition: qgsblureffect.h:169
QgsGlowEffect::setSpreadMapUnitScale
void setSpreadMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the spread distance.
Definition: qgsgloweffect.h:100
QgsColorEffect::brightness
int brightness() const
Returns the brightness modification for the effect.
Definition: qgscoloreffect.h:70
QgsImageOperation::GrayscaleLightness
@ GrayscaleLightness
Keep the lightness of the color, drops the saturation.
Definition: qgsimageoperation.h:55
QgsBlurEffect
A paint effect which blurs a source picture, using a number of different blur methods.
Definition: qgsblureffect.h:35
QgsDrawSourceWidget::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect) override
Sets the paint effect to modify with the widget.
Definition: qgspainteffectwidget.cpp:44
QgsBlurEffect::setBlendMode
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
Definition: qgsblureffect.h:161
QgsTransformEffect::setReflectX
void setReflectX(const bool reflectX)
Sets whether to reflect along the x-axis.
Definition: qgstransformeffect.h:219
QgsDrawSourceEffect::setBlendMode
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
Definition: qgspainteffect.h:369
QgsGlowEffect::color
QColor color() const
Returns the color for the glow.
Definition: qgsgloweffect.h:204
QgsBlurEffect::setBlurUnit
void setBlurUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the blur level (radius).
Definition: qgsblureffect.h:93
QgsTransformEffect::setScaleY
void setScaleY(const double scaleY)
Sets the y axis scaling factor.
Definition: qgstransformeffect.h:159
QgsPaintEffectWidget::changed
void changed()
Emitted when properties of the effect are changed through the widget.
QgsGlowEffect::setRamp
void setRamp(QgsColorRamp *ramp)
Sets the color ramp for the glow.
Definition: qgsgloweffect.cpp:195
QgsShadowEffect::setColor
void setColor(const QColor &color)
Sets the color for the shadow.
Definition: qgsshadoweffect.h:179
QgsColorEffect::colorizeColor
QColor colorizeColor() const
Returns the color used for colorizing a picture.
Definition: qgscoloreffect.h:158
QgsUnitTypes::RenderPoints
@ RenderPoints
Points (e.g., for font sizes)
Definition: qgsunittypes.h:172
QgsGlowEffect::setBlendMode
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
Definition: qgsgloweffect.h:230
QgsColorEffect::setColorizeColor
void setColorizeColor(const QColor &colorizeColor)
Sets the color used for colorizing a picture.
Definition: qgscoloreffect.cpp:122
QgsGlowEffect::setBlurLevel
void setBlurLevel(const double level)
Sets blur level (radius) for the glow.
Definition: qgsgloweffect.h:119
QgsImageOperation::GrayscaleAverage
@ GrayscaleAverage
Grayscale by taking average of color RGB components.
Definition: qgsimageoperation.h:57
QgsShadowEffect::color
QColor color() const
Returns the color used for the shadow.
Definition: qgsshadoweffect.h:186
QgsDrawSourceEffect
A paint effect which draws the source picture with minor or no alterations.
Definition: qgspainteffect.h:329
QgsTransformEffect::translateX
double translateX() const
Returns the transform x translation.
Definition: qgstransformeffect.h:76
QgsColorEffect
A paint effect which alters the colors (e.g., brightness, contrast) in a source picture.
Definition: qgscoloreffect.h:36
QgsTransformEffect::reflectX
bool reflectX() const
Returns whether transform will be reflected along the x-axis.
Definition: qgstransformeffect.h:227
QgsUnitTypes::RenderMillimeters
@ RenderMillimeters
Millimeters.
Definition: qgsunittypes.h:168
QgsShadowEffect::offsetMapUnitScale
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale used for the shadow offset distance.
Definition: qgsshadoweffect.h:172
QgsTransformWidget::QgsTransformWidget
QgsTransformWidget(QWidget *parent=nullptr)
Definition: qgspainteffectwidget.cpp:645
QgsImageOperation::GrayscaleOff
@ GrayscaleOff
No change.
Definition: qgsimageoperation.h:58
QgsShadowEffect::offsetDistance
double offsetDistance() const
Returns the distance used for offsetting the shadow.
Definition: qgsshadoweffect.h:136
qgstransformeffect.h
qgspainteffect.h
QgsTransformEffect::setTranslateUnit
void setTranslateUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the transform translation.
Definition: qgstransformeffect.h:106
QgsTransformEffect::setTranslateX
void setTranslateX(const double translateX)
Sets the transform x translation.
Definition: qgstransformeffect.h:66
QgsDrawSourceWidget::QgsDrawSourceWidget
QgsDrawSourceWidget(QWidget *parent=nullptr)
Definition: qgspainteffectwidget.cpp:33
QgsTransformEffect::setReflectY
void setReflectY(const bool reflectY)
Sets whether to reflect along the y-axis.
Definition: qgstransformeffect.h:235
QgsTransformEffect::shearY
double shearY() const
Returns the y axis shearing factor.
Definition: qgstransformeffect.h:211
QgsBlurEffect::setOpacity
void setOpacity(const double opacity)
Sets the opacity for the effect.
Definition: qgsblureffect.h:145
QgsShadowEffectWidget::QgsShadowEffectWidget
QgsShadowEffectWidget(QWidget *parent=nullptr)
Definition: qgspainteffectwidget.cpp:254
QgsBlurEffect::BlurMethod
BlurMethod
Available blur methods (algorithms)
Definition: qgsblureffect.h:41
QgsColorEffect::setColorizeStrength
void setColorizeStrength(int colorizeStrength)
Sets the strength for colorizing a picture.
Definition: qgscoloreffect.h:168
QgsColorEffect::setGrayscaleMode
void setGrayscaleMode(QgsImageOperation::GrayscaleMode grayscaleMode)
Sets whether the effect should convert a picture to grayscale.
Definition: qgscoloreffect.h:113
QgsColorButton::colorChanged
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
QgsGlowWidget::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect) override
Sets the paint effect to modify with the widget.
Definition: qgspainteffectwidget.cpp:469
QgsGlowEffect::setOpacity
void setOpacity(const double opacity)
Sets the opacity for the effect.
Definition: qgsgloweffect.h:176
QgsShadowEffect::opacity
double opacity() const
Returns the opacity for the effect.
Definition: qgsshadoweffect.h:202
qgscoloreffect.h
QgsDrawSourceEffect::setOpacity
void setOpacity(const double opacity)
Sets the opacity for the effect.
Definition: qgspainteffect.h:353
QgsGlowEffect::blurUnit
QgsUnitTypes::RenderUnit blurUnit() const
Returns the units used for the glow blur level (radius).
Definition: qgsgloweffect.h:148
QgsPaintEffect::setDrawMode
void setDrawMode(DrawMode drawMode)
Sets the draw mode for the effect.
Definition: qgspainteffect.cpp:49
QgsShadowEffect::setOpacity
void setOpacity(const double opacity)
Sets the opacity for the effect.
Definition: qgsshadoweffect.h:194
QgsGlowEffect
Base class for paint effect which draw a glow inside or outside a picture.
Definition: qgsgloweffect.h:39
QgsColorEffect::setColorizeOn
void setColorizeOn(bool colorizeOn)
Sets whether the effect should colorize a picture.
Definition: qgscoloreffect.h:129
QgsGlowEffect::spreadMapUnitScale
const QgsMapUnitScale & spreadMapUnitScale() const
Returns the map unit scale used for the spread distance.
Definition: qgsgloweffect.h:109
QgsImageOperation::GrayscaleLuminosity
@ GrayscaleLuminosity
Grayscale by perceptual luminosity (weighted sum of color RGB components)
Definition: qgsimageoperation.h:56
QgsGlowEffect::ColorRamp
@ ColorRamp
Use colors from a color ramp.
Definition: qgsgloweffect.h:47
qgscolorramp.h
QgsBlurEffect::StackBlur
@ StackBlur
Stack blur, a fast but low quality blur. Valid blur level values are between 0 - 16.
Definition: qgsblureffect.h:42
QgsShadowEffect::blurMapUnitScale
const QgsMapUnitScale & blurMapUnitScale() const
Returns the map unit scale used for the shadow blur strength (radius).
Definition: qgsshadoweffect.h:102
QgsTransformEffect::reflectY
bool reflectY() const
Returns whether transform will be reflected along the y-axis.
Definition: qgstransformeffect.h:243
QgsColorEffect::setBrightness
void setBrightness(int brightness)
Sets the brightness modification for the effect.
Definition: qgscoloreffect.h:61
QgsShadowEffect::offsetUnit
QgsUnitTypes::RenderUnit offsetUnit() const
Returns the units used for the shadow offset distance.
Definition: qgsshadoweffect.h:154
QgsColorEffect::blendMode
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
Definition: qgscoloreffect.h:210
QgsGlowEffect::setBlurUnit
void setBlurUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the glow blur level (radius).
Definition: qgsgloweffect.h:138
QgsShadowEffect::setOffsetUnit
void setOffsetUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the shadow offset distance.
Definition: qgsshadoweffect.h:145
QgsGlowEffect::setSpreadUnit
void setSpreadUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the glow spread distance.
Definition: qgsgloweffect.h:82
qgsgloweffect.h
QgsTransformEffect::setScaleX
void setScaleX(const double scaleX)
Sets the x axis scaling factor.
Definition: qgstransformeffect.h:144
QgsTransformEffect::setShearY
void setShearY(const double shearY)
Sets the y axis shearing factor.
Definition: qgstransformeffect.h:203
QgsGlowEffect::blurLevel
double blurLevel() const
Returns the blur level (radius) for the glow.
Definition: qgsgloweffect.h:128
QgsTransformEffect::setTranslateY
void setTranslateY(const double translateY)
Sets the transform y translation.
Definition: qgstransformeffect.h:86
QgsShadowEffectWidget::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect) override
Sets the paint effect to modify with the widget.
Definition: qgspainteffectwidget.cpp:284
QgsColorEffect::setContrast
void setContrast(int contrast)
Sets the contrast modification for the effect.
Definition: qgscoloreffect.h:79
QgsUnitSelectionWidget::changed
void changed()
QgsTransformWidget::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect) override
Sets the paint effect to modify with the widget.
Definition: qgspainteffectwidget.cpp:676
qgspainteffectwidget.h
QgsTransformEffect::rotation
double rotation() const
Returns the transform rotation, in degrees clockwise.
Definition: qgstransformeffect.h:179
QgsPaintEffect::drawMode
DrawMode drawMode() const
Returns the draw mode for the effect.
Definition: qgspainteffect.h:213
QgsShadowEffect::blurLevel
double blurLevel() const
Returns the blur level (radius) for the shadow.
Definition: qgsshadoweffect.h:62
QgsShadowEffect::offsetAngle
int offsetAngle() const
Returns the angle used for offsetting the shadow.
Definition: qgsshadoweffect.h:118
QgsGlowEffect::setColor
void setColor(const QColor &color)
Sets the color for the glow.
Definition: qgsgloweffect.h:194
QgsGlowEffect::ramp
QgsColorRamp * ramp() const
Returns the color ramp used for the glow.
Definition: qgsgloweffect.h:222
QgsGlowEffect::setSpread
void setSpread(const double spread)
Sets the spread distance for drawing the glow effect.
Definition: qgsgloweffect.h:64
QgsGlowEffect::setColorType
void setColorType(GlowColorType colorType)
Sets the color mode to use for the glow.
Definition: qgsgloweffect.h:249
QgsBlurEffect::blurLevel
double blurLevel() const
Returns the blur level (radius)
Definition: qgsblureffect.h:83
qgsstyle.h
QgsUnitTypes::RenderPixels
@ RenderPixels
Pixels.
Definition: qgsunittypes.h:170
QgsPaintEffectWidget
Base class for effect properties widgets.
Definition: qgspainteffectwidget.h:41
QgsShadowEffect::setBlendMode
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
Definition: qgsshadoweffect.h:210
QgsColorEffectWidget::QgsColorEffectWidget
QgsColorEffectWidget(QWidget *parent=nullptr)
Definition: qgspainteffectwidget.cpp:835
QgsBlurEffect::blurMapUnitScale
const QgsMapUnitScale & blurMapUnitScale() const
Returns the map unit scale used for the blur strength (radius).
Definition: qgsblureffect.h:123
QgsTransformEffect::translateMapUnitScale
const QgsMapUnitScale & translateMapUnitScale() const
Returns the map unit scale used for the transform translation.
Definition: qgstransformeffect.h:136
QgsShadowEffect::setBlurLevel
void setBlurLevel(const double level)
Sets blur level (radius) for the shadow.
Definition: qgsshadoweffect.h:52
QgsTransformEffect::setRotation
void setRotation(const double rotation)
Sets the transform rotation, in degrees clockwise.
Definition: qgstransformeffect.h:173
QgsColorEffect::grayscaleMode
QgsImageOperation::GrayscaleMode grayscaleMode() const
Returns whether the effect will convert a picture to grayscale.
Definition: qgscoloreffect.h:120
QgsTransformEffect::translateY
double translateY() const
Returns the transform y translation.
Definition: qgstransformeffect.h:96
qgsshadoweffect.h
QgsGlowEffect::colorType
GlowColorType colorType() const
Returns the color mode used for the glow.
Definition: qgsgloweffect.h:259
QgsBlurEffect::blurMethod
BlurMethod blurMethod() const
Returns the blur method (algorithm) used for performing the blur.
Definition: qgsblureffect.h:137
QgsTransformEffect
A paint effect which applies transformations (such as move, scale and rotate) to a picture.
Definition: qgstransformeffect.h:37
QgsDrawSourceEffect::blendMode
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
Definition: qgspainteffect.h:377
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:54
QgsTransformEffect::setShearX
void setShearX(const double shearX)
Sets the x axis shearing factor.
Definition: qgstransformeffect.h:187
QgsGlowEffect::opacity
double opacity() const
Returns the opacity for the effect.
Definition: qgsgloweffect.h:184
QgsColorEffect::colorizeStrength
int colorizeStrength() const
Returns the strength used for colorizing a picture.
Definition: qgscoloreffect.h:178
QgsTransformEffect::shearX
double shearX() const
Returns the x axis shearing factor.
Definition: qgstransformeffect.h:195
QgsShadowEffect::blurUnit
QgsUnitTypes::RenderUnit blurUnit() const
Returns the units used for the shadow blur level (radius).
Definition: qgsshadoweffect.h:82
QgsShadowEffect::setOffsetAngle
void setOffsetAngle(const int angle)
Sets the angle for offsetting the shadow.
Definition: qgsshadoweffect.h:110
QgsBlurEffect::opacity
double opacity() const
Returns the opacity for the effect.
Definition: qgsblureffect.h:153
QgsShadowEffect::blendMode
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
Definition: qgsshadoweffect.h:218
QgsBlurEffect::setBlurLevel
void setBlurLevel(const double level)
Sets blur level (radius)
Definition: qgsblureffect.h:72
qgscolorrampbutton.h
qgslogger.h
QgsUnitTypes::RenderUnitList
QList< QgsUnitTypes::RenderUnit > RenderUnitList
List of render units.
Definition: qgsunittypes.h:239
QgsTransformEffect::scaleX
double scaleX() const
Returns the x axis scaling factor.
Definition: qgstransformeffect.h:152
QgsPaintEffect::type
virtual QString type() const =0
Returns the effect type.
QgsBlurEffect::setBlurMapUnitScale
void setBlurMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the blur strength (radius).
Definition: qgsblureffect.h:113
QgsBlurEffect::blurUnit
QgsUnitTypes::RenderUnit blurUnit() const
Returns the units used for the blur level (radius).
Definition: qgsblureffect.h:103
qgsblureffect.h
QgsBlurEffect::GaussianBlur
@ GaussianBlur
Gaussian blur, a slower but high quality blur. Blur level values are the distance in pixels for the b...
Definition: qgsblureffect.h:43
QgsTransformEffect::scaleY
double scaleY() const
Returns the y axis scaling factor.
Definition: qgstransformeffect.h:167
QgsGlowWidget::QgsGlowWidget
QgsGlowWidget(QWidget *parent=nullptr)
Definition: qgspainteffectwidget.cpp:438
QgsColorEffect::setSaturation
void setSaturation(double saturation)
Sets the saturation modification for the effect.
Definition: qgscoloreffect.h:97
QgsColorEffect::contrast
int contrast() const
Returns the contrast modification for the effect.
Definition: qgscoloreffect.h:88
QgsShadowEffect::setOffsetMapUnitScale
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the shadow offset distance.
Definition: qgsshadoweffect.h:163
QgsShadowEffect::setBlurMapUnitScale
void setBlurMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the shadow blur strength (radius).
Definition: qgsshadoweffect.h:92
QgsColorEffect::setBlendMode
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
Definition: qgscoloreffect.h:202
QgsUnitTypes::RenderMapUnits
@ RenderMapUnits
Map units.
Definition: qgsunittypes.h:169
QgsDrawSourceEffect::opacity
double opacity() const
Returns the opacity for the effect.
Definition: qgspainteffect.h:361
QgsImageOperation::GrayscaleMode
GrayscaleMode
Modes for converting a QImage to grayscale.
Definition: qgsimageoperation.h:54
QgsGlowEffect::spread
double spread() const
Returns the spread distance used for drawing the glow effect.
Definition: qgsgloweffect.h:73
QgsGlowEffect::SingleColor
@ SingleColor
Use a single color and fade the color to totally transparent.
Definition: qgsgloweffect.h:46
QgsGlowEffect::spreadUnit
QgsUnitTypes::RenderUnit spreadUnit() const
Returns the units used for the glow spread distance.
Definition: qgsgloweffect.h:91
QgsColorEffect::saturation
double saturation() const
Returns the saturation modification for the effect.
Definition: qgscoloreffect.h:106
QgsShadowEffect
Base class for paint effects which offset, blurred shadows.
Definition: qgsshadoweffect.h:35
QgsShadowEffect::setOffsetDistance
void setOffsetDistance(const double distance)
Sets the distance for offsetting the shadow.
Definition: qgsshadoweffect.h:127
QgsColorEffect::colorizeOn
bool colorizeOn() const
Returns whether the effect will colorize a picture.
Definition: qgscoloreffect.h:138
QgsColorEffectWidget::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect) override
Sets the paint effect to modify with the widget.
Definition: qgspainteffectwidget.cpp:866
QgsBlurWidget::setPaintEffect
void setPaintEffect(QgsPaintEffect *effect) override
Sets the paint effect to modify with the widget.
Definition: qgspainteffectwidget.cpp:136
QgsColorRampButton::colorRampChanged
void colorRampChanged()
Emitted whenever a new color ramp is set for the button.
QgsBlurEffect::setBlurMethod
void setBlurMethod(const BlurMethod method)
Sets the blur method (algorithm) to use for performing the blur.
Definition: qgsblureffect.h:130
QgsGlowEffect::setBlurMapUnitScale
void setBlurMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the glow blur strength (radius).
Definition: qgsgloweffect.h:158