From 04cdfce782f2a104ab5d0ee92de67c7b6271835b Mon Sep 17 00:00:00 2001 From: Maximilian Güntner Date: Sat, 2 Nov 2013 02:20:02 +0100 Subject: Added a custom widget for tagging dives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A custom tag widget has been added to MainTab. Tags are seperated by a comma ",". The implementation supports escaping a comma by using "\,". While typing, the widget supports the user by suggesting tags using a QCompleter. Signed-off-by: Maximilian Güntner --- qt-ui/completionmodels.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'qt-ui/completionmodels.cpp') diff --git a/qt-ui/completionmodels.cpp b/qt-ui/completionmodels.cpp index 8bd4f5441..31733addb 100644 --- a/qt-ui/completionmodels.cpp +++ b/qt-ui/completionmodels.cpp @@ -12,6 +12,7 @@ CREATE_SINGLETON(BuddyCompletionModel); CREATE_SINGLETON(DiveMasterCompletionModel); CREATE_SINGLETON(LocationCompletionModel); CREATE_SINGLETON(SuitCompletionModel); +CREATE_SINGLETON(TagCompletionModel); #undef CREATE_SINGLETON @@ -35,3 +36,15 @@ CREATE_UPDATE_METHOD(DiveMasterCompletionModel, divemaster); CREATE_UPDATE_METHOD(LocationCompletionModel, location); CREATE_UPDATE_METHOD(SuitCompletionModel, suit); +void TagCompletionModel::updateModel() +{ + if(g_tag_list == NULL) + return; + QStringList list; + struct tag_entry *current_tag_entry = g_tag_list->next; + while (current_tag_entry != NULL) { + list.append(QString(current_tag_entry->tag->name)); + current_tag_entry = current_tag_entry->next; + } + setStringList(list); +} -- cgit v1.2.3-70-g09d2