Project

General

Profile

Correct method to clearing a WStandardItemModel when using a WSortFilterProxyModel and WTableView

Added by David Hubbard almost 10 years ago

Hello

I'm adapting your JWt TreeViewDragDrop example a bit - actually experimenting with putting database access using JPA behind it.

In the example the full list of files is read upfront and when a folder is selected the attached filter is used to only show those in the folder (by regex) [I think]

In my adaption I was looking to redraw the list (in the Table) from a database retrieval when a folder is selected.

My problem is that in (my version of) populateFiles(), which I call on each selection now, clearing the Model (WStandardItemModel) - either via clear() or removeRows(), results in a Null Object Exception. The Exception comes from the Filter after an event is fired from the change (clearing) the Model.

I have removed the filter and am linking the View direct to the base Model, and manipulating the Model - and this is working how I expected.

So, I don't know if this is a bug or working as expected - are you allowed to clear a Model with a Filter attached or does clearing the Model not make sense when filtering is applied?

Regards

Dave