Skip to content

Commit

Permalink
Preselect last loaded map in file dialog to enable easy reloads in Rviz
Browse files Browse the repository at this point in the history
  • Loading branch information
victorreijgwart committed Dec 12, 2024
1 parent 7bf1525 commit 21c91e2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,12 @@ void WavemapMapDisplay::requestWholeMapCallback() {
void WavemapMapDisplay::loadMapFromDiskCallback() {
ProfilerZoneScoped;
// Open file selection dialog
const auto filepath_qt = QFileDialog::getOpenFileName();
const bool has_last_path =
std::filesystem::exists(load_map_from_disk_property_.getAtRestValue());
const std::string last_path =
has_last_path ? load_map_from_disk_property_.getAtRestValue() : "";
const auto filepath_qt = QFileDialog::getOpenFileName(
nullptr, "Choose a wavemap map file", last_path.c_str());

// Check if the chosen filepath is not empty
if (filepath_qt.isEmpty()) {
Expand Down

0 comments on commit 21c91e2

Please sign in to comment.