17 changes: 17 additions & 0 deletions python/core/composer/qgscomposeritem.sip
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,23 @@ class QgsComposerItem : QObject, QGraphicsRectItem
*/
virtual void setFrameOutlineWidth( double outlineWidth );

/** Returns the join style used for drawing the item's frame
* @returns Join style for outline frame
* @note introduced in 2.3
* @see hasFrame
* @see setFrameJoinStyle
*/
Qt::PenJoinStyle frameJoinStyle() const;

/** Sets join style used when drawing the item's frame
* @param style Join style for outline frame
* @returns nothing
* @note introduced in 2.3
* @see setFrameEnabled
* @see frameJoinStyle
*/
void setFrameJoinStyle( Qt::PenJoinStyle style );

/** Returns the estimated amount the item's frame bleeds outside the item's
* actual rectangle. For instance, if the item has a 2mm frame outline, then
* 1mm of this frame is drawn outside the item's rect. In this case the
Expand Down
16 changes: 16 additions & 0 deletions src/app/composer/qgscomposeritemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,19 @@ void QgsComposerItemWidget::on_mOutlineWidthSpinBox_valueChanged( double d )
mItem->endCommand();
}

void QgsComposerItemWidget::on_mFrameJoinStyleCombo_currentIndexChanged( int index )
{
Q_UNUSED( index );
if ( !mItem )
{
return;
}

mItem->beginCommand( tr( "Item frame join style" ) );
mItem->setFrameJoinStyle( mFrameJoinStyleCombo->penJoinStyle() );
mItem->endCommand();
}

void QgsComposerItemWidget::on_mFrameGroupBox_toggled( bool state )
{
if ( !mItem )
Expand Down Expand Up @@ -339,6 +352,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()
mTransparencySlider->blockSignals( true );
mTransparencySpnBx->blockSignals( true );
mFrameColorButton->blockSignals( true );
mFrameJoinStyleCombo->blockSignals( true );
mBackgroundColorButton->blockSignals( true );
mItemRotationSpinBox->blockSignals( true );

Expand All @@ -349,6 +363,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mOutlineWidthSpinBox->setValue( mItem->pen().widthF() );
mFrameJoinStyleCombo->setPenJoinStyle( mItem->frameJoinStyle() );
mItemIdLineEdit->setText( mItem->id() );
mFrameGroupBox->setChecked( mItem->hasFrame() );
mBackgroundGroupBox->setChecked( mItem->hasBackground() );
Expand All @@ -359,6 +374,7 @@ void QgsComposerItemWidget::setValuesForGuiElements()

mBackgroundColorButton->blockSignals( false );
mFrameColorButton->blockSignals( false );
mFrameJoinStyleCombo->blockSignals( false );
mOutlineWidthSpinBox->blockSignals( false );
mFrameGroupBox->blockSignals( false );
mBackgroundGroupBox->blockSignals( false );
Expand Down
1 change: 1 addition & 0 deletions src/app/composer/qgscomposeritemwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa
// void on_mTransparencySpinBox_valueChanged( int value );
void on_mOutlineWidthSpinBox_valueChanged( double d );
void on_mFrameGroupBox_toggled( bool state );
void on_mFrameJoinStyleCombo_currentIndexChanged( int index );
void on_mBackgroundGroupBox_toggled( bool state );
void on_mItemIdLineEdit_editingFinished();

Expand Down
24 changes: 22 additions & 2 deletions src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue
, mFrame( false )
, mBackground( true )
, mBackgroundColor( QColor( 255, 255, 255, 255 ) )
, mFrameJoinStyle( Qt::MiterJoin )
, mItemPositionLocked( false )
, mLastValidViewScaleFactor( -1 )
, mItemRotation( 0 )
Expand All @@ -79,6 +80,7 @@ QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, Q
, mFrame( false )
, mBackground( true )
, mBackgroundColor( QColor( 255, 255, 255, 255 ) )
, mFrameJoinStyle( Qt::MiterJoin )
, mItemPositionLocked( false )
, mLastValidViewScaleFactor( -1 )
, mItemRotation( 0 )
Expand All @@ -100,7 +102,7 @@ void QgsComposerItem::init( bool manageZValue )
setBrush( QBrush( QColor( 255, 255, 255, 255 ) ) );
QPen defaultPen( QColor( 0, 0, 0 ) );
defaultPen.setWidthF( 0.3 );
defaultPen.setJoinStyle( Qt::MiterJoin );
defaultPen.setJoinStyle( mFrameJoinStyle );
setPen( defaultPen );
//let z-Value be managed by composition
if ( mComposition && manageZValue )
Expand Down Expand Up @@ -175,6 +177,7 @@ bool QgsComposerItem::_writeXML( QDomElement& itemElem, QDomDocument& doc ) cons
composerItemElem.setAttribute( "positionMode", QString::number(( int ) mLastUsedPositionMode ) );
composerItemElem.setAttribute( "zValue", QString::number( zValue() ) );
composerItemElem.setAttribute( "outlineWidth", QString::number( pen().widthF() ) );
composerItemElem.setAttribute( "frameJoinStyle", QgsSymbolLayerV2Utils::encodePenJoinStyle( mFrameJoinStyle ) );
composerItemElem.setAttribute( "itemRotation", QString::number( mItemRotation ) );
composerItemElem.setAttribute( "uuid", mUuid );
composerItemElem.setAttribute( "id", mId );
Expand Down Expand Up @@ -315,11 +318,13 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&
penGreen = frameColorElem.attribute( "green" ).toDouble( &greenOk );
penBlue = frameColorElem.attribute( "blue" ).toDouble( &blueOk );
penAlpha = frameColorElem.attribute( "alpha" ).toDouble( &alphaOk );
mFrameJoinStyle = QgsSymbolLayerV2Utils::decodePenJoinStyle( itemElem.attribute( "frameJoinStyle", "miter" ) );

if ( redOk && greenOk && blueOk && alphaOk && widthOk )
{
QPen framePen( QColor( penRed, penGreen, penBlue, penAlpha ) );
framePen.setWidthF( penWidth );
framePen.setJoinStyle( Qt::MiterJoin );
framePen.setJoinStyle( mFrameJoinStyle );
setPen( framePen );
}
}
Expand Down Expand Up @@ -370,6 +375,21 @@ void QgsComposerItem::setFrameOutlineWidth( double outlineWidth )
emit frameChanged();
}

void QgsComposerItem::setFrameJoinStyle( Qt::PenJoinStyle style )
{
if ( mFrameJoinStyle == style )
{
//no change
return;
}
mFrameJoinStyle = style;

QPen itemPen = pen();
itemPen.setJoinStyle( mFrameJoinStyle );
setPen( itemPen );
emit frameChanged();
}

double QgsComposerItem::estimatedFrameBleed() const
{
if ( !hasFrame() )
Expand Down
18 changes: 18 additions & 0 deletions src/core/composer/qgscomposeritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,22 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem
*/
virtual void setFrameOutlineWidth( double outlineWidth );

