[Qt6] Switch QRegExp usage to QRegularExpression

This commit is contained in:
G.K.MacGregor
2023-08-20 19:39:13 +01:00
parent 6d79329442
commit 22703e4bfb
6 changed files with 12 additions and 11 deletions

View File

@@ -22,6 +22,7 @@
#include <QByteArrayList>
#include <QClipboard>
#include <QMimeData>
#include <QRegularExpression>
#include "levelonecommands.h"
@@ -459,7 +460,7 @@ PasteCommand::PasteCommand(TeletextDocument *teletextDocument, int pageCharSet,
const int rightColumn = m_selectionActive ? m_pasteRightColumn : 39;
// Parse line-feeds in the clipboard data
QStringList plainTextData = mimeData->text().split(QRegExp("\n|\r\n|\r"));
QStringList plainTextData = mimeData->text().split(QRegularExpression("\n|\r\n|\r"));
// "if" statement will be false if clipboard data is a single line of text
// that will fit from the cursor position

View File

@@ -28,7 +28,7 @@
#include <QPainter>
#include <QPushButton>
#include <QRadioButton>
#include <QRegExp>
#include <QRegularExpression>
#include <QSaveFile>
#include <QScreen>
#include <QSettings>
@@ -1133,7 +1133,7 @@ void MainWindow::exportM29()
else {
exportFileName = QFileInfo(m_curFile).fileName();
// Suggest a new filename to avoid clobbering the original file
if (QRegExp(("^[Pp]?[1-8][0-9A-Fa-f][0-9A-Fa-f]")).indexIn(exportFileName) != -1) {
if (QRegularExpression(("^[Pp]?[1-8][0-9A-Fa-f][0-9A-Fa-f]")).match(exportFileName).hasMatch()) {
// Page number forms start of file name, change it to xFF
if (exportFileName.at(0) == 'P' || exportFileName.at(0) == 'p') {
exportFileName[2] = 'F';

View File

@@ -24,7 +24,7 @@
#include <QLineEdit>
#include <QMap>
#include <QPair>
#include <QRegExpValidator>
#include <QRegularExpressionValidator>
#include <QString>
#include "pagecomposelinksdockwidget.h"
@@ -61,7 +61,7 @@ PageComposeLinksDockWidget::PageComposeLinksDockWidget(TeletextWidget *parent):
level3p5OnlyLabel->setAlignment(Qt::AlignCenter);
x27Layout->addWidget(level3p5OnlyLabel, 6, 0, 1, 5);
m_pageNumberValidator = new QRegExpValidator(QRegExp("[1-8][0-9A-Fa-f][0-9A-Fa-f]"), this);
m_pageNumberValidator = new QRegularExpressionValidator(QRegularExpression("[1-8][0-9A-Fa-f][0-9A-Fa-f]"), this);
for (int i=0; i<8; i++) {
if (i < 4) {

View File

@@ -24,7 +24,7 @@
#include <QComboBox>
#include <QDockWidget>
#include <QLineEdit>
#include <QRegExpValidator>
#include <QRegularExpressionValidator>
#include <QString>
#include "mainwidget.h"
@@ -46,7 +46,7 @@ private:
QComboBox *m_composeLinkFunctionComboBox[4]; // For links 4-7; remember to subtract 4!
QLineEdit *m_composeLinkPageNumberLineEdit[8], *m_composeLinkSubPageNumbersLineEdit[8];
QRegExpValidator *m_pageNumberValidator;
QRegularExpressionValidator *m_pageNumberValidator;
};
#endif

View File

@@ -24,7 +24,7 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QRegExpValidator>
#include <QRegularExpressionValidator>
#include <QSpinBox>
#include <QVBoxLayout>
@@ -41,7 +41,7 @@ PageOptionsDockWidget::PageOptionsDockWidget(TeletextWidget *parent): QDockWidge
this->setWindowTitle("Page options");
// Page number
m_pageNumberValidator = new QRegExpValidator(QRegExp("[1-8][0-9A-Fa-f][0-9A-Fa-f]"), this);
m_pageNumberValidator = new QRegularExpressionValidator(QRegularExpression("[1-8][0-9A-Fa-f][0-9A-Fa-f]"), this);
QHBoxLayout *pageNumberLayout = new QHBoxLayout;
pageNumberLayout->addWidget(new QLabel(tr("Page number")));

View File

@@ -24,7 +24,7 @@
#include <QComboBox>
#include <QDockWidget>
#include <QLineEdit>
#include <QRegExpValidator>
#include <QRegularExpressionValidator>
#include <QSpinBox>
#include "mainwidget.h"
@@ -46,7 +46,7 @@ private:
QComboBox *m_defaultRegionCombo, *m_defaultNOSCombo, *m_secondRegionCombo, *m_secondNOSCombo;
QLineEdit *m_fastTextEdit[6];
QRegExpValidator *m_pageNumberValidator;
QRegularExpressionValidator *m_pageNumberValidator;
void addRegionList(QComboBox *);
void setFastTextLinkPageNumber(int, const QString &);