(qt) Don't lose selection when changing to and from compact mode.

This commit is contained in:
Daniel Lee 2010-09-18 15:51:38 +00:00
parent d7be6c4f5a
commit 603937184b
2 changed files with 9 additions and 1 deletions

View File

@ -710,6 +710,7 @@ Details :: refresh( )
myPeerLimitSpin->blockSignals( false );
}
if( !torrents.empty( ) )
{
const Torrent * tor;

View File

@ -967,12 +967,19 @@ TrMainWindow :: refreshPref( int key )
refreshTrayIcon( );
break;
case Prefs::COMPACT_VIEW:
case Prefs::COMPACT_VIEW: {
QItemSelectionModel * selectionModel( ui.listView->selectionModel( ) );
const QItemSelection selection( selectionModel->selection( ) );
const QModelIndex currentIndex( selectionModel->currentIndex( ) );
b = myPrefs.getBool( key );
ui.action_CompactView->setChecked( b );
ui.listView->setItemDelegate( b ? myTorrentDelegateMin : myTorrentDelegate );
selectionModel->clear( );
ui.listView->reset( ); // force the rows to resize
selectionModel->select( selection, QItemSelectionModel::Select );
selectionModel->setCurrentIndex( currentIndex, QItemSelectionModel::NoUpdate );
break;
}
case Prefs::MAIN_WINDOW_X:
case Prefs::MAIN_WINDOW_Y: