Skip to content

Commit fa3036d

Browse files
committed
[feature/qt6] Migrate QRegExp to QRegularExpression
1 parent 6d681ab commit fa3036d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

plugins/gui/src/main_window/main_window.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include <QInputDialog>
4747
#include <QMessageBox>
4848
#include <QPushButton>
49-
#include <QRegExp>
49+
#include <QRegularExpression>
5050
#include <QShortcut>
5151
#include <QStringList>
5252
#include <QtConcurrent>
@@ -215,10 +215,11 @@ namespace hal
215215
if (it.second.empty()) continue; // no extensions registered
216216

217217
QString label = QString::fromStdString(it.first);
218-
QRegExp re("Default (.*) Writer", Qt::CaseInsensitive);
219-
QString txt = (re.indexIn(label) < 0)
220-
? label.remove(QChar(':'))
221-
: QString("Export as ") + re.cap(1);
218+
QRegularExpression re("Default (.*) Writer", QRegularExpression::CaseInsensitiveOption);
219+
QRegularExpressionMatch match = re.match(label);
220+
QString txt = (match.hasMatch())
221+
? QString("Export as ") + match.captured(1)
222+
: label.remove(QChar(':'));
222223

223224
QStringList extensions;
224225
extensions.append(txt);

0 commit comments

Comments
 (0)