diff --git a/src/musredit_qt5/musredit/PTextEdit.cpp b/src/musredit_qt5/musredit/PTextEdit.cpp index 615d6a5f..4f52756d 100644 --- a/src/musredit_qt5/musredit/PTextEdit.cpp +++ b/src/musredit_qt5/musredit/PTextEdit.cpp @@ -3522,7 +3522,8 @@ void PTextEdit::fillRecentFiles() //---------------------------------------------------------------------------------------------------- /** - *
run list is split (space separated) and expanded (start-end -> start, start+1, ..., end) to a list + *
run list is split (space separated), expanded (start-end -> start, start+1, ..., end) or + * (start:end:step -> start, start+step, ..., end) to a list. * * \param runListStr list to be split and expanded * \param ok true if everything is fine; false if an error has been encountered @@ -3572,6 +3573,37 @@ QStringList PTextEdit::getRunList(QString runListStr, bool &ok) str = QString("%1").arg(i); result << str; } + } else if (tok[i].contains(':')) { // list given, hence need to expand + QStringList runListTok = tok[i].split(':', Qt::SkipEmptyParts); + int start{0}, end{0}, step{0}; + if (runListTok.size() != 3) { // error + ok = false; + result.clear(); + return result; + } + start = runListTok[0].toInt(&isInt); + if (!isInt) { + ok = false; + result.clear(); + return result; + } + end = runListTok[1].toInt(&isInt); + if (!isInt) { + ok = false; + result.clear(); + return result; + } + step = runListTok[2].toInt(&isInt); + if (!isInt) { + ok = false; + result.clear(); + return result; + } + do { + str = QString("%1").arg(start); + result << str; + start += step; + } while (start <= end); } else { // keep it result << tok[i]; } diff --git a/src/musredit_qt6/musredit/PTextEdit.cpp b/src/musredit_qt6/musredit/PTextEdit.cpp index 3c28f837..891ab867 100644 --- a/src/musredit_qt6/musredit/PTextEdit.cpp +++ b/src/musredit_qt6/musredit/PTextEdit.cpp @@ -3487,7 +3487,8 @@ void PTextEdit::fillRecentFiles() //---------------------------------------------------------------------------------------------------- /** - *
run list is split (space separated) and expanded (start-end -> start, start+1, ..., end) to a list + *
run list is split (space separated), expanded (start-end -> start, start+1, ..., end) or + * (start:end:step -> start, start+step, ..., end) to a list. * * \param runListStr list to be split and expanded * \param ok true if everything is fine; false if an error has been encountered @@ -3529,6 +3530,37 @@ QStringList PTextEdit::getRunList(QString runListStr, bool &ok) str = QString("%1").arg(i); result << str; } + } else if (tok[i].contains(':')) { // list given, hence need to expand + QStringList runListTok = tok[i].split(':', Qt::SkipEmptyParts); + int start{0}, end{0}, step{0}; + if (runListTok.size() != 3) { // error + ok = false; + result.clear(); + return result; + } + start = runListTok[0].toInt(&isInt); + if (!isInt) { + ok = false; + result.clear(); + return result; + } + end = runListTok[1].toInt(&isInt); + if (!isInt) { + ok = false; + result.clear(); + return result; + } + step = runListTok[2].toInt(&isInt); + if (!isInt) { + ok = false; + result.clear(); + return result; + } + do { + str = QString("%1").arg(start); + result << str; + start += step; + } while (start <= end); } else { // keep it result << tok[i]; }