diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-06-19 11:42:38 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-06-20 19:52:13 +0000 |
commit | 9fe2ea2e0d8e696d7ba7d2dd03325007c2e415cc (patch) | |
tree | 5a81bbcdbfff0a1f09c4ac44c8aaa5246b659871 /examples/serialbus/modbus | |
parent | 06149b7bdf7573b97e76af6d83d5c0f5c777e305 (diff) |
Migrate the modbus example to use QRegularExpression
This patch updates the modbus example MainWindow class to use
QRegularExpression in place of QRegExp which is to be
considered deprecated.
Change-Id: Ie030b695a1885c5e1ffc2511da2381c5df6b958a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples/serialbus/modbus')
-rw-r--r-- | examples/serialbus/modbus/slave/mainwindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/serialbus/modbus/slave/mainwindow.cpp b/examples/serialbus/modbus/slave/mainwindow.cpp index 23d3c49..1b7ad72 100644 --- a/examples/serialbus/modbus/slave/mainwindow.cpp +++ b/examples/serialbus/modbus/slave/mainwindow.cpp @@ -55,6 +55,7 @@ #include <QModbusRtuSerialSlave> #include <QModbusTcpServer> #include <QRegularExpression> +#include <QRegularExpressionValidator> #include <QStatusBar> #include <QUrl> @@ -326,8 +327,8 @@ void MainWindow::setupWidgetContainers() for (QLineEdit *lineEdit : qle) { registers.insert(lineEdit->objectName(), lineEdit); lineEdit->setProperty("ID", regexp.match(lineEdit->objectName()).captured("ID").toInt()); - lineEdit->setValidator(new QRegExpValidator(QRegExp(QStringLiteral("[0-9a-f]{0,4}"), - Qt::CaseInsensitive), this)); + lineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(QStringLiteral("[0-9a-f]{0,4}"), + QRegularExpression::CaseInsensitiveOption), this)); connect(lineEdit, &QLineEdit::textChanged, this, &MainWindow::setRegister); } } |