Restore data defined page orientation control

This commit is contained in:
Nyall Dawson 2017-12-15 21:27:46 +10:00
parent 5d6a509636
commit db17c2c43a
4 changed files with 38 additions and 13 deletions

View File

@ -66,7 +66,14 @@ QgsLayoutPagePropertiesWidget::QgsLayoutPagePropertiesWidget( QWidget *parent, Q
registerDataDefinedButton( mPaperSizeDDBtn, QgsLayoutObject::PresetPaperSize );
registerDataDefinedButton( mWidthDDBtn, QgsLayoutObject::ItemWidth );
registerDataDefinedButton( mHeightDDBtn, QgsLayoutObject::ItemHeight );
registerDataDefinedButton( mOrientationDDBtn, QgsLayoutObject::PaperOrientation );
registerDataDefinedButton( mExcludePageDDBtn, QgsLayoutObject::ExcludeFromExports );
connect( mPaperSizeDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
connect( mWidthDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
connect( mHeightDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
connect( mOrientationDDBtn, &QgsPropertyOverrideButton::changed, this, &QgsLayoutPagePropertiesWidget::refreshLayout );
mExcludePageDDBtn->registerEnabledWidget( mExcludePageCheckBox, false );
showCurrentPageSize();
@ -168,6 +175,11 @@ void QgsLayoutPagePropertiesWidget::excludeExportsToggled( bool checked )
mPage->endCommand();
}
void QgsLayoutPagePropertiesWidget::refreshLayout()
{
mPage->layout()->refresh();
}
void QgsLayoutPagePropertiesWidget::showCurrentPageSize()
{
QgsLayoutSize paperSize = mPage->pageSize();

View File

@ -49,6 +49,7 @@ class QgsLayoutPagePropertiesWidget : public QgsLayoutItemBaseWidget, private Ui
void setToCustomSize();
void symbolChanged();
void excludeExportsToggled( bool checked );
void refreshLayout();
private:

View File

@ -700,8 +700,8 @@ QList<QgsLayoutItem *> QgsLayout::ungroupItems( QgsLayoutItemGroup *group )
void QgsLayout::refresh()
{
emit refreshed();
mPageCollection->beginPageSizeChange();
emit refreshed();
mPageCollection->reflow();
mPageCollection->endPageSizeChange();
update();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>409</height>
<width>717</width>
<height>473</height>
</rect>
</property>
<property name="windowTitle">
@ -49,13 +49,6 @@
<string>Page size</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Orientation</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mWidthLabel">
<property name="text">
@ -161,9 +154,6 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mPageOrientationComboBox"/>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
@ -188,6 +178,27 @@
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="mPageOrientationComboBox"/>
</item>
<item>
<widget class="QgsPropertyOverrideButton" name="mOrientationDDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Orientation</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -275,6 +286,7 @@
<tabstop>mPageSizeComboBox</tabstop>
<tabstop>mPaperSizeDDBtn</tabstop>
<tabstop>mPageOrientationComboBox</tabstop>
<tabstop>mOrientationDDBtn</tabstop>
<tabstop>mWidthSpin</tabstop>
<tabstop>mWidthDDBtn</tabstop>
<tabstop>mLockAspectRatio</tabstop>