use static (And const where applicable) regular expression objects

the speed increase here is noticable since the work of creating a regex object is only done once per session
This commit is contained in:
garak
2022-11-22 22:57:26 -05:00
committed by t
parent d1bdbc2741
commit 37fcfba829
18 changed files with 79 additions and 56 deletions

View File

@@ -609,7 +609,7 @@ void MainWindow::setMetatileLabel(int metatileId, QString label) {
if (!metatile)
return;
QRegularExpression expression("[_A-Za-z0-9]*$");
static const QRegularExpression expression("[_A-Za-z0-9]*$");
QRegularExpressionValidator validator(expression);
int pos = 0;
if (validator.validate(label, pos) != QValidator::Acceptable) {