Skip to content

Commit

Permalink
Link labeling and layout data defined buttons to color buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 11, 2019
1 parent 8707eee commit fd9bd0a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/layout/qgslayoutpicturewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ QgsLayoutPictureWidget::QgsLayoutPictureWidget( QgsLayoutItemPicture *picture )
mStrokeColorButton->setColorDialogTitle( tr( "Select Stroke Color" ) );
mStrokeColorButton->setContext( QStringLiteral( "composer" ) );

mFillColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mFillColorDDBtn->registerEnabledWidget( mFillColorButton, false );
mStrokeColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mStrokeColorDDBtn->registerEnabledWidget( mStrokeColorButton, false );

mNorthTypeComboBox->blockSignals( true );
mNorthTypeComboBox->addItem( tr( "Grid north" ), QgsLayoutItemPicture::GridNorth );
mNorthTypeComboBox->addItem( tr( "True north" ), QgsLayoutItemPicture::TrueNorth );
Expand Down
7 changes: 7 additions & 0 deletions src/app/layout/qgslayoutscalebarwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ QgsLayoutScaleBarWidget::QgsLayoutScaleBarWidget( QgsLayoutItemScaleBar *scaleBa
mStrokeColorButton->setNoColorString( tr( "Transparent Line" ) );
mStrokeColorButton->setShowNoColor( true );

mFillColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mFillColorDDBtn->registerEnabledWidget( mFillColorButton, false );
mFillColor2DDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mFillColor2DDBtn->registerEnabledWidget( mFillColor2Button, false );
mLineColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mLineColorDDBtn->registerEnabledWidget( mStrokeColorButton, false );

if ( mScalebar )
{
mFillColorDDBtn->registerExpressionContextGenerator( mScalebar );
Expand Down
5 changes: 5 additions & 0 deletions src/gui/layout/qgslayoutitemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ QgsLayoutItemPropertiesWidget::QgsLayoutItemPropertiesWidget( QWidget *parent, Q
mSizeLockAspectRatio->setWidthSpinBox( mWidthSpin );
mSizeLockAspectRatio->setHeightSpinBox( mHeightSpin );

mItemFrameColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mItemFrameColorDDBtn->registerEnabledWidget( mFrameColorButton, false );
mItemBackgroundColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mItemBackgroundColorDDBtn->registerEnabledWidget( mBackgroundColorButton, false );

connect( mFrameColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutItemPropertiesWidget::mFrameColorButton_colorChanged );
connect( mBackgroundColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutItemPropertiesWidget::mBackgroundColorButton_colorChanged );
connect( mStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mStrokeWidthSpinBox_valueChanged );
Expand Down
11 changes: 11 additions & 0 deletions src/gui/qgstextformatwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ void QgsTextFormatWidget::initWidget()
mShadowColorBtn->setContext( QStringLiteral( "labeling" ) );
mShadowColorBtn->setDefaultColor( Qt::black );

mFontColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mFontColorDDBtn->registerEnabledWidget( btnTextColor, false );
mBufferColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mBufferColorDDBtn->registerEnabledWidget( btnBufferColor, false );
mShapeStrokeColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mShapeStrokeColorDDBtn->registerEnabledWidget( mShapeStrokeColorBtn, false );
mShapeFillColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mShapeFillColorDDBtn->registerEnabledWidget( mShapeFillColorBtn, false );
mShadowColorDDBtn->setFlags( QgsPropertyOverrideButton::FlagDisableCheckedWidgetOnlyWhenProjectColorSet );
mShadowColorDDBtn->registerEnabledWidget( mShadowColorBtn, false );

// set up quadrant offset button group
mQuadrantBtnGrp = new QButtonGroup( this );
mQuadrantBtnGrp->addButton( mPointOffsetAboveLeft, static_cast<int>( QgsPalLayerSettings::QuadrantAboveLeft ) );
Expand Down

0 comments on commit fd9bd0a

Please sign in to comment.