Port from QRegExpValidator to QRegularExpressionValidator

QRegExpValidator is going away in Qt6, so port over to the
version using QRegularExpression.

Change-Id: Iecd1ba1f0e5e01009ae43b79c1ccc73f0fc046b2
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Lars Knoll
2020-03-18 13:32:28 +01:00
parent 2e4915bdb9
commit 99a81e78d5
14 changed files with 40 additions and 40 deletions

View File

@@ -28,7 +28,7 @@
#include <QComboBox>
#include <QLineEdit>
#include <QRegExp>
#include <QRegExpValidator>
#include <QRegularExpressionValidator>
using namespace ScxmlEditor::PluginInterface;
@@ -51,9 +51,10 @@ QWidget *SCAttributeItemDelegate::createEditor(QWidget *parent, const QStyleOpti
if (index.column() == 0) {
auto edit = new QLineEdit(parent);
edit->setFocusPolicy(Qt::StrongFocus);
QRegExp rx("^(?!xml)[_a-z][a-z0-9-._]*$");
rx.setCaseSensitivity(Qt::CaseInsensitive);
edit->setValidator(new QRegExpValidator(rx, parent));
QRegularExpression rx("^(?!xml)[_a-z][a-z0-9-._]*$");
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
edit->setValidator(new QRegularExpressionValidator(rx, parent));
return edit;
}
}