KListView and searching

Stephen Leaf smileaf at smileaf.org
Fri Sep 29 23:16:55 BST 2006

On Wednesday 27 September 2006 6:19 am, Philip Rodrigues wrote:
I'll post what I said in #kde here for others to ponder.

Instead of reimplementing the selectall which could have issues where the 
intended operation would be to select everything not just limited to visible 

How about an overloaded selectAll with an added IteratorFlag filter option.

void KListView::selectAll(bool select, int filter)
  QListViewItemIterator it(this, filter);
  while ( it.current() )
    setSelected(id.current(), select);

> There are a number of bugs that occur with the behaviour of the selection
> in KListView when some items are hidden by a KListViewSearchLine[1].
> The two issues I have seen are:
> * Choosing 'Select All' selects *all* items, including those hidden by the
> search
> * Selecting a range with Shift+Click selects hidden items too.
> This is harmful, since if you then hit 'delete', hidden items are deleted.
> I think the attached patch fixes the first issue, although the second issue
> will be more tricky to fix. I have some questions:
> * Is this the right approach to fixing the problem?
> * Does it break BC? I'm reimplementing a virtual method from QListView, and
> discussions on #kde-devel suggest that's OK, but I'm not a C++ guru.
> If those are OK, I'll add apidox and clean up the indentation and commit.
> Also, if anyone has any ideas how to fix the Shift+Click handling, do tell
> (my guess is: install an event handler, in which we check for Shift
> pressed. If it is, handle it correctly, if it isn't, pass it up to
> QListView)
> Regards,
> Philip
> 1. 134361, 115800, 122218, 122158 - NB These have been fixed on an
> app-by-app basis, but I think that KListView is the root cause

More information about the kde-core-devel mailing list