X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmdictionary%2Fgui%2FDictManagerModel.cpp;h=f2aee342faaa7399bc9fa82759707a0eecd885a7;hb=346a68ad33b6a6946fbee3993cfc7b3cb9e1690d;hp=ecb93bda49dded2f04ff6c02ecb66d4e0c5fd216;hpb=ac86fa7a460e6fb10126eb63372d18a5dd1e1f4d;p=mdictionary diff --git a/src/mdictionary/gui/DictManagerModel.cpp b/src/mdictionary/gui/DictManagerModel.cpp index ecb93bd..f2aee34 100644 --- a/src/mdictionary/gui/DictManagerModel.cpp +++ b/src/mdictionary/gui/DictManagerModel.cpp @@ -59,11 +59,18 @@ void DictManagerModel::setDictionaries(QHash dictio void DictManagerModel::clear() { - beginRemoveRows(QModelIndex(), 0, rowCount()); + bool empty = true; + if (!_dictionaries.isEmpty()){ +// beginRemoveRows(QModelIndex(), 0, rowCount()); + beginResetModel(); + empty = false; + } _dictionaries.clear(); _dictList.clear(); - endRemoveRows(); - Q_EMIT dataChanged(QModelIndex(), QModelIndex()); + + if (!empty){ + endResetModel(); + } } QVariant DictManagerModel::data(const QModelIndex & index, int role) const @@ -124,8 +131,6 @@ int DictManagerModel::setDataPriv(int index, const QVariant &value, int role) if (value.type() == QVariant::Bool) { _dictionaries[dictionary] = value.toBool(); -// if (index == _dictList.count()) -// emit dataChanged(this->index(index-1), this->index(index)); Q_EMIT dataChanged(this->index(0), this->index(_dictList.count() - 1)); return 2; } @@ -164,7 +169,6 @@ bool DictManagerModel::isCurrentDictSelected() Qt::ItemFlags DictManagerModel::flags(const QModelIndex &index) const { Qt::ItemFlags fl = QAbstractItemModel::flags(index); - qDebug("lol1"); return (fl | Qt::ItemIsEditable); }