Skip to content

UrlQuery

Qt Base Class: QUrlQuery

Signature: QUrlQuery(self) -> None QUrlQuery(self, other: PySide6.QtCore.QUrlQuery) -> None QUrlQuery(self, queryString: str) -> None QUrlQuery(self, url: Union[PySide6.QtCore.QUrl, str]) -> None

Base classes

Name Children Inherits
QUrlQuery
PySide6.QtCore
QUrlQuery(self) -> None
MutableMapping
collections.abc
A MutableMapping is a generic container for associating

⋔ Inheritance diagram

graph TD
  1473299831616["core.UrlQuery"]
  1473243721760["QtCore.QUrlQuery"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473222543776["abc.MutableMapping"]
  1473222540848["abc.Mapping"]
  1473222211728["abc.Collection"]
  1473222226368["abc.Sized"]
  1473222223440["abc.Iterable"]
  1473222220512["abc.Container"]
  1473243721760 --> 1473299831616
  1473291690208 --> 1473243721760
  140713234304496 --> 1473291690208
  1473222543776 --> 1473299831616
  1473222540848 --> 1473222543776
  1473222211728 --> 1473222540848
  1473222226368 --> 1473222211728
  140713234304496 --> 1473222226368
  1473222223440 --> 1473222211728
  140713234304496 --> 1473222223440
  1473222220512 --> 1473222211728
  140713234304496 --> 1473222220512

🛈 DocStrings

Bases: QUrlQuery, MutableMapping

Way to manipulate a key-value pairs in a URL's query.

Source code in prettyqt\core\urlquery.py
class UrlQuery(QtCore.QUrlQuery, MutableMapping, metaclass=datatypes.QABCMeta):
    """Way to manipulate a key-value pairs in a URL's query."""

    def __repr__(self):
        return get_repr(self, self.toString())

    def __str__(self):
        return self.toString()

    def __contains__(self, key: str):
        return self.hasQueryItem(key)

    def __add__(self, other: dict) -> Self:
        for k, v in other.items():
            self.addQueryItem(k, str(v))
        return self

    def __delitem__(self, item: str):
        self.removeQueryItem(item)

    def __setitem__(self, key, value):
        items = dict(self.queryItems())
        items[key] = value
        items = list(items.items())
        self.setQueryItems(items)

    def __len__(self):
        return len(self.queryItems())

    def __iter__(self):
        return iter(i[0] for i in self.queryItems())

    def __getitem__(self, key: str):
        if not self.hasQueryItem(key):
            raise KeyError(key)
        return self.queryItemValue(key)

    def serialize(self) -> dict[str, Any]:
        return dict(path=self.toString())