Changeset 11222


Ignore:
Timestamp:
Sep 18, 2010, 3:51:38 PM (11 years ago)
Author:
Longinus00
Message:

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

Location:
trunk/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/details.cc

    r11216 r11222  
    711711    }
    712712
     713    if( !torrents.empty( ) )
    713714    {
    714715        const Torrent * tor;
  • trunk/qt/mainwin.cc

    r11196 r11222  
    968968            break;
    969969
    970         case Prefs::COMPACT_VIEW:
     970        case Prefs::COMPACT_VIEW: {
     971            QItemSelectionModel * selectionModel( ui.listView->selectionModel( ) );
     972            const QItemSelection selection( selectionModel->selection( ) );
     973            const QModelIndex currentIndex( selectionModel->currentIndex( ) );
    971974            b = myPrefs.getBool( key );
    972975            ui.action_CompactView->setChecked( b );
    973976            ui.listView->setItemDelegate( b ? myTorrentDelegateMin : myTorrentDelegate );
     977            selectionModel->clear( );
    974978            ui.listView->reset( ); // force the rows to resize
    975             break;
     979            selectionModel->select( selection, QItemSelectionModel::Select );
     980            selectionModel->setCurrentIndex( currentIndex, QItemSelectionModel::NoUpdate );
     981            break;
     982        }
    976983
    977984        case Prefs::MAIN_WINDOW_X:
Note: See TracChangeset for help on using the changeset viewer.