mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: remove selection-code to select a new current_dive
The undo-machinery makes sure that a current_dive always exists after an undo command. This part of the code should never be called. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c00737eb23
commit
e26ac9e58d
1 changed files with 0 additions and 15 deletions
|
@ -337,9 +337,6 @@ void DiveListView::selectDive(int i, bool scrollto)
|
||||||
|
|
||||||
void DiveListView::selectDives(const QList<int> &newDiveSelection)
|
void DiveListView::selectDives(const QList<int> &newDiveSelection)
|
||||||
{
|
{
|
||||||
int firstInList, newSelection;
|
|
||||||
struct dive *d;
|
|
||||||
|
|
||||||
if (!newDiveSelection.count())
|
if (!newDiveSelection.count())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -350,22 +347,10 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection)
|
||||||
// becomes the selected_dive that we scroll to
|
// becomes the selected_dive that we scroll to
|
||||||
QList<int> sortedSelection = newDiveSelection;
|
QList<int> sortedSelection = newDiveSelection;
|
||||||
std::sort(sortedSelection.begin(), sortedSelection.end());
|
std::sort(sortedSelection.begin(), sortedSelection.end());
|
||||||
newSelection = firstInList = sortedSelection.first();
|
|
||||||
|
|
||||||
while (!sortedSelection.isEmpty())
|
while (!sortedSelection.isEmpty())
|
||||||
selectDive(sortedSelection.takeLast());
|
selectDive(sortedSelection.takeLast());
|
||||||
|
|
||||||
while (!current_dive) {
|
|
||||||
// that can happen if we restored a selection after edit
|
|
||||||
// and the only selected dive is no longer visible because of a filter
|
|
||||||
newSelection--;
|
|
||||||
if (newSelection < 0)
|
|
||||||
newSelection = dive_table.nr - 1;
|
|
||||||
if (newSelection == firstInList)
|
|
||||||
break;
|
|
||||||
if ((d = get_dive(newSelection)) != NULL && !d->hidden_by_filter)
|
|
||||||
selectDive(newSelection);
|
|
||||||
}
|
|
||||||
QAbstractItemModel *m = model();
|
QAbstractItemModel *m = model();
|
||||||
QModelIndexList idxList = m->match(m->index(0, 0), DiveTripModelBase::DIVE_IDX, get_divenr(current_dive), 2, Qt::MatchRecursive);
|
QModelIndexList idxList = m->match(m->index(0, 0), DiveTripModelBase::DIVE_IDX, get_divenr(current_dive), 2, Qt::MatchRecursive);
|
||||||
if (!idxList.isEmpty()) {
|
if (!idxList.isEmpty()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue