summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-05-31 18:14:49 (GMT)
committerTobias Markmann <tm@ayena.de>2015-05-31 18:14:49 (GMT)
commit44f48755200c7185fcae53e9e944e3a50e8806a5 (patch)
treeb5e6b5cfd8a5f8246e5b303c8aa68612f2bfc62b /Swift/QtUI/QtVCardWidget
parent5b851c72510ef88feb059455033915588fa6fb8c (diff)
downloadswift-44f48755200c7185fcae53e9e944e3a50e8806a5.zip
swift-44f48755200c7185fcae53e9e944e3a50e8806a5.tar.bz2
Remove magic number and fix QtVCardWidget::sizeHint
This adds layout margin and spacing to the calculation of the correct size hint. Test-Information: Tested on OS X 10.9.5 with Qt 5.4.1. Change-Id: I7036f64a6621f5ce6603e77da26a887e28c663ca
Diffstat (limited to 'Swift/QtUI/QtVCardWidget')
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp6
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardWidget.ui178
2 files changed, 95 insertions, 89 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp
index e202de5..79360d8 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp
@@ -84,6 +84,12 @@ QSize QtVCardWidget::sizeHint() const {
newSizeHint = QSize(std::max(newSizeHint.width(), fieldsWidgetSize.width()), newSizeHint.height() + fieldsWidgetSize.height());
+ // add layout margin
+ newSizeHint += QSize(layout()->contentsMargins().left() + layout()->contentsMargins().right(), layout()->contentsMargins().top() + layout()->contentsMargins().bottom());
+
+ // the spaceing before and after the line between the profile header and its fields
+ newSizeHint += QSize(0, layout()->spacing() * 2);
+
return newSizeHint;
}
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui b/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui
index 4fc8605..3a2997b 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui
+++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.ui
@@ -6,14 +6,17 @@
<rect>
<x>0</x>
<y>0</y>
- <width>535</width>
- <height>126</height>
+ <width>239</width>
+ <height>102</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout" rowstretch="1" columnstretch="1,0">
+ <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1">
+ <property name="spacing">
+ <number>2</number>
+ </property>
<property name="leftMargin">
<number>5</number>
</property>
@@ -26,102 +29,99 @@
<property name="bottomMargin">
<number>5</number>
</property>
- <item row="0" column="0" colspan="2">
- <layout class="QVBoxLayout" name="card" stretch="0,0,1">
- <property name="spacing">
- <number>2</number>
+ <item>
+ <widget class="Swift::QtVCardPhotoAndNameFields" name="photoAndName" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- <item>
- <widget class="Swift::QtVCardPhotoAndNameFields" name="photoAndName" native="true"/>
- </item>
- <item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
+ </widget>
+ </item>
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>229</width>
+ <height>77</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMinAndMaxSize</enum>
</property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
+ <property name="leftMargin">
+ <number>0</number>
</property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
+ <property name="topMargin">
+ <number>0</number>
</property>
- <property name="widgetResizable">
- <bool>true</bool>
+ <property name="rightMargin">
+ <number>0</number>
</property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <property name="bottomMargin">
+ <number>0</number>
</property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>523</width>
- <height>110</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetMinAndMaxSize</enum>
- </property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
+ <item>
+ <layout class="QGridLayout" name="cardFields"/>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="rightMargin">
- <number>0</number>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
</property>
- <property name="bottomMargin">
- <number>0</number>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
</property>
- <item>
- <layout class="QGridLayout" name="cardFields"/>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Preferred</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>1000</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
</item>
</layout>
</widget>