void QgsLayoutItemPropertiesWidget::setValuesForGuiElements() { if ( !mItem ) { return; } mBackgroundColorButton->setColorDialogTitle( tr( "Select Background Color" ) ); mBackgroundColorButton->setAllowOpacity( true ); mBackgroundColorButton->setContext( QStringLiteral( "composer" ) ); mFrameColorButton->setColorDialogTitle( tr( "Select Frame Color" ) ); mFrameColorButton->setAllowOpacity( true ); mFrameColorButton->setContext( QStringLiteral( "composer" ) ); setValuesForGuiPositionElements(); setValuesForGuiNonPositionElements(); populateDataDefinedButtons(); }
void QgsComposerItemWidget::setValuesForGuiElements() { if ( !mItem ) { return; } mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) ); mBackgroundColorButton->setAllowAlpha( true ); mBackgroundColorButton->setContext( "composer" ); mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) ); mFrameColorButton->setAllowAlpha( true ); mFrameColorButton->setContext( "composer" ); setValuesForGuiPositionElements(); setValuesForGuiNonPositionElements(); populateDataDefinedButtons(); }
QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem* item ) : QgsComposerItemBaseWidget( parent, item ) , mItem( item ) , mFreezeXPosSpin( false ) , mFreezeYPosSpin( false ) , mFreezeWidthSpin( false ) , mFreezeHeightSpin( false ) , mFreezePageSpin( false ) { setupUi( this ); //make button exclusive QButtonGroup* buttonGroup = new QButtonGroup( this ); buttonGroup->addButton( mUpperLeftCheckBox ); buttonGroup->addButton( mUpperMiddleCheckBox ); buttonGroup->addButton( mUpperRightCheckBox ); buttonGroup->addButton( mMiddleLeftCheckBox ); buttonGroup->addButton( mMiddleCheckBox ); buttonGroup->addButton( mMiddleRightCheckBox ); buttonGroup->addButton( mLowerLeftCheckBox ); buttonGroup->addButton( mLowerMiddleCheckBox ); buttonGroup->addButton( mLowerRightCheckBox ); buttonGroup->setExclusive( true ); setValuesForGuiElements(); connect( mItem->composition(), SIGNAL( paperSizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) ); connect( mItem, SIGNAL( sizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) ); connect( mItem, SIGNAL( itemChanged() ), this, SLOT( setValuesForGuiNonPositionElements() ) ); connect( mTransparencySlider, SIGNAL( valueChanged( int ) ), mTransparencySpnBx, SLOT( setValue( int ) ) ); QgsExpressionContext* context = mItem->createExpressionContext(); mVariableEditor->setContext( context ); mVariableEditor->setEditableScopeIndex( context->scopeCount() - 1 ); delete context; connect( mVariableEditor, SIGNAL( scopeChanged() ), this, SLOT( variablesChanged() ) ); //connect atlas signals to data defined buttons QgsAtlasComposition* atlas = atlasComposition(); if ( atlas ) { //repopulate data defined buttons if atlas layer changes connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( populateDataDefinedButtons() ) ); connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( populateDataDefinedButtons() ) ); } //connect data defined buttons connect( mXPositionDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mXPositionDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mYPositionDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mYPositionDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mWidthDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mHeightDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mHeightDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mItemRotationDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mItemRotationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mTransparencyDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mTransparencyDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mBlendModeDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mBlendModeDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mExcludePrintsDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) ); connect( mExcludePrintsDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) ); }