Skip to content
Permalink
Browse files

[symbology] migrate shapeburst color ramp widget

  • Loading branch information
nirvn committed Dec 3, 2016
1 parent 1560c7f commit aa4d7515909038e2d91769c1a9ecaf5195736266
@@ -28,6 +28,7 @@
#include "qgssvgcache.h"
#include "qgssymbollayerutils.h"
#include "qgscolorramp.h"
#include "qgscolorrampbutton.h"
#include "qgsgradientcolorrampdialog.h"
#include "qgsdatadefined.h"
#include "qgsstyle.h" //for symbol selector dialog
@@ -1360,11 +1361,9 @@ QgsShapeburstFillSymbolLayerWidget::QgsShapeburstFillSymbolLayerWidget( const Qg
spinOffsetX->setClearValue( 0.0 );
spinOffsetY->setClearValue( 0.0 );

cboGradientColorRamp->populate( QgsStyle::defaultStyle() );
btnColorRamp->setShowGradientOnly( true );

connect( cboGradientColorRamp, SIGNAL( currentIndexChanged( int ) ), this, SLOT( applyColorRamp() ) );
connect( cboGradientColorRamp, SIGNAL( sourceRampEdited() ), this, SLOT( applyColorRamp() ) );
connect( mButtonEditRamp, SIGNAL( clicked() ), cboGradientColorRamp, SLOT( editSourceRamp() ) );
connect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsShapeburstFillSymbolLayerWidget::applyColorRamp );

connect( btnChangeColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor( const QColor& ) ) );
connect( btnChangeColor2, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor2( const QColor& ) ) );
@@ -1395,7 +1394,7 @@ void QgsShapeburstFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer* layer )
if ( mLayer->colorType() == QgsShapeburstFillSymbolLayer::SimpleTwoColor )
{
radioTwoColor->setChecked( true );
cboGradientColorRamp->setEnabled( false );
btnColorRamp->setEnabled( false );
}
else
{
@@ -1444,9 +1443,9 @@ void QgsShapeburstFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer* layer )
// set source color ramp
if ( mLayer->colorRamp() )
{
cboGradientColorRamp->blockSignals( true );
cboGradientColorRamp->setSourceColorRamp( mLayer->colorRamp() );
cboGradientColorRamp->blockSignals( false );
btnColorRamp->blockSignals( true );
btnColorRamp->setColorRamp( mLayer->colorRamp() );
btnColorRamp->blockSignals( false );
}

spinOffsetX->blockSignals( true );
@@ -1549,7 +1548,7 @@ void QgsShapeburstFillSymbolLayerWidget::on_mRadioUseWholeShape_toggled( bool va

void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
{
QgsColorRamp* ramp = cboGradientColorRamp->currentColorRamp();
QgsColorRamp* ramp = btnColorRamp->colorRamp();
if ( !ramp )
return;

@@ -150,30 +150,26 @@
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<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>
</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="8" column="2" rowspan="2">
<widget class="QgsDataDefinedButton" name="mRefPoint1YDDBtn">
@@ -29,24 +29,26 @@
</widget>
</item>
<item row="3" column="1" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QgsColorRampComboBox" name="cboGradientColorRamp"/>
</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="4">
<widget class="QgsDataDefinedButton" name="mShadeWholeShapeDDBtn">
@@ -126,7 +128,7 @@
<item>
<widget class="QRadioButton" name="mRadioUseMaxDistance">
<property name="text">
<string>Shade to a set distance</string>
<string>Set distance</string>
</property>
</widget>
</item>
@@ -339,7 +341,7 @@
<item>
<widget class="QRadioButton" name="mRadioUseWholeShape">
<property name="text">
<string>Shade whole shape</string>
<string>Whole shape</string>
</property>
</widget>
</item>
@@ -424,16 +426,16 @@
<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>
<tabstop>radioTwoColor</tabstop>
<tabstop>radioColorRamp</tabstop>
<tabstop>cboGradientColorRamp</tabstop>
<tabstop>mButtonEditRamp</tabstop>
<tabstop>btnColorRamp</tabstop>
<tabstop>mRadioUseWholeShape</tabstop>
<tabstop>mRadioUseMaxDistance</tabstop>
<tabstop>mSpinMaxDistance</tabstop>
@@ -479,7 +481,7 @@
<connection>
<sender>radioColorRamp</sender>
<signal>toggled(bool)</signal>
<receiver>cboGradientColorRamp</receiver>
<receiver>btnColorRamp</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">

0 comments on commit aa4d751

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