我解决了用
Qt::SkipEmptyParts 替换 QString::SkipEmptyParts 的问题,因为 Qt::SkipEmptyParts 已被弃用。
如果您想保持向后兼容性,但也想对 qt 版本 >= 5.11.x 使用新版本,您可以使用:
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
const auto skip_empty_parts = Qt::SkipEmptyParts;
#else
const auto skip_empty_parts = QString::SkipEmptyParts;
#endif
更新:
正如@Alienpenguin所说,
QString::SkipEmptyParts已在Qt6中被弃用并删除,现在可以使用Qt::SkipEmptyParts。