void QgsSimpleLineSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer ) { if ( layer->layerType() != "SimpleLine" ) return; // layer type is correct, we can do the cast mLayer = static_cast<QgsSimpleLineSymbolLayerV2*>( layer ); // set values spinWidth->setValue( mLayer->width() ); btnChangeColor->setColor( mLayer->color() ); spinOffset->setValue( mLayer->offset() ); cboPenStyle->blockSignals( true ); cboJoinStyle->blockSignals( true ); cboCapStyle->blockSignals( true ); cboPenStyle->setPenStyle( mLayer->penStyle() ); cboJoinStyle->setPenJoinStyle( mLayer->penJoinStyle() ); cboCapStyle->setPenCapStyle( mLayer->penCapStyle() ); cboPenStyle->blockSignals( false ); cboJoinStyle->blockSignals( false ); cboCapStyle->blockSignals( false ); //use a custom dash pattern? bool useCustomDashPattern = mLayer->useCustomDashPattern(); mChangePatternButton->setEnabled( useCustomDashPattern ); label_3->setEnabled( !useCustomDashPattern ); cboPenStyle->setEnabled( !useCustomDashPattern ); mCustomCheckBox->blockSignals( true ); mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked ); mCustomCheckBox->blockSignals( false ); updatePatternIcon(); }
void QgsSimpleLineSymbolLayerV2Widget::on_mChangePatternButton_clicked() { QgsDashSpaceDialog d( mLayer->customDashVector() ); if ( d.exec() == QDialog::Accepted ) { mLayer->setCustomDashVector( d.dashDotVector() ); updatePatternIcon(); emit changed(); } }
QgsSimpleLineSymbolLayerV2Widget::QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { mLayer = NULL; setupUi( this ); connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( penWidthChanged() ) ); connect( btnChangeColor, SIGNAL( clicked() ), this, SLOT( colorChanged() ) ); connect( cboPenStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( penStyleChanged() ) ); connect( spinOffset, SIGNAL( valueChanged( double ) ), this, SLOT( offsetChanged() ) ); connect( cboCapStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( penStyleChanged() ) ); connect( cboJoinStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( penStyleChanged() ) ); updatePatternIcon(); }
void QgsSimpleLineSymbolLayerV2Widget::colorChanged() { #if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889 // FIXME need to also check max QT_VERSION when Qt bug fixed QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog ); #else QColor color = QColorDialog::getColor( mLayer->color(), this ); #endif if ( !color.isValid() ) return; mLayer->setColor( color ); btnChangeColor->setColor( mLayer->color() ); updatePatternIcon(); emit changed(); }
void QgsSimpleLineSymbolLayerV2Widget::penWidthChanged() { mLayer->setWidth( spinWidth->value() ); updatePatternIcon(); emit changed(); }
void QgsSimpleLineSymbolLayerV2Widget::offsetChanged() { mLayer->setOffset( spinOffset->value() ); updatePatternIcon(); emit changed(); }
void QgsSimpleLineSymbolLayerV2Widget::colorChanged( const QColor& color ) { mLayer->setColor( color ); updatePatternIcon(); emit changed(); }