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
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
-rw-r--r--Swift/QtUI/QtProfileWindow.cpp2
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp6
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardWidget.ui178
3 files changed, 96 insertions, 90 deletions
diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp
index 71d4281..06d602a 100644
--- a/Swift/QtUI/QtProfileWindow.cpp
+++ b/Swift/QtUI/QtProfileWindow.cpp
@@ -116,7 +116,7 @@ void QtProfileWindow::hide() {
116} 116}
117 117
118QSize QtProfileWindow::sizeHint() const { 118QSize QtProfileWindow::sizeHint() const {
119 return QWidget::sizeHint() + QSize(0, 15); 119 return QWidget::sizeHint();
120} 120}
121 121
122void QtProfileWindow::updateTitle() { 122void QtProfileWindow::updateTitle() {
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 {
84 84
85 newSizeHint = QSize(std::max(newSizeHint.width(), fieldsWidgetSize.width()), newSizeHint.height() + fieldsWidgetSize.height()); 85 newSizeHint = QSize(std::max(newSizeHint.width(), fieldsWidgetSize.width()), newSizeHint.height() + fieldsWidgetSize.height());
86 86
87 // add layout margin
88 newSizeHint += QSize(layout()->contentsMargins().left() + layout()->contentsMargins().right(), layout()->contentsMargins().top() + layout()->contentsMargins().bottom());
89
90 // the spaceing before and after the line between the profile header and its fields
91 newSizeHint += QSize(0, layout()->spacing() * 2);
92
87 return newSizeHint; 93 return newSizeHint;
88} 94}
89 95
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 @@
6 <rect> 6 <rect>
7 <x>0</x> 7 <x>0</x>
8 <y>0</y> 8 <y>0</y>
9 <width>535</width> 9 <width>239</width>
10 <height>126</height> 10 <height>102</height>
11 </rect> 11 </rect>
12 </property> 12 </property>
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Form</string> 14 <string>Form</string>
15 </property> 15 </property>
16 <layout class="QGridLayout" name="gridLayout" rowstretch="1" columnstretch="1,0"> 16 <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1">
17 <property name="spacing">
18 <number>2</number>
19 </property>
17 <property name="leftMargin"> 20 <property name="leftMargin">
18 <number>5</number> 21 <number>5</number>
19 </property> 22 </property>
@@ -26,102 +29,99 @@
26 <property name="bottomMargin"> 29 <property name="bottomMargin">
27 <number>5</number> 30 <number>5</number>
28 </property> 31 </property>
29 <item row="0" column="0" colspan="2"> 32 <item>
30 <layout class="QVBoxLayout" name="card" stretch="0,0,1"> 33 <widget class="Swift::QtVCardPhotoAndNameFields" name="photoAndName" native="true">
31 <property name="spacing"> 34 <property name="sizePolicy">
32 <number>2</number> 35 <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
36 <horstretch>0</horstretch>
37 <verstretch>0</verstretch>
38 </sizepolicy>
33 </property> 39 </property>
34 <property name="sizeConstraint"> 40 </widget>
35 <enum>QLayout::SetDefaultConstraint</enum> 41 </item>
42 <item>
43 <widget class="Line" name="line">
44 <property name="orientation">
45 <enum>Qt::Horizontal</enum>
36 </property> 46 </property>
37 <item> 47 </widget>
38 <widget class="Swift::QtVCardPhotoAndNameFields" name="photoAndName" native="true"/> 48 </item>
39 </item> 49 <item>
40 <item> 50 <widget class="QScrollArea" name="scrollArea">
41 <widget class="Line" name="line"> 51 <property name="sizePolicy">
42 <property name="orientation"> 52 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
43 <enum>Qt::Horizontal</enum> 53 <horstretch>0</horstretch>
44 </property> 54 <verstretch>0</verstretch>
45 </widget> 55 </sizepolicy>
46 </item> 56 </property>
47 <item> 57 <property name="frameShape">
48 <widget class="QScrollArea" name="scrollArea"> 58 <enum>QFrame::NoFrame</enum>
49 <property name="sizePolicy"> 59 </property>
50 <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> 60 <property name="frameShadow">
51 <horstretch>0</horstretch> 61 <enum>QFrame::Plain</enum>
52 <verstretch>0</verstretch> 62 </property>
53 </sizepolicy> 63 <property name="horizontalScrollBarPolicy">
54 </property> 64 <enum>Qt::ScrollBarAlwaysOff</enum>
55 <property name="frameShape"> 65 </property>
56 <enum>QFrame::NoFrame</enum> 66 <property name="widgetResizable">
67 <bool>true</bool>
68 </property>
69 <property name="alignment">
70 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
71 </property>
72 <widget class="QWidget" name="scrollAreaWidgetContents">
73 <property name="geometry">
74 <rect>
75 <x>0</x>
76 <y>0</y>
77 <width>229</width>
78 <height>77</height>
79 </rect>
80 </property>
81 <property name="sizePolicy">
82 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
83 <horstretch>0</horstretch>
84 <verstretch>0</verstretch>
85 </sizepolicy>
86 </property>
87 <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
88 <property name="sizeConstraint">
89 <enum>QLayout::SetMinAndMaxSize</enum>
57 </property> 90 </property>
58 <property name="frameShadow"> 91 <property name="leftMargin">
59 <enum>QFrame::Plain</enum> 92 <number>0</number>
60 </property> 93 </property>
61 <property name="horizontalScrollBarPolicy"> 94 <property name="topMargin">
62 <enum>Qt::ScrollBarAlwaysOff</enum> 95 <number>0</number>
63 </property> 96 </property>
64 <property name="widgetResizable"> 97 <property name="rightMargin">
65 <bool>true</bool> 98 <number>0</number>
66 </property> 99 </property>
67 <property name="alignment"> 100 <property name="bottomMargin">
68 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> 101 <number>0</number>
69 </property> 102 </property>
70 <widget class="QWidget" name="scrollAreaWidgetContents"> 103 <item>
71 <property name="geometry"> 104 <layout class="QGridLayout" name="cardFields"/>
72 <rect> 105 </item>
73 <x>0</x> 106 <item>
74 <y>0</y> 107 <spacer name="verticalSpacer">
75 <width>523</width> 108 <property name="orientation">
76 <height>110</height> 109 <enum>Qt::Vertical</enum>
77 </rect>
78 </property>
79 <property name="sizePolicy">
80 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
81 <horstretch>0</horstretch>
82 <verstretch>0</verstretch>
83 </sizepolicy>
84 </property>
85 <layout class="QVBoxLayout" name="verticalLayout">
86 <property name="sizeConstraint">
87 <enum>QLayout::SetMinAndMaxSize</enum>
88 </property>
89 <property name="leftMargin">
90 <number>0</number>
91 </property>
92 <property name="topMargin">
93 <number>0</number>
94 </property> 110 </property>
95 <property name="rightMargin"> 111 <property name="sizeType">
96 <number>0</number> 112 <enum>QSizePolicy::Expanding</enum>
97 </property> 113 </property>
98 <property name="bottomMargin"> 114 <property name="sizeHint" stdset="0">
99 <number>0</number> 115 <size>
116 <width>0</width>
117 <height>0</height>
118 </size>
100 </property> 119 </property>
101 <item> 120 </spacer>
102 <layout class="QGridLayout" name="cardFields"/> 121 </item>
103 </item> 122 </layout>
104 <item> 123 </widget>
105 <spacer name="verticalSpacer"> 124 </widget>
106 <property name="orientation">
107 <enum>Qt::Vertical</enum>
108 </property>
109 <property name="sizeType">
110 <enum>QSizePolicy::Preferred</enum>
111 </property>
112 <property name="sizeHint" stdset="0">
113 <size>
114 <width>20</width>
115 <height>1000</height>
116 </size>
117 </property>
118 </spacer>
119 </item>
120 </layout>
121 </widget>
122 </widget>
123 </item>
124 </layout>
125 </item> 125 </item>
126 </layout> 126 </layout>
127 </widget> 127 </widget>