Skip to content

Commit

Permalink
Add ratio lock for width/height in new item properties dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 25, 2017
1 parent 3021fc8 commit 3648308
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 131 deletions.
3 changes: 3 additions & 0 deletions src/gui/layout/qgslayoutnewitempropertiesdialog.cpp
Expand Up @@ -46,6 +46,9 @@ QgsLayoutItemPropertiesDialog::QgsLayoutItemPropertiesDialog( QWidget *parent, Q
mPosUnitsComboBox->linkToWidget( mYPosSpin );
mSizeUnitsComboBox->linkToWidget( mWidthSpin );
mSizeUnitsComboBox->linkToWidget( mHeightSpin );

mLockAspectRatio->setWidthSpinBox( mWidthSpin );
mLockAspectRatio->setHeightSpinBox( mHeightSpin );
}

void QgsLayoutItemPropertiesDialog::setItemPosition( QgsLayoutPoint position )
Expand Down
301 changes: 170 additions & 131 deletions src/ui/layout/qgslayoutnewitemproperties.ui
Expand Up @@ -13,130 +13,7 @@
<property name="windowTitle">
<string>New Item Properties</string>
</property>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="0,1,0" columnstretch="1,0">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Position and size</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1,0,0">
<item row="3" column="0">
<widget class="QLabel" name="mHeightLabel">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<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="1" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mYPosSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-9999999.000000000000000</double>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mXLabel">
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mXPosSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-9999999.000000000000000</double>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mYLabel">
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<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="2" column="0">
<widget class="QLabel" name="mWidthLabel">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="2">
<widget class="QgsLayoutUnitsComboBox" name="mPosUnitsComboBox"/>
</item>
<item row="2" column="3" rowspan="2">
<widget class="QgsLayoutUnitsComboBox" name="mSizeUnitsComboBox"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="0,0,0" columnstretch="1,0">
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
Expand Down Expand Up @@ -322,6 +199,16 @@
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
Expand All @@ -335,19 +222,170 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Position and size</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1,0,0,0">
<item row="2" column="4" rowspan="2">
<widget class="QgsLayoutUnitsComboBox" name="mSizeUnitsComboBox"/>
</item>
<item row="2" column="1" colspan="2">
<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="3" column="1" colspan="2">
<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="3" column="0">
<widget class="QLabel" name="mHeightLabel">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mXLabel">
<property name="text">
<string>X</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="0" column="4" rowspan="2">
<widget class="QgsLayoutUnitsComboBox" name="mPosUnitsComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mYLabel">
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item row="2" column="3" rowspan="2">
<layout class="QHBoxLayout" name="_2">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QgsRatioLockButton" name="mLockAspectRatio">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Lock aspect ratio (including while drawing extent onto canvas)</string>
</property>
<property name="leftMargin" stdset="0">
<number>13</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" colspan="3">
<widget class="QgsDoubleSpinBox" name="mXPosSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-9999999.000000000000000</double>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QgsDoubleSpinBox" name="mYPosSpin">
<property name="suffix">
<string/>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-9999999.000000000000000</double>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
<property name="showClearButton" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsRatioLockButton</class>
<extends>QToolButton</extends>
<header>qgsratiolockbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
Expand All @@ -365,6 +403,7 @@
<tabstop>mPosUnitsComboBox</tabstop>
<tabstop>mWidthSpin</tabstop>
<tabstop>mHeightSpin</tabstop>
<tabstop>mLockAspectRatio</tabstop>
<tabstop>mSizeUnitsComboBox</tabstop>
<tabstop>mUpperLeftCheckBox</tabstop>
<tabstop>mUpperMiddleCheckBox</tabstop>
Expand Down

0 comments on commit 3648308

Please sign in to comment.