Skip to content

Commit

Permalink
Restore data defined page orientation control
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 17, 2017
1 parent 5d6a509 commit db17c2c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
12 changes: 12 additions & 0 deletions src/app/layout/qgslayoutpagepropertieswidget.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -168,6 +175,11 @@ void QgsLayoutPagePropertiesWidget::excludeExportsToggled( bool checked )
mPage->endCommand();
}

void QgsLayoutPagePropertiesWidget::refreshLayout()
{
mPage->layout()->refresh();
}

void QgsLayoutPagePropertiesWidget::showCurrentPageSize()
{
QgsLayoutSize paperSize = mPage->pageSize();
Expand Down
1 change: 1 addition & 0 deletions src/app/layout/qgslayoutpagepropertieswidget.h
Expand Up @@ -49,6 +49,7 @@ class QgsLayoutPagePropertiesWidget : public QgsLayoutItemBaseWidget, private Ui
void setToCustomSize();
void symbolChanged();
void excludeExportsToggled( bool checked );
void refreshLayout();

private:

Expand Down
2 changes: 1 addition & 1 deletion src/core/layout/qgslayout.cpp
Expand Up @@ -700,8 +700,8 @@ QList<QgsLayoutItem *> QgsLayout::ungroupItems( QgsLayoutItemGroup *group )

void QgsLayout::refresh()
{
emit refreshed();
mPageCollection->beginPageSizeChange();
emit refreshed();
mPageCollection->reflow();
mPageCollection->endPageSizeChange();
update();
Expand Down
36 changes: 24 additions & 12 deletions src/ui/layout/qgslayoutpagepropertieswidget.ui
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit db17c2c

Please sign in to comment.