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
This commit is contained in:
parent
805495c8ea
commit
d1a914d8fb
1 changed files with 3 additions and 2 deletions
|
@ -156,7 +156,7 @@ namespace Oxygen
|
||||||
|
|
||||||
// retrieve selection
|
// retrieve selection
|
||||||
QModelIndex current( ui.exceptionListView->selectionModel()->currentIndex() );
|
QModelIndex current( ui.exceptionListView->selectionModel()->currentIndex() );
|
||||||
if( !current.isValid() ) return;
|
if( ! model().contains( current ) ) return;
|
||||||
|
|
||||||
Exception& exception( model().get( current ) );
|
Exception& exception( model().get( current ) );
|
||||||
|
|
||||||
|
@ -203,6 +203,7 @@ namespace Oxygen
|
||||||
// remove
|
// remove
|
||||||
model().remove( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
|
model().remove( model().get( ui.exceptionListView->selectionModel()->selectedRows() ) );
|
||||||
resizeColumns();
|
resizeColumns();
|
||||||
|
updateButtons();
|
||||||
emit changed();
|
emit changed();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -212,7 +213,7 @@ namespace Oxygen
|
||||||
void ExceptionListWidget::toggle( const QModelIndex& index )
|
void ExceptionListWidget::toggle( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( !index.isValid() ) return;
|
if( !model().contains( index ) ) return;
|
||||||
if( index.column() != ExceptionModel::ENABLED ) return;
|
if( index.column() != ExceptionModel::ENABLED ) return;
|
||||||
|
|
||||||
// get matching exception
|
// get matching exception
|
||||||
|
|
Loading…
Reference in a new issue