mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
* Fix layout picture item test (alternate fix to #31382) * doxygen: add pointer to QgsProperty::value() to QgsAbstractPropertyCollection::value()
This commit is contained in:
parent
a90bee24a4
commit
596ffd06fd
@ -89,6 +89,8 @@ Returns a matching property from the collection, if one exists.
|
||||
virtual QVariant value( int key, const QgsExpressionContext &context, const QVariant &defaultValue = QVariant() ) const = 0;
|
||||
%Docstring
|
||||
Returns the calculated value of the property with the specified key from within the collection.
|
||||
If you need the validity of the value (like ok provided from the
|
||||
valueAs* variants) refer to the property() and :py:func:`QgsProperty.value()`
|
||||
|
||||
:param key: integer key for property to return. The intended use case is that a context specific enum is cast to
|
||||
int and used for the key value.
|
||||
|
@ -342,8 +342,10 @@ void QgsLayoutItemPicture::refreshPicture( const QgsExpressionContext *context )
|
||||
mHasExpressionError = false;
|
||||
if ( mDataDefinedProperties.isActive( QgsLayoutObject::PictureSource ) )
|
||||
{
|
||||
source = mDataDefinedProperties.value( QgsLayoutObject::PictureSource, *evalContext, QVariant( source ) );
|
||||
if ( !source.canConvert( QMetaType::QString ) )
|
||||
bool ok = false;
|
||||
const QgsProperty &sourceProperty = mDataDefinedProperties.property( QgsLayoutObject::PictureSource );
|
||||
source = sourceProperty.value( *evalContext, QVariant( source ), &ok );
|
||||
if ( !ok || !source.canConvert( QMetaType::QString ) )
|
||||
{
|
||||
mHasExpressionError = true;
|
||||
source = QString();
|
||||
|
@ -101,6 +101,8 @@ class CORE_EXPORT QgsAbstractPropertyCollection
|
||||
|
||||
/**
|
||||
* Returns the calculated value of the property with the specified key from within the collection.
|
||||
* If you need the validity of the value (like ok provided from the
|
||||
* valueAs* variants) refer to the property() and QgsProperty::value()
|
||||
* \param key integer key for property to return. The intended use case is that a context specific enum is cast to
|
||||
* int and used for the key value.
|
||||
* \param context expression context to evaluate property against
|
||||
|
@ -60,7 +60,8 @@ MACRO (ADD_QGIS_TEST TESTSRC)
|
||||
STRING(REPLACE "qgs" "" TESTNAME ${TESTNAME})
|
||||
STRING(REPLACE ".cpp" "" TESTNAME ${TESTNAME})
|
||||
SET (TESTNAME "qgis_${TESTNAME}test")
|
||||
ADD_EXECUTABLE(${TESTNAME} ${TESTSRC} ${util_SRCS})
|
||||
QT5_ADD_RESOURCES(IMAGES_RCC_SRC ${CMAKE_SOURCE_DIR}/images/images.qrc)
|
||||
ADD_EXECUTABLE(${TESTNAME} ${TESTSRC} ${util_SRCS} ${IMAGES_RCC_SRC})
|
||||
SET_TARGET_PROPERTIES(${TESTNAME} PROPERTIES AUTOMOC TRUE)
|
||||
TARGET_LINK_LIBRARIES(${TESTNAME}
|
||||
${Qt5Core_LIBRARIES}
|
||||
|
@ -76,6 +76,7 @@ void TestQgsLayoutPicture::initTestCase()
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
|
||||
mPngImage = QStringLiteral( TEST_DATA_DIR ) + "/sample_image.png";
|
||||
mSvgImage = QStringLiteral( TEST_DATA_DIR ) + "/sample_svg.svg";
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 32 KiB |
Loading…
x
Reference in New Issue
Block a user