/** Returns the join style used for drawing the item's frame
* @returns Join style for outline frame
* @note introduced in 2.3
* @see hasFrame
* @see setFrameJoinStyle
*/
Qt::PenJoinStyle frameJoinStyle() const { return mFrameJoinStyle; }
/** Sets join style used when drawing the item's frame
* @param style Join style for outline frame
* @returns nothing
* @note introduced in 2.3
* @see setFrameEnabled
* @see frameJoinStyle
*/
void setFrameJoinStyle( Qt::PenJoinStyle style );

/** Returns the estimated amount the item's frame bleeds outside the item's
* actual rectangle. For instance, if the item has a 2mm frame outline, then
* 1mm of this frame is drawn outside the item's rect. In this case the
Expand Down Expand Up @@ -382,6 +398,8 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem
bool mBackground;
/**Background color*/
QColor mBackgroundColor;
/**Frame join style*/
Qt::PenJoinStyle mFrameJoinStyle;

/**True if item position and size cannot be changed with mouse move
@note: this member was added in version 1.2*/
Expand Down
1 change: 1 addition & 0 deletions src/core/composer/qgscomposershape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ void QgsComposerShape::createDefaultShapeStyleSymbol()
properties.insert( "style_border", "solid" );
properties.insert( "color_border", "black" );
properties.insert( "width_border", "0.3" );
properties.insert( "joinstyle", "miter" );
mShapeStyleSymbol = QgsFillSymbolV2::createSimple( properties );

mMaxSymbolBleed = QgsSymbolLayerV2Utils::estimateMaxSymbolBleed( mShapeStyleSymbol );
Expand Down
1 change: 1 addition & 0 deletions src/core/composer/qgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ void QgsComposition::createDefaultPageStyleSymbol()
properties.insert( "color", "white" );
properties.insert( "style", "solid" );
properties.insert( "style_border", "no" );
properties.insert( "joinstyle", "miter" );
mPageStyleSymbol = QgsFillSymbolV2::createSimple( properties );
}

