| 89 | } |
| 90 | |
| 91 | void BootEntryListView::rowsMoved(const QModelIndex &, int sourceStart, int sourceEnd, const QModelIndex &, int destinationRow) |
| 92 | { |
| 93 | auto index = currentIndex(); |
| 94 | if(!index.isValid() || !model()->checkIndex(index) || index.row() >= model()->rowCount()) |
| 95 | return; |
| 96 | |
| 97 | if(sourceStart <= index.row() && index.row() <= sourceEnd) |
| 98 | index = model()->index(index.row() + destinationRow - sourceStart, 0); |
| 99 | |
| 100 | else if(sourceStart <= destinationRow) |
| 101 | { |
| 102 | if(sourceEnd < index.row() && index.row() < destinationRow) |
| 103 | index = model()->index(index.row() - sourceEnd + sourceStart, 0); |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | if(destinationRow < index.row() && index.row() < sourceStart) |
| 108 | index = model()->index(index.row() + sourceEnd - sourceStart, 0); |
| 109 | } |
| 110 | |
| 111 | setCurrentIndex(index); |
| 112 | } |
| 113 | |
| 114 | void BootEntryListView::rowsChanged(const QModelIndex &, int, int) |
| 115 | { |