diff --git a/src/libcalamares/utils/String.h b/src/libcalamares/utils/String.h index d4bd33357..26df00b07 100644 --- a/src/libcalamares/utils/String.h +++ b/src/libcalamares/utils/String.h @@ -1,5 +1,5 @@ /* === This file is part of Calamares - === - * + * * SPDX-FileCopyrightText: 2013-2016 Teo Mrnjavac * SPDX-FileCopyrightText: 2018 Adriaan de Groot * @@ -33,6 +33,27 @@ #include +/* Qt 5.14 changed the API to QString::split(), adding new overloads + * that take a different enum, then Qt 5.15 deprecated the old ones. + * To avoid overly-many warnings related to the API change, introduce + * Calamares-specific constants that pull from the correct enum. + */ +constexpr static const auto SplitSkipEmptyParts = +#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) + QString::SkipEmptyParts +#else + Qt::SkipEmptyParts +#endif + ; + +constexpr static const auto SplitKeepEmptyParts = +#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 ) + QString::KeepEmptyParts +#else + Qt::KeepEmptyParts +#endif + ; + /** * @brief The CalamaresUtils namespace contains utility functions. */