diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtContactEditWidget.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Swift/QtUI/QtContactEditWidget.cpp b/Swift/QtUI/QtContactEditWidget.cpp index a347a00..84cbf6b 100644 --- a/Swift/QtUI/QtContactEditWidget.cpp +++ b/Swift/QtUI/QtContactEditWidget.cpp @@ -115,6 +115,15 @@ void QtContactEditWidget::setNameSuggestions(const std::vector<std::string>& sug throbberLabel_->movie()->stop(); throbberLabel_->hide(); + // remove old suggestions except for the user input text field + QLayoutItem* suggestionItem = NULL; + while ((suggestionItem = suggestionsLayout_->itemAt(0)) && suggestionItem->widget() != name_) { + QWidget* suggestionWidget = suggestionItem->widget(); + suggestionsLayout_->removeWidget(suggestionWidget); + delete suggestionWidget; + } + + // populate new suggestions foreach(const std::string& name, suggestions) { suggestionsLayout_->insertWidget(nameLayout_->count() - 2, new QRadioButton(doubleAmpersand(name), this)); } |