From ccd02666ee3d058f0fa110349023f91e72e9f74b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 3 May 2009 18:35:33 +0000 Subject: [PATCH] (trunk qt) fix remove-torrent filtering error reported by W4pp --- qt/mainwin.cc | 8 ++++++++ qt/mainwin.h | 1 + qt/torrent-model.cc | 1 - 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qt/mainwin.cc b/qt/mainwin.cc index ff90cf6cb..55d85a8c1 100644 --- a/qt/mainwin.cc +++ b/qt/mainwin.cc @@ -188,6 +188,9 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode // torrent view myFilterModel.setSourceModel( &myModel ); + connect( &myModel, SIGNAL(modelReset()), this, SLOT(onModelReset())); + connect( &myModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), this, SLOT(onModelReset())); + connect( &myModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), this, SLOT(onModelReset())); ui.listView->setModel( &myFilterModel ); connect( ui.listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this, SLOT(refreshActionSensitivity())); @@ -278,6 +281,11 @@ void TrMainWindow :: onSessionSourceChanged( ) { myModel.clear( ); +} + +void +TrMainWindow :: onModelReset( ) +{ refreshTitle( ); refreshVisibleCount( ); refreshActionSensitivity( ); diff --git a/qt/mainwin.h b/qt/mainwin.h index 0ba303ed3..51ca99160 100644 --- a/qt/mainwin.h +++ b/qt/mainwin.h @@ -121,6 +121,7 @@ class TrMainWindow: public QMainWindow void onSetPrefs( ); void onSetPrefs( bool ); void onSessionSourceChanged( ); + void onModelReset( ); private slots: void setSortPref ( int ); diff --git a/qt/torrent-model.cc b/qt/torrent-model.cc index 27511c0ff..9ce04c5ae 100644 --- a/qt/torrent-model.cc +++ b/qt/torrent-model.cc @@ -204,7 +204,6 @@ TorrentModel :: removeTorrent( int id ) if( row >= 0 ) { Torrent * tor = myIdToTorrent.value( id, 0 ); - std::cerr << "removing torrent " << id << std::endl; beginRemoveRows( QModelIndex(), row, row ); myIdToRow.remove( id ); -- 2.40.0