[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 <QByteArrayList>
#include <QClipboard> #include <QClipboard>
#include <QMimeData> #include <QMimeData>
#include <QRegularExpression>
#include "levelonecommands.h" #include "levelonecommands.h"
@@ -459,7 +460,7 @@ PasteCommand::PasteCommand(TeletextDocument *teletextDocument, int pageCharSet,
const int rightColumn = m_selectionActive ? m_pasteRightColumn : 39; const int rightColumn = m_selectionActive ? m_pasteRightColumn : 39;
// Parse line-feeds in the clipboard data // 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 // "if" statement will be false if clipboard data is a single line of text
// that will fit from the cursor position // that will fit from the cursor position

View File

@@ -28,7 +28,7 @@
#include <QPainter> #include <QPainter>
#include <QPushButton> #include <QPushButton>
#include <QRadioButton> #include <QRadioButton>
#include <QRegExp> #include <QRegularExpression>
#include <QSaveFile> #include <QSaveFile>
#include <QScreen> #include <QScreen>
#include <QSettings> #include <QSettings>
@@ -1133,7 +1133,7 @@ void MainWindow::exportM29()
else { else {
exportFileName = QFileInfo(m_curFile).fileName(); exportFileName = QFileInfo(m_curFile).fileName();
// Suggest a new filename to avoid clobbering the original file // 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 // Page number forms start of file name, change it to xFF
if (exportFileName.at(0) == 'P' || exportFileName.at(0) == 'p') { if (exportFileName.at(0) == 'P' || exportFileName.at(0) == 'p') {
exportFileName[2] = 'F'; exportFileName[2] = 'F';

View File

@@ -24,7 +24,7 @@
#include <QLineEdit> #include <QLineEdit>
#include <QMap> #include <QMap>
#include <QPair> #include <QPair>
#include <QRegExpValidator> #include <QRegularExpressionValidator>
#include <QString> #include <QString>
#include "pagecomposelinksdockwidget.h" #include "pagecomposelinksdockwidget.h"
@@ -61,7 +61,7 @@ PageComposeLinksDockWidget::PageComposeLinksDockWidget(TeletextWidget *parent):
level3p5OnlyLabel->setAlignment(Qt::AlignCenter); level3p5OnlyLabel->setAlignment(Qt::AlignCenter);
x27Layout->addWidget(level3p5OnlyLabel, 6, 0, 1, 5); 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++) { for (int i=0; i<8; i++) {
if (i < 4) { if (i < 4) {

View File

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

View File

@@ -24,7 +24,7 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QRegExpValidator> #include <QRegularExpressionValidator>
#include <QSpinBox> #include <QSpinBox>
#include <QVBoxLayout> #include <QVBoxLayout>
@@ -41,7 +41,7 @@ PageOptionsDockWidget::PageOptionsDockWidget(TeletextWidget *parent): QDockWidge
this->setWindowTitle("Page options"); this->setWindowTitle("Page options");
// Page number // 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; QHBoxLayout *pageNumberLayout = new QHBoxLayout;
pageNumberLayout->addWidget(new QLabel(tr("Page number"))); pageNumberLayout->addWidget(new QLabel(tr("Page number")));

View File

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