summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-30 12:39:22 +0100
committerLiang Qi <liang.qi@qt.io>2017-01-30 12:46:20 +0100
commit246799d8a7bf42c1f22fca7ef6d77e8d58054bad (patch)
treea0b92a804d7d2a30cd68fa327df5777d8bcc36ba /examples/widgets
parent5ad191850becd7dc1d61d0975f141a5db64e6373 (diff)
parent02cc57f4edbae450ecfa8368052afa44f8aeee19 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: examples/network/network-chat/peermanager.cpp src/widgets/util/qsystemtrayicon.cpp src/widgets/util/qsystemtrayicon_qpa.cpp src/widgets/util/qsystemtrayicon_win.cpp src/widgets/util/qsystemtrayicon_x11.cpp Change-Id: I1c026df83818c0ccaf956980370e7522960627db
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.cpp3
-rw-r--r--examples/widgets/dialogs/licensewizard/licensewizard.cpp6
-rw-r--r--examples/widgets/doc/src/icons.qdoc4
-rw-r--r--examples/widgets/tutorials/addressbook/part7/addressbook.cpp2
4 files changed, 9 insertions, 6 deletions
diff --git a/examples/widgets/dialogs/classwizard/classwizard.cpp b/examples/widgets/dialogs/classwizard/classwizard.cpp
index d6c7c7a546..3eab2f5fb2 100644
--- a/examples/widgets/dialogs/classwizard/classwizard.cpp
+++ b/examples/widgets/dialogs/classwizard/classwizard.cpp
@@ -363,9 +363,10 @@ void CodeStylePage::initializePage()
baseIncludeLabel->setEnabled(!baseClass.isEmpty());
baseIncludeLineEdit->setEnabled(!baseClass.isEmpty());
+ QRegularExpression rx("Q[A-Z].*");
if (baseClass.isEmpty()) {
baseIncludeLineEdit->clear();
- } else if (QRegExp("Q[A-Z].*").exactMatch(baseClass)) {
+ } else if (rx.match(baseClass).hasMatch()) {
baseIncludeLineEdit->setText('<' + baseClass + '>');
} else {
baseIncludeLineEdit->setText('"' + baseClass.toLower() + ".h\"");
diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.cpp b/examples/widgets/dialogs/licensewizard/licensewizard.cpp
index e145a18e2c..6dbb894ad8 100644
--- a/examples/widgets/dialogs/licensewizard/licensewizard.cpp
+++ b/examples/widgets/dialogs/licensewizard/licensewizard.cpp
@@ -54,6 +54,8 @@
#include "licensewizard.h"
+QString emailRegExp = QStringLiteral(".+@.+");
+
//! [0] //! [1] //! [2]
LicenseWizard::LicenseWizard(QWidget *parent)
: QWizard(parent)
@@ -189,7 +191,7 @@ EvaluatePage::EvaluatePage(QWidget *parent)
emailLabel = new QLabel(tr("&Email address:"));
emailLineEdit = new QLineEdit;
- emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this));
+ emailLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(emailRegExp), this));
emailLabel->setBuddy(emailLineEdit);
//! [21]
@@ -264,7 +266,7 @@ DetailsPage::DetailsPage(QWidget *parent)
emailLabel = new QLabel(tr("&Email address:"));
emailLineEdit = new QLineEdit;
- emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this));
+ emailLineEdit->setValidator(new QRegularExpressionValidator(QRegularExpression(emailRegExp), this));
emailLabel->setBuddy(emailLineEdit);
postalLabel = new QLabel(tr("&Postal address:"));
diff --git a/examples/widgets/doc/src/icons.qdoc b/examples/widgets/doc/src/icons.qdoc
index d3bf508f2c..42d823975b 100644
--- a/examples/widgets/doc/src/icons.qdoc
+++ b/examples/widgets/doc/src/icons.qdoc
@@ -741,8 +741,8 @@
whitespace and one or several digits again.
The first digits of the regular expression are captured using
- parentheses. This enables us to use the QRegExp::cap() or
- QRegExp::capturedTexts() functions to extract the matched
+ parentheses. This enables us to use the QRegularExpressionMatch::captured()
+ or QRegularExpressionMatch::capturedTexts() functions to extract the matched
characters. If the first and second numbers of the spin box value
differ (e.g., "16 x 24"), we use the first number.
diff --git a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
index 8fabcf8758..e946c873e3 100644
--- a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
+++ b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp
@@ -402,7 +402,7 @@ void AddressBook::exportAsVCard()
int index = name.indexOf(" ");
if (index != -1) {
- nameList = name.split(QRegExp("\\s+"), QString::SkipEmptyParts);
+ nameList = name.split(QRegularExpression("\\s+"), QString::SkipEmptyParts);
firstName = nameList.first();
lastName = nameList.last();
} else {