Skip to content

Commit

Permalink
Don't try to reuse True value in enum, causes Python issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 12, 2020
1 parent cd52fab commit bf71382
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions python/core/auto_additions/qgstextcharacterformat.py
@@ -1,7 +1,7 @@
# The following has been generated automatically from src/core/textrenderer/qgstextcharacterformat.h
# monkey patching scoped based enum
QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ = "Property is not set"
QgsTextCharacterFormat.BooleanValue.True.__doc__ = "Property is set and ``True``"
QgsTextCharacterFormat.BooleanValue.False.__doc__ = "Property is set and ``False``"
QgsTextCharacterFormat.BooleanValue.__doc__ = 'Status values for boolean format properties\n\n' + '* ``NotSet``: ' + QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ + '\n' + '* ``True``: ' + QgsTextCharacterFormat.BooleanValue.True.__doc__ + '\n' + '* ``False``: ' + QgsTextCharacterFormat.BooleanValue.False.__doc__
QgsTextCharacterFormat.BooleanValue.SetTrue.__doc__ = "Property is set and ``True``"
QgsTextCharacterFormat.BooleanValue.SetFalse.__doc__ = "Property is set and ``False``"
QgsTextCharacterFormat.BooleanValue.__doc__ = 'Status values for boolean format properties\n\n' + '* ``NotSet``: ' + QgsTextCharacterFormat.BooleanValue.NotSet.__doc__ + '\n' + '* ``SetTrue``: ' + QgsTextCharacterFormat.BooleanValue.SetTrue.__doc__ + '\n' + '* ``SetFalse``: ' + QgsTextCharacterFormat.BooleanValue.SetFalse.__doc__
# --
Expand Up @@ -40,8 +40,8 @@ Constructor for QgsTextCharacterFormat, based on the specified QTextCharFormat `
enum class BooleanValue
{
NotSet,
True,
False,
SetTrue,
SetFalse,
};

QColor textColor() const;
Expand Down
16 changes: 8 additions & 8 deletions src/core/textrenderer/qgstextcharacterformat.cpp
Expand Up @@ -21,11 +21,11 @@ QgsTextCharacterFormat::QgsTextCharacterFormat( const QTextCharFormat &format )
: mTextColor( format.hasProperty( QTextFormat::ForegroundBrush ) ? format.foreground().color() : QColor() )
#if 0 // settings which affect font metrics are disabled for now
, mFontWeight( format.hasProperty( QTextFormat::FontWeight ) ? format.fontWeight() : -1 )
, mItalic( format.hasProperty( QTextFormat::FontItalic ) ? ( format.fontItalic() ? BooleanValue::True : BooleanValue::False ) : BooleanValue::NotSet )
, mItalic( format.hasProperty( QTextFormat::FontItalic ) ? ( format.fontItalic() ? BooleanValue::SetTrue : BooleanValue::SetFalse ) : BooleanValue::NotSet )
#endif
, mStrikethrough( format.hasProperty( QTextFormat::FontStrikeOut ) ? ( format.fontStrikeOut() ? BooleanValue::True : BooleanValue::False ) : BooleanValue::NotSet )
, mUnderline( format.hasProperty( QTextFormat::FontUnderline ) ? ( format.fontUnderline() ? BooleanValue::True : BooleanValue::False ) : BooleanValue::NotSet )
, mOverline( format.hasProperty( QTextFormat::FontOverline ) ? ( format.fontOverline() ? BooleanValue::True : BooleanValue::False ) : BooleanValue::NotSet )
, mStrikethrough( format.hasProperty( QTextFormat::FontStrikeOut ) ? ( format.fontStrikeOut() ? BooleanValue::SetTrue : BooleanValue::SetFalse ) : BooleanValue::NotSet )
, mUnderline( format.hasProperty( QTextFormat::FontUnderline ) ? ( format.fontUnderline() ? BooleanValue::SetTrue : BooleanValue::SetFalse ) : BooleanValue::NotSet )
, mOverline( format.hasProperty( QTextFormat::FontOverline ) ? ( format.fontOverline() ? BooleanValue::SetTrue : BooleanValue::SetFalse ) : BooleanValue::NotSet )
{

}
Expand Down Expand Up @@ -73,15 +73,15 @@ void QgsTextCharacterFormat::setOverline( QgsTextCharacterFormat::BooleanValue e
void QgsTextCharacterFormat::updateFontForFormat( QFont &font ) const
{
if ( mUnderline != BooleanValue::NotSet )
font.setUnderline( mUnderline == QgsTextCharacterFormat::BooleanValue::True );
font.setUnderline( mUnderline == QgsTextCharacterFormat::BooleanValue::SetTrue );
if ( mOverline != BooleanValue::NotSet )
font.setOverline( mOverline == QgsTextCharacterFormat::BooleanValue::True );
font.setOverline( mOverline == QgsTextCharacterFormat::BooleanValue::SetTrue );
if ( mStrikethrough != QgsTextCharacterFormat::BooleanValue::NotSet )
font.setStrikeOut( mStrikethrough == QgsTextCharacterFormat::BooleanValue::True );
font.setStrikeOut( mStrikethrough == QgsTextCharacterFormat::BooleanValue::SetTrue );

#if 0 // settings which affect font metrics are disabled for now
if ( mItalic != QgsTextCharacterFormat::BooleanValue::NotSet )
font.setItalic( mItalic == QgsTextCharacterFormat::BooleanValue::True );
font.setItalic( mItalic == QgsTextCharacterFormat::BooleanValue::SetTrue );
if ( mFontWeight != -1 )
font.setWeight( mFontWeight );
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/core/textrenderer/qgstextcharacterformat.h
Expand Up @@ -51,8 +51,8 @@ class CORE_EXPORT QgsTextCharacterFormat
enum class BooleanValue
{
NotSet, //!< Property is not set
True, //!< Property is set and TRUE
False, //!< Property is set and FALSE
SetTrue, //!< Property is set and TRUE
SetFalse, //!< Property is set and FALSE
};

/**
Expand Down

0 comments on commit bf71382

Please sign in to comment.