Skip to content
Permalink
Browse files

[effects] migrate inner/outer glow color ramp widget

  • Loading branch information
nirvn committed Dec 3, 2016
1 parent aa4d751 commit e604fc9fe18d5782984dfcf0577ce76875a78d1a
Showing with 36 additions and 53 deletions.
  1. +10 −13 src/gui/effects/qgspainteffectwidget.cpp
  2. +26 −40 src/ui/effects/widget_glow.ui
@@ -24,6 +24,7 @@
#include "qgscoloreffect.h"
#include "qgsstyle.h"
#include "qgscolorramp.h"
#include "qgscolorrampbutton.h"

//
// draw source
@@ -421,15 +422,12 @@ QgsGlowWidget::QgsGlowWidget( QWidget *parent )

mSpreadUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderPixels << QgsUnitTypes::RenderMapUnits );

mRampComboBox->populate( QgsStyle::defaultStyle() );
mRampComboBox->setShowGradientOnly( true );
connect( mRampComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( applyColorRamp() ) );
connect( mRampComboBox, SIGNAL( sourceRampEdited() ), this, SLOT( applyColorRamp() ) );
connect( mButtonEditRamp, SIGNAL( clicked() ), mRampComboBox, SLOT( editSourceRamp() ) );

connect( radioSingleColor, SIGNAL( toggled( bool ) ), this, SLOT( colorModeChanged() ) );
btnColorRamp->setShowGradientOnly( true );

initGui();

connect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsGlowWidget::applyColorRamp );
connect( radioSingleColor, SIGNAL( toggled( bool ) ), this, SLOT( colorModeChanged() ) );
}

void QgsGlowWidget::setPaintEffect( QgsPaintEffect *effect )
@@ -461,14 +459,13 @@ void QgsGlowWidget::initGui()

if ( mEffect->ramp() )
{
mRampComboBox->setSourceColorRamp( mEffect->ramp() );
btnColorRamp->setColorRamp( mEffect->ramp() );
}

radioSingleColor->setChecked( mEffect->colorType() == QgsGlowEffect::SingleColor );
mColorBtn->setEnabled( mEffect->colorType() == QgsGlowEffect::SingleColor );
radioColorRamp->setChecked( mEffect->colorType() == QgsGlowEffect::ColorRamp );
mRampComboBox->setEnabled( mEffect->colorType() == QgsGlowEffect::ColorRamp );
mButtonEditRamp->setEnabled( mEffect->colorType() == QgsGlowEffect::ColorRamp );
btnColorRamp->setEnabled( mEffect->colorType() == QgsGlowEffect::ColorRamp );
mDrawModeComboBox->setDrawMode( mEffect->drawMode() );

blockSignals( false );
@@ -483,7 +480,7 @@ void QgsGlowWidget::blockSignals( const bool block )
mTranspSlider->blockSignals( block );
mColorBtn->blockSignals( block );
mBlendCmbBx->blockSignals( block );
mRampComboBox->blockSignals( block );
btnColorRamp->blockSignals( block );
radioSingleColor->blockSignals( block );
radioColorRamp->blockSignals( block );
mDrawModeComboBox->blockSignals( block );
@@ -503,7 +500,7 @@ void QgsGlowWidget::colorModeChanged()
else
{
mEffect->setColorType( QgsGlowEffect::ColorRamp );
mEffect->setRamp( mRampComboBox->currentColorRamp() );
mEffect->setRamp( btnColorRamp->colorRamp() );
}
emit changed();
}
@@ -594,7 +591,7 @@ void QgsGlowWidget::applyColorRamp()
return;
}

QgsColorRamp* ramp = mRampComboBox->currentColorRamp();
QgsColorRamp* ramp = btnColorRamp->colorRamp();
if ( !ramp )
return;

@@ -135,24 +135,26 @@
</widget>
</item>
<item row="4" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<item>
<widget class="QgsColorRampComboBox" name="mRampComboBox"/>
</item>
<item>
<widget class="QPushButton" name="mButtonEditRamp">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
</layout>
<widget class="QgsColorRampButton" name="btnColorRamp">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QgsBlendModeComboBox" name="mBlendCmbBx"/>
@@ -275,9 +277,10 @@
<container>1</container>
</customwidget>
<customwidget>
<class>QgsColorRampComboBox</class>
<extends>QComboBox</extends>
<header>qgscolorrampcombobox.h</header>
<class>QgsColorRampButton</class>
<extends>QToolButton</extends>
<header>qgscolorrampbutton.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
@@ -289,8 +292,7 @@
<tabstop>radioSingleColor</tabstop>
<tabstop>mColorBtn</tabstop>
<tabstop>radioColorRamp</tabstop>
<tabstop>mRampComboBox</tabstop>
<tabstop>mButtonEditRamp</tabstop>
<tabstop>btnColorRamp</tabstop>
<tabstop>mBlendCmbBx</tabstop>
<tabstop>mDrawModeComboBox</tabstop>
</tabstops>
@@ -315,7 +317,7 @@
<connection>
<sender>radioColorRamp</sender>
<signal>toggled(bool)</signal>
<receiver>mRampComboBox</receiver>
<receiver>btnColorRamp</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
@@ -328,21 +330,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>radioColorRamp</sender>
<signal>toggled(bool)</signal>
<receiver>mButtonEditRamp</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>64</x>
<y>156</y>
</hint>
<hint type="destinationlabel">
<x>423</x>
<y>157</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit e604fc9

Please sign in to comment.
You can’t perform that action at this time.