Project

General

Profile

Bug #3514 ยป w-batch-edit-proxy-model-fix-broken-indexes.patch

Jan Lindemann, 08/04/2014 02:15 PM

View differences:

src/Wt/WBatchEditProxyModel.C
WModelIndex sourceIndex = mapToSource(index);
if (sourceIndex.isValid())
return sourceModel()->flags(index);
return sourceModel()->flags(sourceIndex);
else {
std::map<int, WFlags<ItemFlag> >::const_iterator i
= newRowFlags_.find(index.column());
if (i != newRowFlags_.end())
return i->second;
else
return WAbstractProxyModel::flags(index);
return WAbstractProxyModel::flags(sourceIndex);
}
}
test/models/WBatchEditProxyModelTest.C
BOOST_REQUIRE(sm->rowCount() == 0);
BOOST_REQUIRE(pm->rowCount() == 0);
WModelIndex a = f.proxyModel_->index(1, 0);
WModelIndex b = f.proxyModel_->mapToSource(a);
WModelIndex c = f.proxyModel_->mapFromSource(b);
BOOST_REQUIRE(a == c);
pm->insertRows(0, 2);
BOOST_REQUIRE(f.modelEvents_[SourceModel].size() == 0);
    (1-1/1)