From 15b51db1ab634ce0171e8d65d7b49caaf0437bbf Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 1 Nov 2012 19:09:09 +0100 Subject: [PATCH] oxygenlistmodel: Added "contains" method to generic model, to check index validity better. oxygenexceptionlistwidget: better check index validity in "edit" method. Also update buttons status after removing items, since apparently selectionChanged signal is not sent by Qt. CCBUG: 309388 --- clients/oxygen/config/oxygenexceptionlistwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clients/oxygen/config/oxygenexceptionlistwidget.cpp b/clients/oxygen/config/oxygenexceptionlistwidget.cpp index 474f2b2a4b..faefbc63c9 100644 --- a/clients/oxygen/config/oxygenexceptionlistwidget.cpp +++ b/clients/oxygen/config/oxygenexceptionlistwidget.cpp @@ -156,7 +156,7 @@ namespace Oxygen // retrieve selection QModelIndex current( ui.exceptionListView->selectionModel()->currentIndex() ); - if( !current.isValid() ) return; + if( ! model().contains( current ) ) return; Exception& exception( model().get( current ) ); @@ -203,6 +203,7 @@ namespace Oxygen // remove model().remove( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) ); resizeColumns(); + updateButtons(); emit changed(); return; @@ -212,7 +213,7 @@ namespace Oxygen void ExceptionListWidget::toggle( const QModelIndex& index ) { - if( !index.isValid() ) return; + if( !model().contains( index ) ) return; if( index.column() != ExceptionModel::ENABLED ) return; // get matching exception