Expand Down
72 changes: 72 additions & 0 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,16 @@ void QgsSimpleLineSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mDashPatternUnitComboBox->blockSignals( false );

// set values
spinWidth->blockSignals( true );
spinWidth->setValue( mLayer->width() );
spinWidth->blockSignals( false );
btnChangeColor->blockSignals( true );
btnChangeColor->setColor( mLayer->color() );
btnChangeColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColor->blockSignals( false );
spinOffset->blockSignals( true );
spinOffset->setValue( mLayer->offset() );
spinOffset->blockSignals( false );
cboPenStyle->blockSignals( true );
cboJoinStyle->blockSignals( true );
cboCapStyle->blockSignals( true );
Expand Down Expand Up @@ -336,14 +342,26 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer
break;
}
}
btnChangeColorBorder->blockSignals( true );
btnChangeColorBorder->setColor( mLayer->borderColor() );
btnChangeColorBorder->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColorBorder->blockSignals( false );
btnChangeColorFill->blockSignals( true );
btnChangeColorFill->setColor( mLayer->color() );
btnChangeColorFill->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColorFill->blockSignals( false );
spinSize->blockSignals( true );
spinSize->setValue( mLayer->size() );
spinSize->blockSignals( false );
spinAngle->blockSignals( true );
spinAngle->setValue( mLayer->angle() );
spinAngle->blockSignals( false );
mOutlineStyleComboBox->blockSignals( true );
mOutlineStyleComboBox->setPenStyle( mLayer->outlineStyle() );
mOutlineStyleComboBox->blockSignals( false );
mOutlineWidthSpinBox->blockSignals( true );
mOutlineWidthSpinBox->setValue( mLayer->outlineWidth() );
mOutlineWidthSpinBox->blockSignals( false );

// without blocking signals the value gets changed because of slot setOffset()
spinOffsetX->blockSignals( true );
Expand Down Expand Up @@ -552,13 +570,23 @@ void QgsSimpleFillSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mLayer = static_cast<QgsSimpleFillSymbolLayerV2*>( layer );

// set values
btnChangeColor->blockSignals( true );
btnChangeColor->setColor( mLayer->color() );
btnChangeColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColor->blockSignals( false );
cboFillStyle->blockSignals( true );
cboFillStyle->setBrushStyle( mLayer->brushStyle() );
cboFillStyle->blockSignals( false );
btnChangeBorderColor->blockSignals( true );
btnChangeBorderColor->setColor( mLayer->borderColor() );
btnChangeBorderColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeBorderColor->blockSignals( false );
cboBorderStyle->blockSignals( true );
cboBorderStyle->setPenStyle( mLayer->borderStyle() );
cboBorderStyle->blockSignals( false );
spinBorderWidth->blockSignals( true );
spinBorderWidth->setValue( mLayer->borderWidth() );
spinBorderWidth->blockSignals( false );
cboJoinStyle->blockSignals( true );
cboJoinStyle->setPenJoinStyle( mLayer->penJoinStyle() );
cboJoinStyle->blockSignals( false );
Expand Down Expand Up @@ -707,10 +735,14 @@ void QgsGradientFillSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer
mLayer = static_cast<QgsGradientFillSymbolLayerV2*>( layer );

// set values
btnChangeColor->blockSignals( true );
btnChangeColor->setColor( mLayer->color() );
btnChangeColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColor->blockSignals( false );
btnChangeColor2->blockSignals( true );
btnChangeColor2->setColor( mLayer->color2() );
btnChangeColor2->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColor2->blockSignals( false );

if ( mLayer->gradientColorType() == QgsGradientFillSymbolLayerV2::SimpleTwoColor )
{
Expand Down Expand Up @@ -1046,10 +1078,14 @@ void QgsShapeburstFillSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* lay
mLayer = static_cast<QgsShapeburstFillSymbolLayerV2*>( layer );

// set values
btnChangeColor->blockSignals( true );
btnChangeColor->setColor( mLayer->color() );
btnChangeColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColor->blockSignals( false );
btnChangeColor2->blockSignals( true );
btnChangeColor2->setColor( mLayer->color2() );
btnChangeColor2->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColor2->blockSignals( false );

if ( mLayer->colorType() == QgsShapeburstFillSymbolLayerV2::SimpleTwoColor )
{
Expand Down Expand Up @@ -1293,9 +1329,15 @@ void QgsMarkerLineSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mLayer = static_cast<QgsMarkerLineSymbolLayerV2*>( layer );

// set values
spinInterval->blockSignals( true );
spinInterval->setValue( mLayer->interval() );
spinInterval->blockSignals( false );
chkRotateMarker->blockSignals( true );
chkRotateMarker->setChecked( mLayer->rotateMarker() );
chkRotateMarker->blockSignals( false );
spinOffset->blockSignals( true );
spinOffset->setValue( mLayer->offset() );
spinOffset->blockSignals( false );
if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::Interval )
radInterval->setChecked( true );
else if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::Vertex )
Expand Down Expand Up @@ -1650,8 +1692,12 @@ void QgsSvgMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
}
}

