From 47d900bee53370e44934de67282d6f219b331a57 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 9 Feb 2022 15:56:36 -0800 Subject: [PATCH] Qt6: don't build MapWidget Since Qt6 doesn't include QtLocation anymore, we can't build MapWidget. Signed-off-by: Dirk Hohndel --- core/divefilter.cpp | 6 ++++++ desktop-widgets/divelistview.cpp | 2 ++ desktop-widgets/mainwindow.cpp | 8 ++++++++ desktop-widgets/tab-widgets/maintab.cpp | 2 ++ subsurface-helper.cpp | 5 +++++ 5 files changed, 23 insertions(+) diff --git a/core/divefilter.cpp b/core/divefilter.cpp index 3ea69a0ba..a54754c85 100644 --- a/core/divefilter.cpp +++ b/core/divefilter.cpp @@ -148,7 +148,9 @@ void DiveFilter::startFilterDiveSites(QVector ds) dive_sites = ds; // When switching into dive site mode, reload the dive sites. // TODO: why here? why not catch the filterReset signal in the map widget +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) MapWidget::instance()->reload(); +#endif emit diveListNotifier.filterReset(); } } @@ -159,7 +161,9 @@ void DiveFilter::stopFilterDiveSites() return; dive_sites.clear(); emit diveListNotifier.filterReset(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) MapWidget::instance()->reload(); +#endif } void DiveFilter::setFilterDiveSite(QVector ds) @@ -172,8 +176,10 @@ void DiveFilter::setFilterDiveSite(QVector ds) dive_sites = ds; emit diveListNotifier.filterReset(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) MapWidget::instance()->setSelected(dive_sites); MapWidget::instance()->selectionChanged(); +#endif MainWindow::instance()->diveList->expandAll(); } diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index cbd238927..39ec20de0 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -523,7 +523,9 @@ void DiveListView::selectionChangeDone() if (d->selected && !d->hidden_by_filter && d->dive_site && !selectedSites.contains(d->dive_site)) selectedSites.push_back(d->dive_site); } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) MapWidget::instance()->setSelected(selectedSites); +#endif } emit divesSelected(); } diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 1a695eb7a..eeb07c431 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -132,7 +132,9 @@ MainWindow::MainWindow() : QMainWindow(), // for the "default" mode mainTab.reset(new MainTab); diveList.reset(new DiveListView); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) mapWidget.reset(MapWidget::instance()); // Yes, this is ominous see comment in mapwidget.cpp. +#endif plannerWidgets.reset(new PlannerWidgets); statistics.reset(new StatsWidget); profile.reset(new ProfileWidget); @@ -198,7 +200,9 @@ MainWindow::MainWindow() : QMainWindow(), initialUiSetup(); readSettings(); diveList->setFocus(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) MapWidget::instance()->reload(); +#endif diveList->expand(diveList->model()->index(0, 0)); diveList->scrollTo(diveList->model()->index(0, 0), QAbstractItemView::PositionAtCenter); #ifdef NO_USERMANUAL @@ -327,7 +331,9 @@ void MainWindow::selectionChanged() if (current_dive) enableDisableOtherDCsActions(); profile->plotCurrentDive(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) MapWidget::instance()->selectionChanged(); +#endif } void MainWindow::on_actionNew_triggered() @@ -508,7 +514,9 @@ void MainWindow::closeCurrentFile() clear_dive_file_data(); // this clears all the core data structures and resets the models setCurrentFile(nullptr); diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) MapWidget::instance()->reload(); +#endif if (!existing_filename) setTitle(); disableShortcuts(); diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 05d5a1327..fe3c93eb0 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -89,8 +89,10 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &MainTab::updateDiveInfo); connect(ui.editDiveSiteButton, &QToolButton::clicked, MainWindow::instance(), &MainWindow::startDiveSiteEdit); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex); connect(ui.location, &DiveLocationLineEdit::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex); +#endif connect(ui.location, &DiveLocationLineEdit::editingFinished, this, &MainTab::on_location_diveSiteSelected); // One might think that we could listen to the precise property-changed signals of the preferences system. diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp index 39a830f20..193a472b5 100644 --- a/subsurface-helper.cpp +++ b/subsurface-helper.cpp @@ -2,8 +2,11 @@ #include #include +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include "map-widget/qmlmapwidgethelper.h" #include "qt-models/maplocationmodel.h" +#endif + #include "stats/statsview.h" #include "core/qt-gui.h" #include "core/settings/qPref.h" @@ -222,7 +225,9 @@ static void register_qml_types(QQmlEngine *engine) register_qml_type("ChartListModel"); #endif // not SUBSURFACE_MOBILE +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) register_qml_type("MapWidgetHelper"); register_qml_type("MapLocationModel"); +#endif register_qml_type("StatsView"); }