From e677a606d5f3d4ef5b0e6a29ec8eb996f197600b Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 31 May 2015 00:43:14 +0200 Subject: 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 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) { this->editable = editable; ui->avatarWidget->setEditable(editable); - ui->horizontalLayoutFN->setSpacing(editable ? 2 : 0); ui->lineEditFN->setVisible(editable); ui->labelFN->setVisible(!editable); - ui->horizontalLayoutNICKNAME->setSpacing(editable ? 2 : 0); ui->lineEditNICKNAME->setVisible(editable); ui->labelNICKNAME->setVisible(!editable); // prefix given middle last suffix - ui->horizontalLayoutFULLNAME->setSpacing(editable ? 2 : 0); ui->lineEditPREFIX->setVisible(editable); ui->lineEditGIVEN->setVisible(editable); ui->lineEditMIDDLE->setVisible(editable); @@ -79,7 +76,7 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) { for (QStringList::iterator i = fullname.begin(); i != fullname.end(); i++) { *i = i->trimmed(); } - ui->labelFULLNAME->setText(fullname.join(" ")); + ui->labelFULLNAME->setText((fullname.filter(QRegExp(".+"))).join(" ")); } 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 @@ 0 0 - 522 - 81 + 207 + 168 @@ -62,52 +62,65 @@ + + 0 + - - - - 0 - 0 - - - - - 18 - - - - - - - - - - - - 0 - 0 - - - - - 18 - 50 - false - - - - Formatted Name - - + + + 0 + + + + + + 0 + 0 + + + + + 18 + + + + + + + + + + + + 0 + 0 + + + + + 18 + 50 + false + + + + Formatted Name + + + + Qt::Horizontal + + QSizePolicy::MinimumExpanding + - 5 + 0 20 @@ -116,44 +129,57 @@ - - - - - - 0 - 0 - - - - - - - + + + 0 + - - - - 0 - 0 - - - - Nickname - - - true - - + + + 0 + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + Nickname + + + true + + + + Qt::Horizontal + + QSizePolicy::MinimumExpanding + - 5 + 0 20 @@ -162,117 +188,137 @@ - + - 2 + 0 - QLayout::SetMinimumSize + QLayout::SetDefaultConstraint - - - - 0 - 0 - - - - - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 0 - 0 - - - - Prefix - - - - - - - - 0 - 0 - - - - Given Name - - - - - - false - - - - - - - true - - - - 0 - 0 - - - - Middle Name - - - - - - true - - - - - - - - 0 - 0 - - - - Last Name - - - - - - - - 0 - 0 - - - - Suffix - - - false - - + + + 0 + + + + + + 0 + 0 + + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + 5 + + + 0 + + + + + + 0 + 0 + + + + Prefix + + + + + + + + 0 + 0 + + + + Given Name + + + + + + false + + + + + + + + 0 + 0 + + + + Suffix + + + false + + + + + + + + 0 + 0 + + + + Last Name + + + + + + + true + + + + 0 + 0 + + + + Middle Name + + + + + + true + + + + + + Qt::Horizontal + + QSizePolicy::MinimumExpanding + 40 -- cgit v0.10.2-6-g49f6