1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 03:35:27 +00:00

Merge branch 'noanchor' into 'master'

Replace usage of QRegularExpression::anchoredPattern with `^` and `$`

See merge request OpenMW/openmw!2607
This commit is contained in:
psi29a 2023-01-13 09:55:59 +00:00
commit b7e5759599
5 changed files with 6 additions and 7 deletions

View File

@ -205,7 +205,7 @@ void Launcher::GraphicsPage::saveSettings()
int cHeight = 0;
if (standardRadioButton->isChecked())
{
QRegularExpression resolutionRe(QRegularExpression::anchoredPattern(QString("(\\d+) x (\\d+).*")));
QRegularExpression resolutionRe("^(\\d+) x (\\d+)");
QRegularExpressionMatch match = resolutionRe.match(resolutionComboBox->currentText().simplified());
if (match.hasMatch())
{

View File

@ -20,8 +20,7 @@ Launcher::TextInputDialog::TextInputDialog(const QString& title, const QString&
label->setText(text);
// Line edit
QValidator* validator
= new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
QValidator* validator = new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9_]*$"), this);
mLineEdit = new LineEdit(this);
mLineEdit->setValidator(validator);
mLineEdit->setCompleter(nullptr);

View File

@ -30,7 +30,7 @@ bool Wizard::IniSettings::readFile(QTextStream& stream)
// Look for a square bracket, "'\\["
// that has one or more "not nothing" in it, "([^]]+)"
// and is closed with a square bracket, "\\]"
QRegularExpression sectionRe(QRegularExpression::anchoredPattern("^\\[([^]]+)\\]"));
QRegularExpression sectionRe("^\\[([^]]+)\\]$");
// Find any character(s) that is/are not equal sign(s), "[^=]+"
// followed by an optional whitespace, an equal sign, and another optional whitespace, "\\s*=\\s*"
@ -75,7 +75,7 @@ bool Wizard::IniSettings::writeFile(const QString& path, QTextStream& stream)
// Look for a square bracket, "'\\["
// that has one or more "not nothing" in it, "([^]]+)"
// and is closed with a square bracket, "\\]"
QRegularExpression sectionRe(QRegularExpression::anchoredPattern("^\\[([^]]+)\\]"));
QRegularExpression sectionRe("^\\[([^]]+)\\]$");
// Find any character(s) that is/are not equal sign(s), "[^=]+"
// followed by an optional whitespace, an equal sign, and another optional whitespace, "\\s*=\\s*"

View File

@ -47,7 +47,7 @@ QStringList Config::LauncherSettings::subKeys(const QString& key)
bool Config::LauncherSettings::writeFile(QTextStream& stream)
{
QString sectionPrefix;
QRegularExpression sectionRe(QRegularExpression::anchoredPattern("([^/]+)/(.+)$"));
QRegularExpression sectionRe("^([^/]+)/(.+)$");
QMultiMap<QString, QString> settings = SettingsBase::getSettings();
QMapIterator<QString, QString> i(settings);

View File

@ -42,7 +42,7 @@ namespace Config
QString sectionPrefix;
QRegularExpression sectionRe(QRegularExpression::anchoredPattern("^\\[([^]]+)\\]"));
QRegularExpression sectionRe("^\\[([^]]+)\\]$");
QRegularExpression keyRe("^([^=]+)\\s*=\\s*(.+)$");
while (!stream.atEnd())