From c277844cf486eae7980b58e00daa330889bea6cb Mon Sep 17 00:00:00 2001 From: wh201906 Date: Tue, 21 Sep 2021 11:12:42 +0800 Subject: [PATCH] Make SkipEmptyParts compatible with older Qt Fix #25 --- module/lf.cpp | 4 ++++ ui/mainwindow.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/module/lf.cpp b/module/lf.cpp index ee4aead..97f6dd3 100644 --- a/module/lf.cpp +++ b/module/lf.cpp @@ -84,7 +84,11 @@ void LF::getLFConfig() start = result.indexOf(config["field start"].toString()); end = result.indexOf(config["field end"].toString()); result = result.mid(start, end - start); +#if (QT_VERSION <= QT_VERSION_CHECK(5,14,0)) + resultList = result.split("\n", QString::SkipEmptyParts); +#else resultList = result.split("\n", Qt::SkipEmptyParts); +#endif qDebug() << "LF CONFIG GET\n" << resultList; for(auto it = resultList.begin(); it != resultList.end(); it++) { diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 62f2bb6..c186ad6 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -156,7 +156,11 @@ void MainWindow::on_PM3_connectButton_clicked() #endif envSetProcess.waitForReadyRead(10000); QString envSetResult = QString(envSetProcess.readAll()); +#if (QT_VERSION <= QT_VERSION_CHECK(5,14,0)) clientEnv = envSetResult.split("\n", QString::SkipEmptyParts); +#else + clientEnv = envSetResult.split("\n", Qt::SkipEmptyParts); +#endif if(clientEnv.size() > 2) // the first element is "set" and the last element is the current path { clientEnv.removeFirst();