From 8346ac7b439a831e94fc7dcd7e5cfa8fb0aaa467 Mon Sep 17 00:00:00 2001 From: Kintaxs Date: Sun, 16 Apr 2017 21:38:51 +0800 Subject: [PATCH] fix wrong message of adding a existed phrase --- src/model/UserphraseModel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/model/UserphraseModel.cpp b/src/model/UserphraseModel.cpp index 995abeb..896f4df 100644 --- a/src/model/UserphraseModel.cpp +++ b/src/model/UserphraseModel.cpp @@ -212,11 +212,13 @@ void UserphraseModel::add(const QString &phrase, const QString &bopomofo) if (ret > 0) { emit beginResetModel(); - userphrase_.insert(Userphrase{ + bool result = userphrase_.insert(Userphrase{ phrase, bopomofo }); emit endResetModel(); + if (!result) + refresh(); emit addNewPhraseCompleted(userphrase_[userphrase_.size()-1]); } else { qWarning() << "chewing_userphrase_add() returns" << ret;