Skip to content

Commit db17c2c

Browse files
committedDec 17, 2017
Restore data defined page orientation control
1 parent 5d6a509 commit db17c2c

File tree

4 files changed

+38
-13
lines changed

4 files changed

+38
-13
lines changed
 

‎src/app/layout/qgslayoutpagepropertieswidget.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,14 @@ QgsLayoutPagePropertiesWidget::QgsLayoutPagePropertiesWidget( QWidget *parent, Q
6666
registerDataDefinedButton( mPaperSizeDDBtn, QgsLayoutObject::PresetPaperSize );
6767
registerDataDefinedButton( mWidthDDBtn, QgsLayoutObject::ItemWidth );
6868
registerDataDefinedButton( mHeightDDBtn, QgsLayoutObject::ItemHeight );
69+
registerDataDefinedButton( mOrientationDDBtn, QgsLayoutObject::PaperOrientation );
6970
registerDataDefinedButton( mExcludePageDDBtn, QgsLayoutObject::ExcludeFromExports );
71+
72+
connect( mPaperSizeDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
73+
connect( mWidthDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
74+
connect( mHeightDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
75+
connect( mOrientationDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
76+
7077
mExcludePageDDBtn->registerEnabledWidget( mExcludePageCheckBox, false );
7178

7279
showCurrentPageSize();
@@ -168,6 +175,11 @@ void QgsLayoutPagePropertiesWidget::excludeExportsToggled( bool checked )
168175
mPage->endCommand();
169176
}
170177

178+
void QgsLayoutPagePropertiesWidget::refreshLayout()
179+
{
180+
mPage->layout()->refresh();
181+
}
182+
171183
void QgsLayoutPagePropertiesWidget::showCurrentPageSize()
172184
{
173185
QgsLayoutSize paperSize = mPage->pageSize();

‎src/app/layout/qgslayoutpagepropertieswidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class QgsLayoutPagePropertiesWidget : public QgsLayoutItemBaseWidget, private Ui
4949
void setToCustomSize();
5050
void symbolChanged();
5151
void excludeExportsToggled( bool checked );
52+
void refreshLayout();
5253

5354
private:
5455

‎src/core/layout/qgslayout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ QList<QgsLayoutItem *> QgsLayout::ungroupItems( QgsLayoutItemGroup *group )
700700

701701
void QgsLayout::refresh()
702702
{
703-
emit refreshed();
704703
mPageCollection->beginPageSizeChange();
704+
emit refreshed();
705705
mPageCollection->reflow();
706706
mPageCollection->endPageSizeChange();
707707
update();

‎src/ui/layout/qgslayoutpagepropertieswidget.ui

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>397</width>
10-
<height>409</height>
9+
<width>717</width>
10+
<height>473</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -49,13 +49,6 @@
4949
<string>Page size</string>
5050
</property>
5151
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
52-
<item row="2" column="0">
53-
<widget class="QLabel" name="label_4">
54-
<property name="text">
55-
<string>Orientation</string>
56-
</property>
57-
</widget>
58-
</item>
5952
<item row="3" column="0">
6053
<widget class="QLabel" name="mWidthLabel">
6154
<property name="text">
@@ -161,9 +154,6 @@
161154
</property>
162155
</widget>
163156
</item>
164-
<item row="2" column="1">
165-
<widget class="QComboBox" name="mPageOrientationComboBox"/>
166-
</item>
167157
<item row="0" column="1">
168158
<layout class="QHBoxLayout" name="horizontalLayout">
169159
<property name="topMargin">
@@ -188,6 +178,27 @@
188178
</property>
189179
</widget>
190180
</item>
181+
<item row="1" column="1">
182+
<layout class="QHBoxLayout" name="horizontalLayout_3">
183+
<item>
184+
<widget class="QComboBox" name="mPageOrientationComboBox"/>
185+
</item>
186+
<item>
187+
<widget class="QgsPropertyOverrideButton" name="mOrientationDDBtn">
188+
<property name="text">
189+
<string>…</string>
190+
</property>
191+
</widget>
192+
</item>
193+
</layout>
194+
</item>
195+
<item row="1" column="0">
196+
<widget class="QLabel" name="label_4">
197+
<property name="text">
198+
<string>Orientation</string>
199+
</property>
200+
</widget>
201+
</item>
191202
</layout>
192203
</widget>
193204
</item>
@@ -275,6 +286,7 @@
275286
<tabstop>mPageSizeComboBox</tabstop>
276287
<tabstop>mPaperSizeDDBtn</tabstop>
277288
<tabstop>mPageOrientationComboBox</tabstop>
289+
<tabstop>mOrientationDDBtn</tabstop>
278290
<tabstop>mWidthSpin</tabstop>
279291
<tabstop>mWidthDDBtn</tabstop>
280292
<tabstop>mLockAspectRatio</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.