Ifdef the code which does manual relayout on compact view toggle to Qt < 5.4 (QTBUG-33537)

This commit is contained in:
Mike Gelfand 2015-04-20 09:28:26 +00:00
parent f1010159a6
commit 7ce0ebfee7
1 changed files with 4 additions and 0 deletions

View File

@ -1048,16 +1048,20 @@ TrMainWindow::refreshPref (int key)
break;
case Prefs::COMPACT_VIEW: {
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) // QTBUG-33537
QItemSelectionModel * selectionModel (ui.listView->selectionModel ());
const QItemSelection selection (selectionModel->selection ());
const QModelIndex currentIndex (selectionModel->currentIndex ());
#endif
b = myPrefs.getBool (key);
ui.action_CompactView->setChecked (b);
ui.listView->setItemDelegate (b ? myTorrentDelegateMin : myTorrentDelegate);
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) // QTBUG-33537
selectionModel->clear ();
ui.listView->reset (); // force the rows to resize
selectionModel->select (selection, QItemSelectionModel::Select);
selectionModel->setCurrentIndex (currentIndex, QItemSelectionModel::NoUpdate);
#endif
break;
}