Skip to content

Commit

Permalink
Fixed crash when doing "Show all" after "Select all" in search result…
Browse files Browse the repository at this point in the history
… table while using a spatial query.
  • Loading branch information
albar965 committed Dec 17, 2018
1 parent bd3fc5c commit 050ada3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ For example: #3 is https://github.com/albar965/littlenavmap/issues/3.
Version 2.2.3

* Fixed crash when reading unexpected value in "activeflightplanwx.txt" of Active Sky.
* Fixed crash when doing "Show all" after "Select all" in search result table while using a spatial query.
* Problem solved where altitude restrictions in procedures caused an invalid "cannot comply to altitude restrictions" error.
* Fixed several display issues in profile (e.g. LPPR ADNOV I17 at CI17).
* Fixed drawing issues with overlapping procedure leg points having different altitude restrictions (e.g. LPPR ADNOV I17 at CI17).
Expand Down
28 changes: 20 additions & 8 deletions src/search/airportsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,20 +513,32 @@ void AirportSearch::getSelectedMapObjects(map::MapSearchResult& result) const

// Fill the result with incomplete airport objects (only id and lat/lon)
const QItemSelection& selection = controller->getSelection();
int range = 0;
for(const QItemSelectionRange& rng : selection)
{
for(int row = rng.top(); row <= rng.bottom(); ++row)
{
map::MapAirport ap;
rec.setValue(0, controller->getRawData(row, idColumnName));
rec.setValue(1, controller->getRawData(row, "lonx"));
rec.setValue(2, controller->getRawData(row, "laty"));

// Not fully populated
factory.fillAirport(rec, ap, false /* complete */, false /* nav */,
NavApp::getCurrentSimulatorDb() == atools::fs::FsPaths::XPLANE11);
result.airports.append(ap);
QVariant idVar = controller->getRawData(row, idColumnName);
if(idVar.isValid())
{
rec.setValue(0, idVar);
rec.setValue(1, controller->getRawData(row, "lonx"));
rec.setValue(2, controller->getRawData(row, "laty"));

#ifdef DEBUG_INFORMATION_SELECTION
qDebug() << Q_FUNC_INFO << "range" << range << "row" << row << rec;
#endif
// Not fully populated
factory.fillAirport(rec, ap, false /* complete */, false /* nav */,
NavApp::getCurrentSimulatorDb() == atools::fs::FsPaths::XPLANE11);
result.airports.append(ap);
}
else
qWarning() << Q_FUNC_INFO << "Invalid selection: range" << range
<< "row" << row << "col" << idColumnName << idVar;
}
range++;
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/search/searchbasetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ void SearchBaseTable::updateFromMinSpinBox(int value, const Column *col)
controller->filterByMinMaxSpinBox(col, atools::roundToInt(valMin),
atools::roundToInt(valMax));
col->getMaxSpinBoxWidget()->setMinimum(value);

}

void SearchBaseTable::updateFromMaxSpinBox(int value, const Column *col)
Expand Down Expand Up @@ -700,8 +699,17 @@ void SearchBaseTable::loadAllRowsIntoView()
Ui::MainWindow *ui = NavApp::getMainUi();
if(ui->tabWidgetSearch->currentIndex() == tabIndex)
{
// bool allSelected = getSelectedRowCount() == getVisibleRowCount();

// Clear selection since it can get invalid
view->clearSelection();

controller->loadAllRows();
updatePushButtons();

// if(allSelected)
// view->selectAll();

NavApp::setStatusMessage(tr("All entries read."));
}
}
Expand Down

0 comments on commit 050ada3

Please sign in to comment.