Index: python/core/qgslabelattributes.sip =================================================================== --- python/core/qgslabelattributes.sip (revision 12578) +++ python/core/qgslabelattributes.sip (working copy) @@ -47,6 +47,11 @@ bool underlineIsSet ( ) const; bool underline ( ) const; + /* strikeout added in 1.5 */ + void setStrikeOut( bool enable ); + bool strikeOutIsSet ( ) const; + bool strikeOut ( ) const; + void setSize ( double size, int type ); bool sizeIsSet ( ) const; int sizeType ( ) const; Index: python/core/qgslabel.sip =================================================================== --- python/core/qgslabel.sip (revision 12578) +++ python/core/qgslabel.sip (working copy) @@ -38,6 +38,7 @@ BorderColor, BorderStyle, MultilineEnabled, + StrikeOut, // added in 1.5 LabelFieldCount }; Index: src/app/qgslabeldialog.cpp =================================================================== --- src/app/qgslabeldialog.cpp (revision 12582) +++ src/app/qgslabeldialog.cpp (working copy) @@ -89,6 +89,10 @@ cboUnderlineField->addItems( myFieldStringList ); cboUnderlineField->setCurrentIndex( itemNoForField( mLabel->labelField( QgsLabel::Underline ), myFieldStringList ) ); + cboStrikeOutField->clear(); + cboStrikeOutField->addItems( myFieldStringList ); + cboStrikeOutField->setCurrentIndex( itemNoForField( mLabel->labelField( QgsLabel::StrikeOut ), myFieldStringList ) ); + cboFontSizeField->clear(); cboFontSizeField->addItems( myFieldStringList ); cboFontSizeField->setCurrentIndex( itemNoForField( mLabel->labelField( QgsLabel::Size ), myFieldStringList ) ); @@ -196,6 +200,14 @@ { mFont.setUnderline( false ); } + if ( myLabelAttributes->strikeOutIsSet() ) + { + mFont.setStrikeOut( myLabelAttributes->strikeOut() ); + } + else + { + mFont.setStrikeOut( false ); + } mFontColor = myLabelAttributes->color(); @@ -270,8 +282,6 @@ //NOTE: do we need this line too? TS spinBufferSize->setValue( myLabelAttributes->bufferSize() ); - //TODO - transparency attributes for buffers - } @@ -364,6 +374,7 @@ myLabelAttributes->setBold( mFont.bold() ); myLabelAttributes->setItalic( mFont.italic() ); myLabelAttributes->setUnderline( mFont.underline() ); + myLabelAttributes->setStrikeOut( mFont.strikeOut() ); myLabelAttributes->setColor( mFontColor ); myTypeInt = 0; if ( radioOffsetUnitsPoints->isChecked() ) @@ -412,6 +423,7 @@ mLabel->setLabelField( QgsLabel::Bold, fieldIndexFromName( cboBoldField->currentText() ) ); mLabel->setLabelField( QgsLabel::Italic, fieldIndexFromName( cboItalicField->currentText() ) ); mLabel->setLabelField( QgsLabel::Underline, fieldIndexFromName( cboUnderlineField->currentText() ) ); + mLabel->setLabelField( QgsLabel::StrikeOut, fieldIndexFromName( cboStrikeOutField->currentText() ) ); mLabel->setLabelField( QgsLabel::Size, fieldIndexFromName( cboFontSizeField->currentText() ) ); mLabel->setLabelField( QgsLabel::SizeType, fieldIndexFromName( cboFontSizeTypeField->currentText() ) ); mLabel->setLabelField( QgsLabel::Color, fieldIndexFromName( cboFontColorField->currentText() ) ); Index: src/core/qgslabelattributes.cpp =================================================================== --- src/core/qgslabelattributes.cpp (revision 12578) +++ src/core/qgslabelattributes.cpp (working copy) @@ -31,6 +31,7 @@ mBoldIsSet( false ), mItalicIsSet( false ), mUnderlineIsSet( false ), + mStrikeOutIsSet( false ), mSizeType( 0 ), mSize( 0.0 ), mSizeIsSet( false ), @@ -247,7 +248,23 @@ return mFont.underline(); } +void QgsLabelAttributes::setStrikeOut( bool enable ) +{ + mFont.setStrikeOut( enable ); + mStrikeOutIsSet = true; +} +bool QgsLabelAttributes::strikeOutIsSet( void ) const +{ + return mStrikeOutIsSet; +} + +bool QgsLabelAttributes::strikeOut( void ) const +{ + return mFont.strikeOut(); +} + + void QgsLabelAttributes::setSize( double size, int type ) { mSizeType = type; Index: src/core/qgslabel.cpp =================================================================== --- src/core/qgslabel.cpp (revision 12578) +++ src/core/qgslabel.cpp (working copy) @@ -207,6 +207,16 @@ font.setUnderline(( bool ) value.toInt() ); } + value = fieldValue( StrikeOut, feature ); + if ( value.isEmpty() ) + { + font.setStrikeOut( mLabelAttributes->strikeOut() ); + } + else + { + font.setStrikeOut(( bool ) value.toInt() ); + } + // QgsPoint overridePoint; bool useOverridePoint = false; @@ -832,6 +842,20 @@ readLabelField( el, Underline ); } + /* Strikeout */ + scratchNode = node.namedItem( "strikeout" ); + + if ( scratchNode.isNull() ) + { + QgsDebugMsg( "couldn't find QgsLabel ``strikeout'' attribute" ); + } + else + { + el = scratchNode.toElement(); + mLabelAttributes->setStrikeOut(( bool )el.attribute( "on", "0" ).toInt() ); + readLabelField( el, StrikeOut ); + } + /* Color */ scratchNode = node.namedItem( "color" ); @@ -1130,6 +1154,27 @@ } labelattributes.appendChild( underline ); + // strikeout + QDomElement strikeOut = document.createElement( "strikeout" ); + if ( mLabelAttributes->strikeOutIsSet() ) + { + strikeOut.setAttribute( "on", mLabelAttributes->strikeOut() ); + if ( mLabelFieldIdx[StrikeOut] != -1 ) + { + strikeOut.setAttribute( "fieldname", labelField( StrikeOut ) ); + } + else + { + strikeOut.setAttribute( "fieldname", "" ); + } + } + else + { + strikeOut.setAttribute( "on", 0 ); + strikeOut.setAttribute( "fieldname", "" ); + } + labelattributes.appendChild( strikeOut ); + // color QDomElement color = document.createElement( "color" ); if ( mLabelAttributes->colorIsSet() ) Index: src/core/qgslabel.h =================================================================== --- src/core/qgslabel.h (revision 12578) +++ src/core/qgslabel.h (working copy) @@ -81,6 +81,7 @@ BorderColor, BorderStyle, MultilineEnabled, + StrikeOut, // added in 1.5 LabelFieldCount }; Index: src/core/qgslabelattributes.h =================================================================== --- src/core/qgslabelattributes.h (revision 12578) +++ src/core/qgslabelattributes.h (working copy) @@ -119,6 +119,11 @@ bool underlineIsSet( void ) const; bool underline( void ) const; + /* strikeout added in 1.5 */ + void setStrikeOut( bool enable ); + bool strikeOutIsSet( void ) const; + bool strikeOut( void ) const; + void setSize( double size, int type ); bool sizeIsSet( void ) const; int sizeType( void ) const; @@ -185,12 +190,13 @@ QString mText; bool mTextIsSet; - /** Font (family, weight, italic, underline) */ + /** Font (family, weight, italic, underline, strikeout) */ QFont mFont; bool mFamilyIsSet; bool mBoldIsSet; bool mItalicIsSet; bool mUnderlineIsSet; + bool mStrikeOutIsSet; /** Font size, size type */ int mSizeType; Index: src/ui/qgslabeldialogbase.ui =================================================================== --- src/ui/qgslabeldialogbase.ui (revision 12582) +++ src/ui/qgslabeldialogbase.ui (working copy) @@ -6,8 +6,8 @@ 0 0 - 642 - 516 + 662 + 561 @@ -19,277 +19,275 @@ Form1 - - - 0 - - - - - true + + + + + 0 - + 0 - -990 - 619 - 1440 + 0 + 644 + 365 - - - - - - - Basic label options - - - - - - Field containing label - - - cboLabelField - - - - - - - - 1 - 0 - - - - - - - - Default label - - - leDefaultLabel - - - - - - - - 2 - 0 - - - - - - - - - 2 - 0 - - - - Font - - - - - - - Font size - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - spinFontSize - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - 6 - - - 1000000.000000000000000 - - - 0.000000000000000 - - - - - - - - 2 - 0 - - - - Color - - - - - - - Angle (deg) - - - spinAngle - - - - - - - ° - - - 360 - - - 0 - - - - - - - Multiline labels? - - - true - - - - - - - - - - - - Placement - - - - 11 + + Basic label options and placement + + + + + 10 + 0 + 621 + 174 + + + + Basic label options + + + + + + Field containing label - - - - Below Right - - - - - - - Right - - - - - - - Below - - - - - - - Over - - - true - - - - - - - Above - - - - - - - Left - - - - - - - Below Left - - - - - - - Above Right - - - - - - - Above Left - - - - - - - - - - Font size units - - - - - - Points - - - - - - - Map units - - - - - - - + + cboLabelField + + + + + + + + 1 + 0 + + + + + + + + Default label + + + leDefaultLabel + + + + + + + + 2 + 0 + + + + + + + + + 2 + 0 + + + + Font + + + + + + + Font size + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spinFontSize + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + 6 + + + 1000000.000000000000000 + + + 0.000000000000000 + + + + + + + + 2 + 0 + + + + Color + + + + + + + Angle (deg) + + + spinAngle + + + + + + + ° + + + 360 + + + 0 + + + + + + + Multiline labels? + + + true + + + + + + + + + 10 + 180 + 621 + 106 + + + + Placement + + + + 11 + + + + + Below Right + + + + + + + Right + + + + + + + Below + + + + + + + Over + + + true + + + + + + + Above + + + + + + + Left + + + + + + + Below Left + + + + + + + Above Right + + + + + + + Above Left + + + + + + + + + + 0 + 0 + 644 + 365 + + + + Scale dependent rendering, buffer labels, font size units and offset + + + Use scale dependent rendering @@ -350,7 +348,7 @@ - + true @@ -440,404 +438,465 @@ - - - - Offset units - - - - - - X Offset (pts) - - - - - - - Y Offset (pts) - - - - - - - -99.000000000000000 - - - - - - - -99.000000000000000 - - - - - - - Points - - - - - - - Map units - - - - - + + + + + + Font size units + + + + + + Points + + + + + + + Map units + + + + + + + + + + Offset units + + + + + + X Offset (pts) + + + + + + + -99.000000000000000 + + + + + + + Points + + + + + + + Y Offset (pts) + + + + + + + -99.000000000000000 + + + + + + + Map units + + + + + + + - - - - Data defined placement - - - - - - - 0 - 0 - - - - Placement - - - - - - - - - - - 0 - 0 - - - - Angle (deg) - - - - - - - - - - - - - Data defined properties - - - - - - - 0 - 0 - - - - &Font family - - - cboFontField - - - - - - - - - - - 0 - 0 - - - - &Bold - - - cboBoldField - - - - - - - - - - - 0 - 0 - - - - &Italic - - - cboItalicField - - - - - - - - - - - 0 - 0 - - - - &Underline - - - cboUnderlineField - - - - - - - - - - - 0 - 0 - - - - &Size - - - cboFontSizeField - - - - - - - - - - - 0 - 0 - - - - Size units - - - cboFontSizeTypeField - - - - - - - - - - false - - - - 0 - 0 - - - - Transparency - - - cboFontTransparencyField - - - - - - - false - - - - - - - - 0 - 0 - - - - &Color - - - cboFontColorField - - - - - - - - - - - - - Data defined buffer - - - - - - false - - - - 0 - 0 - - - - - 70 - 0 - - - - Transparency: - - - cboBufferTransparencyField - - - - - - - false - - - - - - - - 0 - 0 - - - - Size: - - - cboBufferSizeField - - - - - - - - - - - - - Data defined position - - - - - - - 0 - 0 - - - - X Coordinate - - - - - - - - - - - 0 - 0 - - - - Y Coordinate - - - - - - - - - - - 0 - 0 - - - - X Offset (pts) - - - - - - - - - - - 0 - 0 - - - - Y Offset (pts) - - - - - - - - - + + + + 0 + 0 + 644 + 365 + + + + Data defined settings (placement and properties) + + + + + 10 + 0 + 621 + 84 + + + + Data defined placement + + + + + + + 0 + 0 + + + + Placement + + + + + + + + + + + 0 + 0 + + + + Angle (deg) + + + + + + + + + + + + 10 + 90 + 621 + 246 + + + + Data defined properties + + + + + + + 0 + 0 + + + + &Font family + + + cboFontField + + + + + + + + + + + 0 + 0 + + + + &Bold + + + cboBoldField + + + + + + + + + + + 0 + 0 + + + + &Italic + + + cboItalicField + + + + + + + + + + + 0 + 0 + + + + &Underline + + + cboUnderlineField + + + + + + + + + + + 0 + 0 + + + + &Size + + + cboFontSizeField + + + + + + + + + + + 0 + 0 + + + + Size units + + + cboFontSizeTypeField + + + + + + + + + + + 0 + 0 + + + + &Color + + + cboFontColorField + + + + + + + + + + + + + Strikeout + + + + + + + + + + 0 + 0 + 644 + 365 + + + + Data defined settings: buffer and position + + + + + 10 + 0 + 621 + 84 + + + + Data defined buffer + + + + + + false + + + + 0 + 0 + + + + + 70 + 0 + + + + Transparency: + + + cboBufferTransparencyField + + + + + + + false + + + + + + + + 0 + 0 + + + + Size: + + + cboBufferSizeField + + + + + + + + + + + + 10 + 90 + 621 + 138 + + + + Data defined position + + + + + + + 0 + 0 + + + + X Coordinate + + + + + + + + + + + 0 + 0 + + + + Y Coordinate + + + + + + + + + + + 0 + 0 + + + + X Offset (pts) + + + + + + + + + + + 0 + 0 + + + + Y Offset (pts) + + + + + + + + + - + @@ -872,7 +931,6 @@ - scrollArea cboLabelField leDefaultLabel btnDefaultFont @@ -889,21 +947,13 @@ radioBelowLeft radioBelow radioBelowRight - radioFontSizeUnitsPoints - radioFontSizeUnitsMap - chkUseScaleDependentRendering spinMinimumScale spinMaximumScale - chkUseBuffer pbnDefaultBufferColor_2 spinBufferSize radioBufferUnitsPoints radioBufferUnitsMap spinBufferTransparency - spinXOffset - spinYOffset - radioOffsetUnitsPoints - radioOffsetUnitsMap cboAlignmentField cboAngleField cboFontField @@ -912,7 +962,7 @@ cboUnderlineField cboFontSizeField cboFontSizeTypeField - cboFontTransparencyField + cboStrikeOutField cboFontColorField cboBufferTransparencyField cboBufferSizeField