diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-03-15 14:47:00 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-03-17 08:35:31 +0100 |
commit | b798b2cbb4061243762531c7eef37de165ced949 (patch) | |
tree | fc880c16956841357921ee8fd53eca8f0362a27d /src/printsupport/dialogs/qprintdialog_unix.cpp | |
parent | 3a5342163aced5ed1574e42d375eefc963c24ad0 (diff) |
Remove QRegExp usage from Qt PrintSupport
Change-Id: I32daae8e5028084dd12f0aba4da7920f995d919f
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Diffstat (limited to 'src/printsupport/dialogs/qprintdialog_unix.cpp')
-rw-r--r-- | src/printsupport/dialogs/qprintdialog_unix.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index f3b47bcbd2..a59d8bbb4a 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -67,6 +67,10 @@ #include <QtWidgets/qdialogbuttonbox.h> +#if QT_CONFIG(regularexpression) +#include <qregularexpression.h> +#endif + #if QT_CONFIG(completer) #include <private/qcompleter_p.h> #endif @@ -1434,10 +1438,13 @@ QUnixPrintWidget::QUnixPrintWidget(QPrinter *printer, QWidget *parent) if (printer->docName().isEmpty()) { cur += QStringLiteral("print.pdf"); } else { - const QRegExp re(QStringLiteral("(.*)\\.\\S+")); - if (re.exactMatch(printer->docName())) - cur += re.cap(1); +#if QT_CONFIG(regularexpression) + const QRegularExpression re(QStringLiteral("(.*)\\.\\S+")); + auto match = re.match(printer->docName()); + if (match.hasMatch()) + cur += match.captured(1); else +#endif cur += printer->docName(); cur += QStringLiteral(".pdf"); } |