diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2017-07-02 15:35:57 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-07-02 15:36:11 +0200 |
commit | a14693c150c11910ed483ec375fa8f5a85ec648e (patch) | |
tree | a29eb456970860839bf37216d3f0d8955c97ba68 | |
parent | ad6af17aea071680cf35c06846fab6fb8f885a44 (diff) | |
download | qt3-a14693c150c11910ed483ec375fa8f5a85ec648e.tar.gz qt3-a14693c150c11910ed483ec375fa8f5a85ec648e.zip |
ListView: Deselect items that are hidden by the filter
during selectAll and invertSelection
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit d96172f76d7cfef8f9e758c4831ebca077a30537)
-rw-r--r-- | src/widgets/qlistview.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/widgets/qlistview.cpp b/src/widgets/qlistview.cpp index 6e2564c..8027644 100644 --- a/src/widgets/qlistview.cpp +++ b/src/widgets/qlistview.cpp @@ -5366,9 +5366,17 @@ void QListView::selectAll( bool select ) QListViewItemIterator it( this ); while ( it.current() ) { QListViewItem *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 QListView::invertSelection() bool b = signalsBlocked(); blockSignals( TRUE ); QListViewItemIterator 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(); |