Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Partially hook up data defined page size
TODO:
- preset page sizes
- reflow after update
  • Loading branch information
nyalldawson committed Aug 7, 2017
1 parent f802c56 commit 57c9668
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 60 deletions.
4 changes: 4 additions & 0 deletions src/app/layout/qgslayoutpagepropertieswidget.cpp
Expand Up @@ -55,6 +55,10 @@ QgsLayoutPagePropertiesWidget::QgsLayoutPagePropertiesWidget( QWidget *parent, Q
connect( mWidthSpin, static_cast< void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPagePropertiesWidget::setToCustomSize );
connect( mHeightSpin, static_cast< void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutPagePropertiesWidget::setToCustomSize );

registerDataDefinedButton( mPaperSizeDDBtn, QgsLayoutObject::PresetPaperSize );
registerDataDefinedButton( mWidthDDBtn, QgsLayoutObject::ItemWidth );
registerDataDefinedButton( mHeightDDBtn, QgsLayoutObject::ItemHeight );

showCurrentPageSize();
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/layout/qgslayoutobject.h
Expand Up @@ -49,8 +49,8 @@ class CORE_EXPORT QgsLayoutObject: public QObject, public QgsExpressionContextGe
TestProperty, //!< Dummy property with no effect on item
//composer page properties
PresetPaperSize, //!< Preset paper size for composition
PaperWidth, //!< Paper width
PaperHeight, //!< Paper height
PaperWidth, //!< Paper width (deprecated)
PaperHeight, //!< Paper height (deprecated)
NumPages, //!< Number of pages in composition
PaperOrientation, //!< Paper orientation
//general composer item properties
Expand Down
152 changes: 94 additions & 58 deletions src/ui/layout/qgslayoutpagepropertieswidget.ui
Expand Up @@ -33,46 +33,64 @@
<string>Page size</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mWidthLabel">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mPageOrientationComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Orientation</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mPageSizeComboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mHeightLabel">
<widget class="QLabel" name="mWidthLabel">
<property name="text">
<string>Height</string>
<string>Width</string>
</property>
</widget>
</item>
<item row="2" column="1" rowspan="2">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,0,0,0,1">
<item row="0" column="4" rowspan="2">
<item row="3" column="1" rowspan="2">
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,0,0,0,0,0">
<item row="0" column="5" rowspan="2">
<widget class="QgsLayoutUnitsComboBox" name="mSizeUnitsComboBox"/>
</item>
<item row="0" column="3" rowspan="2">
<item row="1" column="0" colspan="3">
<widget class="QgsDoubleSpinBox" name="mHeightSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QgsDoubleSpinBox" name="mWidthSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="4" rowspan="2">
<layout class="QHBoxLayout" name="_2">
<property name="leftMargin">
<number>2</number>
Expand Down Expand Up @@ -104,46 +122,56 @@
</item>
</layout>
</item>
<item row="0" column="0" colspan="3">
<widget class="QgsDoubleSpinBox" name="mWidthSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
<item row="0" column="3">
<widget class="QgsPropertyOverrideButton" name="mWidthDDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QgsDoubleSpinBox" name="mHeightSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
<item row="1" column="3">
<widget class="QgsPropertyOverrideButton" name="mHeightDDBtn">
<property name="text">
<string>…</string>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="mHeightLabel">
<property name="text">
<string>Height</string>
</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">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="mPageSizeComboBox"/>
</item>
<item>
<widget class="QgsPropertyOverrideButton" name="mPaperSizeDDBtn">
<property name="text">
<string>…</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand All @@ -166,13 +194,21 @@
<extends>QComboBox</extends>
<header>qgslayoutunitscombobox.h</header>
</customwidget>
<customwidget>
<class>QgsPropertyOverrideButton</class>
<extends>QToolButton</extends>
<header>qgspropertyoverridebutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mPageSizeComboBox</tabstop>
<tabstop>mPaperSizeDDBtn</tabstop>
<tabstop>mPageOrientationComboBox</tabstop>
<tabstop>mWidthSpin</tabstop>
<tabstop>mHeightSpin</tabstop>
<tabstop>mWidthDDBtn</tabstop>
<tabstop>mLockAspectRatio</tabstop>
<tabstop>mHeightSpin</tabstop>
<tabstop>mHeightDDBtn</tabstop>
<tabstop>mSizeUnitsComboBox</tabstop>
</tabstops>
<resources/>
Expand Down

0 comments on commit 57c9668

Please sign in to comment.