Remove QRegExp usage from Qt PrintSupport

Change-Id: I32daae8e5028084dd12f0aba4da7920f995d919f
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
bb10
Lars Knoll 2020-03-15 14:47:00 +01:00
parent 3a5342163a
commit b798b2cbb4
1 changed files with 10 additions and 3 deletions

View File

@ -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");
}