mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-27 00:03:38 -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
python/core/auto_generated
src/core
tests
src/core
testdata/control_images/composer_picture/expected_composerpicture_badexpression
@ -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;
|
virtual QVariant value( int key, const QgsExpressionContext &context, const QVariant &defaultValue = QVariant() ) const = 0;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns the calculated value of the property with the specified key from within the collection.
|
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
|
: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.
|
int and used for the key value.
|
||||||
|
@ -342,8 +342,10 @@ void QgsLayoutItemPicture::refreshPicture( const QgsExpressionContext *context )
|
|||||||
mHasExpressionError = false;
|
mHasExpressionError = false;
|
||||||
if ( mDataDefinedProperties.isActive( QgsLayoutObject::PictureSource ) )
|
if ( mDataDefinedProperties.isActive( QgsLayoutObject::PictureSource ) )
|
||||||
{
|
{
|
||||||
source = mDataDefinedProperties.value( QgsLayoutObject::PictureSource, *evalContext, QVariant( source ) );
|
bool ok = false;
|
||||||
if ( !source.canConvert( QMetaType::QString ) )
|
const QgsProperty &sourceProperty = mDataDefinedProperties.property( QgsLayoutObject::PictureSource );
|
||||||
|
source = sourceProperty.value( *evalContext, QVariant( source ), &ok );
|
||||||
|
if ( !ok || !source.canConvert( QMetaType::QString ) )
|
||||||
{
|
{
|
||||||
mHasExpressionError = true;
|
mHasExpressionError = true;
|
||||||
source = QString();
|
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.
|
* 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
|
* \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.
|
* int and used for the key value.
|
||||||
* \param context expression context to evaluate property against
|
* \param context expression context to evaluate property against
|
||||||
|
@ -60,7 +60,8 @@ MACRO (ADD_QGIS_TEST TESTSRC)
|
|||||||
STRING(REPLACE "qgs" "" TESTNAME ${TESTNAME})
|
STRING(REPLACE "qgs" "" TESTNAME ${TESTNAME})
|
||||||
STRING(REPLACE ".cpp" "" TESTNAME ${TESTNAME})
|
STRING(REPLACE ".cpp" "" TESTNAME ${TESTNAME})
|
||||||
SET (TESTNAME "qgis_${TESTNAME}test")
|
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)
|
SET_TARGET_PROPERTIES(${TESTNAME} PROPERTIES AUTOMOC TRUE)
|
||||||
TARGET_LINK_LIBRARIES(${TESTNAME}
|
TARGET_LINK_LIBRARIES(${TESTNAME}
|
||||||
${Qt5Core_LIBRARIES}
|
${Qt5Core_LIBRARIES}
|
||||||
|
@ -76,6 +76,7 @@ void TestQgsLayoutPicture::initTestCase()
|
|||||||
{
|
{
|
||||||
QgsApplication::init();
|
QgsApplication::init();
|
||||||
QgsApplication::initQgis();
|
QgsApplication::initQgis();
|
||||||
|
QgsApplication::showSettings();
|
||||||
|
|
||||||
mPngImage = QStringLiteral( TEST_DATA_DIR ) + "/sample_image.png";
|
mPngImage = QStringLiteral( TEST_DATA_DIR ) + "/sample_image.png";
|
||||||
mSvgImage = QStringLiteral( TEST_DATA_DIR ) + "/sample_svg.svg";
|
mSvgImage = QStringLiteral( TEST_DATA_DIR ) + "/sample_svg.svg";
|
||||||
|
Binary file not shown.
Before ![]() (image error) Size: 4.2 KiB After ![]() (image error) Size: 32 KiB ![]() ![]() |
Loading…
x
Reference in New Issue
Block a user