[Interest] Set manipulation in Qt 6

Vadim Peretokin vperetokin at gmail.com
Sat Jun 20 08:44:19 CEST 2020


Being good users open-source of Qt, we're <https://github.com/Mudlet/Mudlet>
looking into our compatibility early on to help report any issues and we're
finding this compatibility code to be rather problematic from the developer
experience point of view:

QMap<QString, QList<QPointF>> customLines;
QMap<QString, QColor> customLinesColor;
// ...

#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
    auto customLineKeys = customLines.keys();
    QSet<QString> missingKeys{customLineKeys.begin(), customLineKeys.end()};
    if (!customLinesColor.isEmpty()) {
        auto customLinesColorKeys = customLinesColor.keys();
        QSet<QString> customLinesColorKeysSet{customLinesColorKeys.begin(),
customLinesColorKeys.end()};
        missingKeys.subtract(customLinesColorKeysSet);
    }
#else
    QSet<QString>
missingKeys{customLines.keys().toSet().subtract(customLinesColor.keys().toSet())};
#endif

Are we doing it wrong or is this a regression in Qt? (QTBUG-83697
<https://bugreports.qt.io/browse/QTBUG-83697>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200620/01ff6606/attachment.html>


More information about the Interest mailing list