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>
This commit is contained in:
parent
6864374f05
commit
7dff4b921b
@ -239,9 +239,9 @@ private:
|
|||||||
int i = data.indexOf("a href=\"?view=detail");
|
int i = data.indexOf("a href=\"?view=detail");
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
QString href = data.mid(i, data.indexOf('\"', i + 8) - i + 1);
|
QString href = data.mid(i, data.indexOf('\"', i + 8) - i + 1);
|
||||||
QRegExp regex("dpap=([A-Za-z0-9]+)");
|
QRegularExpression regex("dpap=([A-Za-z0-9]+)");
|
||||||
regex.indexIn(href);
|
QRegularExpressionMatch match = regex.match(href);
|
||||||
QString airport = regex.cap(1);
|
QString airport = match.captured(1);
|
||||||
QUrlQuery query(m_url);
|
QUrlQuery query(m_url);
|
||||||
query.addQueryItem("dpap", airport);
|
query.addQueryItem("dpap", airport);
|
||||||
m_url.setQuery(query);
|
m_url.setQuery(query);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user