@@ -53,8 +53,8 @@ void QgsComposerConfigObject::updateDataDefinedProperty()
5353 }
5454 QgsComposerObject::DataDefinedProperty key = QgsComposerObject::NoProperty;
5555
56- if ( ddButton->property ( " propertyKey" ). isValid () )
57- key = static_cast < QgsComposerObject::DataDefinedProperty >( ddButton->property ( " propertyKey" ). toInt () );
56+ if ( ddButton->propertyKey () >= 0 )
57+ key = static_cast < QgsComposerObject::DataDefinedProperty >( ddButton->propertyKey () );
5858
5959 if ( key == QgsComposerObject::NoProperty )
6060 {
@@ -74,12 +74,10 @@ void QgsComposerConfigObject::updateDataDefinedButtons()
7474 }
7575}
7676
77- void QgsComposerConfigObject::initializeDataDefinedButton ( QgsDataDefinedButtonV2* button, QgsComposerObject::DataDefinedProperty key,
78- QgsDataDefinedButtonV2::DataType type, const QString& description )
77+ void QgsComposerConfigObject::initializeDataDefinedButton ( QgsDataDefinedButtonV2* button, QgsComposerObject::DataDefinedProperty key )
7978{
8079 button->blockSignals ( true );
81- button->init ( atlasCoverageLayer (), mComposerObject ->dataDefinedProperties ().property ( key ), type, description );
82- button->setProperty ( " propertyKey" , key );
80+ button->init ( key, mComposerObject ->dataDefinedProperties (), QgsComposerObject::PROPERTY_DEFINITIONS , atlasCoverageLayer () );
8381 connect ( button, &QgsDataDefinedButtonV2::changed, this , &QgsComposerConfigObject::updateDataDefinedProperty );
8482 button->registerExpressionContextGenerator ( mComposerObject );
8583 button->blockSignals ( false );
@@ -90,10 +88,10 @@ void QgsComposerConfigObject::updateDataDefinedButton( QgsDataDefinedButtonV2* b
9088 if ( !button )
9189 return ;
9290
93- if ( ! button->property ( " propertyKey" ). isValid () )
91+ if ( button->propertyKey () < 0 )
9492 return ;
9593
96- QgsComposerObject::DataDefinedProperty key = static_cast < QgsComposerObject::DataDefinedProperty >( button->property ( " propertyKey" ). toInt () );
94+ QgsComposerObject::DataDefinedProperty key = static_cast < QgsComposerObject::DataDefinedProperty >( button->propertyKey () );
9795 whileBlocking ( button )->setToProperty ( mComposerObject ->dataDefinedProperties ().property ( key ) );
9896}
9997
@@ -539,26 +537,16 @@ void QgsComposerItemWidget::setValuesForGuiNonPositionElements()
539537
540538void QgsComposerItemWidget::initializeDataDefinedButtons ()
541539{
542- mConfigObject ->initializeDataDefinedButton ( mXPositionDDBtn , QgsComposerObject::PositionX,
543- QgsDataDefinedButtonV2::AnyType, QgsDataDefinedButtonV2::doubleDesc () );
544- mConfigObject ->initializeDataDefinedButton ( mYPositionDDBtn , QgsComposerObject::PositionY,
545- QgsDataDefinedButtonV2::AnyType, QgsDataDefinedButtonV2::doubleDesc () );
546- mConfigObject ->initializeDataDefinedButton ( mWidthDDBtn , QgsComposerObject::ItemWidth,
547- QgsDataDefinedButtonV2::AnyType, QgsDataDefinedButtonV2::doubleDesc () );
548- mConfigObject ->initializeDataDefinedButton ( mHeightDDBtn , QgsComposerObject::ItemHeight,
549- QgsDataDefinedButtonV2::AnyType, QgsDataDefinedButtonV2::doubleDesc () );
550- mConfigObject ->initializeDataDefinedButton ( mItemRotationDDBtn , QgsComposerObject::ItemRotation,
551- QgsDataDefinedButtonV2::AnyType, QgsDataDefinedButtonV2::double180RotDesc () );
552- mConfigObject ->initializeDataDefinedButton ( mTransparencyDDBtn , QgsComposerObject::Transparency,
553- QgsDataDefinedButtonV2::AnyType, QgsDataDefinedButtonV2::intTranspDesc () );
554- mConfigObject ->initializeDataDefinedButton ( mBlendModeDDBtn , QgsComposerObject::BlendMode,
555- QgsDataDefinedButtonV2::String, QgsDataDefinedButtonV2::blendModesDesc () );
556- mConfigObject ->initializeDataDefinedButton ( mExcludePrintsDDBtn , QgsComposerObject::ExcludeFromExports,
557- QgsDataDefinedButtonV2::String, QgsDataDefinedButtonV2::boolDesc () );
558- mConfigObject ->initializeDataDefinedButton ( mItemFrameColorDDBtn , QgsComposerObject::FrameColor,
559- QgsDataDefinedButtonV2::String, QgsDataDefinedButtonV2::colorAlphaDesc () );
560- mConfigObject ->initializeDataDefinedButton ( mItemBackgroundColorDDBtn , QgsComposerObject::BackgroundColor,
561- QgsDataDefinedButtonV2::String, QgsDataDefinedButtonV2::colorAlphaDesc () );
540+ mConfigObject ->initializeDataDefinedButton ( mXPositionDDBtn , QgsComposerObject::PositionX );
541+ mConfigObject ->initializeDataDefinedButton ( mYPositionDDBtn , QgsComposerObject::PositionY );
542+ mConfigObject ->initializeDataDefinedButton ( mWidthDDBtn , QgsComposerObject::ItemWidth );
543+ mConfigObject ->initializeDataDefinedButton ( mHeightDDBtn , QgsComposerObject::ItemHeight );
544+ mConfigObject ->initializeDataDefinedButton ( mItemRotationDDBtn , QgsComposerObject::ItemRotation );
545+ mConfigObject ->initializeDataDefinedButton ( mTransparencyDDBtn , QgsComposerObject::Transparency );
546+ mConfigObject ->initializeDataDefinedButton ( mBlendModeDDBtn , QgsComposerObject::BlendMode );
547+ mConfigObject ->initializeDataDefinedButton ( mExcludePrintsDDBtn , QgsComposerObject::ExcludeFromExports );
548+ mConfigObject ->initializeDataDefinedButton ( mItemFrameColorDDBtn , QgsComposerObject::FrameColor );
549+ mConfigObject ->initializeDataDefinedButton ( mItemBackgroundColorDDBtn , QgsComposerObject::BackgroundColor );
562550}
563551
564552void QgsComposerItemWidget::populateDataDefinedButtons ()
@@ -793,9 +781,9 @@ QgsComposerItemBaseWidget::QgsComposerItemBaseWidget( QWidget* parent, QgsCompos
793781
794782}
795783
796- void QgsComposerItemBaseWidget::registerDataDefinedButton ( QgsDataDefinedButtonV2* button, QgsComposerObject::DataDefinedProperty property, QgsDataDefinedButtonV2::DataType type, const QString& description )
784+ void QgsComposerItemBaseWidget::registerDataDefinedButton ( QgsDataDefinedButtonV2* button, QgsComposerObject::DataDefinedProperty property )
797785{
798- mConfigObject ->initializeDataDefinedButton ( button, property, type, description );
786+ mConfigObject ->initializeDataDefinedButton ( button, property );
799787}
800788
801789void QgsComposerItemBaseWidget::updateDataDefinedButton ( QgsDataDefinedButtonV2* button )
0 commit comments