qt: Migrate to Qt6. (#6418)
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <QLineEdit>
|
||||
#include <QRegExpValidator>
|
||||
#include <QRegularExpression>
|
||||
#include "citra_qt/util/spinbox.h"
|
||||
#include "common/assert.h"
|
||||
|
||||
@@ -244,14 +244,15 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const {
|
||||
}
|
||||
|
||||
// Match string
|
||||
QRegExp num_regexp(regexp);
|
||||
QRegularExpression num_regexp(QRegularExpression::anchoredPattern(regexp));
|
||||
int num_pos = strpos;
|
||||
QString sub_input = input.mid(strpos, input.length() - strpos - suffix.length());
|
||||
|
||||
if (!num_regexp.exactMatch(sub_input) && num_regexp.matchedLength() == 0)
|
||||
auto match = num_regexp.match(sub_input);
|
||||
if (!match.hasMatch())
|
||||
return QValidator::Invalid;
|
||||
|
||||
sub_input = sub_input.left(num_regexp.matchedLength());
|
||||
sub_input = sub_input.left(match.capturedLength());
|
||||
bool ok;
|
||||
qint64 val = sub_input.toLongLong(&ok, base);
|
||||
|
||||
@@ -263,7 +264,7 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const {
|
||||
return QValidator::Invalid;
|
||||
|
||||
// Make sure we are actually at the end of this string...
|
||||
strpos += num_regexp.matchedLength();
|
||||
strpos += match.capturedLength();
|
||||
|
||||
if (!suffix.isEmpty() && input.mid(strpos) != suffix) {
|
||||
return QValidator::Invalid;
|
||||
|
Reference in New Issue
Block a user