diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2017-01-21 00:41:45 +0100 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2017-02-15 14:45:58 +0000 |
commit | 7dff4b921b0111c9ebe392ab1c168aaeff3d2605 (patch) | |
tree | 9391bcd773cfe32e244fae3c6eddc600c64760d5 /examples | |
parent | 6864374f05c7493be2c18079e3777483d480ac6e (diff) | |
download | qtbase-7dff4b921b0111c9ebe392ab1c168aaeff3d2605.tar.gz |
Example: migrate flightinfo to QRegularExpression
Update the flightinfo example to use the new QRegularExpression class
in place of the deprecated QRegExp.
Change-Id: I2395b37170565e922500e675210c400e90ae0f73
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/embedded/flightinfo/flightinfo.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/embedded/flightinfo/flightinfo.cpp b/examples/embedded/flightinfo/flightinfo.cpp index 8ad1e5c0c0..e91277db58 100644 --- a/examples/embedded/flightinfo/flightinfo.cpp +++ b/examples/embedded/flightinfo/flightinfo.cpp @@ -239,9 +239,9 @@ private: int i = data.indexOf("a href=\"?view=detail"); if (i > 0) { QString href = data.mid(i, data.indexOf('\"', i + 8) - i + 1); - QRegExp regex("dpap=([A-Za-z0-9]+)"); - regex.indexIn(href); - QString airport = regex.cap(1); + QRegularExpression regex("dpap=([A-Za-z0-9]+)"); + QRegularExpressionMatch match = regex.match(href); + QString airport = match.captured(1); QUrlQuery query(m_url); query.addQueryItem("dpap", airport); m_url.setQuery(query); |