mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-09 00:17:27 -05:00
Fix accidental api break
QFlags created from enum classes aren't automatically converted from an int value passed by Python code, so we need to create compatibility functions for the older variants which accept plain ints
This commit is contained in:
parent
0bd603cf45
commit
4e73dd92b9
@ -289,13 +289,20 @@ Returns the capabilities for the data item.
|
|||||||
.. seealso:: :py:func:`setCapabilities`
|
.. seealso:: :py:func:`setCapabilities`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
virtual void setCapabilities( Qgis::BrowserItemCapabilities capabilities );
|
virtual void setCapabilities( Qgis::BrowserItemCapabilities capabilities ) /PyName=setCapabilitiesV2/;
|
||||||
%Docstring
|
%Docstring
|
||||||
Sets the capabilities for the data item.
|
Sets the capabilities for the data item.
|
||||||
|
|
||||||
.. seealso:: :py:func:`capabilities2`
|
.. seealso:: :py:func:`capabilities2`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
void setCapabilities( int capabilities ) /Deprecated/;
|
||||||
|
%Docstring
|
||||||
|
|
||||||
|
.. deprecated::
|
||||||
|
use setCapabilitiesV2 instead.
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
static int findItem( QVector<QgsDataItem *> items, QgsDataItem *item );
|
static int findItem( QVector<QgsDataItem *> items, QgsDataItem *item );
|
||||||
|
|
||||||
|
|||||||
@ -325,7 +325,7 @@ matches the settings from that context.
|
|||||||
.. seealso:: :py:func:`drawPreviewIcon`
|
.. seealso:: :py:func:`drawPreviewIcon`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
QImage bigSymbolPreviewImage( QgsExpressionContext *expressionContext = 0, Qgis::SymbolPreviewFlags flags = Qgis::SymbolPreviewFlag::FlagIncludeCrosshairsForMarkerSymbols );
|
QImage bigSymbolPreviewImage( QgsExpressionContext *expressionContext = 0, Qgis::SymbolPreviewFlags flags = Qgis::SymbolPreviewFlag::FlagIncludeCrosshairsForMarkerSymbols ) /PyName=bigSymbolPreviewImageV2/;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns a large (roughly 100x100 pixel) preview image for the symbol.
|
Returns a large (roughly 100x100 pixel) preview image for the symbol.
|
||||||
|
|
||||||
@ -338,6 +338,13 @@ Returns a large (roughly 100x100 pixel) preview image for the symbol.
|
|||||||
.. seealso:: :py:func:`drawPreviewIcon`
|
.. seealso:: :py:func:`drawPreviewIcon`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
QImage bigSymbolPreviewImage( QgsExpressionContext *expressionContext = 0, int flags = static_cast< int >( Qgis::SymbolPreviewFlag::FlagIncludeCrosshairsForMarkerSymbols ) ) /Deprecated/;
|
||||||
|
%Docstring
|
||||||
|
|
||||||
|
.. deprecated::
|
||||||
|
use bigSymbolPreviewImageV2 instead.
|
||||||
|
%End
|
||||||
|
|
||||||
QString dump() const;
|
QString dump() const;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns a string dump of the symbol's properties.
|
Returns a string dump of the symbol's properties.
|
||||||
|
|||||||
@ -525,6 +525,11 @@ bool QgsDataItem::rename( const QString & )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsDataItem::setCapabilities( int capabilities )
|
||||||
|
{
|
||||||
|
setCapabilities( static_cast< Qgis::BrowserItemCapabilities >( capabilities ) );
|
||||||
|
}
|
||||||
|
|
||||||
Qgis::BrowserItemState QgsDataItem::state() const
|
Qgis::BrowserItemState QgsDataItem::state() const
|
||||||
{
|
{
|
||||||
return mState;
|
return mState;
|
||||||
|
|||||||
@ -291,7 +291,12 @@ class CORE_EXPORT QgsDataItem : public QObject
|
|||||||
*
|
*
|
||||||
* \see capabilities2()
|
* \see capabilities2()
|
||||||
*/
|
*/
|
||||||
virtual void setCapabilities( Qgis::BrowserItemCapabilities capabilities ) { mCapabilities = capabilities; }
|
virtual void setCapabilities( Qgis::BrowserItemCapabilities capabilities ) SIP_PYNAME( setCapabilitiesV2 ) { mCapabilities = capabilities; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \deprecated use setCapabilitiesV2 instead.
|
||||||
|
*/
|
||||||
|
Q_DECL_DEPRECATED void setCapabilities( int capabilities ) SIP_DEPRECATED;
|
||||||
|
|
||||||
// static methods
|
// static methods
|
||||||
|
|
||||||
|
|||||||
@ -720,6 +720,10 @@ QImage QgsSymbol::bigSymbolPreviewImage( QgsExpressionContext *expressionContext
|
|||||||
return preview;
|
return preview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QImage QgsSymbol::bigSymbolPreviewImage( QgsExpressionContext *expressionContext, int flags )
|
||||||
|
{
|
||||||
|
return bigSymbolPreviewImage( expressionContext, static_cast< Qgis::SymbolPreviewFlags >( flags ) );
|
||||||
|
}
|
||||||
|
|
||||||
QString QgsSymbol::dump() const
|
QString QgsSymbol::dump() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -354,7 +354,12 @@ class CORE_EXPORT QgsSymbol
|
|||||||
* \see asImage()
|
* \see asImage()
|
||||||
* \see drawPreviewIcon()
|
* \see drawPreviewIcon()
|
||||||
*/
|
*/
|
||||||
QImage bigSymbolPreviewImage( QgsExpressionContext *expressionContext = nullptr, Qgis::SymbolPreviewFlags flags = Qgis::SymbolPreviewFlag::FlagIncludeCrosshairsForMarkerSymbols );
|
QImage bigSymbolPreviewImage( QgsExpressionContext *expressionContext = nullptr, Qgis::SymbolPreviewFlags flags = Qgis::SymbolPreviewFlag::FlagIncludeCrosshairsForMarkerSymbols ) SIP_PYNAME( bigSymbolPreviewImageV2 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \deprecated use bigSymbolPreviewImageV2 instead.
|
||||||
|
*/
|
||||||
|
Q_DECL_DEPRECATED QImage bigSymbolPreviewImage( QgsExpressionContext *expressionContext = nullptr, int flags = static_cast< int >( Qgis::SymbolPreviewFlag::FlagIncludeCrosshairsForMarkerSymbols ) ) SIP_DEPRECATED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string dump of the symbol's properties.
|
* Returns a string dump of the symbol's properties.
|
||||||
|
|||||||
@ -445,7 +445,7 @@ void QgsSymbolSelectorWidget::updatePreview()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
std::unique_ptr< QgsSymbol > symbolClone( mSymbol->clone() );
|
std::unique_ptr< QgsSymbol > symbolClone( mSymbol->clone() );
|
||||||
QImage preview = symbolClone->bigSymbolPreviewImage( &mPreviewExpressionContext );
|
QImage preview = symbolClone->bigSymbolPreviewImage( &mPreviewExpressionContext, Qgis::SymbolPreviewFlags() );
|
||||||
lblPreview->setPixmap( QPixmap::fromImage( preview ) );
|
lblPreview->setPixmap( QPixmap::fromImage( preview ) );
|
||||||
// Hope this is a appropriate place
|
// Hope this is a appropriate place
|
||||||
if ( !mBlockModified )
|
if ( !mBlockModified )
|
||||||
|
|||||||
@ -255,7 +255,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbolPreviewRotation()
|
|||||||
simpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, QgsProperty::fromExpression( expression ) );
|
simpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, QgsProperty::fromExpression( expression ) );
|
||||||
|
|
||||||
QgsExpressionContext ec;
|
QgsExpressionContext ec;
|
||||||
QImage image = markerSymbol.bigSymbolPreviewImage( &ec );
|
QImage image = markerSymbol.bigSymbolPreviewImage( &ec, Qgis::SymbolPreviewFlags() );
|
||||||
image.save( _fileNameForTest( name ) );
|
image.save( _fileNameForTest( name ) );
|
||||||
QVERIFY( _verifyImage( name, mReport ) );
|
QVERIFY( _verifyImage( name, mReport ) );
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user