From a65280fbaef675c9451d4ee961b2c3771d3bbbd2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 31 Oct 2014 16:23:57 -0200 Subject: [PATCH] Implemented the setData method for BuddyFilter Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index faf22de51..81e17edc2 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -2390,7 +2390,19 @@ QVariant BuddyFilterModel::data(const QModelIndex &index, int role) const bool BuddyFilterModel::setData(const QModelIndex &index, const QVariant &value, int role) { - return QStringListModel::setData(index, value, role); + if (role == Qt::CheckStateRole) { + checkState[index.row()] = value.toBool(); + anyChecked = false; + for (int i = 0; i < rowCount(); i++) { + if (checkState[i] == true) { + anyChecked = true; + break; + } + } + dataChanged(index, index); + return true; + } + return false; } MultiFilterSortModel *MultiFilterSortModel::instance()