Skip to content

Commit cbca612

Browse files
committedMar 10, 2019
Add configuration GUI for label geometry generators
1 parent ae51dce commit cbca612

File tree

3 files changed

+231
-215
lines changed

3 files changed

+231
-215
lines changed
 

‎src/gui/qgstextformatwidget.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,10 @@ void QgsTextFormatWidget::initWidget()
522522

523523
connect( mQuadrantBtnGrp, static_cast<void ( QButtonGroup::* )( int )>( &QButtonGroup::buttonClicked ), this, &QgsTextFormatWidget::updatePreview );
524524

525+
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPolygonLayer.svg" ) ), tr( "Polygon / MultiPolygon" ), QgsWkbTypes::GeometryType::PolygonGeometry );
526+
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconLineLayer.svg" ) ), tr( "LineString / MultiLineString" ), QgsWkbTypes::GeometryType::LineGeometry );
527+
mGeometryGeneratorType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "/mIconPointLayer.svg" ) ), tr( "Point / MultiPoint" ), QgsWkbTypes::GeometryType::PointGeometry );
528+
525529
// set correct initial tab to match displayed setting page
526530
whileBlocking( mOptionsTab )->setCurrentIndex( mLabelStackedWidget->currentIndex() );
527531

@@ -530,6 +534,12 @@ void QgsTextFormatWidget::initWidget()
530534
lblFontPreview->setMapUnits( mMapCanvas->mapSettings().mapUnits() );
531535
mPreviewScaleComboBox->setScale( mMapCanvas->mapSettings().scale() );
532536
}
537+
538+
setupWidget();
539+
}
540+
541+
void QgsTextFormatWidget::setupWidget()
542+
{
533543
}
534544

535545
void QgsTextFormatWidget::setWidgetMode( QgsTextFormatWidget::Mode mode )

‎src/gui/qgstextformatwidget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ class GUI_EXPORT QgsTextFormatWidget : public QWidget, protected Ui::QgsTextForm
163163
bool mLoadSvgParams = false;
164164

165165
void initWidget();
166+
/**
167+
* Used to setup child classes. Called at the end of initWidget.
168+
*/
169+
virtual void setupWidget();
166170
void setWidgetMode( Mode mode );
167171
void toggleDDButtons( bool visible );
168172
void blockFontChangeSignals( bool blk );

‎src/ui/qgstextformatwidgetbase.ui

