Skip to content

Commit

Permalink
disable callout settings when corresponding checkbox or data-defined
Browse files Browse the repository at this point in the history
button is not active (fix #32067)
  • Loading branch information
alexbruy authored and nyalldawson committed Mar 20, 2020
1 parent 0b01508 commit e5a6d37
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 60 deletions.
2 changes: 2 additions & 0 deletions src/gui/qgslabelinggui.cpp
Expand Up @@ -142,6 +142,7 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas,
connect( mBufferDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mShapeDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mShadowDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mCalloutsDrawCheckBox, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mDirectSymbChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mFormatNumChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mScaleBasedVisibilityChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
Expand Down Expand Up @@ -580,6 +581,7 @@ void QgsLabelingGui::updateUi()
syncDefinedCheckboxFrame( mBufferDrawDDBtn, mBufferDrawChkBx, mBufferFrame );
syncDefinedCheckboxFrame( mShapeDrawDDBtn, mShapeDrawChkBx, mShapeFrame );
syncDefinedCheckboxFrame( mShadowDrawDDBtn, mShadowDrawChkBx, mShadowFrame );
syncDefinedCheckboxFrame( mCalloutDrawDDBtn, mCalloutsDrawCheckBox, mCalloutFrame );

syncDefinedCheckboxFrame( mDirectSymbDDBtn, mDirectSymbChkBx, mDirectSymbFrame );
syncDefinedCheckboxFrame( mFormatNumDDBtn, mFormatNumChkBx, mFormatNumFrame );
Expand Down
12 changes: 12 additions & 0 deletions src/gui/qgstextformatwidget.cpp
Expand Up @@ -487,6 +487,11 @@ void QgsTextFormatWidget::initWidget()
{
updateShadowFrameStatus();
} );
connect( mCalloutDrawDDBtn, &QgsPropertyOverrideButton::activated, this, &QgsTextFormatWidget::updateCalloutFrameStatus );
connect( mCalloutsDrawCheckBox, &QCheckBox::stateChanged, this, [ = ]( int )
{
updateCalloutFrameStatus();
} );

mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPolygonLayer.svg" ) ), tr( "Polygon / MultiPolygon" ), QgsWkbTypes::GeometryType::PolygonGeometry );
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconLineLayer.svg" ) ), tr( "LineString / MultiLineString" ), QgsWkbTypes::GeometryType::LineGeometry );
Expand Down Expand Up @@ -784,6 +789,8 @@ void QgsTextFormatWidget::populateDataDefinedButtons()
registerDataDefinedButton( mZIndexDDBtn, QgsPalLayerSettings::ZIndex );

registerDataDefinedButton( mCalloutDrawDDBtn, QgsPalLayerSettings::CalloutDraw );
mCalloutDrawDDBtn->registerCheckedWidget( mCalloutsDrawCheckBox );

registerDataDefinedButton( mLabelAllPartsDDBtn, QgsPalLayerSettings::LabelAllParts );
}

Expand Down Expand Up @@ -1678,6 +1685,11 @@ void QgsTextFormatWidget::updateShadowFrameStatus()
mShadowFrame->setEnabled( mShadowDrawDDBtn->isActive() || mShadowDrawChkBx->isChecked() );
}

void QgsTextFormatWidget::updateCalloutFrameStatus()
{
mCalloutFrame->setEnabled( mCalloutDrawDDBtn->isActive() || mCalloutsDrawCheckBox->isChecked() );
}

void QgsTextFormatWidget::setFormatFromStyle( const QString &name, QgsStyle::StyleEntity type )
{
switch ( type )
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgstextformatwidget.h
Expand Up @@ -300,6 +300,7 @@ class GUI_EXPORT QgsTextFormatWidget : public QWidget, public QgsExpressionConte
void updateShapeFrameStatus();
void updateBufferFrameStatus();
void updateShadowFrameStatus();
void updateCalloutFrameStatus();
};


Expand Down
122 changes: 62 additions & 60 deletions src/ui/qgstextformatwidgetbase.ui
Expand Up @@ -112,7 +112,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>807</width>
<width>806</width>
<height>300</height>
</rect>
</property>
Expand Down Expand Up @@ -615,7 +615,7 @@
<item>
<widget class="QStackedWidget" name="mLabelStackedWidget">
<property name="currentIndex">
<number>6</number>
<number>5</number>
</property>
<widget class="QWidget" name="mLabelPage_Text">
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -644,8 +644,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>775</width>
<height>405</height>
<width>781</width>
<height>395</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
Expand Down Expand Up @@ -1227,8 +1227,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>509</height>
<width>767</width>
<height>624</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_42">
Expand Down Expand Up @@ -2126,8 +2126,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>775</width>
<height>405</height>
<width>781</width>
<height>395</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
Expand Down Expand Up @@ -2472,8 +2472,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>633</height>
<width>767</width>
<height>696</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
Expand Down Expand Up @@ -3233,8 +3233,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>775</width>
<height>405</height>
<width>767</width>
<height>406</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
Expand Down Expand Up @@ -3661,8 +3661,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>775</width>
<height>405</height>
<width>781</width>
<height>395</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_46">
Expand Down Expand Up @@ -3694,47 +3694,6 @@ font-style: italic;</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout_45" columnstretch="0,0,0">
<property name="leftMargin">
<number>20</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mCalloutStyleComboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QStackedWidget" name="mCalloutStackedWidget">
<widget class="QWidget" name="pageDummy">
<layout class="QVBoxLayout" name="verticalLayout_19">
<item>
<widget class="QLabel" name="label_45">
<property name="text">
<string>This callout type doesn't have any editable properties</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="mCalloutsDrawCheckBox">
<property name="sizePolicy">
Expand All @@ -3761,6 +3720,49 @@ font-style: italic;</string>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="QFrame" name="mCalloutFrame">
<layout class="QGridLayout" name="gridLayout_45" columnstretch="0,0,0">
<property name="leftMargin">
<number>20</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mCalloutStyleComboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QStackedWidget" name="mCalloutStackedWidget">
<widget class="QWidget" name="pageDummy">
<layout class="QVBoxLayout" name="verticalLayout_19">
<item>
<widget class="QLabel" name="label_45">
<property name="text">
<string>This callout type doesn't have any editable properties</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -3808,9 +3810,9 @@ font-style: italic;</string>
<property name="geometry">
<rect>
<x>0</x>
<y>-263</y>
<width>758</width>
<height>932</height>
<y>0</y>
<width>767</width>
<height>1035</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
Expand Down Expand Up @@ -5584,8 +5586,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>674</height>
<width>767</width>
<height>757</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
Expand Down

0 comments on commit e5a6d37

Please sign in to comment.