Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #35055 from alexbruy/labeling-ux
[UI] Couple of UI/UX fixes for Text format widget
  • Loading branch information
alexbruy committed Mar 15, 2020
2 parents ea843c8 + 7a7f487 commit e791d29
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 77 deletions.
2 changes: 2 additions & 0 deletions src/gui/labeling/qgslabelinggui.cpp
Expand Up @@ -186,6 +186,7 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas,
connect( mBufferDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mEnableMaskChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mShapeDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mCalloutsDrawCheckBox, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mShadowDrawChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mDirectSymbChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
connect( mFormatNumChkBx, &QAbstractButton::toggled, this, &QgsLabelingGui::updateUi );
Expand Down Expand Up @@ -626,6 +627,7 @@ void QgsLabelingGui::updateUi()
syncDefinedCheckboxFrame( mEnableMaskDDBtn, mEnableMaskChkBx, mMaskFrame );
syncDefinedCheckboxFrame( mShapeDrawDDBtn, mShapeDrawChkBx, mShapeFrame );
syncDefinedCheckboxFrame( mShadowDrawDDBtn, mShadowDrawChkBx, mShadowFrame );
syncDefinedCheckboxFrame( mCalloutDrawDDBtn, mCalloutsDrawCheckBox, mCalloutFrame );

syncDefinedCheckboxFrame( mDirectSymbDDBtn, mDirectSymbChkBx, mDirectSymbFrame );
syncDefinedCheckboxFrame( mFormatNumDDBtn, mFormatNumChkBx, mFormatNumFrame );
Expand Down
19 changes: 18 additions & 1 deletion src/gui/qgstextformatwidget.cpp
Expand Up @@ -493,6 +493,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 @@ -533,7 +538,12 @@ void QgsTextFormatWidget::setWidgetMode( QgsTextFormatWidget::Mode mode )
mOptionsTab->removeTab( 8 );
mOptionsTab->removeTab( 7 );
mOptionsTab->removeTab( 6 );
mOptionsTab->removeTab( 5 );
mOptionsTab->removeTab( 3 );
mLabelStackedWidget->removeWidget( mLabelPage_Rendering );
mLabelStackedWidget->removeWidget( mLabelPage_Callouts );
mLabelStackedWidget->removeWidget( mLabelPage_Mask );
mLabelStackedWidget->removeWidget( mLabelPage_Placement );
mLabelStackedWidget->setCurrentIndex( 0 );

frameLabelWith->hide();
mDirectSymbolsFrame->hide();
Expand Down Expand Up @@ -795,6 +805,8 @@ void QgsTextFormatWidget::populateDataDefinedButtons()
registerDataDefinedButton( mZIndexDDBtn, QgsPalLayerSettings::ZIndex );

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

registerDataDefinedButton( mLabelAllPartsDDBtn, QgsPalLayerSettings::LabelAllParts );
}

Expand Down Expand Up @@ -1727,6 +1739,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 @@ -304,6 +304,7 @@ class GUI_EXPORT QgsTextFormatWidget : public QWidget, public QgsExpressionConte
void updateShapeFrameStatus();
void updateBufferFrameStatus();
void updateShadowFrameStatus();
void updateCalloutFrameStatus();
};


Expand Down
154 changes: 78 additions & 76 deletions src/ui/qgstextformatwidgetbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>880</width>
<height>516</height>
<height>589</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -694,7 +694,7 @@
<item>
<widget class="QStackedWidget" name="mLabelStackedWidget">
<property name="currentIndex">
<number>3</number>
<number>6</number>
</property>
<widget class="QWidget" name="mLabelPage_Text">
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -723,8 +723,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>782</width>
<height>387</height>
<width>317</width>
<height>260</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
Expand Down Expand Up @@ -1306,8 +1306,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>374</width>
<height>708</height>
<width>348</width>
<height>624</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_42">
Expand Down Expand Up @@ -2205,8 +2205,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>308</width>
<height>308</height>
<width>284</width>
<height>273</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
Expand Down Expand Up @@ -2551,8 +2551,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>831</width>
<height>295</height>
<width>830</width>
<height>376</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_121">
Expand Down Expand Up @@ -2829,8 +2829,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>474</width>
<height>786</height>
<width>816</width>
<height>696</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
Expand Down Expand Up @@ -3590,8 +3590,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>318</width>
<height>457</height>
<width>816</width>
<height>406</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
Expand Down Expand Up @@ -3991,7 +3991,7 @@ font-style: italic;</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="page">
<widget class="QWidget" name="mLabelPage_Callouts">
<layout class="QVBoxLayout" name="verticalLayout_14">
<property name="leftMargin">
<number>0</number>
Expand All @@ -4018,8 +4018,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>156</width>
<height>185</height>
<width>830</width>
<height>376</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_46">
Expand All @@ -4037,61 +4037,6 @@ font-style: italic;</string>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_43">
<item row="0" column="0">
<widget class="QLabel" name="label_511">
<property name="text">
<string>Callouts</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QgsPropertyOverrideButton" name="mCalloutDrawDDBtn">
<property name="text">
<string>…</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 @@ -4105,6 +4050,13 @@ font-style: italic;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_511">
<property name="text">
<string>Callouts</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_15">
<property name="orientation">
Expand All @@ -4118,6 +4070,56 @@ font-style: italic;</string>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QgsPropertyOverrideButton" name="mCalloutDrawDDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</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="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>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -4166,8 +4168,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>1154</height>
<width>431</width>
<height>1108</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
Expand Down Expand Up @@ -5991,8 +5993,8 @@ font-style: italic;</string>
<rect>
<x>0</x>
<y>0</y>
<width>415</width>
<height>853</height>
<width>383</width>
<height>624</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
Expand Down

0 comments on commit e791d29

Please sign in to comment.