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
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;
}
Qt::ItemFlags DictManagerModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags fl = QAbstractItemModel::flags(index);
- qDebug("lol1");
return (fl | Qt::ItemIsEditable);
}