From a0101ef9439b0e9324d679cd5c3c1e58ec70eddc Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Fri, 29 Aug 2025 23:11:21 +0200 Subject: [PATCH] refactor: Fix Qt deprecation warnings --- CMakeLists.txt | 2 - src/core/vatsim/vatsimstatusfilereader.cpp | 4 +- src/gui/components/dbmappingcomponent.cpp | 8 +- src/gui/components/internalscomponent.cpp | 15 +- src/gui/components/internalscomponent.h | 2 +- src/gui/components/mappingcomponent.cpp | 4 +- src/gui/components/mappingcomponent.h | 2 +- src/gui/components/navigatordialog.cpp | 2 +- .../components/settingsadvancedcomponent.cpp | 4 +- .../components/settingsadvancedcomponent.h | 2 +- src/gui/editors/interpolationsetupform.cpp | 4 +- src/gui/editors/interpolationsetupform.h | 2 +- src/gui/enableforframelesswindow.cpp | 4 +- src/gui/guiutility.cpp | 15 +- src/gui/guiutility.h | 3 - src/gui/pluginselector.cpp | 2 +- src/misc/datacache.cpp | 2 +- src/misc/fileutils.cpp | 2 +- src/misc/logcategorylist.h | 2 +- src/misc/metadatautils.cpp | 4 +- src/misc/mixin/mixinmetatype.h | 2 +- src/misc/namevariantpair.cpp | 2 +- src/misc/rgbcolor.cpp | 5 +- src/misc/simulation/aircraftmodel.cpp | 5 +- .../simulation/fscommon/aircraftcfgparser.cpp | 4 +- src/misc/stringutils.cpp | 8 +- src/misc/valuecache.cpp | 24 ++- src/misc/variant.cpp | 146 +++++++++--------- src/misc/variant.h | 9 +- src/misc/variantprivate.h | 4 +- src/swiftlauncher/swiftlauncher.cpp | 2 +- .../core/fsd/testfsdclient/testfsdclient.cpp | 8 +- .../misc/teststringutils/teststringutils.cpp | 2 +- third_party/simplecrypt/CMakeLists.txt | 1 + 34 files changed, 148 insertions(+), 159 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87f2ddcaf..071e4794d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,8 +128,6 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang") add_compile_options("$<$:-Woverloaded-virtual;-Wzero-as-null-pointer-constant;-Wno-return-std-move>") endif() -add_compile_definitions(QT_NO_DEPRECATED_WARNINGS) - if(SWIFT_USE_CRASHPAD) add_compile_definitions(SWIFT_USE_CRASHPAD) endif() diff --git a/src/core/vatsim/vatsimstatusfilereader.cpp b/src/core/vatsim/vatsimstatusfilereader.cpp index 54b221fc8..28d1be9a1 100644 --- a/src/core/vatsim/vatsimstatusfilereader.cpp +++ b/src/core/vatsim/vatsimstatusfilereader.cpp @@ -120,8 +120,8 @@ namespace swift::core::vatsim Q_UNUSED(changed); // data read finished - emit this->statusFileRead(statusFileData.count()); - emit this->dataRead(CEntityFlags::VatsimStatusFile, CEntityFlags::ReadFinished, statusFileData.count()); + emit this->statusFileRead(statusFileData.size()); + emit this->dataRead(CEntityFlags::VatsimStatusFile, CEntityFlags::ReadFinished, statusFileData.size()); } else { diff --git a/src/gui/components/dbmappingcomponent.cpp b/src/gui/components/dbmappingcomponent.cpp index ae6a3f29a..cb8af7ca7 100644 --- a/src/gui/components/dbmappingcomponent.cpp +++ b/src/gui/components/dbmappingcomponent.cpp @@ -664,10 +664,10 @@ namespace swift::gui::components QPoint globalPos = this->mapToGlobal(point); QScopedPointer contextMenu(new QMenu(this)); - contextMenu->addAction("Max.data area", this, &CDbMappingComponent::resizeForSelect, - QKeySequence(static_cast(Qt::CTRL) + Qt::Key_M, Qt::Key_D)); - contextMenu->addAction("Max.mapping area", this, &CDbMappingComponent::resizeForMapping, - QKeySequence(static_cast(Qt::CTRL) + Qt::Key_M, Qt::Key_M)); + contextMenu->addAction("Max.data area", QKeySequence(static_cast(Qt::CTRL) + Qt::Key_M, Qt::Key_D), + this, &CDbMappingComponent::resizeForSelect); + contextMenu->addAction("Max.mapping area", QKeySequence(static_cast(Qt::CTRL) + Qt::Key_M, Qt::Key_M), + this, &CDbMappingComponent::resizeForMapping); QAction *selectedItem = contextMenu.data()->exec(globalPos); Q_UNUSED(selectedItem) } diff --git a/src/gui/components/internalscomponent.cpp b/src/gui/components/internalscomponent.cpp index cc8ac4ab3..503a27d43 100644 --- a/src/gui/components/internalscomponent.cpp +++ b/src/gui/components/internalscomponent.cpp @@ -54,11 +54,11 @@ namespace swift::gui::components ui->le_TxtMsgTo->setValidator(new CUpperCaseValidator(ui->le_TxtMsgFrom)); ui->le_AtisCallsign->setValidator(new CUpperCaseValidator(ui->le_AtisCallsign)); - connect(ui->cb_DebugContextAudio, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); - connect(ui->cb_DebugContextApplication, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); - connect(ui->cb_DebugContextNetwork, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); - connect(ui->cb_DebugContextOwnAircraft, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); - connect(ui->cb_DebugContextSimulator, &QCheckBox::stateChanged, this, &CInternalsComponent::enableDebug); + connect(ui->cb_DebugContextAudio, &QCheckBox::checkStateChanged, this, &CInternalsComponent::enableDebug); + connect(ui->cb_DebugContextApplication, &QCheckBox::checkStateChanged, this, &CInternalsComponent::enableDebug); + connect(ui->cb_DebugContextNetwork, &QCheckBox::checkStateChanged, this, &CInternalsComponent::enableDebug); + connect(ui->cb_DebugContextOwnAircraft, &QCheckBox::checkStateChanged, this, &CInternalsComponent::enableDebug); + connect(ui->cb_DebugContextSimulator, &QCheckBox::checkStateChanged, this, &CInternalsComponent::enableDebug); connect(ui->pb_SendTextMessageDirectly, &QPushButton::released, this, &CInternalsComponent::sendTextMessage, Qt::QueuedConnection); @@ -74,7 +74,7 @@ namespace swift::gui::components connect(ui->pb_NetworkUpdateAndReset, &QPushButton::released, this, &CInternalsComponent::networkStatistics); connect(ui->pb_NetworkUpdate, &QPushButton::released, this, &CInternalsComponent::networkStatistics); - connect(ui->cb_NetworkStatistics, &QCheckBox::stateChanged, this, + connect(ui->cb_NetworkStatistics, &QCheckBox::checkStateChanged, this, &CInternalsComponent::onNetworkStatisticsToggled); if (sGui && sGui->isSupportingCrashpad()) @@ -104,7 +104,7 @@ namespace swift::gui::components QWidget::showEvent(event); } - void CInternalsComponent::enableDebug(int state) + void CInternalsComponent::enableDebug(Qt::CheckState checkState) { Q_ASSERT(sGui->getIContextApplication()); Q_ASSERT(sGui->getIContextAudio()); @@ -112,7 +112,6 @@ namespace swift::gui::components Q_ASSERT(sGui->getIContextOwnAircraft()); Q_ASSERT(sGui->getIContextSimulator()); - const Qt::CheckState checkState = static_cast(state); const bool debug = (checkState == Qt::Checked); const QObject *sender = QObject::sender(); diff --git a/src/gui/components/internalscomponent.h b/src/gui/components/internalscomponent.h index c254f6ece..5aaf1b426 100644 --- a/src/gui/components/internalscomponent.h +++ b/src/gui/components/internalscomponent.h @@ -39,7 +39,7 @@ namespace swift::gui::components private: //! Enable / disable debugging - void enableDebug(int state); + void enableDebug(Qt::CheckState checkState); //! Send the text message void sendTextMessage(); diff --git a/src/gui/components/mappingcomponent.cpp b/src/gui/components/mappingcomponent.cpp index 36daf90ea..f10c29591 100644 --- a/src/gui/components/mappingcomponent.cpp +++ b/src/gui/components/mappingcomponent.cpp @@ -113,7 +113,7 @@ namespace swift::gui::components this->setForceSmall(true); // Aircraft previews - connect(ui->cb_AircraftIconDisplayed, &QCheckBox::stateChanged, this, + connect(ui->cb_AircraftIconDisplayed, &QCheckBox::checkStateChanged, this, &CMappingComponent::onModelPreviewChanged); // model string completer @@ -416,7 +416,7 @@ namespace swift::gui::components this->showOverlayHTMLMessage(msg, 3s); } - void CMappingComponent::onModelPreviewChanged(int state) + void CMappingComponent::onModelPreviewChanged(Qt::CheckState state) { Q_UNUSED(state); this->closeOverlay(); diff --git a/src/gui/components/mappingcomponent.h b/src/gui/components/mappingcomponent.h index ddc328345..8e6a901be 100644 --- a/src/gui/components/mappingcomponent.h +++ b/src/gui/components/mappingcomponent.h @@ -120,7 +120,7 @@ namespace swift::gui void onResetAircraft(); //! Model preview - void onModelPreviewChanged(int state); + void onModelPreviewChanged(Qt::CheckState state); //! Request update for models from backend void onModelsUpdateRequested(); diff --git a/src/gui/components/navigatordialog.cpp b/src/gui/components/navigatordialog.cpp index e7236afa8..3ee0477d6 100644 --- a/src/gui/components/navigatordialog.cpp +++ b/src/gui/components/navigatordialog.cpp @@ -251,7 +251,7 @@ namespace swift::gui::components void CNavigatorDialog::enterEvent(QEnterEvent *event) { // event called when mouse is over, acts as auto-focus - QApplication::setActiveWindow(this); + activateWindow(); QDialog::enterEvent(event); } diff --git a/src/gui/components/settingsadvancedcomponent.cpp b/src/gui/components/settingsadvancedcomponent.cpp index 8ce8039cf..00e339d10 100644 --- a/src/gui/components/settingsadvancedcomponent.cpp +++ b/src/gui/components/settingsadvancedcomponent.cpp @@ -16,13 +16,13 @@ namespace swift::gui::components const bool crashDumpUploadEnabled = m_crashDumpUploadEnabled.getThreadLocal(); ui->cb_crashDumpsUpload->setChecked(crashDumpUploadEnabled); - connect(ui->cb_crashDumpsUpload, &QCheckBox::stateChanged, this, + connect(ui->cb_crashDumpsUpload, &QCheckBox::checkStateChanged, this, &CSettingsAdvancedComponent::crashDumpUploadEnabledChanged); } CSettingsAdvancedComponent::~CSettingsAdvancedComponent() {} - void CSettingsAdvancedComponent::crashDumpUploadEnabledChanged(int state) + void CSettingsAdvancedComponent::crashDumpUploadEnabledChanged(Qt::CheckState state) { auto text = ui->cb_crashDumpsUpload->text(); if (!text.endsWith("(restart needed)")) diff --git a/src/gui/components/settingsadvancedcomponent.h b/src/gui/components/settingsadvancedcomponent.h index 190e7217c..b38284a5b 100644 --- a/src/gui/components/settingsadvancedcomponent.h +++ b/src/gui/components/settingsadvancedcomponent.h @@ -33,7 +33,7 @@ namespace swift::gui::components virtual ~CSettingsAdvancedComponent(); private: - void crashDumpUploadEnabledChanged(int state); + void crashDumpUploadEnabledChanged(Qt::CheckState state); QScopedPointer ui; swift::misc::CSetting m_crashDumpUploadEnabled { this }; diff --git a/src/gui/editors/interpolationsetupform.cpp b/src/gui/editors/interpolationsetupform.cpp index a9d7919ad..316ddc0a6 100644 --- a/src/gui/editors/interpolationsetupform.cpp +++ b/src/gui/editors/interpolationsetupform.cpp @@ -20,7 +20,7 @@ namespace swift::gui::editors m_allCheckBoxes = this->findChildren(QString(), Qt::FindDirectChildrenOnly); for (QCheckBox *cb : std::as_const(m_allCheckBoxes)) { - connect(cb, &QCheckBox::stateChanged, this, &CInterpolationSetupForm::onCheckboxChanged); + connect(cb, &QCheckBox::checkStateChanged, this, &CInterpolationSetupForm::onCheckboxChanged); } // one connect is enough, otherwise 2 change signals @@ -79,7 +79,7 @@ namespace swift::gui::editors return CStatusMessageList(); } - void CInterpolationSetupForm::onCheckboxChanged(int state) + void CInterpolationSetupForm::onCheckboxChanged(Qt::CheckState state) { Q_UNUSED(state) emit this->valueChanged(); diff --git a/src/gui/editors/interpolationsetupform.h b/src/gui/editors/interpolationsetupform.h index 27968bff1..6453b7148 100644 --- a/src/gui/editors/interpolationsetupform.h +++ b/src/gui/editors/interpolationsetupform.h @@ -53,7 +53,7 @@ namespace swift::gui::editors QList m_allCheckBoxes; //! Checkbox has been changed - void onCheckboxChanged(int state); + void onCheckboxChanged(Qt::CheckState state); //! Interpolator mode void onInterpolatorModeChanged(bool checked); diff --git a/src/gui/enableforframelesswindow.cpp b/src/gui/enableforframelesswindow.cpp index 235b8e87c..dd7ac80bb 100644 --- a/src/gui/enableforframelesswindow.cpp +++ b/src/gui/enableforframelesswindow.cpp @@ -194,7 +194,7 @@ namespace swift::gui Q_ASSERT(m_widget); if (m_windowMode == WindowFrameless && event->button() == Qt::LeftButton) { - m_framelessDragPosition = event->globalPos() - m_widget->frameGeometry().topLeft(); + m_framelessDragPosition = event->globalPosition().toPoint() - m_widget->frameGeometry().topLeft(); event->accept(); return true; } @@ -217,7 +217,7 @@ namespace swift::gui return false; } - m_widget->move(event->globalPos() - m_framelessDragPosition); + m_widget->move(event->globalPosition().toPoint() - m_framelessDragPosition); event->accept(); return true; } diff --git a/src/gui/guiutility.cpp b/src/gui/guiutility.cpp index 7d09b545c..402d8e7da 100644 --- a/src/gui/guiutility.cpp +++ b/src/gui/guiutility.cpp @@ -377,7 +377,7 @@ namespace swift::gui const QJsonDocument jsonDoc(QJsonDocument::fromJson(utf8Data)); const QJsonObject jsonObj(jsonDoc.object()); const QString typeName(jsonObj.value("type").toString()); - const int typeId = QMetaType::type(qPrintable(typeName)); + const int typeId = QMetaType::fromName(qPrintable(typeName)).id(); // check if a potential valid value object if (typeName.isEmpty() || typeId == QMetaType::UnknownType) { return CVariant(); } @@ -397,7 +397,7 @@ namespace swift::gui Q_ASSERT_X(!jsonObj.isEmpty(), Q_FUNC_INFO, "Empty JSON object"); const QString typeName(jsonObj.value("type").toString()); if (typeName.isEmpty()) { return Unknown; } - const int typeId = QMetaType::type(qPrintable(typeName)); + const int typeId = QMetaType::fromName(qPrintable(typeName)).id(); return typeId; } @@ -724,14 +724,7 @@ namespace swift::gui return effect; } - QFontMetrics CGuiUtility::currentFontMetrics() - { - const QWidget *w = CGuiUtility::mainApplicationWidget(); - if (w) { return w->fontMetrics(); } - return QApplication::fontMetrics(); - } - - QFontMetricsF CGuiUtility::currentFontMetricsF() { return QFontMetricsF(CGuiUtility::currentFontMetrics()); } + QFontMetricsF CGuiUtility::currentFontMetricsF() { return QFontMetricsF(qApp->font()); } QFont CGuiUtility::currentFont() { @@ -754,7 +747,7 @@ namespace swift::gui { // 43 characters 0123456789012345678901234567890123456789012 static const QString s("The quick brown fox jumps over the lazy dog"); - const QFontMetricsF fm = CGuiUtility::currentFontMetrics(); + const QFontMetricsF fm = CGuiUtility::currentFontMetricsF(); const qreal scale = withRatio ? CGuiUtility::mainApplicationWidgetPixelRatio() : 1.0; const QSizeF size = fm.size(Qt::TextSingleLine, s); return size * scale; diff --git a/src/gui/guiutility.h b/src/gui/guiutility.h index d560c2fba..16e54d045 100644 --- a/src/gui/guiutility.h +++ b/src/gui/guiutility.h @@ -227,9 +227,6 @@ namespace swift::gui static QGraphicsOpacityEffect *fadeOutWidget(int durationMs, QWidget *widget, double startValue = 1.0, double endValue = 0.0); - //! Main window font metrics or default metrics - static QFontMetrics currentFontMetrics(); - //! Main window font metrics or default metrics static QFontMetricsF currentFontMetricsF(); diff --git a/src/gui/pluginselector.cpp b/src/gui/pluginselector.cpp index 0d0bcf03f..d4e304d03 100644 --- a/src/gui/pluginselector.cpp +++ b/src/gui/pluginselector.cpp @@ -41,7 +41,7 @@ namespace swift::gui QCheckBox *cb = new QCheckBox(name); cb->setObjectName(identifier); cb->setProperty("pluginIdentifier", identifier); - connect(cb, &QCheckBox::stateChanged, this, &CPluginSelector::handlePluginStateChange); + connect(cb, &QCheckBox::checkStateChanged, this, &CPluginSelector::handlePluginStateChange); if (enabled) { cb->setCheckState(Qt::Checked); } else { cb->setCheckState(Qt::Unchecked); } diff --git a/src/misc/datacache.cpp b/src/misc/datacache.cpp index b012b6f84..c992c1668 100644 --- a/src/misc/datacache.cpp +++ b/src/misc/datacache.cpp @@ -616,7 +616,7 @@ namespace swift::misc for (auto it = m_timestamps.cbegin(); it != m_timestamps.cend(); ++it) { result.push_back(it.key() + "(" + - QDateTime::fromMSecsSinceEpoch(it.value(), Qt::UTC).toString(Qt::ISODate) + ")"); + QDateTime::fromMSecsSinceEpoch(it.value(), QTimeZone::UTC).toString(Qt::ISODate) + ")"); } return result.join(","); } diff --git a/src/misc/fileutils.cpp b/src/misc/fileutils.cpp index c9bff5220..32274c2ae 100644 --- a/src/misc/fileutils.cpp +++ b/src/misc/fileutils.cpp @@ -55,7 +55,7 @@ namespace swift::misc if (!file.open(QIODevice::WriteOnly)) { return false; } const qint64 c = file.write(data); file.close(); - return c == data.count(); + return c == data.size(); } bool CFileUtils::writeStringToLockedFile(const QString &content, const QString &fileNameAndPath) diff --git a/src/misc/logcategorylist.h b/src/misc/logcategorylist.h index 49b47236a..829a89ea6 100644 --- a/src/misc/logcategorylist.h +++ b/src/misc/logcategorylist.h @@ -122,7 +122,7 @@ namespace swift::misc { list.push_back(fromQStringList(T::getLogCategories())); } - if constexpr (QMetaTypeId::Defined) { list.push_back(QMetaType::typeName(qMetaTypeId())); } + if constexpr (QMetaTypeId::Defined) { list.push_back(QMetaType(qMetaTypeId()).name()); } if constexpr (std::is_base_of_v) { list.appendCategoriesFromMetaObject(T::staticMetaObject); diff --git a/src/misc/metadatautils.cpp b/src/misc/metadatautils.cpp index 4facc33c9..05c4ba2bf 100644 --- a/src/misc/metadatautils.cpp +++ b/src/misc/metadatautils.cpp @@ -29,9 +29,9 @@ namespace swift::misc meta = meta.append("type: ") .append(QString::number(mt)) .append(" name: ") - .append(QMetaType::typeName(mt)) + .append(metaType.name()) .append(" | ") - .append(QString::number(QMetaType::sizeOf(mt))) + .append(QString::number(metaType.sizeOf())) .append(" / ") .append(QString::number(swift::misc::heapSizeOf(metaType))) .append(separator); diff --git a/src/misc/mixin/mixinmetatype.h b/src/misc/mixin/mixinmetatype.h index ed5af28ad..054e5dcd9 100644 --- a/src/misc/mixin/mixinmetatype.h +++ b/src/misc/mixin/mixinmetatype.h @@ -67,7 +67,7 @@ namespace swift::misc template QString MetaType::getClassName() const { - return QMetaType::typeName(getMetaTypeId()); + return QMetaType(getMetaTypeId()).name(); } template diff --git a/src/misc/namevariantpair.cpp b/src/misc/namevariantpair.cpp index c0c79edbc..b57d4d4e8 100644 --- a/src/misc/namevariantpair.cpp +++ b/src/misc/namevariantpair.cpp @@ -49,7 +49,7 @@ namespace swift::misc // doing this in the switch gives gcc warning as IndexIcon is no member of ColumnIndex if (static_cast(i) == static_cast(IndexIcon)) { - if (static_cast(variant.type()) == QMetaType::Int) + if (static_cast(variant.typeId()) == QMetaType::Int) { CIcons::IconIndex iconIndex = variant.value(); this->m_icon = CIcon::iconByIndex(iconIndex); diff --git a/src/misc/rgbcolor.cpp b/src/misc/rgbcolor.cpp index 3707979f3..2e69ab222 100644 --- a/src/misc/rgbcolor.cpp +++ b/src/misc/rgbcolor.cpp @@ -115,7 +115,8 @@ namespace swift::misc void CRgbColor::setByString(const QString &color, bool isName) { if (color.isEmpty()) { return; } - else if (isName) + + if (isName) { const QColor q(color); m_r = q.red(); @@ -132,7 +133,7 @@ namespace swift::misc this->setInvalid(); return; } - q.setNamedColor("#" + c); + q = QColor::fromString("#" + c); this->setQColor(q); } } diff --git a/src/misc/simulation/aircraftmodel.cpp b/src/misc/simulation/aircraftmodel.cpp index 8e7d31f69..f63aa00c0 100644 --- a/src/misc/simulation/aircraftmodel.cpp +++ b/src/misc/simulation/aircraftmodel.cpp @@ -320,7 +320,7 @@ namespace swift::misc::simulation else if (variant.canConvert()) { m_fileTimestamp = variant.value(); } break; case IndexModelMode: - if (static_cast(variant.type()) == QMetaType::QString) + if (static_cast(variant.typeId()) == QMetaType::QString) { this->setModelModeAsString(variant.toString()); } @@ -519,7 +519,8 @@ namespace swift::misc::simulation QDateTime CAircraftModel::getFileTimestamp() const { - return this->hasValidFileTimestamp() ? QDateTime::fromMSecsSinceEpoch(m_fileTimestamp, Qt::UTC) : QDateTime(); + return this->hasValidFileTimestamp() ? QDateTime::fromMSecsSinceEpoch(m_fileTimestamp, QTimeZone::utc()) : + QDateTime(); } QString CAircraftModel::getFormattedFileTimestampYmdhms() const diff --git a/src/misc/simulation/fscommon/aircraftcfgparser.cpp b/src/misc/simulation/fscommon/aircraftcfgparser.cpp index 4d7a416ab..f9bf5448c 100644 --- a/src/misc/simulation/fscommon/aircraftcfgparser.cpp +++ b/src/misc/simulation/fscommon/aircraftcfgparser.cpp @@ -412,12 +412,12 @@ namespace swift::misc::simulation::fscommon { return {}; // normal when there is no settings value } - else if (static_cast(qv.type()) == QMetaType::QStringList) + if (static_cast(qv.typeId()) == QMetaType::QStringList) { const QStringList l = qv.toStringList(); return l.join(",").trimmed(); } - else if (static_cast(qv.type()) == QMetaType::QString) { return qv.toString().trimmed(); } + if (static_cast(qv.typeId()) == QMetaType::QString) { return qv.toString().trimmed(); } Q_ASSERT(false); return {}; } diff --git a/src/misc/stringutils.cpp b/src/misc/stringutils.cpp index 68a86d485..5bed04538 100644 --- a/src/misc/stringutils.cpp +++ b/src/misc/stringutils.cpp @@ -273,7 +273,7 @@ namespace swift::misc if (dateTimeString.isEmpty() || format.isEmpty()) { return {}; } QDateTime dt = QDateTime::fromString(dateTimeString, format); if (!dt.isValid()) { return dt; } - dt.setOffsetFromUtc(0); // must only be applied to valid timestamps + dt.setTimeZone(QTimeZone::utc()); // must only be applied to valid timestamps return dt; } @@ -282,7 +282,7 @@ namespace swift::misc if (dateTimeString.isEmpty()) { return {}; } QDateTime dt = QDateTime::fromString(dateTimeString, format); if (!dt.isValid()) { return dt; } - dt.setOffsetFromUtc(0); // must only be applied to valid timestamps + dt.setTimeZone(QTimeZone::utc()); // must only be applied to valid timestamps return dt; } @@ -291,7 +291,7 @@ namespace swift::misc if (dateTimeString.isEmpty()) { return {}; } QDateTime dt = locale.toDateTime(dateTimeString, format); if (!dt.isValid()) { return dt; } - dt.setOffsetFromUtc(0); // must only be applied to valid timestamps + dt.setTimeZone(QTimeZone::utc()); // must only be applied to valid timestamps return dt; } @@ -348,7 +348,7 @@ namespace swift::misc QDate date; date.setDate(year, month, day); QDateTime dt; - dt.setOffsetFromUtc(0); + dt.setTimeZone(QTimeZone::utc()); dt.setDate(date); if (dateTimeString.length() < 12) { return dt; } diff --git a/src/misc/valuecache.cpp b/src/misc/valuecache.cpp index bad6f181a..463a90b12 100644 --- a/src/misc/valuecache.cpp +++ b/src/misc/valuecache.cpp @@ -116,9 +116,10 @@ namespace swift::misc QStringList result; for (const auto &key : keys) { - QString time = contains(key) ? - QDateTime::fromMSecsSinceEpoch(value(key).second, Qt::UTC).toString(Qt::ISODate) : - "no timestamp"; + QString time = + contains(key) ? + QDateTime::fromMSecsSinceEpoch(value(key).second, QTimeZone::utc()).toString(Qt::ISODate) : + "no timestamp"; result.push_back(key + " (" + time + ")"); } return result.join(","); @@ -255,7 +256,7 @@ namespace swift::misc if (values.isEmpty()) { return; } m_elements.detach(); //! \fixme see http://doc.qt.io/qt-5/containers.html#implicit-sharing-iterator-problem auto out = std::as_const(m_elements).lowerBound(values.cbegin().key()); - auto end = std::as_const(m_elements).upperBound((values.cend() - 1).key()); + auto end = std::as_const(m_elements).upperBound((std::prev(values.cend())).key()); for (auto in = values.cbegin(); in != values.cend(); ++in) { while (out != end && out.key() < in.key()) { ++out; } @@ -292,7 +293,7 @@ namespace swift::misc CValueCachePacket ackedChanges(values.isSaved()); m_elements.detach(); //! \fixme see http://doc.qt.io/qt-5/containers.html#implicit-sharing-iterator-problem auto out = std::as_const(m_elements).lowerBound(values.cbegin().key()); - auto end = std::as_const(m_elements).upperBound((values.cend() - 1).key()); + auto end = std::as_const(m_elements).upperBound((std::prev(values.cend())).key()); for (auto in = values.cbegin(); in != values.cend(); ++in) { while (out != end && out.key() < in.key()) { ++out; } @@ -822,23 +823,20 @@ namespace swift::misc { return CStatusMessage(this, invalidSeverity, u"Empty cache value %1", true) << element.m_nameWithKey; } - else if (value.userType() != element.m_metaType) + if (value.userType() != element.m_metaType) { return CStatusMessage(this).error(u"Expected %1 but got %2 for %3") - << QMetaType::typeName(element.m_metaType) << value.typeName() << element.m_nameWithKey; + << QMetaType(element.m_metaType).name() << value.typeName() << element.m_nameWithKey; } - else if (element.m_validator && !element.m_validator(value, reason)) + if (element.m_validator && !element.m_validator(value, reason)) { if (reason.isEmpty()) { return CStatusMessage(this).error(u"%1 is not valid for %2") << value.toQString() << element.m_nameWithKey; } - else - { - return CStatusMessage(this).error(u"%1 (%2 for %3)") - << reason << value.toQString() << element.m_nameWithKey; - } + return CStatusMessage(this).error(u"%1 (%2 for %3)") + << reason << value.toQString() << element.m_nameWithKey; } else { return {}; } } diff --git a/src/misc/variant.cpp b/src/misc/variant.cpp index 01f140c2b..4a7eee011 100644 --- a/src/misc/variant.cpp +++ b/src/misc/variant.cpp @@ -29,9 +29,9 @@ namespace swift::misc //! \private int qMetaTypeId_CVariantList = -1; // referenced in variantlist.cpp - private_ns::IValueObjectMetaInfo *private_ns::getValueObjectMetaInfo(int typeId) + private_ns::IValueObjectMetaInfo *private_ns::getValueObjectMetaInfo(QMetaType mt) { - return getValueObjectMetaInfo(QVariant(QMetaType(typeId), nullptr)); + return getValueObjectMetaInfo(QVariant(mt, nullptr)); } private_ns::IValueObjectMetaInfo *private_ns::getValueObjectMetaInfo(const QVariant &v) @@ -41,14 +41,15 @@ namespace swift::misc bool CVariant::canConvert(int typeId) const { - if (m_v.canConvert(typeId)) { return true; } + const QMetaType mt(typeId); + if (m_v.canConvert(mt)) { return true; } if (typeId == qMetaTypeId_CVariantList) { return m_v.canConvert>() || m_v.canConvert(); } if (userType() == qMetaTypeId_CVariantList) { - return QVariant::fromValue(QVector()).canConvert(typeId) || + return QVariant::fromValue(QVector()).canConvert(mt) || QVariant(QMetaType(typeId), nullptr).canConvert(); } return false; @@ -56,14 +57,15 @@ namespace swift::misc bool CVariant::convert(int typeId) { - if (!m_v.canConvert(typeId)) + const QMetaType mt(typeId); + if (!m_v.canConvert(mt)) { if (!canConvert(typeId)) { return false; } if (typeId == qMetaTypeId_CVariantList) { if (m_v.canConvert>()) { - if (!m_v.convert(qMetaTypeId>())) { return false; } + if (!m_v.convert(QMetaType(qMetaTypeId>()))) { return false; } } else if (m_v.canConvert()) { @@ -77,14 +79,14 @@ namespace swift::misc } if (userType() == qMetaTypeId_CVariantList) { - if (QVariant::fromValue(QVector()).canConvert(typeId)) + if (QVariant::fromValue(QVector()).canConvert(mt)) { - if (!m_v.convert(qMetaTypeId>())) { return false; } + if (!m_v.convert(QMetaType(qMetaTypeId>()))) { return false; } } else { return false; } } } - return m_v.convert(typeId); + return m_v.convert(mt); } bool CVariant::isVariantList() const { return userType() == qMetaTypeId_CVariantList; } @@ -168,22 +170,22 @@ namespace swift::misc QJsonObject json; json.insert("type", this->typeName()); - switch (m_v.type()) + switch (m_v.metaType().id()) { - case QVariant::Invalid: json.insert("value", 0); break; - case QVariant::Int: json.insert("value", m_v.toInt()); break; - case QVariant::UInt: json.insert("value", m_v.toInt()); break; - case QVariant::Bool: json.insert("value", m_v.toBool()); break; - case QVariant::Double: json.insert("value", m_v.toDouble()); break; - case QVariant::LongLong: json.insert("value", m_v.toLongLong()); break; - case QVariant::ULongLong: json.insert("value", m_v.toLongLong()); break; - case QVariant::String: json.insert("value", m_v.toString()); break; - case QVariant::Char: json.insert("value", m_v.toString()); break; - case QVariant::ByteArray: json.insert("value", m_v.toString()); break; - case QVariant::DateTime: json.insert("value", m_v.toDateTime().toString(Qt::ISODate)); break; - case QVariant::Date: json.insert("value", m_v.toDate().toString(Qt::ISODate)); break; - case QVariant::Time: json.insert("value", m_v.toTime().toString(Qt::ISODate)); break; - case QVariant::StringList: json.insert("value", QJsonArray::fromStringList(m_v.toStringList())); break; + case QMetaType::UnknownType: json.insert("value", 0); break; + case QMetaType::Int: json.insert("value", m_v.toInt()); break; + case QMetaType::UInt: json.insert("value", m_v.toInt()); break; + case QMetaType::Bool: json.insert("value", m_v.toBool()); break; + case QMetaType::Double: json.insert("value", m_v.toDouble()); break; + case QMetaType::LongLong: json.insert("value", m_v.toLongLong()); break; + case QMetaType::ULongLong: json.insert("value", m_v.toLongLong()); break; + case QMetaType::QString: json.insert("value", m_v.toString()); break; + case QMetaType::Char: json.insert("value", m_v.toString()); break; + case QMetaType::QByteArray: json.insert("value", m_v.toString()); break; + case QMetaType::QDateTime: json.insert("value", m_v.toDateTime().toString(Qt::ISODate)); break; + case QMetaType::QDate: json.insert("value", m_v.toDate().toString(Qt::ISODate)); break; + case QMetaType::QTime: json.insert("value", m_v.toTime().toString(Qt::ISODate)); break; + case QMetaType::QStringList: json.insert("value", QJsonArray::fromStringList(m_v.toStringList())); break; default: try { @@ -222,44 +224,44 @@ namespace swift::misc m_v.clear(); return; } - const int typeId = QMetaType::type(qPrintable(typeName)); + + const QMetaType mt = QMetaType::fromName(qPrintable(typeName)); const QJsonValue value = json.value("value"); if (value.isUndefined()) { throw CJsonException("Missing 'value'"); } - switch (typeId) + switch (mt.id()) { - case QVariant::Invalid: throw CJsonException("Type not recognized by QMetaType"); - case QVariant::Int: m_v.setValue(value.toInt()); break; - case QVariant::UInt: m_v.setValue(static_cast(value.toInt())); break; - case QVariant::Bool: m_v.setValue(value.toBool()); break; - case QVariant::Double: m_v.setValue(value.toDouble()); break; - case QVariant::LongLong: m_v.setValue(static_cast(value.toDouble())); break; - case QVariant::ULongLong: m_v.setValue(static_cast(value.toDouble())); break; - case QVariant::String: m_v.setValue(value.toString()); break; - case QVariant::Char: m_v.setValue(value.toString().size() > 0 ? value.toString().at(0) : '\0'); break; - case QVariant::ByteArray: m_v.setValue(value.toString().toLatin1()); break; - case QVariant::DateTime: m_v.setValue(fromStringUtc(value.toString(), Qt::ISODate)); break; - case QVariant::Date: m_v.setValue(QDate::fromString(value.toString(), Qt::ISODate)); break; - case QVariant::Time: m_v.setValue(QTime::fromString(value.toString(), Qt::ISODate)); break; - case QVariant::StringList: m_v.setValue(QVariant(value.toArray().toVariantList()).toStringList()); break; + case QMetaType::UnknownType: throw CJsonException("Type not recognized by QMetaType"); + case QMetaType::Int: m_v.setValue(value.toInt()); break; + case QMetaType::UInt: m_v.setValue(static_cast(value.toInt())); break; + case QMetaType::Bool: m_v.setValue(value.toBool()); break; + case QMetaType::Double: m_v.setValue(value.toDouble()); break; + case QMetaType::LongLong: m_v.setValue(static_cast(value.toDouble())); break; + case QMetaType::ULongLong: m_v.setValue(static_cast(value.toDouble())); break; + case QMetaType::QString: m_v.setValue(value.toString()); break; + case QMetaType::Char: m_v.setValue(value.toString().size() > 0 ? value.toString().at(0) : '\0'); break; + case QMetaType::QByteArray: m_v.setValue(value.toString().toLatin1()); break; + case QMetaType::QDateTime: m_v.setValue(fromStringUtc(value.toString(), Qt::ISODate)); break; + case QMetaType::QDate: m_v.setValue(QDate::fromString(value.toString(), Qt::ISODate)); break; + case QMetaType::QTime: m_v.setValue(QTime::fromString(value.toString(), Qt::ISODate)); break; + case QMetaType::QStringList: m_v.setValue(QVariant(value.toArray().toVariantList()).toStringList()); break; default: try { - auto *meta = private_ns::getValueObjectMetaInfo(typeId); + auto *meta = private_ns::getValueObjectMetaInfo(mt); if (meta) { CJsonScope scope("value"); // tracker Q_UNUSED(scope); - m_v = QVariant(QMetaType(typeId), nullptr); + m_v = QVariant(mt, nullptr); // this will call convertFromJson if there is no MemoizedJson meta->convertFromMemoizedJson(value.toObject(), data(), true); } - else if (QMetaType::hasRegisteredConverterFunction(QMetaType(qMetaTypeId()), - QMetaType(typeId))) + else if (QMetaType::hasRegisteredConverterFunction(QMetaType(qMetaTypeId()), mt)) { m_v.setValue(value.toString()); - if (!m_v.convert(typeId)) { throw CJsonException("Failed to convert from JSON string"); } + if (!m_v.convert(mt)) { throw CJsonException("Failed to convert from JSON string"); } } else { throw CJsonException("Type not supported by convertFromJson"); } } @@ -315,9 +317,9 @@ namespace swift::misc m_v.clear(); return; } - int typeId = QMetaType::type(qPrintable(typeName)); + const QMetaType mt = QMetaType::fromName(qPrintable(typeName)); - auto *meta = private_ns::getValueObjectMetaInfo(typeId); + auto *meta = private_ns::getValueObjectMetaInfo(mt); if (meta) { try @@ -326,7 +328,7 @@ namespace swift::misc if (value.isUndefined()) { throw CJsonException("Missing 'value'"); } CJsonScope scope("value"); - m_v = QVariant(QMetaType(typeId), nullptr); + m_v = QVariant(mt, nullptr); meta->convertFromMemoizedJson(value.toObject(), data(), allowFallbackToJson); } catch (const private_ns::CVariantException &ex) @@ -353,18 +355,18 @@ namespace swift::misc size_t CVariant::getValueHash() const { - switch (m_v.type()) + switch (m_v.metaType().id()) { - case QVariant::Invalid: return 0; - case QVariant::Int: return qHash(m_v.toInt()); - case QVariant::UInt: return qHash(m_v.toUInt()); - case QVariant::Bool: return qHash(m_v.toUInt()); - case QVariant::Double: return qHash(m_v.toUInt()); - case QVariant::LongLong: return qHash(m_v.toLongLong()); - case QVariant::ULongLong: return qHash(m_v.toULongLong()); - case QVariant::String: return qHash(m_v.toString()); - case QVariant::Char: return qHash(m_v.toChar()); - case QVariant::ByteArray: return qHash(m_v.toByteArray()); + case QMetaType::UnknownType: return 0; + case QMetaType::Int: return qHash(m_v.toInt()); + case QMetaType::UInt: return qHash(m_v.toUInt()); + case QMetaType::Bool: return qHash(m_v.toUInt()); + case QMetaType::Double: return qHash(m_v.toUInt()); + case QMetaType::LongLong: return qHash(m_v.toLongLong()); + case QMetaType::ULongLong: return qHash(m_v.toULongLong()); + case QMetaType::QString: return qHash(m_v.toString()); + case QMetaType::Char: return qHash(m_v.toChar()); + case QMetaType::QByteArray: return qHash(m_v.toByteArray()); default: try { @@ -397,7 +399,7 @@ namespace swift::misc * 2 functions required for unmarshallFromDbus * \internal */ - QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType, const QString &typeName); + QVariant fixQVariantFromDbusArgument(const QVariant &variant, QMetaType localUserType, const QString &typeName); QVariant complexQtTypeFromDbusArgument(const QDBusArgument &argument, int type); //! @} @@ -410,7 +412,7 @@ namespace swift::misc if (typeName.isEmpty()) { *this = CVariant(); } else { - *this = fixQVariantFromDbusArgument(dbusVar.variant(), QMetaType::type(qPrintable(typeName)), typeName); + *this = fixQVariantFromDbusArgument(dbusVar.variant(), QMetaType::fromName(qPrintable(typeName)), typeName); } } @@ -481,10 +483,9 @@ namespace swift::misc QPixmap CVariant::toPixmap() const { - if (m_v.type() == QVariant::Pixmap) { return m_v.value(); } - if (m_v.type() == QVariant::Image) { return QPixmap::fromImage(m_v.value()); } - if (m_v.type() == QVariant::Icon) { return iconToPixmap(m_v.value()); } - + if (m_v.typeId() == QMetaType::QPixmap) { return m_v.value(); } + if (m_v.typeId() == QMetaType::QImage) { return QPixmap::fromImage(m_v.value()); } + if (m_v.typeId() == QMetaType::QIcon) { return iconToPixmap(m_v.value()); } return CIcon(toIcon()).toPixmap(); } @@ -492,7 +493,7 @@ namespace swift::misc int CVariant::getMetaTypeId() const { return private_ns::MetaTypeHelper::maybeGetMetaTypeId(); } - QString CVariant::getClassName() const { return QMetaType::typeName(getMetaTypeId()); } + QString CVariant::getClassName() const { return QMetaType(getMetaTypeId()).name(); } bool CVariant::isA(int metaTypeId) const { @@ -521,24 +522,23 @@ namespace swift::misc } } - QVariant fixQVariantFromDbusArgument(const QVariant &variant, int localUserType, const QString &typeName) + QVariant fixQVariantFromDbusArgument(const QVariant &variant, QMetaType localUserType, const QString &typeName) { - if (localUserType == static_cast(QVariant::Invalid)) + if (localUserType.id() == static_cast(QMetaType::UnknownType)) { CLogMessage(&variant).warning(u"Invalid type for unmarshall: %1") << typeName; } - // my business? if (!variant.canConvert()) { return variant; } // complex, user type // it has to be made sure, that the cast works const QDBusArgument arg = variant.value(); - constexpr int userType = static_cast(QVariant::UserType); - if (localUserType < userType) + constexpr int userType = static_cast(QMetaType::User); + if (localUserType.id() < userType) { // complex Qt type, e.g. QDateTime - return complexQtTypeFromDbusArgument(arg, localUserType); + return complexQtTypeFromDbusArgument(arg, localUserType.id()); } else if (QMetaType(localUserType).flags() & QMetaType::IsEnumeration) { @@ -593,7 +593,7 @@ namespace swift::misc } default: { - const char *name = QMetaType::typeName(type); + const char *name = QMetaType(type).name(); qFatal("Type cannot be resolved: %s (%d)", name ? name : "", type); } } diff --git a/src/misc/variant.h b/src/misc/variant.h index b8c1ba511..873edca60 100644 --- a/src/misc/variant.h +++ b/src/misc/variant.h @@ -84,9 +84,6 @@ namespace swift::misc //! Move-construct from a QVariant. CVariant(QVariant &&var) noexcept : m_v(std::move(var)) {} - //! Construct a null variant of the given type. - CVariant(QVariant::Type type) : m_v(type) {} - //! Avoid unexpected implicit cast to QVariant::Type. (Use CVariant::from() instead.) CVariant(int) = delete; @@ -252,7 +249,11 @@ namespace swift::misc bool isValid() const { return m_v.isValid(); } //! Return the metatype ID of the value in this variant, or QMetaType::User if it is a user type. - QMetaType::Type type() const { return static_cast(m_v.type()); } + QMetaType::Type type() const + { + const int type = m_v.typeId(); + return type >= QMetaType::Type::User ? QMetaType::Type::User : static_cast(type); + } //! Return the typename of the value in this variant. const char *typeName() const { return m_v.typeName(); } diff --git a/src/misc/variantprivate.h b/src/misc/variantprivate.h index 2462497fe..6fd09f55f 100644 --- a/src/misc/variantprivate.h +++ b/src/misc/variantprivate.h @@ -78,7 +78,7 @@ namespace swift::misc static QString blurb(int typeId, const QString &operationName) { - return QString("CVariant requested unsupported operation of contained ") + QMetaType::typeName(typeId) + + return QString("CVariant requested unsupported operation of contained ") + QMetaType(typeId).name() + " object: " + operationName; } }; @@ -369,7 +369,7 @@ namespace swift::misc } //! \private Getter to obtain the IValueObjectMetaInfo which was stored by swift::misc::registerMetaValueType. - IValueObjectMetaInfo *getValueObjectMetaInfo(int typeId); + IValueObjectMetaInfo *getValueObjectMetaInfo(QMetaType mt); //! \private Getter to obtain the IValueObjectMetaInfo which was stored by swift::misc::registerMetaValueType. IValueObjectMetaInfo *getValueObjectMetaInfo(const QVariant &); diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index a00766897..505d168fe 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -410,7 +410,7 @@ bool CSwiftLauncher::warnAboutOtherSwiftApplications() const QString msg = u"While using the wizard no other application should run.\nClose applications and try " u"again.\nCurrently running: " % running.processNames().join(','); - QMessageBox::question(this, "Wizard", msg, QMessageBox::Close); + QMessageBox::question(this, "Wizard", msg, QMessageBox::StandardButtons(QMessageBox::StandardButton::Close)); return false; } diff --git a/tests/core/fsd/testfsdclient/testfsdclient.cpp b/tests/core/fsd/testfsdclient/testfsdclient.cpp index 596a955bf..53885d2f5 100644 --- a/tests/core/fsd/testfsdclient/testfsdclient.cpp +++ b/tests/core/fsd/testfsdclient/testfsdclient.cpp @@ -728,9 +728,9 @@ namespace SwiftFsdTest // Server without ICAOEQ capability is set by default (in init()) QSignalSpy spy(m_client, &CFSDClient::rawFsdMessage); QDateTime takeoffTimePlanned = QDateTime::fromString("1530", "hhmm"); - takeoffTimePlanned.setTimeSpec(Qt::UTC); + takeoffTimePlanned.setTimeZone(QTimeZone::utc()); QDateTime takeoffTimeActual = QDateTime::fromString("1535", "hhmm"); - takeoffTimeActual.setTimeSpec(Qt::UTC); + takeoffTimeActual.setTimeZone(QTimeZone::utc()); CAltitude flightLevel(35000, CAltitude::FlightLevel, CLengthUnit::ft()); CFlightPlanAircraftInfo info("H/B744/L"); CFlightPlan fp({}, info, "EGLL", "KORD", "NONE", takeoffTimePlanned, takeoffTimeActual, @@ -755,9 +755,9 @@ namespace SwiftFsdTest QSignalSpy spy(m_client, &CFSDClient::rawFsdMessage); QDateTime takeoffTimePlanned = QDateTime::fromString("1530", "hhmm"); - takeoffTimePlanned.setTimeSpec(Qt::UTC); + takeoffTimePlanned.setTimeZone(QTimeZone::utc()); QDateTime takeoffTimeActual = QDateTime::fromString("1535", "hhmm"); - takeoffTimeActual.setTimeSpec(Qt::UTC); + takeoffTimeActual.setTimeZone(QTimeZone::utc()); CAltitude flightLevel(35000, CAltitude::FlightLevel, CLengthUnit::ft()); CFlightPlanAircraftInfo info("B748/H-SDE3FGHIM1M2RWXY/LB1"); CFlightPlan fp({}, info, "EGLL", "KORD", "NONE", takeoffTimePlanned, takeoffTimeActual, diff --git a/tests/misc/teststringutils/teststringutils.cpp b/tests/misc/teststringutils/teststringutils.cpp index bba3ddc03..d24af7118 100644 --- a/tests/misc/teststringutils/teststringutils.cpp +++ b/tests/misc/teststringutils/teststringutils.cpp @@ -84,7 +84,7 @@ namespace MiscTest (c.length() == size) ? fromStringUtc(c, "yyyyMMddHHmmss") : fromStringUtc(c, "yyyyMMddHHmmsszzz"); QDateTime dt3 = (c.length() == size) ? QDateTime::fromString(c, "yyyyMMddHHmmss") : QDateTime::fromString(c, "yyyyMMddHHmmsszzz"); - dt3.setOffsetFromUtc(0); + dt3.setTimeZone(QTimeZone::utc()); const qint64 ms1 = dt1.toMSecsSinceEpoch(); const qint64 ms2 = dt2.toMSecsSinceEpoch(); diff --git a/third_party/simplecrypt/CMakeLists.txt b/third_party/simplecrypt/CMakeLists.txt index 80f59452a..5084ae4f9 100644 --- a/third_party/simplecrypt/CMakeLists.txt +++ b/third_party/simplecrypt/CMakeLists.txt @@ -16,3 +16,4 @@ target_include_directories(SimpleCrypt ${PROJECT_SOURCE_DIR}/third_party ) set_property(TARGET SimpleCrypt PROPERTY POSITION_INDEPENDENT_CODE ON) +target_compile_definitions(SimpleCrypt PRIVATE QT_NO_DEPRECATED_WARNINGS)