Core: replace QRegExp with QRegularExpression
This commit is contained in:
@@ -25,12 +25,13 @@
|
||||
#ifndef _PreComp_
|
||||
# include <boost_signals2.hpp>
|
||||
# include <QApplication>
|
||||
# include <QRegExp>
|
||||
# include <QEvent>
|
||||
# include <QCloseEvent>
|
||||
# include <QMdiSubWindow>
|
||||
# include <QPrinter>
|
||||
# include <QPrinterInfo>
|
||||
# include <QRegularExpression>
|
||||
# include <QRegularExpressionMatch>
|
||||
#endif
|
||||
|
||||
#include <Base/Interpreter.h>
|
||||
@@ -144,16 +145,17 @@ void MDIView::onRelabel(Gui::Document *pDoc)
|
||||
// Try to separate document name and view number if there is one
|
||||
QString cap = windowTitle();
|
||||
// Either with dirty flag ...
|
||||
QRegExp rx(QLatin1String("(\\s\\:\\s\\d+\\[\\*\\])$"));
|
||||
int pos = rx.lastIndexIn(cap);
|
||||
if (pos == -1) {
|
||||
QRegularExpression rx(QLatin1String("(\\s\\:\\s\\d+\\[\\*\\])$"));
|
||||
QRegularExpressionMatch match;
|
||||
int pos = cap.lastIndexOf(rx, -1, &match);
|
||||
if (!match.hasMatch()) {
|
||||
// ... or not
|
||||
rx.setPattern(QLatin1String("(\\s\\:\\s\\d+)$"));
|
||||
pos = rx.lastIndexIn(cap);
|
||||
pos = cap.lastIndexOf(rx, -1, &match);
|
||||
}
|
||||
if (pos != -1) {
|
||||
if (match.hasMatch()) {
|
||||
cap = QString::fromUtf8(pDoc->getDocument()->Label.getValue());
|
||||
cap += rx.cap();
|
||||
cap += match.captured();
|
||||
setWindowTitle(cap);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user