mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
apply #2199
git-svn-id: http://svn.osgeo.org/qgis/trunk@12642 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
9b7a041be7
commit
7003ed00c4
@ -38,6 +38,7 @@ public:
|
|||||||
BorderColor,
|
BorderColor,
|
||||||
BorderStyle,
|
BorderStyle,
|
||||||
MultilineEnabled,
|
MultilineEnabled,
|
||||||
|
StrikeOut, // added in 1.5
|
||||||
LabelFieldCount
|
LabelFieldCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +47,11 @@ public:
|
|||||||
bool underlineIsSet ( ) const;
|
bool underlineIsSet ( ) const;
|
||||||
bool underline ( ) 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 );
|
void setSize ( double size, int type );
|
||||||
bool sizeIsSet ( ) const;
|
bool sizeIsSet ( ) const;
|
||||||
int sizeType ( ) const;
|
int sizeType ( ) const;
|
||||||
|
@ -89,6 +89,10 @@ void QgsLabelDialog::init( )
|
|||||||
cboUnderlineField->addItems( myFieldStringList );
|
cboUnderlineField->addItems( myFieldStringList );
|
||||||
cboUnderlineField->setCurrentIndex( itemNoForField( mLabel->labelField( QgsLabel::Underline ), 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->clear();
|
||||||
cboFontSizeField->addItems( myFieldStringList );
|
cboFontSizeField->addItems( myFieldStringList );
|
||||||
cboFontSizeField->setCurrentIndex( itemNoForField( mLabel->labelField( QgsLabel::Size ), myFieldStringList ) );
|
cboFontSizeField->setCurrentIndex( itemNoForField( mLabel->labelField( QgsLabel::Size ), myFieldStringList ) );
|
||||||
@ -196,6 +200,14 @@ void QgsLabelDialog::init( )
|
|||||||
{
|
{
|
||||||
mFont.setUnderline( false );
|
mFont.setUnderline( false );
|
||||||
}
|
}
|
||||||
|
if ( myLabelAttributes->strikeOutIsSet() )
|
||||||
|
{
|
||||||
|
mFont.setStrikeOut( myLabelAttributes->strikeOut() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mFont.setStrikeOut( false );
|
||||||
|
}
|
||||||
|
|
||||||
mFontColor = myLabelAttributes->color();
|
mFontColor = myLabelAttributes->color();
|
||||||
|
|
||||||
@ -270,8 +282,6 @@ void QgsLabelDialog::init( )
|
|||||||
|
|
||||||
//NOTE: do we need this line too? TS
|
//NOTE: do we need this line too? TS
|
||||||
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
|
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
|
||||||
//TODO - transparency attributes for buffers
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -364,6 +374,7 @@ void QgsLabelDialog::apply()
|
|||||||
myLabelAttributes->setBold( mFont.bold() );
|
myLabelAttributes->setBold( mFont.bold() );
|
||||||
myLabelAttributes->setItalic( mFont.italic() );
|
myLabelAttributes->setItalic( mFont.italic() );
|
||||||
myLabelAttributes->setUnderline( mFont.underline() );
|
myLabelAttributes->setUnderline( mFont.underline() );
|
||||||
|
myLabelAttributes->setStrikeOut( mFont.strikeOut() );
|
||||||
myLabelAttributes->setColor( mFontColor );
|
myLabelAttributes->setColor( mFontColor );
|
||||||
myTypeInt = 0;
|
myTypeInt = 0;
|
||||||
if ( radioOffsetUnitsPoints->isChecked() )
|
if ( radioOffsetUnitsPoints->isChecked() )
|
||||||
@ -412,6 +423,7 @@ void QgsLabelDialog::apply()
|
|||||||
mLabel->setLabelField( QgsLabel::Bold, fieldIndexFromName( cboBoldField->currentText() ) );
|
mLabel->setLabelField( QgsLabel::Bold, fieldIndexFromName( cboBoldField->currentText() ) );
|
||||||
mLabel->setLabelField( QgsLabel::Italic, fieldIndexFromName( cboItalicField->currentText() ) );
|
mLabel->setLabelField( QgsLabel::Italic, fieldIndexFromName( cboItalicField->currentText() ) );
|
||||||
mLabel->setLabelField( QgsLabel::Underline, fieldIndexFromName( cboUnderlineField->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::Size, fieldIndexFromName( cboFontSizeField->currentText() ) );
|
||||||
mLabel->setLabelField( QgsLabel::SizeType, fieldIndexFromName( cboFontSizeTypeField->currentText() ) );
|
mLabel->setLabelField( QgsLabel::SizeType, fieldIndexFromName( cboFontSizeTypeField->currentText() ) );
|
||||||
mLabel->setLabelField( QgsLabel::Color, fieldIndexFromName( cboFontColorField->currentText() ) );
|
mLabel->setLabelField( QgsLabel::Color, fieldIndexFromName( cboFontColorField->currentText() ) );
|
||||||
|
@ -207,6 +207,16 @@ void QgsLabel::renderLabel( QgsRenderContext &renderContext,
|
|||||||
font.setUnderline(( bool ) value.toInt() );
|
font.setUnderline(( bool ) value.toInt() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value = fieldValue( StrikeOut, feature );
|
||||||
|
if ( value.isEmpty() )
|
||||||
|
{
|
||||||
|
font.setStrikeOut( mLabelAttributes->strikeOut() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
font.setStrikeOut(( bool ) value.toInt() );
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
QgsPoint overridePoint;
|
QgsPoint overridePoint;
|
||||||
bool useOverridePoint = false;
|
bool useOverridePoint = false;
|
||||||
@ -832,6 +842,20 @@ void QgsLabel::readXML( const QDomNode& node )
|
|||||||
readLabelField( el, Underline );
|
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 */
|
/* Color */
|
||||||
scratchNode = node.namedItem( "color" );
|
scratchNode = node.namedItem( "color" );
|
||||||
|
|
||||||
@ -1130,6 +1154,27 @@ void QgsLabel::writeXML( QDomNode & layer_node, QDomDocument & document ) const
|
|||||||
}
|
}
|
||||||
labelattributes.appendChild( underline );
|
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
|
// color
|
||||||
QDomElement color = document.createElement( "color" );
|
QDomElement color = document.createElement( "color" );
|
||||||
if ( mLabelAttributes->colorIsSet() )
|
if ( mLabelAttributes->colorIsSet() )
|
||||||
|
@ -81,6 +81,7 @@ class CORE_EXPORT QgsLabel
|
|||||||
BorderColor,
|
BorderColor,
|
||||||
BorderStyle,
|
BorderStyle,
|
||||||
MultilineEnabled,
|
MultilineEnabled,
|
||||||
|
StrikeOut, // added in 1.5
|
||||||
LabelFieldCount
|
LabelFieldCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ QgsLabelAttributes::QgsLabelAttributes( bool def )
|
|||||||
mBoldIsSet( false ),
|
mBoldIsSet( false ),
|
||||||
mItalicIsSet( false ),
|
mItalicIsSet( false ),
|
||||||
mUnderlineIsSet( false ),
|
mUnderlineIsSet( false ),
|
||||||
|
mStrikeOutIsSet( false ),
|
||||||
mSizeType( 0 ),
|
mSizeType( 0 ),
|
||||||
mSize( 0.0 ),
|
mSize( 0.0 ),
|
||||||
mSizeIsSet( false ),
|
mSizeIsSet( false ),
|
||||||
@ -247,6 +248,22 @@ bool QgsLabelAttributes::underline( void ) const
|
|||||||
return mFont.underline();
|
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 )
|
void QgsLabelAttributes::setSize( double size, int type )
|
||||||
{
|
{
|
||||||
|
@ -119,6 +119,11 @@ class CORE_EXPORT QgsLabelAttributes
|
|||||||
bool underlineIsSet( void ) const;
|
bool underlineIsSet( void ) const;
|
||||||
bool underline( 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 );
|
void setSize( double size, int type );
|
||||||
bool sizeIsSet( void ) const;
|
bool sizeIsSet( void ) const;
|
||||||
int sizeType( void ) const;
|
int sizeType( void ) const;
|
||||||
@ -185,12 +190,13 @@ class CORE_EXPORT QgsLabelAttributes
|
|||||||
QString mText;
|
QString mText;
|
||||||
bool mTextIsSet;
|
bool mTextIsSet;
|
||||||
|
|
||||||
/** Font (family, weight, italic, underline) */
|
/** Font (family, weight, italic, underline, strikeout) */
|
||||||
QFont mFont;
|
QFont mFont;
|
||||||
bool mFamilyIsSet;
|
bool mFamilyIsSet;
|
||||||
bool mBoldIsSet;
|
bool mBoldIsSet;
|
||||||
bool mItalicIsSet;
|
bool mItalicIsSet;
|
||||||
bool mUnderlineIsSet;
|
bool mUnderlineIsSet;
|
||||||
|
bool mStrikeOutIsSet;
|
||||||
|
|
||||||
/** Font size, size type */
|
/** Font size, size type */
|
||||||
int mSizeType;
|
int mSizeType;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user