spinSize->blockSignals( true );
spinSize->setValue( mLayer->size() );
spinSize->blockSignals( false );
spinAngle->blockSignals( true );
spinAngle->setValue( mLayer->angle() );
spinAngle->blockSignals( false );

// without blocking signals the value gets changed because of slot setOffset()
spinOffsetX->blockSignals( true );
Expand Down Expand Up @@ -1915,9 +1961,13 @@ void QgsSVGFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* layer )
if ( mLayer )
{
double width = mLayer->patternWidth();
mTextureWidthSpinBox->blockSignals( true );
mTextureWidthSpinBox->setValue( width );
mTextureWidthSpinBox->blockSignals( false );
mSVGLineEdit->setText( mLayer->svgFilePath() );
mRotationSpinBox->blockSignals( true );
mRotationSpinBox->setValue( mLayer->angle() );
mRotationSpinBox->blockSignals( false );
mTextureWidthUnitComboBox->blockSignals( true );
mTextureWidthUnitComboBox->setCurrentIndex( mLayer->patternWidthUnit() );
mTextureWidthUnitComboBox->blockSignals( false );
Expand Down Expand Up @@ -2163,9 +2213,15 @@ void QgsLinePatternFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* laye
if ( patternLayer )
{
mLayer = patternLayer;
mAngleSpinBox->blockSignals( true );
mAngleSpinBox->setValue( mLayer->lineAngle() );
mAngleSpinBox->blockSignals( false );
mDistanceSpinBox->blockSignals( true );
mDistanceSpinBox->setValue( mLayer->distance() );
mDistanceSpinBox->blockSignals( false );
mOffsetSpinBox->blockSignals( true );
mOffsetSpinBox->setValue( mLayer->offset() );
mOffsetSpinBox->blockSignals( false );

//units
mDistanceUnitComboBox->blockSignals( true );
Expand Down Expand Up @@ -2280,10 +2336,18 @@ void QgsPointPatternFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayerV2* lay
}

mLayer = static_cast<QgsPointPatternFillSymbolLayer*>( layer );
mHorizontalDistanceSpinBox->blockSignals( true );
mHorizontalDistanceSpinBox->setValue( mLayer->distanceX() );
mHorizontalDistanceSpinBox->blockSignals( false );
mVerticalDistanceSpinBox->blockSignals( true );
mVerticalDistanceSpinBox->setValue( mLayer->distanceY() );
mVerticalDistanceSpinBox->blockSignals( false );
mHorizontalDisplacementSpinBox->blockSignals( true );
mHorizontalDisplacementSpinBox->setValue( mLayer->displacementX() );
mHorizontalDisplacementSpinBox->blockSignals( false );
mVerticalDisplacementSpinBox->blockSignals( true );
mVerticalDisplacementSpinBox->setValue( mLayer->displacementY() );
mVerticalDisplacementSpinBox->blockSignals( false );

mHorizontalDistanceUnitComboBox->blockSignals( true );
mHorizontalDistanceUnitComboBox->setCurrentIndex( mLayer->distanceXUnit() );
Expand Down Expand Up @@ -2441,11 +2505,19 @@ void QgsFontMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mLayer = static_cast<QgsFontMarkerSymbolLayerV2*>( layer );

// set values
cboFont->blockSignals( true );
cboFont->setCurrentFont( QFont( mLayer->fontFamily() ) );
cboFont->blockSignals( false );
spinSize->blockSignals( true );
spinSize->setValue( mLayer->size() );
spinSize->blockSignals( false );
btnColor->blockSignals( true );
btnColor->setColor( mLayer->color() );
btnColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnColor->blockSignals( false );
spinAngle->blockSignals( true );
spinAngle->setValue( mLayer->angle() );
spinAngle->blockSignals( false );

//block
spinOffsetX->blockSignals( true );
Expand Down
Loading