QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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  blockSignals( false );
161 }
162 
163 void QgsBlurWidget::blockSignals( const bool block )
164 {
165  mBlurTypeCombo->blockSignals( block );
166  mBlurStrengthSpnBx->blockSignals( block );
167  mOpacityWidget->blockSignals( block );
168  mBlendCmbBx->blockSignals( block );
169  mDrawModeComboBox->blockSignals( block );
170 }
171 
172 void QgsBlurWidget::mBlurTypeCombo_currentIndexChanged( int index )
173 {
174  if ( !mEffect )
175  return;
176 
177  QgsBlurEffect::BlurMethod method = ( QgsBlurEffect::BlurMethod ) mBlurTypeCombo->itemData( index ).toInt();
178  mEffect->setBlurMethod( method );
179 
180  //also update max radius
181  switch ( method )
182  {
184  mBlurStrengthSpnBx->setMaximum( 16 );
185  break;
187  mBlurStrengthSpnBx->setMaximum( 200 );
188  break;
189  }
190 
191  emit changed();
192 }
193 
194 void QgsBlurWidget::mBlurStrengthSpnBx_valueChanged( double value )
195 {
196  if ( !mEffect )
197  return;
198 
199  mEffect->setBlurLevel( value );
200  emit changed();
201 }
202 
203 void QgsBlurWidget::mBlurUnitWidget_changed()
204 {
205  if ( !mEffect )
206  {
207  return;
208  }
209 
210  mEffect->setBlurUnit( mBlurUnitWidget->unit() );
211  mEffect->setBlurMapUnitScale( mBlurUnitWidget->getMapUnitScale() );
212  emit changed();
213 }
214 
215 void QgsBlurWidget::opacityChanged( double value )
216 {
217  if ( !mEffect )
218  return;
219 
220  mEffect->setOpacity( value );
221  emit changed();
222 }
223 
224 void QgsBlurWidget::mDrawModeComboBox_currentIndexChanged( int index )
225 {
226  Q_UNUSED( index )
227 
228  if ( !mEffect )
229  return;
230 
231  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
232  emit changed();
233 }
234 
235 void QgsBlurWidget::mBlendCmbBx_currentIndexChanged( int index )
236 {
237  Q_UNUSED( index )
238 
239  if ( !mEffect )
240  return;
241 
242  mEffect->setBlendMode( mBlendCmbBx->blendMode() );
243  emit changed();
244 }
245 
246 
247 //
248 // Drop Shadow
249 //
250 
252  : QgsPaintEffectWidget( parent )
253 
254 {
255  setupUi( this );
256  connect( mShadowOffsetAngleSpnBx, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsShadowEffectWidget::mShadowOffsetAngleSpnBx_valueChanged );
257  connect( mShadowOffsetAngleDial, &QDial::valueChanged, this, &QgsShadowEffectWidget::mShadowOffsetAngleDial_valueChanged );
258  connect( mShadowOffsetSpnBx, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsShadowEffectWidget::mShadowOffsetSpnBx_valueChanged );
259  connect( mOffsetUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsShadowEffectWidget::mOffsetUnitWidget_changed );
260  connect( mShadowColorBtn, &QgsColorButton::colorChanged, this, &QgsShadowEffectWidget::mShadowColorBtn_colorChanged );
261  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsShadowEffectWidget::mDrawModeComboBox_currentIndexChanged );
262  connect( mShadowBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsShadowEffectWidget::mShadowBlendCmbBx_currentIndexChanged );
263  connect( mShadowRadiuSpnBx, static_cast< void ( QDoubleSpinBox::* )( double ) >( &QDoubleSpinBox::valueChanged ), this, &QgsShadowEffectWidget::mShadowRadiuSpnBx_valueChanged );
264  connect( mBlurUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsShadowEffectWidget::mBlurUnitWidget_changed );
265 
266  mShadowColorBtn->setAllowOpacity( false );
267  mShadowColorBtn->setColorDialogTitle( tr( "Select Shadow Color" ) );
268  mShadowColorBtn->setContext( QStringLiteral( "symbology" ) );
269  mShadowOffsetAngleSpnBx->setClearValue( 0 );
270 
275 
276  initGui();
277 
278  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsShadowEffectWidget::opacityChanged );
279 }
280 
282 {
283  if ( !effect || ( effect->type() != QLatin1String( "dropShadow" ) && effect->type() != QLatin1String( "innerShadow" ) ) )
284  return;
285 
286  mEffect = static_cast<QgsShadowEffect *>( effect );
287  initGui();
288 }
289 
290 void QgsShadowEffectWidget::initGui()
291 {
292  if ( !mEffect )
293  {
294  return;
295  }
296 
297  blockSignals( true );
298 
299  mShadowOffsetAngleSpnBx->setValue( mEffect->offsetAngle() );
300  mShadowOffsetAngleDial->setValue( mEffect->offsetAngle() );
301  mShadowOffsetSpnBx->setValue( mEffect->offsetDistance() );
302  mOffsetUnitWidget->setUnit( mEffect->offsetUnit() );
303  mOffsetUnitWidget->setMapUnitScale( mEffect->offsetMapUnitScale() );
304  mShadowRadiuSpnBx->setValue( mEffect->blurLevel() );
305  mBlurUnitWidget->setUnit( mEffect->blurUnit() );
306  mBlurUnitWidget->setMapUnitScale( mEffect->blurMapUnitScale() );
307  mOpacityWidget->setOpacity( mEffect->opacity() );
308  mShadowColorBtn->setColor( mEffect->color() );
309  mShadowBlendCmbBx->setBlendMode( mEffect->blendMode() );
310  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
311 
312  blockSignals( false );
313 }
314 
315 void QgsShadowEffectWidget::blockSignals( const bool block )
316 {
317  mShadowOffsetAngleSpnBx->blockSignals( block );
318  mShadowOffsetAngleDial->blockSignals( block );
319  mShadowOffsetSpnBx->blockSignals( block );
320  mOffsetUnitWidget->blockSignals( block );
321  mShadowRadiuSpnBx->blockSignals( block );
322  mBlurUnitWidget->blockSignals( block );
323  mOpacityWidget->blockSignals( block );
324  mShadowColorBtn->blockSignals( block );
325  mShadowBlendCmbBx->blockSignals( block );
326  mDrawModeComboBox->blockSignals( block );
327 }
328 
329 void QgsShadowEffectWidget::mShadowOffsetAngleSpnBx_valueChanged( int value )
330 {
331  mShadowOffsetAngleDial->blockSignals( true );
332  mShadowOffsetAngleDial->setValue( value );
333  mShadowOffsetAngleDial->blockSignals( false );
334 
335  if ( !mEffect )
336  return;
337 
338  mEffect->setOffsetAngle( value );
339  emit changed();
340 }
341 
342 void QgsShadowEffectWidget::mShadowOffsetAngleDial_valueChanged( int value )
343 {
344  mShadowOffsetAngleSpnBx->setValue( value );
345 }
346 
347 void QgsShadowEffectWidget::mShadowOffsetSpnBx_valueChanged( double value )
348 {
349  if ( !mEffect )
350  return;
351 
352  mEffect->setOffsetDistance( value );
353  emit changed();
354 }
355 
356 void QgsShadowEffectWidget::mOffsetUnitWidget_changed()
357 {
358  if ( !mEffect )
359  {
360  return;
361  }
362 
363  mEffect->setOffsetUnit( mOffsetUnitWidget->unit() );
364  mEffect->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
365  emit changed();
366 }
367 
368 void QgsShadowEffectWidget::opacityChanged( double value )
369 {
370  if ( !mEffect )
371  return;
372 
373  mEffect->setOpacity( value );
374  emit changed();
375 }
376 
377 void QgsShadowEffectWidget::mShadowColorBtn_colorChanged( const QColor &color )
378 {
379  if ( !mEffect )
380  return;
381 
382  mEffect->setColor( color );
383  emit changed();
384 }
385 
386 void QgsShadowEffectWidget::mShadowRadiuSpnBx_valueChanged( double value )
387 {
388  if ( !mEffect )
389  return;
390 
391  mEffect->setBlurLevel( value );
392  emit changed();
393 }
394 
395 void QgsShadowEffectWidget::mBlurUnitWidget_changed()
396 {
397  if ( !mEffect )
398  {
399  return;
400  }
401 
402  mEffect->setBlurUnit( mBlurUnitWidget->unit() );
403  mEffect->setBlurMapUnitScale( mBlurUnitWidget->getMapUnitScale() );
404  emit changed();
405 }
406 
407 void QgsShadowEffectWidget::mDrawModeComboBox_currentIndexChanged( int index )
408 {
409  Q_UNUSED( index )
410 
411  if ( !mEffect )
412  return;
413 
414  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
415  emit changed();
416 }
417 
418 void QgsShadowEffectWidget::mShadowBlendCmbBx_currentIndexChanged( int index )
419 {
420  Q_UNUSED( index )
421 
422  if ( !mEffect )
423  return;
424 
425  mEffect->setBlendMode( mShadowBlendCmbBx->blendMode() );
426  emit changed();
427 }
428 
429 
430 
431 //
432 // glow
433 //
434 
436  : QgsPaintEffectWidget( parent )
437 
438 {
439  setupUi( this );
440  connect( mSpreadSpnBx, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsGlowWidget::mSpreadSpnBx_valueChanged );
441  connect( mSpreadUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsGlowWidget::mSpreadUnitWidget_changed );
442  connect( mColorBtn, &QgsColorButton::colorChanged, this, &QgsGlowWidget::mColorBtn_colorChanged );
443  connect( mBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGlowWidget::mBlendCmbBx_currentIndexChanged );
444  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsGlowWidget::mDrawModeComboBox_currentIndexChanged );
445  connect( mBlurRadiusSpnBx, static_cast< void ( QDoubleSpinBox::* )( double ) >( &QDoubleSpinBox::valueChanged ), this, &QgsGlowWidget::mBlurRadiusSpnBx_valueChanged );
446  connect( mBlurUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsGlowWidget::mBlurUnitWidget_changed );
447 
448  mColorBtn->setAllowOpacity( false );
449  mColorBtn->setColorDialogTitle( tr( "Select Glow Color" ) );
450  mColorBtn->setContext( QStringLiteral( "symbology" ) );
451 
456 
457  btnColorRamp->setShowGradientOnly( true );
458 
459  initGui();
460 
461  connect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsGlowWidget::applyColorRamp );
462  connect( radioSingleColor, &QAbstractButton::toggled, this, &QgsGlowWidget::colorModeChanged );
463  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsGlowWidget::opacityChanged );
464 }
465 
467 {
468  if ( !effect || ( effect->type() != QLatin1String( "outerGlow" ) && effect->type() != QLatin1String( "innerGlow" ) ) )
469  return;
470 
471  mEffect = static_cast<QgsGlowEffect *>( effect );
472  initGui();
473 }
474 
475 void QgsGlowWidget::initGui()
476 {
477  if ( !mEffect )
478  {
479  return;
480  }
481 
482  blockSignals( true );
483 
484  mSpreadSpnBx->setValue( mEffect->spread() );
485  mSpreadUnitWidget->setUnit( mEffect->spreadUnit() );
486  mSpreadUnitWidget->setMapUnitScale( mEffect->spreadMapUnitScale() );
487  mBlurRadiusSpnBx->setValue( mEffect->blurLevel() );
488  mBlurUnitWidget->setUnit( mEffect->blurUnit() );
489  mBlurUnitWidget->setMapUnitScale( mEffect->blurMapUnitScale() );
490  mOpacityWidget->setOpacity( mEffect->opacity() );
491  mColorBtn->setColor( mEffect->color() );
492  mBlendCmbBx->setBlendMode( mEffect->blendMode() );
493 
494  if ( mEffect->ramp() )
495  {
496  btnColorRamp->setColorRamp( mEffect->ramp() );
497  }
498 
499  radioSingleColor->setChecked( mEffect->colorType() == QgsGlowEffect::SingleColor );
500  mColorBtn->setEnabled( mEffect->colorType() == QgsGlowEffect::SingleColor );
501  radioColorRamp->setChecked( mEffect->colorType() == QgsGlowEffect::ColorRamp );
502  btnColorRamp->setEnabled( mEffect->colorType() == QgsGlowEffect::ColorRamp );
503  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
504 
505  blockSignals( false );
506 }
507 
508 void QgsGlowWidget::blockSignals( const bool block )
509 {
510  mSpreadSpnBx->blockSignals( block );
511  mSpreadUnitWidget->blockSignals( block );
512  mBlurRadiusSpnBx->blockSignals( block );
513  mOpacityWidget->blockSignals( block );
514  mColorBtn->blockSignals( block );
515  mBlendCmbBx->blockSignals( block );
516  btnColorRamp->blockSignals( block );
517  radioSingleColor->blockSignals( block );
518  radioColorRamp->blockSignals( block );
519  mDrawModeComboBox->blockSignals( block );
520 }
521 
522 void QgsGlowWidget::colorModeChanged()
523 {
524  if ( !mEffect )
525  {
526  return;
527  }
528 
529  if ( radioSingleColor->isChecked() )
530  {
532  }
533  else
534  {
536  mEffect->setRamp( btnColorRamp->colorRamp() );
537  }
538  emit changed();
539 }
540 
541 void QgsGlowWidget::mSpreadSpnBx_valueChanged( double value )
542 {
543  if ( !mEffect )
544  return;
545 
546  mEffect->setSpread( value );
547  emit changed();
548 }
549 
550 void QgsGlowWidget::mSpreadUnitWidget_changed()
551 {
552  if ( !mEffect )
553  {
554  return;
555  }
556 
557  mEffect->setSpreadUnit( mSpreadUnitWidget->unit() );
558  mEffect->setSpreadMapUnitScale( mSpreadUnitWidget->getMapUnitScale() );
559  emit changed();
560 }
561 
562 void QgsGlowWidget::opacityChanged( double value )
563 {
564  if ( !mEffect )
565  return;
566 
567  mEffect->setOpacity( value );
568  emit changed();
569 }
570 
571 void QgsGlowWidget::mColorBtn_colorChanged( const QColor &color )
572 {
573  if ( !mEffect )
574  return;
575 
576  mEffect->setColor( color );
577  emit changed();
578 }
579 
580 void QgsGlowWidget::mBlurRadiusSpnBx_valueChanged( double value )
581 {
582  if ( !mEffect )
583  return;
584 
585  mEffect->setBlurLevel( value );
586  emit changed();
587 }
588 
589 void QgsGlowWidget::mBlurUnitWidget_changed()
590 {
591  if ( !mEffect )
592  {
593  return;
594  }
595 
596  mEffect->setBlurUnit( mBlurUnitWidget->unit() );
597  mEffect->setBlurMapUnitScale( mBlurUnitWidget->getMapUnitScale() );
598  emit changed();
599 }
600 
601 void QgsGlowWidget::mBlendCmbBx_currentIndexChanged( int index )
602 {
603  Q_UNUSED( index )
604 
605  if ( !mEffect )
606  return;
607 
608  mEffect->setBlendMode( mBlendCmbBx->blendMode() );
609  emit changed();
610 }
611 
612 void QgsGlowWidget::mDrawModeComboBox_currentIndexChanged( int index )
613 {
614  Q_UNUSED( index )
615 
616  if ( !mEffect )
617  return;
618 
619  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
620  emit changed();
621 }
622 
623 void QgsGlowWidget::applyColorRamp()
624 {
625  if ( !mEffect )
626  {
627  return;
628  }
629 
630  QgsColorRamp *ramp = btnColorRamp->colorRamp();
631  if ( !ramp )
632  return;
633 
634  mEffect->setRamp( ramp );
635  emit changed();
636 }
637 
638 //
639 // transform
640 //
641 
643  : QgsPaintEffectWidget( parent )
644 
645 {
646  setupUi( this );
647  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsTransformWidget::mDrawModeComboBox_currentIndexChanged );
648  connect( mSpinTranslateX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinTranslateX_valueChanged );
649  connect( mSpinTranslateY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinTranslateY_valueChanged );
650  connect( mTranslateUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsTransformWidget::mTranslateUnitWidget_changed );
651  connect( mReflectXCheckBox, &QCheckBox::stateChanged, this, &QgsTransformWidget::mReflectXCheckBox_stateChanged );
652  connect( mReflectYCheckBox, &QCheckBox::stateChanged, this, &QgsTransformWidget::mReflectYCheckBox_stateChanged );
653  connect( mSpinShearX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinShearX_valueChanged );
654  connect( mSpinShearY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinShearY_valueChanged );
655  connect( mSpinScaleX, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinScaleX_valueChanged );
656  connect( mSpinScaleY, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mSpinScaleY_valueChanged );
657  connect( mRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsTransformWidget::mRotationSpinBox_valueChanged );
658 
661  mSpinTranslateX->setClearValue( 0 );
662  mSpinTranslateY->setClearValue( 0 );
663  mRotationSpinBox->setClearValue( 0 );
664  mSpinShearX->setClearValue( 0 );
665  mSpinShearY->setClearValue( 0 );
666  mSpinScaleX->setClearValue( 100.0 );
667  mSpinScaleY->setClearValue( 100.0 );
668 
669  initGui();
670 }
671 
672 
674 {
675  if ( !effect || effect->type() != QLatin1String( "transform" ) )
676  return;
677 
678  mEffect = static_cast<QgsTransformEffect *>( effect );
679  initGui();
680 }
681 
682 void QgsTransformWidget::initGui()
683 {
684  if ( !mEffect )
685  {
686  return;
687  }
688 
689  blockSignals( true );
690 
691  mReflectXCheckBox->setChecked( mEffect->reflectX() );
692  mReflectYCheckBox->setChecked( mEffect->reflectY() );
693  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
694  mSpinTranslateX->setValue( mEffect->translateX() );
695  mSpinTranslateY->setValue( mEffect->translateY() );
696  mTranslateUnitWidget->setUnit( mEffect->translateUnit() );
697  mTranslateUnitWidget->setMapUnitScale( mEffect->translateMapUnitScale() );
698  mSpinShearX->setValue( mEffect->shearX() );
699  mSpinShearY->setValue( mEffect->shearY() );
700  mSpinScaleX->setValue( mEffect->scaleX() * 100.0 );
701  mSpinScaleY->setValue( mEffect->scaleY() * 100.0 );
702  mRotationSpinBox->setValue( mEffect->rotation() );
703 
704  blockSignals( false );
705 }
706 
707 void QgsTransformWidget::blockSignals( const bool block )
708 {
709  mDrawModeComboBox->blockSignals( block );
710  mTranslateUnitWidget->blockSignals( block );
711  mSpinTranslateX->blockSignals( block );
712  mSpinTranslateY->blockSignals( block );
713  mReflectXCheckBox->blockSignals( block );
714  mReflectYCheckBox->blockSignals( block );
715  mSpinShearX->blockSignals( block );
716  mSpinShearY->blockSignals( block );
717  mSpinScaleX->blockSignals( block );
718  mSpinScaleY->blockSignals( block );
719  mRotationSpinBox->blockSignals( block );
720 }
721 
722 
723 void QgsTransformWidget::mDrawModeComboBox_currentIndexChanged( int index )
724 {
725  Q_UNUSED( index )
726 
727  if ( !mEffect )
728  return;
729 
730  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
731  emit changed();
732 }
733 
734 void QgsTransformWidget::mSpinTranslateX_valueChanged( double value )
735 {
736  if ( !mEffect )
737  return;
738 
739  mEffect->setTranslateX( value );
740  emit changed();
741 }
742 
743 void QgsTransformWidget::mSpinTranslateY_valueChanged( double value )
744 {
745  if ( !mEffect )
746  return;
747 
748  mEffect->setTranslateY( value );
749  emit changed();
750 }
751 
752 void QgsTransformWidget::mTranslateUnitWidget_changed()
753 {
754  if ( !mEffect )
755  {
756  return;
757  }
758 
759  mEffect->setTranslateUnit( mTranslateUnitWidget->unit() );
760  mEffect->setTranslateMapUnitScale( mTranslateUnitWidget->getMapUnitScale() );
761  emit changed();
762 }
763 
764 void QgsTransformWidget::mReflectXCheckBox_stateChanged( int state )
765 {
766  if ( !mEffect )
767  return;
768 
769  mEffect->setReflectX( state == Qt::Checked );
770  emit changed();
771 }
772 
773 void QgsTransformWidget::mReflectYCheckBox_stateChanged( int state )
774 {
775  if ( !mEffect )
776  return;
777 
778  mEffect->setReflectY( state == Qt::Checked );
779  emit changed();
780 }
781 
782 void QgsTransformWidget::mSpinShearX_valueChanged( double value )
783 {
784  if ( !mEffect )
785  return;
786 
787  mEffect->setShearX( value );
788  emit changed();
789 }
790 
791 void QgsTransformWidget::mSpinShearY_valueChanged( double value )
792 {
793  if ( !mEffect )
794  return;
795 
796  mEffect->setShearY( value );
797  emit changed();
798 }
799 
800 void QgsTransformWidget::mSpinScaleX_valueChanged( double value )
801 {
802  if ( !mEffect )
803  return;
804 
805  mEffect->setScaleX( value / 100.0 );
806  emit changed();
807 }
808 
809 void QgsTransformWidget::mSpinScaleY_valueChanged( double value )
810 {
811  if ( !mEffect )
812  return;
813 
814  mEffect->setScaleY( value / 100.0 );
815  emit changed();
816 }
817 
818 void QgsTransformWidget::mRotationSpinBox_valueChanged( double value )
819 {
820  if ( !mEffect )
821  return;
822 
823  mEffect->setRotation( value );
824  emit changed();
825 }
826 
827 
828 //
829 // color effect
830 //
831 
833  : QgsPaintEffectWidget( parent )
834 
835 {
836  setupUi( this );
837  connect( mBlendCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsColorEffectWidget::mBlendCmbBx_currentIndexChanged );
838  connect( mDrawModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsColorEffectWidget::mDrawModeComboBox_currentIndexChanged );
839  connect( mBrightnessSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mBrightnessSpinBox_valueChanged );
840  connect( mContrastSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mContrastSpinBox_valueChanged );
841  connect( mSaturationSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mSaturationSpinBox_valueChanged );
842  connect( mColorizeStrengthSpinBox, static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ), this, &QgsColorEffectWidget::mColorizeStrengthSpinBox_valueChanged );
843  connect( mColorizeCheck, &QCheckBox::stateChanged, this, &QgsColorEffectWidget::mColorizeCheck_stateChanged );
844  connect( mColorizeColorButton, &QgsColorButton::colorChanged, this, &QgsColorEffectWidget::mColorizeColorButton_colorChanged );
845  connect( mGrayscaleCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsColorEffectWidget::mGrayscaleCombo_currentIndexChanged );
846 
847  mBrightnessSpinBox->setClearValue( 0 );
848  mContrastSpinBox->setClearValue( 0 );
849  mSaturationSpinBox->setClearValue( 0 );
850  mColorizeColorButton->setAllowOpacity( false );
851 
852  mGrayscaleCombo->addItem( tr( "Off" ), QgsImageOperation::GrayscaleOff );
853  mGrayscaleCombo->addItem( tr( "By Lightness" ), QgsImageOperation::GrayscaleLightness );
854  mGrayscaleCombo->addItem( tr( "By Luminosity" ), QgsImageOperation::GrayscaleLuminosity );
855  mGrayscaleCombo->addItem( tr( "By Average" ), QgsImageOperation::GrayscaleAverage );
856 
857  initGui();
858 
859  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsColorEffectWidget::opacityChanged );
860 }
861 
863 {
864  if ( !effect || effect->type() != QLatin1String( "color" ) )
865  return;
866 
867  mEffect = static_cast<QgsColorEffect *>( effect );
868  initGui();
869 }
870 
871 void QgsColorEffectWidget::initGui()
872 {
873  if ( !mEffect )
874  {
875  return;
876  }
877 
878  blockSignals( true );
879 
880  mSliderBrightness->setValue( mEffect->brightness() );
881  mSliderContrast->setValue( mEffect->contrast() );
882  mSliderSaturation->setValue( ( mEffect->saturation() - 1.0 ) * 100.0 );
883  mColorizeCheck->setChecked( mEffect->colorizeOn() );
884  mSliderColorizeStrength->setValue( mEffect->colorizeStrength() );
885  mColorizeColorButton->setColor( mEffect->colorizeColor() );
886  int grayscaleIdx = mGrayscaleCombo->findData( QVariant( ( int ) mEffect->grayscaleMode() ) );
887  mGrayscaleCombo->setCurrentIndex( grayscaleIdx == -1 ? 0 : grayscaleIdx );
888  mOpacityWidget->setOpacity( mEffect->opacity() );
889  mBlendCmbBx->setBlendMode( mEffect->blendMode() );
890  mDrawModeComboBox->setDrawMode( mEffect->drawMode() );
891  enableColorizeControls( mEffect->colorizeOn() );
892 
893  blockSignals( false );
894 }
895 
896 void QgsColorEffectWidget::blockSignals( const bool block )
897 {
898  mBrightnessSpinBox->blockSignals( block );
899  mContrastSpinBox->blockSignals( block );
900  mSaturationSpinBox->blockSignals( block );
901  mColorizeStrengthSpinBox->blockSignals( block );
902  mColorizeCheck->blockSignals( block );
903  mColorizeColorButton->blockSignals( block );
904  mGrayscaleCombo->blockSignals( block );
905  mOpacityWidget->blockSignals( block );
906  mBlendCmbBx->blockSignals( block );
907  mDrawModeComboBox->blockSignals( block );
908 }
909 
910 void QgsColorEffectWidget::enableColorizeControls( const bool enable )
911 {
912  mSliderColorizeStrength->setEnabled( enable );
913  mColorizeStrengthSpinBox->setEnabled( enable );
914  mColorizeColorButton->setEnabled( enable );
915 }
916 
917 void QgsColorEffectWidget::opacityChanged( double value )
918 {
919  if ( !mEffect )
920  return;
921 
922  mEffect->setOpacity( value );
923  emit changed();
924 }
925 
926 void QgsColorEffectWidget::mBlendCmbBx_currentIndexChanged( int index )
927 {
928  Q_UNUSED( index )
929 
930  if ( !mEffect )
931  return;
932 
933  mEffect->setBlendMode( mBlendCmbBx->blendMode() );
934  emit changed();
935 }
936 
937 void QgsColorEffectWidget::mDrawModeComboBox_currentIndexChanged( int index )
938 {
939  Q_UNUSED( index )
940 
941  if ( !mEffect )
942  return;
943 
944  mEffect->setDrawMode( mDrawModeComboBox->drawMode() );
945  emit changed();
946 }
947 
948 void QgsColorEffectWidget::mBrightnessSpinBox_valueChanged( int value )
949 {
950  if ( !mEffect )
951  return;
952 
953  mEffect->setBrightness( value );
954  emit changed();
955 }
956 
957 void QgsColorEffectWidget::mContrastSpinBox_valueChanged( int value )
958 {
959  if ( !mEffect )
960  return;
961 
962  mEffect->setContrast( value );
963  emit changed();
964 }
965 
966 void QgsColorEffectWidget::mSaturationSpinBox_valueChanged( int value )
967 {
968  if ( !mEffect )
969  return;
970 
971  mEffect->setSaturation( value / 100.0 + 1 );
972  emit changed();
973 }
974 
975 void QgsColorEffectWidget::mColorizeStrengthSpinBox_valueChanged( int value )
976 {
977  if ( !mEffect )
978  return;
979 
980  mEffect->setColorizeStrength( value );
981  emit changed();
982 }
983 
984 void QgsColorEffectWidget::mColorizeCheck_stateChanged( int state )
985 {
986  if ( !mEffect )
987  return;
988 
989  mEffect->setColorizeOn( state == Qt::Checked );
990  enableColorizeControls( state == Qt::Checked );
991  emit changed();
992 }
993 
994 void QgsColorEffectWidget::mColorizeColorButton_colorChanged( const QColor &color )
995 {
996  if ( !mEffect )
997  return;
998 
999  mEffect->setColorizeColor( color );
1000  emit changed();
1001 }
1002 
1003 void QgsColorEffectWidget::mGrayscaleCombo_currentIndexChanged( int index )
1004 {
1005  Q_UNUSED( index )
1006 
1007  if ( !mEffect )
1008  return;
1009 
1010  mEffect->setGrayscaleMode( ( QgsImageOperation::GrayscaleMode ) mGrayscaleCombo->currentData().toInt() );
1011  emit changed();
1012 }
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:31
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:34
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:192
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:123
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:328
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:35
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:642
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:251
QgsBlurEffect::BlurMethod
BlurMethod
Available blur methods (algorithms)
Definition: qgsblureffect.h:40
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:466
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:38
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:281
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:673
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:40
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:832
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:36
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:53
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.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:435
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:53
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:34
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:862
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