mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: replace QRegExp with QRegularExpression
Qt 6 will drop support for QRegExp. Use QRegularExpression instead. The syntax for matches and captures has changed and needed to be adjusted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
73e9c099eb
commit
7d6552ff65
1 changed files with 7 additions and 6 deletions
|
@ -177,7 +177,7 @@ ShiftImageTimesDialog::ShiftImageTimesDialog(QWidget *parent, QStringList fileNa
|
||||||
matchAllImages(false)
|
matchAllImages(false)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
ui.timeEdit->setValidator(new QRegExpValidator(QRegExp("\\d{0,6}:[0-5]\\d")));
|
ui.timeEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("\\d{0,6}:[0-5]\\d")));
|
||||||
connect(ui.syncCamera, SIGNAL(clicked()), this, SLOT(syncCameraClicked()));
|
connect(ui.syncCamera, SIGNAL(clicked()), this, SLOT(syncCameraClicked()));
|
||||||
connect(ui.timeEdit, &QLineEdit::textEdited, this, &ShiftImageTimesDialog::timeEdited);
|
connect(ui.timeEdit, &QLineEdit::textEdited, this, &ShiftImageTimesDialog::timeEdited);
|
||||||
connect(ui.backwards, &QCheckBox::toggled, this, &ShiftImageTimesDialog::backwardsChanged);
|
connect(ui.backwards, &QCheckBox::toggled, this, &ShiftImageTimesDialog::backwardsChanged);
|
||||||
|
@ -249,10 +249,11 @@ void ShiftImageTimesDialog::timeEdited(const QString &timeText)
|
||||||
if (ui.timeEdit->hasAcceptableInput()) {
|
if (ui.timeEdit->hasAcceptableInput()) {
|
||||||
ui.timeEdit->setStyleSheet("");
|
ui.timeEdit->setStyleSheet("");
|
||||||
// parse based on the same reg exp used to validate...
|
// parse based on the same reg exp used to validate...
|
||||||
QRegExp re("(\\d{0,6}):(\\d\\d)");
|
QRegularExpression re("(\\d{0,6}):(\\d\\d)");
|
||||||
if (re.indexIn(timeText) != -1) {
|
QRegularExpressionMatch match = re.match(timeText);
|
||||||
time_t hours = re.cap(1).toInt();
|
if (match.hasMatch()) {
|
||||||
time_t minutes = re.cap(2).toInt();
|
time_t hours = match.captured(1).toInt();
|
||||||
|
time_t minutes = match.captured(2).toInt();
|
||||||
m_amount = (ui.backwards->isChecked() ? -1 : 1) * (3600 * hours + 60 * minutes);
|
m_amount = (ui.backwards->isChecked() ? -1 : 1) * (3600 * hours + 60 * minutes);
|
||||||
updateInvalid();
|
updateInvalid();
|
||||||
}
|
}
|
||||||
|
@ -579,7 +580,7 @@ QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, b
|
||||||
"mn.abcd." for the url (wrong). So we have to go to 'i', to
|
"mn.abcd." for the url (wrong). So we have to go to 'i', to
|
||||||
capture "mn.abcd.edu " (with trailing space), and then clean it up.
|
capture "mn.abcd.edu " (with trailing space), and then clean it up.
|
||||||
*/
|
*/
|
||||||
QStringList list = grownText.split(QRegExp("\\s"), SKIP_EMPTY);
|
QStringList list = grownText.split(QRegularExpression("\\s"), SKIP_EMPTY);
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
result = list[0];
|
result = list[0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue