44 if ( !effect || effect->
type() !=
"drawSource" )
51 void QgsDrawSourceWidget::initGui()
60 mTransparencySpnBx->setValue( mEffect->
transparency() * 100.0 );
61 mTransparencySlider->setValue( mEffect->
transparency() * 1000.0 );
62 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
63 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
65 blockSignals(
false );
68 void QgsDrawSourceWidget::blockSignals(
const bool block )
70 mTransparencySlider->blockSignals( block );
71 mTransparencySpnBx->blockSignals( block );
72 mBlendCmbBx->blockSignals( block );
73 mDrawModeComboBox->blockSignals( block );
76 void QgsDrawSourceWidget::on_mTransparencySpnBx_valueChanged(
double value )
81 mTransparencySlider->blockSignals(
true );
82 mTransparencySlider->setValue( value * 10.0 );
83 mTransparencySlider->blockSignals(
false );
89 void QgsDrawSourceWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
96 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
100 void QgsDrawSourceWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
111 void QgsDrawSourceWidget::on_mTransparencySlider_valueChanged(
int value )
113 mTransparencySpnBx->setValue( value / 10.0 );
136 if ( !effect || effect->
type() !=
"blur" )
143 void QgsBlurWidget::initGui()
150 blockSignals(
true );
152 mBlurTypeCombo->setCurrentIndex( mBlurTypeCombo->findData( mEffect->
blurMethod() ) );
153 mBlurStrengthSpnBx->setValue( mEffect->
blurLevel() );
154 mTransparencySpnBx->setValue( mEffect->
transparency() * 100.0 );
155 mTransparencySlider->setValue( mEffect->
transparency() * 1000.0 );
156 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
157 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
159 blockSignals(
false );
162 void QgsBlurWidget::blockSignals(
const bool block )
164 mBlurTypeCombo->blockSignals( block );
165 mBlurStrengthSpnBx->blockSignals( block );
166 mTransparencySlider->blockSignals( block );
167 mTransparencySpnBx->blockSignals( block );
168 mBlendCmbBx->blockSignals( block );
169 mDrawModeComboBox->blockSignals( block );
172 void QgsBlurWidget::on_mBlurTypeCombo_currentIndexChanged(
int index )
184 mBlurStrengthSpnBx->setMaximum( 16 );
187 mBlurStrengthSpnBx->setMaximum( 200 );
194 void QgsBlurWidget::on_mBlurStrengthSpnBx_valueChanged(
int value )
203 void QgsBlurWidget::on_mTransparencySpnBx_valueChanged(
double value )
208 mTransparencySlider->blockSignals(
true );
209 mTransparencySlider->setValue( value * 10.0 );
210 mTransparencySlider->blockSignals(
false );
216 void QgsBlurWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
223 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
227 void QgsBlurWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
238 void QgsBlurWidget::on_mTransparencySlider_valueChanged(
int value )
240 mTransparencySpnBx->setValue( value / 10.0 );
254 mShadowColorBtn->setAllowAlpha(
false );
255 mShadowColorBtn->setColorDialogTitle(
tr(
"Select shadow color" ) );
256 mShadowColorBtn->setContext(
"symbology" );
265 if ( !effect || ( effect->
type() !=
"dropShadow" && effect->
type() !=
"innerShadow" ) )
272 void QgsShadowEffectWidget::initGui()
279 blockSignals(
true );
281 mShadowOffsetAngleSpnBx->setValue( mEffect->
offsetAngle() );
282 mShadowOffsetAngleDial->setValue( mEffect->
offsetAngle() );
284 mOffsetUnitWidget->setUnit( mEffect->
offsetUnit() );
286 mShadowRadiuSpnBx->setValue( mEffect->
blurLevel() );
287 mShadowTranspSpnBx->setValue( mEffect->
transparency() * 100.0 );
288 mShadowTranspSlider->setValue( mEffect->
transparency() * 1000.0 );
289 mShadowColorBtn->setColor( mEffect->
color() );
290 mShadowBlendCmbBx->setBlendMode( mEffect->
blendMode() );
291 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
293 blockSignals(
false );
296 void QgsShadowEffectWidget::blockSignals(
const bool block )
298 mShadowOffsetAngleSpnBx->blockSignals( block );
299 mShadowOffsetAngleDial->blockSignals( block );
300 mShadowOffsetSpnBx->blockSignals( block );
301 mOffsetUnitWidget->blockSignals( block );
302 mShadowRadiuSpnBx->blockSignals( block );
303 mShadowTranspSpnBx->blockSignals( block );
304 mShadowColorBtn->blockSignals( block );
305 mShadowBlendCmbBx->blockSignals( block );
306 mShadowTranspSlider->blockSignals( block );
307 mDrawModeComboBox->blockSignals( block );
310 void QgsShadowEffectWidget::on_mShadowOffsetAngleSpnBx_valueChanged(
int value )
312 mShadowOffsetAngleDial->blockSignals(
true );
313 mShadowOffsetAngleDial->setValue( value );
314 mShadowOffsetAngleDial->blockSignals(
false );
323 void QgsShadowEffectWidget::on_mShadowOffsetAngleDial_valueChanged(
int value )
325 mShadowOffsetAngleSpnBx->setValue( value );
328 void QgsShadowEffectWidget::on_mShadowOffsetSpnBx_valueChanged(
double value )
337 void QgsShadowEffectWidget::on_mOffsetUnitWidget_changed()
349 void QgsShadowEffectWidget::on_mShadowTranspSpnBx_valueChanged(
double value )
354 mShadowTranspSlider->blockSignals(
true );
355 mShadowTranspSlider->setValue( value * 10.0 );
356 mShadowTranspSlider->blockSignals(
false );
362 void QgsShadowEffectWidget::on_mShadowColorBtn_colorChanged(
const QColor &color )
371 void QgsShadowEffectWidget::on_mShadowRadiuSpnBx_valueChanged(
int value )
380 void QgsShadowEffectWidget::on_mShadowTranspSlider_valueChanged(
int value )
382 mShadowTranspSpnBx->setValue( value / 10.0 );
385 void QgsShadowEffectWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
392 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
396 void QgsShadowEffectWidget::on_mShadowBlendCmbBx_currentIndexChanged(
int index )
403 mEffect->
setBlendMode( mShadowBlendCmbBx->blendMode() );
419 mColorBtn->setAllowAlpha(
false );
420 mColorBtn->setColorDialogTitle(
tr(
"Select glow color" ) );
421 mColorBtn->setContext(
"symbology" );
426 mRampComboBox->setShowGradientOnly(
true );
427 connect( mRampComboBox, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( applyColorRamp() ) );
428 connect( radioSingleColor, SIGNAL( toggled(
bool ) ),
this, SLOT( colorModeChanged() ) );
435 if ( !effect || ( effect->
type() !=
"outerGlow" && effect->
type() !=
"innerGlow" ) )
442 void QgsGlowWidget::initGui()
449 blockSignals(
true );
451 mSpreadSpnBx->setValue( mEffect->
spread() );
452 mSpreadUnitWidget->setUnit( mEffect->
spreadUnit() );
454 mBlurRadiusSpnBx->setValue( mEffect->
blurLevel() );
455 mTranspSpnBx->setValue( mEffect->
transparency() * 100.0 );
456 mTranspSlider->setValue( mEffect->
transparency() * 1000.0 );
457 mColorBtn->setColor( mEffect->
color() );
458 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
460 if ( mEffect->
ramp() )
462 mRampComboBox->setSourceColorRamp( mEffect->
ramp() );
471 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
473 blockSignals(
false );
476 void QgsGlowWidget::blockSignals(
const bool block )
478 mSpreadSpnBx->blockSignals( block );
479 mSpreadUnitWidget->blockSignals( block );
480 mBlurRadiusSpnBx->blockSignals( block );
481 mTranspSpnBx->blockSignals( block );
482 mTranspSlider->blockSignals( block );
483 mColorBtn->blockSignals( block );
484 mBlendCmbBx->blockSignals( block );
485 mRampComboBox->blockSignals( block );
486 radioSingleColor->blockSignals( block );
487 radioColorRamp->blockSignals( block );
488 mDrawModeComboBox->blockSignals( block );
491 void QgsGlowWidget::colorModeChanged()
498 if ( radioSingleColor->isChecked() )
505 mEffect->
setRamp( mRampComboBox->currentColorRamp() );
510 void QgsGlowWidget::on_mSpreadSpnBx_valueChanged(
double value )
519 void QgsGlowWidget::on_mSpreadUnitWidget_changed()
531 void QgsGlowWidget::on_mTranspSpnBx_valueChanged(
double value )
536 mTranspSlider->blockSignals(
true );
537 mTranspSlider->setValue( value * 10.0 );
538 mTranspSlider->blockSignals(
false );
544 void QgsGlowWidget::on_mColorBtn_colorChanged(
const QColor &color )
553 void QgsGlowWidget::on_mBlurRadiusSpnBx_valueChanged(
int value )
562 void QgsGlowWidget::on_mTranspSlider_valueChanged(
int value )
564 mTranspSpnBx->setValue( value / 10.0 );
567 void QgsGlowWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
578 void QgsGlowWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
585 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
589 void QgsGlowWidget::applyColorRamp()
604 void QgsGlowWidget::on_mButtonEditRamp_clicked()
611 if ( mEffect->
ramp() && mEffect->
ramp()->
type() ==
"gradient" )
617 if ( dlg.exec() && gradRamp )
620 mRampComboBox->blockSignals(
true );
621 mRampComboBox->setSourceColorRamp( mEffect->
ramp() );
622 mRampComboBox->blockSignals(
false );
643 mSpinTranslateX->setClearValue( 0 );
644 mSpinTranslateY->setClearValue( 0 );
645 mSpinShearX->setClearValue( 0 );
646 mSpinShearY->setClearValue( 0 );
647 mSpinScaleX->setClearValue( 100.0 );
648 mSpinScaleY->setClearValue( 100.0 );
656 if ( !effect || effect->
type() !=
"transform" )
663 void QgsTransformWidget::initGui()
670 blockSignals(
true );
672 mReflectXCheckBox->setChecked( mEffect->
reflectX() );
673 mReflectYCheckBox->setChecked( mEffect->
reflectY() );
674 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
675 mSpinTranslateX->setValue( mEffect->
translateX() );
676 mSpinTranslateY->setValue( mEffect->
translateY() );
679 mSpinShearX->setValue( mEffect->
shearX() );
680 mSpinShearY->setValue( mEffect->
shearY() );
681 mSpinScaleX->setValue( mEffect->
scaleX() * 100.0 );
682 mSpinScaleY->setValue( mEffect->
scaleY() * 100.0 );
683 mRotationSpinBox->setValue( mEffect->
rotation() );
685 blockSignals(
false );
688 void QgsTransformWidget::blockSignals(
const bool block )
690 mDrawModeComboBox->blockSignals( block );
691 mTranslateUnitWidget->blockSignals( block );
692 mSpinTranslateX->blockSignals( block );
693 mSpinTranslateY->blockSignals( block );
694 mReflectXCheckBox->blockSignals( block );
695 mReflectYCheckBox->blockSignals( block );
696 mSpinShearX->blockSignals( block );
697 mSpinShearY->blockSignals( block );
698 mSpinScaleX->blockSignals( block );
699 mSpinScaleY->blockSignals( block );
700 mRotationSpinBox->blockSignals( block );
704 void QgsTransformWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
711 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
715 void QgsTransformWidget::on_mSpinTranslateX_valueChanged(
double value )
724 void QgsTransformWidget::on_mSpinTranslateY_valueChanged(
double value )
733 void QgsTransformWidget::on_mTranslateUnitWidget_changed()
745 void QgsTransformWidget::on_mReflectXCheckBox_stateChanged(
int state )
754 void QgsTransformWidget::on_mReflectYCheckBox_stateChanged(
int state )
763 void QgsTransformWidget::on_mSpinShearX_valueChanged(
double value )
772 void QgsTransformWidget::on_mSpinShearY_valueChanged(
double value )
781 void QgsTransformWidget::on_mSpinScaleX_valueChanged(
double value )
790 void QgsTransformWidget::on_mSpinScaleY_valueChanged(
double value )
799 void QgsTransformWidget::on_mRotationSpinBox_valueChanged(
double value )
819 mBrightnessSpinBox->setClearValue( 0 );
820 mContrastSpinBox->setClearValue( 0 );
821 mSaturationSpinBox->setClearValue( 0 );
822 mColorizeColorButton->setAllowAlpha(
false );
834 if ( !effect || effect->
type() !=
"color" )
841 void QgsColorEffectWidget::initGui()
848 blockSignals(
true );
850 mSliderBrightness->setValue( mEffect->
brightness() );
851 mSliderContrast->setValue( mEffect->
contrast() );
852 mSliderSaturation->setValue(( mEffect->
saturation() - 1.0 ) * 100.0 );
853 mColorizeCheck->setChecked( mEffect->
colorizeOn() );
857 mGrayscaleCombo->setCurrentIndex( grayscaleIdx == -1 ? 0 : grayscaleIdx );
858 mTranspSpnBx->setValue( mEffect->
transparency() * 100.0 );
859 mTranspSlider->setValue( mEffect->
transparency() * 1000.0 );
860 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
861 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
862 enableColorizeControls( mEffect->
colorizeOn() );
864 blockSignals(
false );
867 void QgsColorEffectWidget::blockSignals(
const bool block )
869 mBrightnessSpinBox->blockSignals( block );
870 mContrastSpinBox->blockSignals( block );
871 mSaturationSpinBox->blockSignals( block );
872 mColorizeStrengthSpinBox->blockSignals( block );
873 mColorizeCheck->blockSignals( block );
874 mColorizeColorButton->blockSignals( block );
875 mGrayscaleCombo->blockSignals( block );
876 mTranspSpnBx->blockSignals( block );
877 mTranspSlider->blockSignals( block );
878 mBlendCmbBx->blockSignals( block );
879 mDrawModeComboBox->blockSignals( block );
882 void QgsColorEffectWidget::enableColorizeControls(
const bool enable )
884 mSliderColorizeStrength->setEnabled( enable );
885 mColorizeStrengthSpinBox->setEnabled( enable );
886 mColorizeColorButton->setEnabled( enable );
889 void QgsColorEffectWidget::on_mTranspSpnBx_valueChanged(
double value )
894 mTranspSlider->blockSignals(
true );
895 mTranspSlider->setValue( value * 10.0 );
896 mTranspSlider->blockSignals(
false );
902 void QgsColorEffectWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
913 void QgsColorEffectWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
920 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
924 void QgsColorEffectWidget::on_mTranspSlider_valueChanged(
int value )
926 mTranspSpnBx->setValue( value / 10.0 );
929 void QgsColorEffectWidget::on_mBrightnessSpinBox_valueChanged(
int value )
938 void QgsColorEffectWidget::on_mContrastSpinBox_valueChanged(
int value )
947 void QgsColorEffectWidget::on_mSaturationSpinBox_valueChanged(
int value )
956 void QgsColorEffectWidget::on_mColorizeStrengthSpinBox_valueChanged(
int value )
965 void QgsColorEffectWidget::on_mColorizeCheck_stateChanged(
int state )
971 enableColorizeControls( state == Qt::Checked );
975 void QgsColorEffectWidget::on_mColorizeColorButton_colorChanged(
const QColor &color )
984 void QgsColorEffectWidget::on_mGrayscaleCombo_currentIndexChanged(
int index )
QgsVectorColorRampV2 * ramp() const
Returns the color ramp used for the glow.
void setOffsetDistance(const double distance)
Sets the distance for offsetting the shadow.
void setBlurMethod(const BlurMethod method)
Sets the blur method (algorithm) to use for performing the blur.
virtual QString type() const =0
int contrast() const
Returns the contrast modification for the effect.
int blurLevel() const
Returns the blur level (strength) for the shadow.
void setOffsetAngle(const int angle)
Sets the angle for offsetting the shadow.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale used for the shadow offset distance.
int colorizeStrength() const
Returns the strength used for colorizing a picture.
void setSpreadUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units used for the glow spread distance.
DrawMode drawMode() const
Returns the draw mode for the effect.
double transparency() const
Returns the transparency for the effect.
void setTransparency(const double transparency)
Sets the transparency for the effect.
void setColorizeColor(const QColor &colorizeColor)
Sets the color used for colorizing a picture.
Base class for visual effects which can be applied to QPicture drawings.
void setDrawMode(const DrawMode drawMode)
Sets the draw mode for the effect.
void setColorizeStrength(int colorizeStrength)
Sets the strength for colorizing a picture.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
void setBlurLevel(const int level)
Sets blur level (strength) for the shadow.
void setBlurLevel(const int level)
Sets blur level (strength)
void setOffsetUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units used for the shadow offset distance.
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units used for the shadow offset distance.
double transparency() const
Returns the transparency for the effect.
QString tr(const char *sourceText, const char *disambiguation, int n)
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
Base class for paint effect which draw a glow inside or outside a picture.
void setTransparency(const double transparency)
Sets the transparency for the effect.
void setTransparency(const double transparency)
Sets the transparency for the effect.
void setGrayscaleMode(QgsImageOperation::GrayscaleMode grayscaleMode)
Sets whether the effect should convert a picture to grayscale.
void setBrightness(int brightness)
Sets the brightness modification for the effect.
BlurMethod
Available blur methods (algorithms)
void setSpreadMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the spread distance.
void setBlurLevel(const int level)
Sets blur level (strength) for the glow.
BlurMethod blurMethod() const
Returns the blur method (algorithm) used for performing the blur.
double spread() const
Returns the spread distance used for drawing the glow effect.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
virtual QString type() const =0
Returns the effect type.
virtual QgsVectorColorRampV2 * clone() const =0
static QgsStyleV2 * defaultStyle()
return default application-wide style
void setColorType(GlowColorType colorType)
Sets the color mode to use for the glow.
double transparency() const
Returns the transparency for the effect.
double transparency() const
Returns the transparency for the effect.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
double saturation() const
Returns the saturation modification for the effect.
void setColorizeOn(bool colorizeOn)
Sets whether the effect should colorize a picture.
void setContrast(int contrast)
Sets the contrast modification for the effect.
void setSpread(const double spread)
Sets the spread distance for drawing the glow effect.
QColor colorizeColor() const
Returns the color used for colorizing a picture.
A paint effect which blurs a source picture, using a number of different blur methods.
const QgsMapUnitScale & spreadMapUnitScale() const
Returns the map unit scale used for the spread distance.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the shadow offset distance.
void setRamp(QgsVectorColorRampV2 *ramp)
Sets the color ramp for the glow.
void setSaturation(double saturation)
Sets the saturation modification for the effect.
int blurLevel() const
Returns the blur level (strength) for the glow.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
A paint effect which alters the colors (eg brightness, contrast) in a source picture.
bool colorizeOn() const
Returns whether the effect will colorize a picture.
QColor color() const
Returns the color for the glow.
GlowColorType colorType() const
Returns the color mode used for the glow.
Base class for paint effects which offset, blurred shadows.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
A paint effect which draws the source picture with minor or no alterations.
GrayscaleMode
Modes for converting a QImage to grayscale.
void setTransparency(const double transparency)
Sets the transparency for the effect.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QgsSymbolV2::OutputUnit spreadUnit() const
Returns the units used for the glow spread distance.
void setColor(const QColor &color)
Sets the color for the shadow.
int offsetAngle() const
Returns the angle used for offsetting the shadow.
double offsetDistance() const
Returns the distance used for offsetting the shadow.
double transparency() const
Returns the transparency for the effect.
void setColor(const QColor &color)
Sets the color for the glow.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
QgsImageOperation::GrayscaleMode grayscaleMode() const
Returns whether the effect will convert a picture to grayscale.
void setTransparency(const double transparency)
Sets the transparency for the effect.
int blurLevel() const
Returns the blur level (strength)
int brightness() const
Returns the brightness modification for the effect.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
QColor color() const
Returns the color used for the shadow.