43 if ( !effect || effect->
type() !=
"drawSource" )
50 void QgsDrawSourceWidget::initGui()
59 mTransparencySpnBx->setValue( mEffect->
transparency() * 100.0 );
60 mTransparencySlider->setValue( mEffect->
transparency() * 1000.0 );
61 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
62 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
64 blockSignals(
false );
67 void QgsDrawSourceWidget::blockSignals(
const bool block )
69 mTransparencySlider->blockSignals( block );
70 mTransparencySpnBx->blockSignals( block );
71 mBlendCmbBx->blockSignals( block );
72 mDrawModeComboBox->blockSignals( block );
75 void QgsDrawSourceWidget::on_mTransparencySpnBx_valueChanged(
double value )
80 mTransparencySlider->blockSignals(
true );
81 mTransparencySlider->setValue( value * 10.0 );
82 mTransparencySlider->blockSignals(
false );
88 void QgsDrawSourceWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
95 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
99 void QgsDrawSourceWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
110 void QgsDrawSourceWidget::on_mTransparencySlider_valueChanged(
int value )
112 mTransparencySpnBx->setValue( value / 10.0 );
135 if ( !effect || effect->
type() !=
"blur" )
142 void QgsBlurWidget::initGui()
149 blockSignals(
true );
151 mBlurTypeCombo->setCurrentIndex( mBlurTypeCombo->findData( mEffect->
blurMethod() ) );
152 mBlurStrengthSpnBx->setValue( mEffect->
blurLevel() );
153 mTransparencySpnBx->setValue( mEffect->
transparency() * 100.0 );
154 mTransparencySlider->setValue( mEffect->
transparency() * 1000.0 );
155 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
156 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
158 blockSignals(
false );
161 void QgsBlurWidget::blockSignals(
const bool block )
163 mBlurTypeCombo->blockSignals( block );
164 mBlurStrengthSpnBx->blockSignals( block );
165 mTransparencySlider->blockSignals( block );
166 mTransparencySpnBx->blockSignals( block );
167 mBlendCmbBx->blockSignals( block );
168 mDrawModeComboBox->blockSignals( block );
171 void QgsBlurWidget::on_mBlurTypeCombo_currentIndexChanged(
int index )
183 mBlurStrengthSpnBx->setMaximum( 16 );
186 mBlurStrengthSpnBx->setMaximum( 200 );
193 void QgsBlurWidget::on_mBlurStrengthSpnBx_valueChanged(
int value )
202 void QgsBlurWidget::on_mTransparencySpnBx_valueChanged(
double value )
207 mTransparencySlider->blockSignals(
true );
208 mTransparencySlider->setValue( value * 10.0 );
209 mTransparencySlider->blockSignals(
false );
215 void QgsBlurWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
222 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
226 void QgsBlurWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
237 void QgsBlurWidget::on_mTransparencySlider_valueChanged(
int value )
239 mTransparencySpnBx->setValue( value / 10.0 );
253 mShadowColorBtn->setAllowAlpha(
false );
254 mShadowColorBtn->setColorDialogTitle(
tr(
"Select shadow color" ) );
255 mShadowColorBtn->setContext(
"symbology" );
264 if ( !effect || ( effect->
type() !=
"dropShadow" && effect->
type() !=
"innerShadow" ) )
271 void QgsShadowEffectWidget::initGui()
278 blockSignals(
true );
280 mShadowOffsetAngleSpnBx->setValue( mEffect->
offsetAngle() );
281 mShadowOffsetAngleDial->setValue( mEffect->
offsetAngle() );
283 mOffsetUnitWidget->setUnit( mEffect->
offsetUnit() );
285 mShadowRadiuSpnBx->setValue( mEffect->
blurLevel() );
286 mShadowTranspSpnBx->setValue( mEffect->
transparency() * 100.0 );
287 mShadowTranspSlider->setValue( mEffect->
transparency() * 1000.0 );
288 mShadowColorBtn->setColor( mEffect->
color() );
289 mShadowBlendCmbBx->setBlendMode( mEffect->
blendMode() );
290 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
292 blockSignals(
false );
295 void QgsShadowEffectWidget::blockSignals(
const bool block )
297 mShadowOffsetAngleSpnBx->blockSignals( block );
298 mShadowOffsetAngleDial->blockSignals( block );
299 mShadowOffsetSpnBx->blockSignals( block );
300 mOffsetUnitWidget->blockSignals( block );
301 mShadowRadiuSpnBx->blockSignals( block );
302 mShadowTranspSpnBx->blockSignals( block );
303 mShadowColorBtn->blockSignals( block );
304 mShadowBlendCmbBx->blockSignals( block );
305 mShadowTranspSlider->blockSignals( block );
306 mDrawModeComboBox->blockSignals( block );
309 void QgsShadowEffectWidget::on_mShadowOffsetAngleSpnBx_valueChanged(
int value )
311 mShadowOffsetAngleDial->blockSignals(
true );
312 mShadowOffsetAngleDial->setValue( value );
313 mShadowOffsetAngleDial->blockSignals(
false );
322 void QgsShadowEffectWidget::on_mShadowOffsetAngleDial_valueChanged(
int value )
324 mShadowOffsetAngleSpnBx->setValue( value );
327 void QgsShadowEffectWidget::on_mShadowOffsetSpnBx_valueChanged(
double value )
336 void QgsShadowEffectWidget::on_mOffsetUnitWidget_changed()
348 void QgsShadowEffectWidget::on_mShadowTranspSpnBx_valueChanged(
double value )
353 mShadowTranspSlider->blockSignals(
true );
354 mShadowTranspSlider->setValue( value * 10.0 );
355 mShadowTranspSlider->blockSignals(
false );
361 void QgsShadowEffectWidget::on_mShadowColorBtn_colorChanged(
const QColor &color )
370 void QgsShadowEffectWidget::on_mShadowRadiuSpnBx_valueChanged(
int value )
379 void QgsShadowEffectWidget::on_mShadowTranspSlider_valueChanged(
int value )
381 mShadowTranspSpnBx->setValue( value / 10.0 );
384 void QgsShadowEffectWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
391 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
395 void QgsShadowEffectWidget::on_mShadowBlendCmbBx_currentIndexChanged(
int index )
402 mEffect->
setBlendMode( mShadowBlendCmbBx->blendMode() );
418 mColorBtn->setAllowAlpha(
false );
419 mColorBtn->setColorDialogTitle(
tr(
"Select glow color" ) );
420 mColorBtn->setContext(
"symbology" );
425 mRampComboBox->setShowGradientOnly(
true );
426 connect( mRampComboBox, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( applyColorRamp() ) );
427 connect( mRampComboBox, SIGNAL( sourceRampEdited() ),
this, SLOT( applyColorRamp() ) );
428 connect( mButtonEditRamp, SIGNAL( clicked() ), mRampComboBox, SLOT( editSourceRamp() ) );
430 connect( radioSingleColor, SIGNAL( toggled(
bool ) ),
this, SLOT( colorModeChanged() ) );
437 if ( !effect || ( effect->
type() !=
"outerGlow" && effect->
type() !=
"innerGlow" ) )
444 void QgsGlowWidget::initGui()
451 blockSignals(
true );
453 mSpreadSpnBx->setValue( mEffect->
spread() );
454 mSpreadUnitWidget->setUnit( mEffect->
spreadUnit() );
456 mBlurRadiusSpnBx->setValue( mEffect->
blurLevel() );
457 mTranspSpnBx->setValue( mEffect->
transparency() * 100.0 );
458 mTranspSlider->setValue( mEffect->
transparency() * 1000.0 );
459 mColorBtn->setColor( mEffect->
color() );
460 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
462 if ( mEffect->
ramp() )
464 mRampComboBox->setSourceColorRamp( mEffect->
ramp() );
472 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
474 blockSignals(
false );
477 void QgsGlowWidget::blockSignals(
const bool block )
479 mSpreadSpnBx->blockSignals( block );
480 mSpreadUnitWidget->blockSignals( block );
481 mBlurRadiusSpnBx->blockSignals( block );
482 mTranspSpnBx->blockSignals( block );
483 mTranspSlider->blockSignals( block );
484 mColorBtn->blockSignals( block );
485 mBlendCmbBx->blockSignals( block );
486 mRampComboBox->blockSignals( block );
487 radioSingleColor->blockSignals( block );
488 radioColorRamp->blockSignals( block );
489 mDrawModeComboBox->blockSignals( block );
492 void QgsGlowWidget::colorModeChanged()
499 if ( radioSingleColor->isChecked() )
506 mEffect->
setRamp( mRampComboBox->currentColorRamp() );
511 void QgsGlowWidget::on_mSpreadSpnBx_valueChanged(
double value )
520 void QgsGlowWidget::on_mSpreadUnitWidget_changed()
532 void QgsGlowWidget::on_mTranspSpnBx_valueChanged(
double value )
537 mTranspSlider->blockSignals(
true );
538 mTranspSlider->setValue( value * 10.0 );
539 mTranspSlider->blockSignals(
false );
545 void QgsGlowWidget::on_mColorBtn_colorChanged(
const QColor &color )
554 void QgsGlowWidget::on_mBlurRadiusSpnBx_valueChanged(
int value )
563 void QgsGlowWidget::on_mTranspSlider_valueChanged(
int value )
565 mTranspSpnBx->setValue( value / 10.0 );
568 void QgsGlowWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
579 void QgsGlowWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
586 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
590 void QgsGlowWidget::applyColorRamp()
616 mSpinTranslateX->setClearValue( 0 );
617 mSpinTranslateY->setClearValue( 0 );
618 mSpinShearX->setClearValue( 0 );
619 mSpinShearY->setClearValue( 0 );
620 mSpinScaleX->setClearValue( 100.0 );
621 mSpinScaleY->setClearValue( 100.0 );
629 if ( !effect || effect->
type() !=
"transform" )
636 void QgsTransformWidget::initGui()
643 blockSignals(
true );
645 mReflectXCheckBox->setChecked( mEffect->
reflectX() );
646 mReflectYCheckBox->setChecked( mEffect->
reflectY() );
647 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
648 mSpinTranslateX->setValue( mEffect->
translateX() );
649 mSpinTranslateY->setValue( mEffect->
translateY() );
652 mSpinShearX->setValue( mEffect->
shearX() );
653 mSpinShearY->setValue( mEffect->
shearY() );
654 mSpinScaleX->setValue( mEffect->
scaleX() * 100.0 );
655 mSpinScaleY->setValue( mEffect->
scaleY() * 100.0 );
656 mRotationSpinBox->setValue( mEffect->
rotation() );
658 blockSignals(
false );
661 void QgsTransformWidget::blockSignals(
const bool block )
663 mDrawModeComboBox->blockSignals( block );
664 mTranslateUnitWidget->blockSignals( block );
665 mSpinTranslateX->blockSignals( block );
666 mSpinTranslateY->blockSignals( block );
667 mReflectXCheckBox->blockSignals( block );
668 mReflectYCheckBox->blockSignals( block );
669 mSpinShearX->blockSignals( block );
670 mSpinShearY->blockSignals( block );
671 mSpinScaleX->blockSignals( block );
672 mSpinScaleY->blockSignals( block );
673 mRotationSpinBox->blockSignals( block );
677 void QgsTransformWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
684 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
688 void QgsTransformWidget::on_mSpinTranslateX_valueChanged(
double value )
697 void QgsTransformWidget::on_mSpinTranslateY_valueChanged(
double value )
706 void QgsTransformWidget::on_mTranslateUnitWidget_changed()
718 void QgsTransformWidget::on_mReflectXCheckBox_stateChanged(
int state )
727 void QgsTransformWidget::on_mReflectYCheckBox_stateChanged(
int state )
736 void QgsTransformWidget::on_mSpinShearX_valueChanged(
double value )
745 void QgsTransformWidget::on_mSpinShearY_valueChanged(
double value )
754 void QgsTransformWidget::on_mSpinScaleX_valueChanged(
double value )
763 void QgsTransformWidget::on_mSpinScaleY_valueChanged(
double value )
772 void QgsTransformWidget::on_mRotationSpinBox_valueChanged(
double value )
792 mBrightnessSpinBox->setClearValue( 0 );
793 mContrastSpinBox->setClearValue( 0 );
794 mSaturationSpinBox->setClearValue( 0 );
795 mColorizeColorButton->setAllowAlpha(
false );
807 if ( !effect || effect->
type() !=
"color" )
814 void QgsColorEffectWidget::initGui()
821 blockSignals(
true );
823 mSliderBrightness->setValue( mEffect->
brightness() );
824 mSliderContrast->setValue( mEffect->
contrast() );
825 mSliderSaturation->setValue(( mEffect->
saturation() - 1.0 ) * 100.0 );
826 mColorizeCheck->setChecked( mEffect->
colorizeOn() );
830 mGrayscaleCombo->setCurrentIndex( grayscaleIdx == -1 ? 0 : grayscaleIdx );
831 mTranspSpnBx->setValue( mEffect->
transparency() * 100.0 );
832 mTranspSlider->setValue( mEffect->
transparency() * 1000.0 );
833 mBlendCmbBx->setBlendMode( mEffect->
blendMode() );
834 mDrawModeComboBox->setDrawMode( mEffect->
drawMode() );
835 enableColorizeControls( mEffect->
colorizeOn() );
837 blockSignals(
false );
840 void QgsColorEffectWidget::blockSignals(
const bool block )
842 mBrightnessSpinBox->blockSignals( block );
843 mContrastSpinBox->blockSignals( block );
844 mSaturationSpinBox->blockSignals( block );
845 mColorizeStrengthSpinBox->blockSignals( block );
846 mColorizeCheck->blockSignals( block );
847 mColorizeColorButton->blockSignals( block );
848 mGrayscaleCombo->blockSignals( block );
849 mTranspSpnBx->blockSignals( block );
850 mTranspSlider->blockSignals( block );
851 mBlendCmbBx->blockSignals( block );
852 mDrawModeComboBox->blockSignals( block );
855 void QgsColorEffectWidget::enableColorizeControls(
const bool enable )
857 mSliderColorizeStrength->setEnabled( enable );
858 mColorizeStrengthSpinBox->setEnabled( enable );
859 mColorizeColorButton->setEnabled( enable );
862 void QgsColorEffectWidget::on_mTranspSpnBx_valueChanged(
double value )
867 mTranspSlider->blockSignals(
true );
868 mTranspSlider->setValue( value * 10.0 );
869 mTranspSlider->blockSignals(
false );
875 void QgsColorEffectWidget::on_mBlendCmbBx_currentIndexChanged(
int index )
886 void QgsColorEffectWidget::on_mDrawModeComboBox_currentIndexChanged(
int index )
893 mEffect->
setDrawMode( mDrawModeComboBox->drawMode() );
897 void QgsColorEffectWidget::on_mTranspSlider_valueChanged(
int value )
899 mTranspSpnBx->setValue( value / 10.0 );
902 void QgsColorEffectWidget::on_mBrightnessSpinBox_valueChanged(
int value )
911 void QgsColorEffectWidget::on_mContrastSpinBox_valueChanged(
int value )
920 void QgsColorEffectWidget::on_mSaturationSpinBox_valueChanged(
int value )
929 void QgsColorEffectWidget::on_mColorizeStrengthSpinBox_valueChanged(
int value )
938 void QgsColorEffectWidget::on_mColorizeCheck_stateChanged(
int state )
944 enableColorizeControls( state == Qt::Checked );
948 void QgsColorEffectWidget::on_mColorizeColorButton_colorChanged(
const QColor &color )
957 void QgsColorEffectWidget::on_mGrayscaleCombo_currentIndexChanged(
int index )
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.
void setOffsetAngle(const int angle)
Sets the angle for offsetting the shadow.
void setSpreadUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units used for the glow spread distance.
void setTransparency(const double transparency)
Sets the transparency for the effect.
The output shall be in pixels.
void setColorizeColor(const QColor &colorizeColor)
Sets the color used for colorizing a picture.
double offsetDistance() const
Returns the distance used for offsetting the shadow.
double transparency() const
Returns the transparency for the effect.
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.
void setBlurLevel(const int level)
Sets blur level (strength) for the shadow.
DrawMode drawMode() const
Returns the draw mode for the effect.
QgsSymbolV2::OutputUnit spreadUnit() const
Returns the units used for the glow spread distance.
void setBlurLevel(const int level)
Sets blur level (strength)
void setOffsetUnit(const QgsSymbolV2::OutputUnit unit)
Sets 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)
BlurMethod blurMethod() const
Returns the blur method (algorithm) used for performing the blur.
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.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
The output shall be in millimeters.
QColor color() const
Returns the color used for the shadow.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
virtual QString type() const =0
Returns the effect type.
static QgsStyleV2 * defaultStyle()
return default application-wide style
void setColorType(GlowColorType colorType)
Sets the color mode to use for the glow.
int blurLevel() const
Returns the blur level (strength)
const QgsMapUnitScale & spreadMapUnitScale() const
Returns the map unit scale used for the spread distance.
The output shall be in map unitx.
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.
int blurLevel() const
Returns the blur level (strength) for the shadow.
double transparency() const
Returns the transparency for the effect.
A paint effect which blurs a source picture, using a number of different blur methods.
GlowColorType colorType() const
Returns the color mode used 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 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.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
void setSaturation(double saturation)
Sets the saturation modification for the effect.
double spread() const
Returns the spread distance used for drawing the glow effect.
int colorizeStrength() const
Returns the strength used for colorizing a picture.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blend mode for the effect.
double saturation() const
Returns the saturation modification for the effect.
QPainter::CompositionMode blendMode() const
Returns the blend mode for the effect.
A paint effect which alters the colors (eg brightness, contrast) in a source picture.
Base class for paint effects which offset, blurred shadows.
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units used for the shadow offset distance.
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.
double transparency() const
Returns the transparency for the effect.
A paint effect which draws the source picture with minor or no alterations.
double transparency() const
Returns the transparency for the effect.
GrayscaleMode
Modes for converting a QImage to grayscale.
void setTransparency(const double transparency)
Sets the transparency for the effect.
bool colorizeOn() const
Returns whether the effect will colorize a picture.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
int contrast() const
Returns the contrast modification for the effect.
Abstract base class for color ramps.
void setColor(const QColor &color)
Sets the color for the shadow.
int offsetAngle() const
Returns the angle used for offsetting the shadow.
void setColor(const QColor &color)
Sets the color for the glow.
void setTransparency(const double transparency)
Sets the transparency for the effect.
QgsVectorColorRampV2 * ramp() const
Returns the color ramp used for the glow.
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale used for the shadow offset distance.
QColor colorizeColor() const
Returns the color used for colorizing a picture.
int brightness() const
Returns the brightness modification for the effect.
int blurLevel() const
Returns the blur level (strength) for the glow.
QColor color() const
Returns the color for the glow.