QUrl url("http://example.com?key=value&foo=bar"); bool hasKey = url.hasQueryItem("key"); // true bool hasBaz = url.hasQueryItem("baz"); // false
QUrl url("http://example.com?key=value&foO=bAr"); bool hasFoo = url.hasQueryItem("foo"); // false bool hasFooCaseSensitive = url.hasQueryItem("foo", Qt::CaseSensitive); // false bool hasFooCaseInsensitive = url.hasQueryItem("foo", Qt::CaseInsensitive); // true bool hasFoO = url.hasQueryItem("foO"); // trueIn this example, we create a QUrl object representing a URL with two query items: "key=value" and "foO=bAr". We then use the hasQueryItem function to check whether "foo" exists in the query string, both case-sensitive and case-insensitive. We also check whether "foO" exists in the query string, which should return true since the query item is present. Package library: Qt Core.