From 2af0620bfcb7547a7786ac2ee209e0dd6e39ec60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 2 Jul 2017 15:37:41 +0200 Subject: ListView: Deselect items that are hidden by the filter during selectAll and invertSelection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- src/widgets/qlistview.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/widgets/qlistview.cpp') diff --git a/src/widgets/qlistview.cpp b/src/widgets/qlistview.cpp index 774c97306..c4a974369 100644 --- a/src/widgets/qlistview.cpp +++ b/src/widgets/qlistview.cpp @@ -5366,9 +5366,17 @@ void TQListView::selectAll( bool select ) TQListViewItemIterator it( this ); while ( it.current() ) { TQListViewItem *i = it.current(); - if ( (bool)i->selected != select ) { - i->setSelected( select ); - anything = TRUE; + if ( i->isVisible()) { + if ( (bool)i->selected != select ) { + i->setSelected( select ); + anything = TRUE; + } + } + else { + if ( (bool)i->selected != FALSE ) { + i->setSelected( FALSE ); + anything = TRUE; + } } ++it; } @@ -5398,8 +5406,16 @@ void TQListView::invertSelection() bool b = signalsBlocked(); blockSignals( TRUE ); TQListViewItemIterator it( this ); - for ( ; it.current(); ++it ) - it.current()->setSelected( !it.current()->isSelected() ); + for ( ; it.current(); ++it ) { + if (it.current()->isVisible()) { + it.current()->setSelected( !it.current()->isSelected() ); + } + else { + if ( FALSE != it.current()->isSelected() ) { + it.current()->setSelected( FALSE ); + } + } + } blockSignals( b ); emit selectionChanged(); triggerUpdate(); -- cgit v1.2.1