MCPcopy Create free account
hub / github.com/Neverous/efibooteditor / rowsMoved

Method rowsMoved

src/bootentrylistview.cpp:91–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void 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
114void BootEntryListView::rowsChanged(const QModelIndex &, int, int)
115{

Callers

nothing calls this directly

Calls 2

indexMethod · 0.80
rowCountMethod · 0.45

Tested by

no test coverage detected