diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp index 6980c3640040c51547e31c7118dd9b61ef86e457..2f3b6eae8585c74199d86610b58baae0aa846297 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp @@ -776,7 +776,9 @@ InputBar::getCommandAndArgs(const QString ¤tText) const if (!currentText.startsWith('/')) return {{}, currentText}; - int command_end = currentText.indexOf(QRegularExpression(QStringLiteral("\\s"))); + static QRegularExpression spaceRegex(QStringLiteral("\\s")); + + int command_end = currentText.indexOf(spaceRegex); if (command_end == -1) command_end = currentText.size(); auto name = currentText.mid(1, command_end - 1); diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index f3b3ce81aa5b25a51dd2aaa8f86840e706cfe6f7..6cec615bb3b01b2fd6381a9ee173166bb484a74d 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -1340,7 +1340,7 @@ TimelineModel::formatDateSeparator(QDate date) const QString fmt = QLocale::system().dateFormat(QLocale::LongFormat); if (now.date().year() == date.year()) { - QRegularExpression rx(QStringLiteral("[^a-zA-Z]*y+[^a-zA-Z]*")); + static QRegularExpression rx(QStringLiteral("[^a-zA-Z]*y+[^a-zA-Z]*")); fmt = fmt.remove(rx); }