diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-05-30 22:43:14 (GMT) |
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2015-05-31 15:30:49 (GMT) |
| commit | e677a606d5f3d4ef5b0e6a29ec8eb996f197600b (patch) | |
| tree | bb5768c6d0a836086201aa533c833825e1f50e1a | |
| parent | e36548d66bdcc70e891ff7f84707ee59c5562c64 (diff) | |
| download | swift-e677a606d5f3d4ef5b0e6a29ec8eb996f197600b.zip swift-e677a606d5f3d4ef5b0e6a29ec8eb996f197600b.tar.bz2 | |
Layout improvements to QtVCardPhotoAndNameFields
Layout label and editing widgets below each other instead of next to
each other. This way there will not be any horizontal spacing if one
of them is hidden.
This also removes empty name parts in the shown fullname.
Test-Information:
Tested on Mac OS X 10.9.5 and Qt 5.4.1.
Change-Id: I20561a8e7f8b9305cd3314b1250a2d006abbccb5
| -rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp | 5 | ||||
| -rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui | 382 |
2 files changed, 215 insertions, 172 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp index c8b010e..75b1f07 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp | |||
| @@ -56,16 +56,13 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) { | |||
| 56 | this->editable = editable; | 56 | this->editable = editable; |
| 57 | 57 | ||
| 58 | ui->avatarWidget->setEditable(editable); | 58 | ui->avatarWidget->setEditable(editable); |
| 59 | ui->horizontalLayoutFN->setSpacing(editable ? 2 : 0); | ||
| 60 | ui->lineEditFN->setVisible(editable); | 59 | ui->lineEditFN->setVisible(editable); |
| 61 | ui->labelFN->setVisible(!editable); | 60 | ui->labelFN->setVisible(!editable); |
| 62 | 61 | ||
| 63 | ui->horizontalLayoutNICKNAME->setSpacing(editable ? 2 : 0); | ||
| 64 | ui->lineEditNICKNAME->setVisible(editable); | 62 | ui->lineEditNICKNAME->setVisible(editable); |
| 65 | ui->labelNICKNAME->setVisible(!editable); | 63 | ui->labelNICKNAME->setVisible(!editable); |
| 66 | 64 | ||
| 67 | // prefix given middle last suffix | 65 | // prefix given middle last suffix |
| 68 | ui->horizontalLayoutFULLNAME->setSpacing(editable ? 2 : 0); | ||
| 69 | ui->lineEditPREFIX->setVisible(editable); | 66 | ui->lineEditPREFIX->setVisible(editable); |
| 70 | ui->lineEditGIVEN->setVisible(editable); | 67 | ui->lineEditGIVEN->setVisible(editable); |
| 71 | ui->lineEditMIDDLE->setVisible(editable); | 68 | ui->lineEditMIDDLE->setVisible(editable); |
| @@ -79,7 +76,7 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) { | |||
| 79 | for (QStringList::iterator i = fullname.begin(); i != fullname.end(); i++) { | 76 | for (QStringList::iterator i = fullname.begin(); i != fullname.end(); i++) { |
| 80 | *i = i->trimmed(); | 77 | *i = i->trimmed(); |
| 81 | } | 78 | } |
| 82 | ui->labelFULLNAME->setText(fullname.join(" ")); | 79 | ui->labelFULLNAME->setText((fullname.filter(QRegExp(".+"))).join(" ")); |
| 83 | } | 80 | } |
| 84 | 81 | ||
| 85 | void QtVCardPhotoAndNameFields::setAvatar(const ByteArray &data, const std::string &type) { | 82 | void QtVCardPhotoAndNameFields::setAvatar(const ByteArray &data, const std::string &type) { |
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui index 146b49d..8e24098 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui +++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.ui | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | <rect> | 9 | <rect> |
| 10 | <x>0</x> | 10 | <x>0</x> |
| 11 | <y>0</y> | 11 | <y>0</y> |
| 12 | <width>522</width> | 12 | <width>207</width> |
| 13 | <height>81</height> | 13 | <height>168</height> |
| 14 | </rect> | 14 | </rect> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="sizePolicy"> | 16 | <property name="sizePolicy"> |
| @@ -62,52 +62,65 @@ | |||
| 62 | </item> | 62 | </item> |
| 63 | <item row="0" column="1"> | 63 | <item row="0" column="1"> |
| 64 | <layout class="QHBoxLayout" name="horizontalLayoutFN"> | 64 | <layout class="QHBoxLayout" name="horizontalLayoutFN"> |
| 65 | <property name="spacing"> | ||
| 66 | <number>0</number> | ||
| 67 | </property> | ||
| 65 | <item> | 68 | <item> |
| 66 | <widget class="Swift::QtElidingLabel" name="labelFN"> | 69 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
| 67 | <property name="sizePolicy"> | 70 | <property name="leftMargin"> |
| 68 | <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> | 71 | <number>0</number> |
| 69 | <horstretch>0</horstretch> | 72 | </property> |
| 70 | <verstretch>0</verstretch> | 73 | <item> |
| 71 | </sizepolicy> | 74 | <widget class="Swift::QtElidingLabel" name="labelFN"> |
| 72 | </property> | 75 | <property name="sizePolicy"> |
| 73 | <property name="font"> | 76 | <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |
| 74 | <font> | 77 | <horstretch>0</horstretch> |
| 75 | <pointsize>18</pointsize> | 78 | <verstretch>0</verstretch> |
| 76 | </font> | 79 | </sizepolicy> |
| 77 | </property> | 80 | </property> |
| 78 | <property name="text"> | 81 | <property name="font"> |
| 79 | <string/> | 82 | <font> |
| 80 | </property> | 83 | <pointsize>18</pointsize> |
| 81 | </widget> | 84 | </font> |
| 82 | </item> | 85 | </property> |
| 83 | <item> | 86 | <property name="text"> |
| 84 | <widget class="Swift::QtResizableLineEdit" name="lineEditFN"> | 87 | <string/> |
| 85 | <property name="sizePolicy"> | 88 | </property> |
| 86 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | 89 | </widget> |
| 87 | <horstretch>0</horstretch> | 90 | </item> |
| 88 | <verstretch>0</verstretch> | 91 | <item> |
| 89 | </sizepolicy> | 92 | <widget class="Swift::QtResizableLineEdit" name="lineEditFN"> |
| 90 | </property> | 93 | <property name="sizePolicy"> |
| 91 | <property name="font"> | 94 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
| 92 | <font> | 95 | <horstretch>0</horstretch> |
| 93 | <pointsize>18</pointsize> | 96 | <verstretch>0</verstretch> |
| 94 | <weight>50</weight> | 97 | </sizepolicy> |
| 95 | <bold>false</bold> | 98 | </property> |
| 96 | </font> | 99 | <property name="font"> |
| 97 | </property> | 100 | <font> |
| 98 | <property name="toolTip"> | 101 | <pointsize>18</pointsize> |
| 99 | <string>Formatted Name</string> | 102 | <weight>50</weight> |
| 100 | </property> | 103 | <bold>false</bold> |
| 101 | </widget> | 104 | </font> |
| 105 | </property> | ||
| 106 | <property name="toolTip"> | ||
| 107 | <string>Formatted Name</string> | ||
| 108 | </property> | ||
| 109 | </widget> | ||
| 110 | </item> | ||
| 111 | </layout> | ||
| 102 | </item> | 112 | </item> |
| 103 | <item> | 113 | <item> |
| 104 | <spacer name="horizontalSpacer_2"> | 114 | <spacer name="horizontalSpacer_2"> |
| 105 | <property name="orientation"> | 115 | <property name="orientation"> |
| 106 | <enum>Qt::Horizontal</enum> | 116 | <enum>Qt::Horizontal</enum> |
| 107 | </property> | 117 | </property> |
| 118 | <property name="sizeType"> | ||
| 119 | <enum>QSizePolicy::MinimumExpanding</enum> | ||
| 120 | </property> | ||
| 108 | <property name="sizeHint" stdset="0"> | 121 | <property name="sizeHint" stdset="0"> |
| 109 | <size> | 122 | <size> |
| 110 | <width>5</width> | 123 | <width>0</width> |
| 111 | <height>20</height> | 124 | <height>20</height> |
| 112 | </size> | 125 | </size> |
| 113 | </property> | 126 | </property> |
| @@ -116,44 +129,57 @@ | |||
| 116 | </layout> | 129 | </layout> |
| 117 | </item> | 130 | </item> |
| 118 | <item row="1" column="1"> | 131 | <item row="1" column="1"> |
| 119 | <layout class="QHBoxLayout" name="horizontalLayoutNICKNAME"> | 132 | <layout class="QHBoxLayout" name="horizontalLayoutNICKNAME" stretch="0,0"> |
| 120 | <item> | 133 | <property name="spacing"> |
| 121 | <widget class="Swift::QtElidingLabel" name="labelNICKNAME"> | 134 | <number>0</number> |
| 122 | <property name="sizePolicy"> | 135 | </property> |
| 123 | <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> | ||
| 124 | <horstretch>0</horstretch> | ||
| 125 | <verstretch>0</verstretch> | ||
| 126 | </sizepolicy> | ||
| 127 | </property> | ||
| 128 | <property name="text"> | ||
| 129 | <string/> | ||
| 130 | </property> | ||
| 131 | </widget> | ||
| 132 | </item> | ||
| 133 | <item> | 136 | <item> |
| 134 | <widget class="Swift::QtResizableLineEdit" name="lineEditNICKNAME"> | 137 | <layout class="QVBoxLayout" name="verticalLayout_2"> |
| 135 | <property name="sizePolicy"> | 138 | <property name="leftMargin"> |
| 136 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | 139 | <number>0</number> |
| 137 | <horstretch>0</horstretch> | 140 | </property> |
| 138 | <verstretch>0</verstretch> | 141 | <item> |
| 139 | </sizepolicy> | 142 | <widget class="Swift::QtElidingLabel" name="labelNICKNAME"> |
| 140 | </property> | 143 | <property name="sizePolicy"> |
| 141 | <property name="toolTip"> | 144 | <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |
| 142 | <string>Nickname</string> | 145 | <horstretch>0</horstretch> |
| 143 | </property> | 146 | <verstretch>0</verstretch> |
| 144 | <property name="frame"> | 147 | </sizepolicy> |
| 145 | <bool>true</bool> | 148 | </property> |
| 146 | </property> | 149 | <property name="text"> |
| 147 | </widget> | 150 | <string/> |
| 151 | </property> | ||
| 152 | </widget> | ||
| 153 | </item> | ||
| 154 | <item> | ||
| 155 | <widget class="Swift::QtResizableLineEdit" name="lineEditNICKNAME"> | ||
| 156 | <property name="sizePolicy"> | ||
| 157 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
| 158 | <horstretch>0</horstretch> | ||
| 159 | <verstretch>0</verstretch> | ||
| 160 | </sizepolicy> | ||
| 161 | </property> | ||
| 162 | <property name="toolTip"> | ||
| 163 | <string>Nickname</string> | ||
| 164 | </property> | ||
| 165 | <property name="frame"> | ||
| 166 | <bool>true</bool> | ||
| 167 | </property> | ||
| 168 | </widget> | ||
| 169 | </item> | ||
| 170 | </layout> | ||
| 148 | </item> | 171 | </item> |
| 149 | <item> | 172 | <item> |
| 150 | <spacer name="horizontalSpacer_3"> | 173 | <spacer name="horizontalSpacer_3"> |
| 151 | <property name="orientation"> | 174 | <property name="orientation"> |
| 152 | <enum>Qt::Horizontal</enum> | 175 | <enum>Qt::Horizontal</enum> |
| 153 | </property> | 176 | </property> |
| 177 | <property name="sizeType"> | ||
| 178 | <enum>QSizePolicy::MinimumExpanding</enum> | ||
| 179 | </property> | ||
| 154 | <property name="sizeHint" stdset="0"> | 180 | <property name="sizeHint" stdset="0"> |
| 155 | <size> | 181 | <size> |
| 156 | <width>5</width> | 182 | <width>0</width> |
| 157 | <height>20</height> | 183 | <height>20</height> |
| 158 | </size> | 184 | </size> |
| 159 | </property> | 185 | </property> |
| @@ -162,117 +188,137 @@ | |||
| 162 | </layout> | 188 | </layout> |
| 163 | </item> | 189 | </item> |
| 164 | <item row="2" column="1"> | 190 | <item row="2" column="1"> |
| 165 | <layout class="QHBoxLayout" name="horizontalLayoutFULLNAME"> | 191 | <layout class="QHBoxLayout" name="horizontalLayoutFULLNAME_1"> |
| 166 | <property name="spacing"> | 192 | <property name="spacing"> |
| 167 | <number>2</number> | 193 | <number>0</number> |
| 168 | </property> | 194 | </property> |
| 169 | <property name="sizeConstraint"> | 195 | <property name="sizeConstraint"> |
| 170 | <enum>QLayout::SetMinimumSize</enum> | 196 | <enum>QLayout::SetDefaultConstraint</enum> |
| 171 | </property> | 197 | </property> |
| 172 | <item> | 198 | <item> |
| 173 | <widget class="Swift::QtElidingLabel" name="labelFULLNAME"> | 199 | <layout class="QVBoxLayout" name="verticalLayout_4"> |
| 174 | <property name="sizePolicy"> | 200 | <property name="leftMargin"> |
| 175 | <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> | 201 | <number>0</number> |
| 176 | <horstretch>0</horstretch> | 202 | </property> |
| 177 | <verstretch>0</verstretch> | 203 | <item> |
| 178 | </sizepolicy> | 204 | <widget class="Swift::QtElidingLabel" name="labelFULLNAME"> |
| 179 | </property> | 205 | <property name="sizePolicy"> |
| 180 | <property name="text"> | 206 | <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> |
| 181 | <string/> | 207 | <horstretch>0</horstretch> |
| 182 | </property> | 208 | <verstretch>0</verstretch> |
| 183 | <property name="textInteractionFlags"> | 209 | </sizepolicy> |
| 184 | <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> | 210 | </property> |
| 185 | </property> | 211 | <property name="text"> |
| 186 | </widget> | 212 | <string/> |
| 187 | </item> | 213 | </property> |
| 188 | <item> | 214 | <property name="textInteractionFlags"> |
| 189 | <widget class="Swift::QtResizableLineEdit" name="lineEditPREFIX"> | 215 | <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> |
| 190 | <property name="sizePolicy"> | 216 | </property> |
| 191 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | 217 | </widget> |
| 192 | <horstretch>0</horstretch> | 218 | </item> |
| 193 | <verstretch>0</verstretch> | 219 | <item> |
| 194 | </sizepolicy> | 220 | <layout class="QHBoxLayout" name="horizontalLayoutFULLNAME_2"> |
| 195 | </property> | 221 | <property name="spacing"> |
| 196 | <property name="toolTip"> | 222 | <number>5</number> |
| 197 | <string>Prefix</string> | 223 | </property> |
| 198 | </property> | 224 | <property name="leftMargin"> |
| 199 | </widget> | 225 | <number>0</number> |
| 200 | </item> | 226 | </property> |
| 201 | <item> | 227 | <item> |
| 202 | <widget class="Swift::QtResizableLineEdit" name="lineEditGIVEN"> | 228 | <widget class="Swift::QtResizableLineEdit" name="lineEditPREFIX"> |
| 203 | <property name="sizePolicy"> | 229 | <property name="sizePolicy"> |
| 204 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | 230 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
| 205 | <horstretch>0</horstretch> | 231 | <horstretch>0</horstretch> |
| 206 | <verstretch>0</verstretch> | 232 | <verstretch>0</verstretch> |
| 207 | </sizepolicy> | 233 | </sizepolicy> |
| 208 | </property> | 234 | </property> |
| 209 | <property name="toolTip"> | 235 | <property name="toolTip"> |
| 210 | <string>Given Name</string> | 236 | <string>Prefix</string> |
| 211 | </property> | 237 | </property> |
| 212 | <property name="text"> | 238 | </widget> |
| 213 | <string/> | 239 | </item> |
| 214 | </property> | 240 | <item> |
| 215 | <property name="readOnly"> | 241 | <widget class="Swift::QtResizableLineEdit" name="lineEditGIVEN"> |
| 216 | <bool>false</bool> | 242 | <property name="sizePolicy"> |
| 217 | </property> | 243 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
| 218 | </widget> | 244 | <horstretch>0</horstretch> |
| 219 | </item> | 245 | <verstretch>0</verstretch> |
| 220 | <item> | 246 | </sizepolicy> |
| 221 | <widget class="Swift::QtResizableLineEdit" name="lineEditMIDDLE"> | 247 | </property> |
| 222 | <property name="enabled"> | 248 | <property name="toolTip"> |
| 223 | <bool>true</bool> | 249 | <string>Given Name</string> |
| 224 | </property> | 250 | </property> |
| 225 | <property name="sizePolicy"> | 251 | <property name="text"> |
| 226 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | 252 | <string/> |
| 227 | <horstretch>0</horstretch> | 253 | </property> |
| 228 | <verstretch>0</verstretch> | 254 | <property name="readOnly"> |
| 229 | </sizepolicy> | 255 | <bool>false</bool> |
| 230 | </property> | 256 | </property> |
| 231 | <property name="toolTip"> | 257 | </widget> |
| 232 | <string>Middle Name</string> | 258 | </item> |
| 233 | </property> | 259 | <item> |
| 234 | <property name="styleSheet"> | 260 | <widget class="Swift::QtResizableLineEdit" name="lineEditSUFFIX"> |
| 235 | <string notr="true"/> | 261 | <property name="sizePolicy"> |
| 236 | </property> | 262 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
| 237 | <property name="frame"> | 263 | <horstretch>0</horstretch> |
| 238 | <bool>true</bool> | 264 | <verstretch>0</verstretch> |
| 239 | </property> | 265 | </sizepolicy> |
| 240 | </widget> | 266 | </property> |
| 241 | </item> | 267 | <property name="toolTip"> |
| 242 | <item> | 268 | <string>Suffix</string> |
| 243 | <widget class="Swift::QtResizableLineEdit" name="lineEditFAMILY"> | 269 | </property> |
| 244 | <property name="sizePolicy"> | 270 | <property name="readOnly"> |
| 245 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | 271 | <bool>false</bool> |
| 246 | <horstretch>0</horstretch> | 272 | </property> |
| 247 | <verstretch>0</verstretch> | 273 | </widget> |
| 248 | </sizepolicy> | 274 | </item> |
| 249 | </property> | 275 | <item> |
| 250 | <property name="toolTip"> | 276 | <widget class="Swift::QtResizableLineEdit" name="lineEditFAMILY"> |
| 251 | <string>Last Name</string> | 277 | <property name="sizePolicy"> |
| 252 | </property> | 278 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
| 253 | </widget> | 279 | <horstretch>0</horstretch> |
| 254 | </item> | 280 | <verstretch>0</verstretch> |
| 255 | <item> | 281 | </sizepolicy> |
| 256 | <widget class="Swift::QtResizableLineEdit" name="lineEditSUFFIX"> | 282 | </property> |
| 257 | <property name="sizePolicy"> | 283 | <property name="toolTip"> |
| 258 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | 284 | <string>Last Name</string> |
| 259 | <horstretch>0</horstretch> | 285 | </property> |
| 260 | <verstretch>0</verstretch> | 286 | </widget> |
| 261 | </sizepolicy> | 287 | </item> |
| 262 | </property> | 288 | <item> |
| 263 | <property name="toolTip"> | 289 | <widget class="Swift::QtResizableLineEdit" name="lineEditMIDDLE"> |
| 264 | <string>Suffix</string> | 290 | <property name="enabled"> |
| 265 | </property> | 291 | <bool>true</bool> |
| 266 | <property name="readOnly"> | 292 | </property> |
| 267 | <bool>false</bool> | 293 | <property name="sizePolicy"> |
| 268 | </property> | 294 | <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
| 269 | </widget> | 295 | <horstretch>0</horstretch> |
| 296 | <verstretch>0</verstretch> | ||
| 297 | </sizepolicy> | ||
| 298 | </property> | ||
| 299 | <property name="toolTip"> | ||
| 300 | <string>Middle Name</string> | ||
| 301 | </property> | ||
| 302 | <property name="styleSheet"> | ||
| 303 | <string notr="true"/> | ||
| 304 | </property> | ||
| 305 | <property name="frame"> | ||
| 306 | <bool>true</bool> | ||
| 307 | </property> | ||
| 308 | </widget> | ||
| 309 | </item> | ||
| 310 | </layout> | ||
| 311 | </item> | ||
| 312 | </layout> | ||
| 270 | </item> | 313 | </item> |
| 271 | <item> | 314 | <item> |
| 272 | <spacer name="horizontalSpacer"> | 315 | <spacer name="horizontalSpacer"> |
| 273 | <property name="orientation"> | 316 | <property name="orientation"> |
| 274 | <enum>Qt::Horizontal</enum> | 317 | <enum>Qt::Horizontal</enum> |
| 275 | </property> | 318 | </property> |
| 319 | <property name="sizeType"> | ||
| 320 | <enum>QSizePolicy::MinimumExpanding</enum> | ||
| 321 | </property> | ||
| 276 | <property name="sizeHint" stdset="0"> | 322 | <property name="sizeHint" stdset="0"> |
| 277 | <size> | 323 | <size> |
| 278 | <width>40</width> | 324 | <width>40</width> |
Swift