diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-03-18 16:49:13 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-03-19 17:26:06 +0100 |
commit | e13c5b753a1c579b28e8b0af950a3972d4475a92 (patch) | |
tree | 6b0566ad29bcd8ad0310b2bfbdce8b152edf3b44 | |
parent | a73d89590cbab1a3e6b56d7e9e44a1898c95ed19 (diff) |
Remove the remaining usages of QRegExp and QRegExpValidator
Change-Id: Iab8e682eeb43b3403eba37f7decb7f7a494ae361
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml | 6 | ||||
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 20 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 12 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_spinbox.qml | 6 | ||||
-rw-r--r-- | tests/manual/testbench/ColorEditor.qml | 6 |
5 files changed, 25 insertions, 25 deletions
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml index daa54967..dd58b5ab 100644 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml @@ -25,7 +25,7 @@ ** ****************************************************************************/ -import QtQuick 2.12 +import QtQuick 2.14 import QtQuick.Controls 2.12 //! [1] @@ -36,8 +36,8 @@ SpinBox { property var items: ["Small", "Medium", "Large"] - validator: RegExpValidator { - regExp: new RegExp("(Small|Medium|Large)", "i") + validator: RegularExpressionValidator { + regularExpression: new RegExp("(Small|Medium|Large)", "i") } textFromValue: function(value) { diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index afce8163..b8482a26 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -617,7 +617,7 @@ int QQuickComboBoxPrivate::match(int start, const QString &text, Qt::MatchFlags if (t == text) return idx; break; - case Qt::MatchRegExp: { + case Qt::MatchRegularExpression: { QRegularExpression rx(QRegularExpression::anchoredPattern(text), options); if (rx.match(t).hasMatch()) return idx; @@ -1380,7 +1380,7 @@ void QQuickComboBox::resetEditText() \uicontrol Return or \uicontrol Enter key is pressed. The currently supported validators are \l[QtQuick]{IntValidator}, - \l[QtQuick]{DoubleValidator}, and \l[QtQuick]{RegExpValidator}. An + \l[QtQuick]{DoubleValidator}, and \l[QtQuick]{RegularExpressionValidator}. An example of using validators is shown below, which allows input of integers between \c 0 and \c 10 into the text field: @@ -1621,14 +1621,14 @@ QString QQuickComboBox::textAt(int index) const combo box performs case sensitive exact matching (\c Qt.MatchExactly). All other match types are case-insensitive unless the \c Qt.MatchCaseSensitive flag is also specified. - \value Qt.MatchExactly The search term matches exactly (default). - \value Qt.MatchRegExp The search term matches as a regular expression. - \value Qt.MatchWildcard The search term matches using wildcards. - \value Qt.MatchFixedString The search term matches as a fixed string. - \value Qt.MatchStartsWith The search term matches the start of the item. - \value Qt.MatchEndsWidth The search term matches the end of the item. - \value Qt.MatchContains The search term is contained in the item. - \value Qt.MatchCaseSensitive The search is case sensitive. + \value Qt.MatchExactly The search term matches exactly (default). + \value Qt.MatchRegularExpression The search term matches as a regular expression. + \value Qt.MatchWildcard The search term matches using wildcards. + \value Qt.MatchFixedString The search term matches as a fixed string. + \value Qt.MatchStartsWith The search term matches the start of the item. + \value Qt.MatchEndsWidth The search term matches the end of the item. + \value Qt.MatchContains The search term is contained in the item. + \value Qt.MatchCaseSensitive The search is case sensitive. \sa textRole */ diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 2d5069b3..abdb0a29 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -48,7 +48,7 @@ ** ****************************************************************************/ -import QtQuick 2.12 +import QtQuick 2.14 import QtQuick.Window 2.2 import QtTest 1.0 import QtQuick.Controls 2.12 @@ -354,9 +354,9 @@ TestCase { { tag: "bananas (MatchExactly)", term: "bananas", flags: Qt.MatchExactly, index: -1 }, { tag: "Cocomuffin (MatchExactly)", term: "Cocomuffin", flags: Qt.MatchExactly, index: 4 }, - { tag: "b(an)+a (MatchRegExp)", term: "B(an)+a", flags: Qt.MatchRegExp, index: 0 }, - { tag: "b(an)+a (MatchRegExp|MatchCaseSensitive)", term: "b(an)+a", flags: Qt.MatchRegExp | Qt.MatchCaseSensitive, index: 1 }, - { tag: "[coc]+\\w+ (MatchRegExp)", term: "[coc]+\\w+", flags: Qt.MatchRegExp, index: 2 }, + { tag: "b(an)+a (MatchRegularExpression)", term: "B(an)+a", flags: Qt.MatchRegularExpression, index: 0 }, + { tag: "b(an)+a (MatchRegularExpression|MatchCaseSensitive)", term: "b(an)+a", flags: Qt.MatchRegularExpression | Qt.MatchCaseSensitive, index: 1 }, + { tag: "[coc]+\\w+ (MatchRegularExpression)", term: "[coc]+\\w+", flags: Qt.MatchRegularExpression, index: 2 }, { tag: "?pp* (MatchWildcard)", term: "?pp*", flags: Qt.MatchWildcard, index: 3 }, { tag: "app* (MatchWildcard|MatchCaseSensitive)", term: "app*", flags: Qt.MatchWildcard | Qt.MatchCaseSensitive, index: -1 }, @@ -1408,9 +1408,9 @@ TestCase { } } - RegExpValidator { + RegularExpressionValidator { id: regExpValidator - regExp: /(red|blue|green)?/ + regularExpression: /(red|blue|green)?/ } function test_validator() { diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml index 22dbb352..a5c40cd3 100644 --- a/tests/auto/controls/data/tst_spinbox.qml +++ b/tests/auto/controls/data/tst_spinbox.qml @@ -48,7 +48,7 @@ ** ****************************************************************************/ -import QtQuick 2.12 +import QtQuick 2.14 import QtTest 1.0 import QtQuick.Controls 2.12 import QtQuick.Window 2.12 @@ -623,8 +623,8 @@ TestCase { property var items: ["Small", "Medium", "Large"] - validator: RegExpValidator { - regExp: new RegExp("(Small|Medium|Large)", "i") + validator: RegularExpressionValidator { + regularExpression: new RegExp("(Small|Medium|Large)", "i") } textFromValue: function(value) { diff --git a/tests/manual/testbench/ColorEditor.qml b/tests/manual/testbench/ColorEditor.qml index 1e10d6d2..7f472f9b 100644 --- a/tests/manual/testbench/ColorEditor.qml +++ b/tests/manual/testbench/ColorEditor.qml @@ -48,7 +48,7 @@ ** ****************************************************************************/ -import QtQuick 2.12 +import QtQuick 2.14 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 @@ -71,8 +71,8 @@ RowLayout { TextField { id: textField - validator: RegExpValidator{ - regExp: /#?[0-9a-fA-F]*/ + validator: RegularExpressionValidator{ + regularExpression: /#?[0-9a-fA-F]*/ } Layout.preferredWidth: 200 |