From f5523b68a93e2bb8642562f4c8b41b00665a406a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 5 Dec 2021 18:14:31 +0100 Subject: [PATCH] Fixed build with Qt < 5.14 --- src/GUI/gui.cpp | 10 ++++++++++ src/GUI/optionsdialog.cpp | 6 ++++++ src/GUI/optionsdialog.h | 3 +++ 3 files changed, 19 insertions(+) diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index 0a42652f..5f279875 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -1059,8 +1059,13 @@ void GUI::openOptions() if (options.plugin != _options.plugin || options.pluginParams.value(options.plugin) != _options.pluginParams.value(_options.plugin)) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + QGeoPositionInfoSource *source = QGeoPositionInfoSource::createSource( + options.plugin, this); +#else // QT 5.14 QGeoPositionInfoSource *source = QGeoPositionInfoSource::createSource( options.plugin, options.pluginParams.value(options.plugin), this); +#endif // QT 5.14 _showPositionAction->setEnabled(source != 0); _mapView->setPositionSource(source); delete _positionSource; @@ -2789,8 +2794,13 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs) .toString(); settings.endGroup(); +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + _positionSource = QGeoPositionInfoSource::createSource(_options.plugin, + this); +#else // QT 5.14 _positionSource = QGeoPositionInfoSource::createSource(_options.plugin, _options.pluginParams.value(_options.plugin), this); +#endif // QT 5.14 _showPositionAction->setEnabled(_positionSource != 0); settings.beginGroup(POSITION_SETTINGS_GROUP); diff --git a/src/GUI/optionsdialog.cpp b/src/GUI/optionsdialog.cpp index fdf8716d..09e9394c 100644 --- a/src/GUI/optionsdialog.cpp +++ b/src/GUI/optionsdialog.cpp @@ -611,17 +611,21 @@ QWidget *OptionsDialog::createPositionPage() _positionPlugin = new QComboBox(); _positionPlugin->addItems(plugins); _positionPlugin->setCurrentIndex(_positionPlugin->findText(_options.plugin)); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) _pluginParameters = new PluginParameters(_positionPlugin->currentText(), _options.pluginParams); connect(_positionPlugin, &QComboBox::currentTextChanged, _pluginParameters, &PluginParameters::setPlugin); +#endif // QT 5.14 QFormLayout *pluginLayout = new QFormLayout(); pluginLayout->addRow(tr("Plugin:"), _positionPlugin); QVBoxLayout *sourceLayout = new QVBoxLayout(); sourceLayout->addLayout(pluginLayout); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) sourceLayout->addWidget(_pluginParameters); +#endif // QT 5.14 sourceLayout->addStretch(); QWidget *sourceTab = new QWidget(); @@ -902,7 +906,9 @@ void OptionsDialog::accept() _options.demPassword = _demAuth->password(); _options.plugin = _positionPlugin->currentText(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) _options.pluginParams = _pluginParameters->parameters(); +#endif // QT 5.14 _options.useOpenGL = _useOpenGL->isChecked(); _options.enableHTTP2 = _enableHTTP2->isChecked(); diff --git a/src/GUI/optionsdialog.h b/src/GUI/optionsdialog.h index 4b9fd526..b259c71e 100644 --- a/src/GUI/optionsdialog.h +++ b/src/GUI/optionsdialog.h @@ -1,6 +1,7 @@ #ifndef OPTIONSDIALOG_H #define OPTIONSDIALOG_H +#include #include #include "palette.h" #include "units.h" @@ -176,7 +177,9 @@ private: AuthenticationWidget *_demAuth; // Position QComboBox *_positionPlugin; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) PluginParameters *_pluginParameters; +#endif // QT 5.14 // System QSpinBox *_pixmapCache; QSpinBox *_connectionTimeout;