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");
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user