Lines changed: 217 additions & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>508</width>
10-
<height>600</height>
10+
<height>883</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -29,66 +29,6 @@
2929
<property name="verticalSpacing">
3030
<number>6</number>
3131
</property>
32-
<item row="0" column="0">
33-
<widget class="QFrame" name="frameLabelWith">
34-
<layout class="QHBoxLayout" name="horizontalLayout_19">
35-
<property name="leftMargin">
36-
<number>0</number>
37-
</property>
38-
<property name="topMargin">
39-
<number>0</number>
40-
</property>
41-
<property name="rightMargin">
42-
<number>0</number>
43-
</property>
44-
<property name="bottomMargin">
45-
<number>0</number>
46-
</property>
47-
<item>
48-
<widget class="QLabel" name="label_12">
49-
<property name="text">
50-
<string>Label with</string>
51-
</property>
52-
</widget>
53-
</item>
54-
<item>
55-
<widget class="QgsFieldExpressionWidget" name="mFieldExpressionWidget" native="true">
56-
<property name="sizePolicy">
57-
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
58-
<horstretch>0</horstretch>
59-
<verstretch>0</verstretch>
60-
</sizepolicy>
61-
</property>
62-
<property name="maximumSize">
63-
<size>
64-
<width>16777215</width>
65-
<height>16777215</height>
66-
</size>
67-
</property>
68-
<property name="focusPolicy">
69-
<enum>Qt::StrongFocus</enum>
70-
</property>
71-
</widget>
72-
</item>
73-
<item>
74-
<spacer name="horizontalSpacer_7">
75-
<property name="orientation">
76-
<enum>Qt::Horizontal</enum>
77-
</property>
78-
<property name="sizeType">
79-
<enum>QSizePolicy::Fixed</enum>
80-
</property>
81-
<property name="sizeHint" stdset="0">
82-
<size>
83-
<width>0</width>
84-
<height>20</height>
85-
</size>
86-
</property>
87-
</spacer>
88-
</item>
89-
</layout>
90-
</widget>
91-
</item>
9232
<item row="3" column="0">
9333
<widget class="QFrame" name="mLabelingFrame">
9434
<property name="minimumSize">
@@ -172,7 +112,7 @@
172112
<rect>
173113
<x>0</x>
174114
<y>0</y>
175-
<width>486</width>
115+
<width>474</width>
176116
<height>300</height>
177117
</rect>
178118
</property>
@@ -651,7 +591,7 @@
651591
<item>
652592
<widget class="QStackedWidget" name="mLabelStackedWidget">
653593
<property name="currentIndex">
654-
<number>1</number>
594+
<number>5</number>
655595
</property>
656596
<widget class="QWidget" name="mLabelPage_Text">
657597
<layout class="QVBoxLayout" name="verticalLayout_6">
@@ -680,8 +620,8 @@
680620
<rect>
681621
<x>0</x>
682622
<y>0</y>
683-
<width>375</width>
684-
<height>470</height>
623+
<width>396</width>
624+
<height>540</height>
685625
</rect>
686626
</property>
687627
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -1460,8 +1400,8 @@ font-style: italic;</string>
14601400
<rect>
14611401
<x>0</x>
14621402
<y>0</y>
1463-
<width>452</width>
1464-
<height>479</height>
1403+
<width>435</width>
1404+
<height>554</height>
14651405
</rect>
14661406
</property>
14671407
<layout class="QVBoxLayout" name="verticalLayout_14">
@@ -2145,8 +2085,8 @@ font-style: italic;</string>
21452085
<rect>
21462086
<x>0</x>
21472087
<y>0</y>
2148-
<width>466</width>
2149-
<height>365</height>
2088+
<width>364</width>
2089+
<height>358</height>
21502090
</rect>
21512091
</property>
21522092
<layout class="QVBoxLayout" name="verticalLayout_12">
@@ -2491,8 +2431,8 @@ font-style: italic;</string>
24912431
<rect>
24922432
<x>0</x>
24932433
<y>0</y>
2494-
<width>464</width>
2495-
<height>776</height>
2434+
<width>578</width>
2435+
<height>902</height>
24962436
</rect>
24972437
</property>
24982438
<layout class="QVBoxLayout" name="verticalLayout_21">
@@ -3264,8 +3204,8 @@ font-style: italic;</string>
32643204
<rect>
32653205
<x>0</x>
32663206
<y>0</y>
3267-
<width>452</width>
3268-
<height>470</height>
3207+
<width>372</width>
3208+
<height>528</height>
32693209
</rect>
32703210
</property>
32713211
<layout class="QVBoxLayout" name="verticalLayout_22">
@@ -3724,9 +3664,9 @@ font-style: italic;</string>
37243664
<property name="geometry">
37253665
<rect>
37263666
<x>0</x>
3727-
<y>0</y>
3728-
<width>452</width>
3729-
<height>977</height>
3667+
<y>-428</y>
3668+
<width>500</width>
3669+
<height>1187</height>
37303670
</rect>
37313671
</property>
37323672
<layout class="QVBoxLayout" name="verticalLayout_11">
@@ -5038,6 +4978,38 @@ font-style: italic;</string>
50384978
</layout>
50394979
</widget>
50404980
</item>
4981+
<item>
4982+
<widget class="QGroupBox" name="mGeometryGeneratorGroupBox">
4983+
<property name="title">
4984+
<string>Geometry generator</string>
4985+
</property>
4986+
<property name="checkable">
4987+
<bool>true</bool>
4988+
</property>
4989+
<layout class="QFormLayout" name="formLayout">
4990+
<item row="1" column="1">
4991+
<widget class="QLineEdit" name="mGeometryGenerator"/>
4992+
</item>
4993+
<item row="1" column="0">
4994+
<widget class="QLabel" name="label">
4995+
<property name="text">
4996+
<string>Expression</string>
4997+
</property>
4998+
</widget>
4999+
</item>
5000+
<item row="2" column="1">
5001+
<widget class="QComboBox" name="mGeometryGeneratorType"/>
5002+
</item>
5003+
<item row="2" column="0">
5004+
<widget class="QLabel" name="label_11">
5005+
<property name="text">
5006+
<string>Geometry Type</string>
5007+
</property>
5008+
</widget>
5009+
</item>
5010+
</layout>
5011+
</widget>
5012+
</item>
50415013
<item>
50425014
<widget class="Line" name="line">
50435015
<property name="minimumSize">
@@ -5069,67 +5041,10 @@ font-style: italic;</string>
50695041
<property name="rightMargin">
50705042
<number>8</number>
50715043
</property>
5072-
<item row="0" column="1">
5073-
<layout class="QHBoxLayout" name="horizontalLayout_22">
5074-
<item>
5075-
<widget class="QLabel" name="mCoordXLabel">
5076-
<property name="sizePolicy">
5077-
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
5078-
<horstretch>0</horstretch>
5079-
<verstretch>0</verstretch>
5080-
</sizepolicy>
5081-
</property>
5082-
<property name="text">
5083-
<string>X</string>
5084-
</property>
5085-
</widget>
5086-
</item>
5087-
<item>
5088-
<widget class="QgsPropertyOverrideButton" name="mCoordXDDBtn">
5089-
<property name="text">
5090-
<string>…</string>
5091-
</property>
5092-
</widget>
5093-
</item>
5094-
<item>
5095-
<widget class="QLabel" name="mCoordYLabel">
5096-
<property name="sizePolicy">
5097-
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
5098-
<horstretch>0</horstretch>
5099-
<verstretch>0</verstretch>
5100-
</sizepolicy>
5101-
</property>
5102-
<property name="text">
5103-
<string>Y</string>
5104-
</property>
5105-
</widget>
5106-
</item>
5107-
<item>
5108-
<widget class="QgsPropertyOverrideButton" name="mCoordYDDBtn">
5109-
<property name="text">
5110-
<string>…</string>
5111-
</property>
5112-
</widget>
5113-
</item>
5114-
<item>
5115-
<spacer name="horizontalSpacer_22">
5116-
<property name="orientation">
5117-
<enum>Qt::Horizontal</enum>
5118-
</property>
5119-
<property name="sizeHint" stdset="0">
5120-
<size>
5121-
<width>0</width>
5122-
<height>20</height>
5123-
</size>
5124-
</property>
5125-
</spacer>
5126-
</item>
5127-
</layout>
5128-
</item>
5129-
<item row="2" column="0">
5130-
<widget class="QLabel" name="mCoordRotationLabel">
5044+
<item row="1" column="0">
5045+
<widget class="QLabel" name="mCoordAlignmentLabel">
51315046
<property name="text">
5132-
<string>Rotation</string>
5047+
<string>Alignment</string>
51335048
</property>
51345049
</widget>
51355050
</item>
@@ -5140,40 +5055,13 @@ font-style: italic;</string>
51405055
</property>
51415056
</widget>
51425057
</item>
5143-
<item row="1" column="0">
5144-
<widget class="QLabel" name="mCoordAlignmentLabel">
5058+
<item row="2" column="0">
5059+
<widget class="QLabel" name="mCoordRotationLabel">
51455060
<property name="text">
5146-
<string>Alignment</string>
5061+
<string>Rotation</string>
51475062
</property>
51485063
</widget>
51495064
</item>
5150-
<item row="2" column="1">
5151-
<layout class="QHBoxLayout" name="horizontalLayout_25">
5152-
<item>
5153-
<widget class="QgsPropertyOverrideButton" name="mCoordRotationDDBtn">
5154-
<property name="text">
5155-
<string>…</string>
5156-
</property>
5157-
</widget>
5158-
</item>
5159-
<item>
5160-
<widget class="QCheckBox" name="chkPreserveRotation">
5161-
<property name="toolTip">
5162-
<string>Uncheck to write labeling engine derived rotation on pin and NULL on unpin</string>
5163-
</property>
5164-
<property name="styleSheet">
5165-
<string notr="true">margin-left: 12px; margin-top: 3px;</string>
5166-
</property>
5167-
<property name="text">
5168-
<string>Preserve data rotation values</string>
5169-
</property>
5170-
<property name="checked">
5171-
<bool>true</bool>
5172-
</property>
5173-
</widget>
5174-
</item>
5175-
</layout>
5176-
</item>
51775065
<item row="1" column="1">
51785066
<widget class="QFrame" name="mCoordAlignmentFrame">
51795067
<layout class="QHBoxLayout" name="horizontalLayout_27">
@@ -5245,6 +5133,90 @@ font-style: italic;</string>
52455133
</layout>
52465134
</widget>
52475135
</item>
5136+
<item row="0" column="1">
5137+
<layout class="QHBoxLayout" name="horizontalLayout_22">
5138+
<item>
5139+
<widget class="QLabel" name="mCoordXLabel">
5140+
<property name="sizePolicy">
5141+
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
5142+
<horstretch>0</horstretch>
5143+
<verstretch>0</verstretch>
5144+
</sizepolicy>
5145+
</property>
5146+
<property name="text">
5147+
<string>X</string>
5148+
</property>
5149+
</widget>
5150+
</item>
5151+
<item>
5152+
<widget class="QgsPropertyOverrideButton" name="mCoordXDDBtn">
5153+
<property name="text">
5154+
<string>…</string>
5155+
</property>
5156+
</widget>
5157+
</item>
5158+
<item>
5159+
<widget class="QLabel" name="mCoordYLabel">
5160+
<property name="sizePolicy">
5161+
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
5162+
<horstretch>0</horstretch>
5163+
<verstretch>0</verstretch>
5164+
</sizepolicy>
5165+
</property>
5166+
<property name="text">
5167+
<string>Y</string>
5168+
</property>
5169+
</widget>
5170+
</item>
5171+
<item>
5172+
<widget class="QgsPropertyOverrideButton" name="mCoordYDDBtn">
5173+
<property name="text">
5174+
<string>…</string>
5175+
</property>
5176+
</widget>
5177+
</item>
5178+
<item>
5179+
<spacer name="horizontalSpacer_22">
5180+
<property name="orientation">
5181+
<enum>Qt::Horizontal</enum>
5182+
</property>
5183+
<property name="sizeHint" stdset="0">
5184+
<size>
5185+
<width>0</width>
5186+
<height>20</height>
5187+
</size>
5188+
</property>
5189+
</spacer>
5190+
</item>
5191+
</layout>
5192+
</item>
5193+
<item row="2" column="1">
5194+
<layout class="QHBoxLayout" name="horizontalLayout_25">
5195+
<item>
5196+
<widget class="QgsPropertyOverrideButton" name="mCoordRotationDDBtn">
5197+
<property name="text">
5198+
<string>…</string>
5199+
</property>
5200+
</widget>
5201+
</item>
5202+
<item>
5203+
<widget class="QCheckBox" name="chkPreserveRotation">
5204+
<property name="toolTip">
5205+
<string>Uncheck to write labeling engine derived rotation on pin and NULL on unpin</string>
5206+
</property>
5207+
<property name="styleSheet">
5208+
<string notr="true">margin-left: 12px; margin-top: 3px;</string>
5209+
</property>
5210+
<property name="text">
5211+
<string>Preserve data rotation values</string>
5212+
</property>
5213+
<property name="checked">
5214+
<bool>true</bool>
5215+
</property>
5216+
</widget>
5217+
</item>
5218+
</layout>
5219+
</item>
52485220
</layout>
52495221
</widget>
52505222
</item>
@@ -5359,8 +5331,8 @@ font-style: italic;</string>
53595331
<rect>
53605332
<x>0</x>
53615333
<y>0</y>
5362-
<width>452</width>
5363-
<height>877</height>
5334+
<width>430</width>
5335+
<height>912</height>
53645336
</rect>
53655337
</property>
53665338
<layout class="QVBoxLayout" name="verticalLayout_8">
@@ -6233,10 +6205,87 @@ font-style: italic;</string>
62336205
</layout>
62346206
</widget>
62356207
</item>
6208+
<item row="0" column="0">
6209+
<widget class="QFrame" name="frameLabelWith">
6210+
<layout class="QHBoxLayout" name="horizontalLayout_19">
6211+
<property name="leftMargin">
6212+
<number>0</number>
6213+
</property>
6214+
<property name="topMargin">
6215+
<number>0</number>
6216+
</property>
6217+
<property name="rightMargin">
6218+
<number>0</number>
6219+
</property>
6220+
<property name="bottomMargin">
6221+
<number>0</number>
6222+
</property>
6223+
<item>
6224+
<widget class="QLabel" name="label_12">
6225+
<property name="text">
6226+
<string>Label with</string>
6227+
</property>
6228+
</widget>
6229+
</item>
6230+
<item>
6231+
<widget class="QgsFieldExpressionWidget" name="mFieldExpressionWidget" native="true">
6232+
<property name="sizePolicy">
6233+
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
6234+
<horstretch>0</horstretch>
6235+
<verstretch>0</verstretch>
6236+
</sizepolicy>
6237+
</property>
6238+
<property name="maximumSize">
6239+
<size>
6240+
<width>16777215</width>
6241+
<height>16777215</height>
6242+
</size>
6243+
</property>
6244+
<property name="focusPolicy">
6245+
<enum>Qt::StrongFocus</enum>
6246+
</property>
6247+
</widget>
6248+
</item>
6249+
<item>
6250+
<spacer name="horizontalSpacer_7">
6251+
<property name="orientation">
6252+
<enum>Qt::Horizontal</enum>
6253+
</property>
6254+
<property name="sizeType">
6255+
<enum>QSizePolicy::Fixed</enum>
6256+
</property>
6257+
<property name="sizeHint" stdset="0">
6258+
<size>
6259+
<width>0</width>
6260+
<height>20</height>
6261+
</size>
6262+
</property>
6263+
</spacer>
6264+
</item>
6265+
</layout>
6266+
</widget>
6267+
</item>
62366268
</layout>
62376269
</widget>
62386270
<layoutdefault spacing="6" margin="11"/>
62396271
<customwidgets>
6272+
<customwidget>
6273+
<class>QgsScrollArea</class>
6274+
<extends>QScrollArea</extends>
6275+
<header>qgsscrollarea.h</header>
6276+
<container>1</container>
6277+
</customwidget>
6278+
<customwidget>
6279+
<class>QgsCollapsibleGroupBox</class>
6280+
<extends>QGroupBox</extends>
6281+
<header>qgscollapsiblegroupbox.h</header>
6282+
<container>1</container>
6283+
</customwidget>
6284+
<customwidget>
6285+
<class>QgsScaleWidget</class>
6286+
<extends>QWidget</extends>
6287+
<header>qgsscalewidget.h</header>
6288+
</customwidget>
62406289
<customwidget>
62416290
<class>QgsDoubleSpinBox</class>
62426291
<extends>QDoubleSpinBox</extends>
@@ -6265,28 +6314,11 @@ font-style: italic;</string>
62656314
<header>qgsopacitywidget.h</header>
62666315
<container>1</container>
62676316
</customwidget>
6268-
<customwidget>
6269-
<class>QgsScrollArea</class>
6270-
<extends>QScrollArea</extends>
6271-
<header>qgsscrollarea.h</header>
6272-
<container>1</container>
6273-
</customwidget>
6274-
<customwidget>
6275-
<class>QgsCollapsibleGroupBox</class>
6276-
<extends>QGroupBox</extends>
6277-
<header>qgscollapsiblegroupbox.h</header>
6278-
<container>1</container>
6279-
</customwidget>
62806317
<customwidget>
62816318
<class>QgsSpinBox</class>
62826319
<extends>QSpinBox</extends>
62836320
<header>qgsspinbox.h</header>
62846321
</customwidget>
6285-
<customwidget>
6286-
<class>QgsScaleWidget</class>
6287-
<extends>QWidget</extends>
6288-
<header>qgsscalewidget.h</header>
6289-
</customwidget>
62906322
<customwidget>
62916323
<class>QgsBlendModeComboBox</class>
62926324
<extends>QComboBox</extends>
@@ -6565,36 +6597,6 @@ font-style: italic;</string>
65656597
</tabstops>
65666598
<resources>
65676599
<include location="../../images/images.qrc"/>
6568-
<include location="../../images/images.qrc"/>
6569-
<include location="../../images/images.qrc"/>
6570-
<include location="../../images/images.qrc"/>
6571-
<include location="../../images/images.qrc"/>
6572-
<include location="../../images/images.qrc"/>
6573-
<include location="../../images/images.qrc"/>
6574-
<include location="../../images/images.qrc"/>
6575-
<include location="../../images/images.qrc"/>
6576-
<include location="../../images/images.qrc"/>
6577-
<include location="../../images/images.qrc"/>
6578-
<include location="../../images/images.qrc"/>
6579-
<include location="../../images/images.qrc"/>
6580-
<include location="../../images/images.qrc"/>
6581-
<include location="../../images/images.qrc"/>
6582-
<include location="../../images/images.qrc"/>
6583-
<include location="../../images/images.qrc"/>
6584-
<include location="../../images/images.qrc"/>
6585-
<include location="../../images/images.qrc"/>
6586-
<include location="../../images/images.qrc"/>
6587-
<include location="../../images/images.qrc"/>
6588-
<include location="../../images/images.qrc"/>
6589-
<include location="../../images/images.qrc"/>
6590-
<include location="../../images/images.qrc"/>
6591-
<include location="../../images/images.qrc"/>
6592-
<include location="../../images/images.qrc"/>
6593-
<include location="../../images/images.qrc"/>
6594-
<include location="../../images/images.qrc"/>
6595-
<include location="../../images/images.qrc"/>
6596-
<include location="../../images/images.qrc"/>
6597-
<include location="../../images/images.qrc"/>
65986600
</resources>
65996601
<connections>
66006602
<connection>

0 commit comments

Comments
 (0)
Please sign in to comment.