diff --git a/python/core/qgslabel.sip b/python/core/qgslabel.sip
index 96fb2f7d2f9..515806f1bb0 100644
--- a/python/core/qgslabel.sip
+++ b/python/core/qgslabel.sip
@@ -38,6 +38,7 @@ public:
BorderColor,
BorderStyle,
MultilineEnabled,
+ StrikeOut, // added in 1.5
LabelFieldCount
};
diff --git a/python/core/qgslabelattributes.sip b/python/core/qgslabelattributes.sip
index 984d65d5791..38fdc4982e2 100644
--- a/python/core/qgslabelattributes.sip
+++ b/python/core/qgslabelattributes.sip
@@ -47,6 +47,11 @@ public:
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;
diff --git a/src/app/qgslabeldialog.cpp b/src/app/qgslabeldialog.cpp
index ab2d811f5d0..f5063be9079 100644
--- a/src/app/qgslabeldialog.cpp
+++ b/src/app/qgslabeldialog.cpp
@@ -89,6 +89,10 @@ void QgsLabelDialog::init( )
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 @@ void QgsLabelDialog::init( )
{
mFont.setUnderline( false );
}
+ if ( myLabelAttributes->strikeOutIsSet() )
+ {
+ mFont.setStrikeOut( myLabelAttributes->strikeOut() );
+ }
+ else
+ {
+ mFont.setStrikeOut( false );
+ }
mFontColor = myLabelAttributes->color();
@@ -270,8 +282,6 @@ void QgsLabelDialog::init( )
//NOTE: do we need this line too? TS
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
- //TODO - transparency attributes for buffers
-
}
@@ -364,6 +374,7 @@ void QgsLabelDialog::apply()
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 @@ void QgsLabelDialog::apply()
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() ) );
diff --git a/src/core/qgslabel.cpp b/src/core/qgslabel.cpp
index 7b983c8848f..e2d1e79cb07 100644
--- a/src/core/qgslabel.cpp
+++ b/src/core/qgslabel.cpp
@@ -207,6 +207,16 @@ void QgsLabel::renderLabel( QgsRenderContext &renderContext,
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 @@ void QgsLabel::readXML( const QDomNode& node )
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 @@ void QgsLabel::writeXML( QDomNode & layer_node, QDomDocument & document ) const
}
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() )
diff --git a/src/core/qgslabel.h b/src/core/qgslabel.h
index 27b64132ad7..648dbfd1d9c 100644
--- a/src/core/qgslabel.h
+++ b/src/core/qgslabel.h
@@ -81,6 +81,7 @@ class CORE_EXPORT QgsLabel
BorderColor,
BorderStyle,
MultilineEnabled,
+ StrikeOut, // added in 1.5
LabelFieldCount
};
diff --git a/src/core/qgslabelattributes.cpp b/src/core/qgslabelattributes.cpp
index e8e1259647b..d5f3eb8d5d6 100644
--- a/src/core/qgslabelattributes.cpp
+++ b/src/core/qgslabelattributes.cpp
@@ -31,6 +31,7 @@ QgsLabelAttributes::QgsLabelAttributes( bool def )
mBoldIsSet( false ),
mItalicIsSet( false ),
mUnderlineIsSet( false ),
+ mStrikeOutIsSet( false ),
mSizeType( 0 ),
mSize( 0.0 ),
mSizeIsSet( false ),
@@ -247,6 +248,22 @@ bool QgsLabelAttributes::underline( void ) const
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 )
{
diff --git a/src/core/qgslabelattributes.h b/src/core/qgslabelattributes.h
index b90e75cceb8..baa3df46926 100644
--- a/src/core/qgslabelattributes.h
+++ b/src/core/qgslabelattributes.h
@@ -119,6 +119,11 @@ class CORE_EXPORT QgsLabelAttributes
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 @@ class CORE_EXPORT QgsLabelAttributes
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;
diff --git a/src/ui/qgslabeldialogbase.ui b/src/ui/qgslabeldialogbase.ui
index 4318fff7f84..910de58765b 100644
--- a/src/ui/qgslabeldialogbase.ui
+++ b/src/ui/qgslabeldialogbase.ui
@@ -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
-
-
-
-
-
-
- -
-
-
- 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)
-
-
-
- -
-
-
-
-
+ -
+
+
-
+
+
+ Font size units
+
+
+
-
+
+
+ Points
+
+
+
+ -
+
+
+ Map units
+
+
+
+
+
+
+ -
+
+
+ Offset units
+
+
+
-
+
+
+ X Offset (pts)
+
+
+
+ -
+
+
+ -99.000000000000000
+
+
+
+ -
+
+
+ Points
+
+
+
+ -
+
+
+ Y Offset (pts)
+
+
+
+ -
+
+
+ -99.000000000000000
+
+
+
+ -
+
+
+ Map units
+
+
+
+
+
+
+
+
+
+
+ 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