Fix the layout on the Print Dialog

The layout was a hardcoded position without layouts, that
would only work on english language since other languages can
have bigger strings than the current ones.

Also removed the 'setFixedSize' stuff and let the widget
find it's best size for itself.

Fixes #656
Fixes #396

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-08-04 13:27:29 -03:00 committed by Dirk Hohndel
parent 116608201d
commit 0416a09a1e
2 changed files with 166 additions and 210 deletions

View file

@ -57,7 +57,6 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
hLayout->addWidget(buttonBox); hLayout->addWidget(buttonBox);
setFixedSize(550, 400);
setWindowTitle(tr("Print")); setWindowTitle(tr("Print"));
setWindowIcon(QIcon(":subsurface-icon")); setWindowIcon(QIcon(":subsurface-icon"));

View file

@ -6,224 +6,181 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>511</width> <width>367</width>
<height>308</height> <height>433</height>
</rect> </rect>
</property> </property>
<widget class="QGroupBox" name="printOptions"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="geometry"> <item>
<rect> <widget class="QGroupBox" name="printType">
<x>10</x> <property name="sizePolicy">
<y>70</y> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<width>489</width> <horstretch>0</horstretch>
<height>81</height> <verstretch>0</verstretch>
</rect> </sizepolicy>
</property>
<property name="title">
<string>Print options</string>
</property>
<widget class="QCheckBox" name="printSelected">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>461</width>
<height>18</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Print only selected dives</string>
</property>
</widget>
<widget class="QCheckBox" name="printInColor">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>461</width>
<height>18</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Print in color</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="printType">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>489</width>
<height>51</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Print type</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget_2">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>491</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="layoutPrintType">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property> </property>
<property name="leftMargin"> <property name="baseSize">
<number>15</number> <size>
<width>0</width>
<height>0</height>
</size>
</property> </property>
<property name="rightMargin"> <property name="title">
<number>15</number> <string>Print type</string>
</property> </property>
<item> <layout class="QGridLayout" name="gridLayout">
<widget class="QRadioButton" name="radioSixDives"> <item row="0" column="0" colspan="2">
<property name="sizePolicy"> <widget class="QRadioButton" name="radioSixDives">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<verstretch>0</verstretch> <horstretch>0</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="text"> </property>
<string>6 dives per page</string> <property name="text">
</property> <string>&amp;6 dives per page</string>
<property name="checked"> </property>
<bool>true</bool> <property name="checked">
</property> <bool>true</bool>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QRadioButton" name="radioTwoDives"> <item row="2" column="0">
<property name="sizePolicy"> <widget class="QRadioButton" name="radioOneDive">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<verstretch>0</verstretch> <horstretch>0</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="text"> </property>
<string>2 dives per page</string> <property name="text">
</property> <string>&amp;1 dive per page</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QRadioButton" name="radioOneDive"> <item row="3" column="0" colspan="2">
<property name="sizePolicy"> <widget class="QRadioButton" name="radioTwoDives">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<verstretch>0</verstretch> <horstretch>0</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="text"> </property>
<string>1 dive per page</string> <property name="text">
</property> <string>&amp;2 dives per page</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QRadioButton" name="radioTablePrint"> <item row="0" column="2">
<property name="sizePolicy"> <widget class="QRadioButton" name="radioTablePrint">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<verstretch>0</verstretch> <horstretch>0</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="text"> </property>
<string>Table print</string> <property name="text">
</property> <string>&amp;Table print</string>
</widget> </property>
</item> </widget>
</layout> </item>
</widget> <item row="2" column="2" rowspan="2">
</widget> <spacer name="verticalSpacer">
<widget class="QGroupBox" name="ordering"> <property name="orientation">
<property name="geometry"> <enum>Qt::Vertical</enum>
<rect> </property>
<x>10</x> <property name="sizeHint" stdset="0">
<y>160</y> <size>
<width>489</width> <width>20</width>
<height>81</height> <height>40</height>
</rect> </size>
</property> </property>
<property name="title"> </spacer>
<string>Ordering</string> </item>
</property> </layout>
<widget class="QRadioButton" name="profileOnTop"> </widget>
<property name="geometry"> </item>
<rect> <item>
<x>10</x> <widget class="QGroupBox" name="printOptions">
<y>30</y> <property name="title">
<width>461</width> <string>Print options</string>
<height>18</height> </property>
</rect> <layout class="QVBoxLayout" name="verticalLayout">
</property> <item>
<property name="sizePolicy"> <widget class="QCheckBox" name="printSelected">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<verstretch>0</verstretch> <horstretch>0</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="text"> </property>
<string>Profile on top</string> <property name="text">
</property> <string>Print only selected dives</string>
<property name="checked"> </property>
<bool>true</bool> </widget>
</property> </item>
</widget> <item>
<widget class="QRadioButton" name="notesOnTop"> <widget class="QCheckBox" name="printInColor">
<property name="geometry"> <property name="sizePolicy">
<rect> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<x>10</x> <horstretch>0</horstretch>
<y>50</y> <verstretch>0</verstretch>
<width>461</width> </sizepolicy>
<height>18</height> </property>
</rect> <property name="text">
</property> <string>Print in color</string>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> </widget>
<horstretch>0</horstretch> </item>
<verstretch>0</verstretch> </layout>
</sizepolicy> </widget>
</property> </item>
<property name="text"> <item>
<string>Notes on top</string> <widget class="QGroupBox" name="ordering">
</property> <property name="title">
<property name="checked"> <string>Ordering</string>
<bool>false</bool> </property>
</property> <layout class="QVBoxLayout" name="verticalLayout_2">
</widget> <item>
</widget> <widget class="QRadioButton" name="profileOnTop">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Prof&amp;ile on top</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="notesOnTop">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Notes on top</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>radioSixDives</tabstop> <tabstop>radioSixDives</tabstop>
<tabstop>radioTwoDives</tabstop> <tabstop>radioTwoDives</tabstop>
<tabstop>radioTablePrint</tabstop>
<tabstop>printSelected</tabstop> <tabstop>printSelected</tabstop>
<tabstop>printInColor</tabstop> <tabstop>printInColor</tabstop>
<tabstop>profileOnTop</tabstop> <tabstop>profileOnTop</tabstop>