Querying Qt Graphs

XPath-like query system, designed for axising Qt but usable elsewhere.

Differences from XPath:

  • Leading slash is ignored, since we are always passing in root objects.

Axis specifiers:

  • attribute

    @abc -> self.abc

  • child

    xyz -> child::xyz

  • self

    . -> self

  • parent

    .. -> self.parent()

uitools.qpath.qpath(root, query, globals=None)[source]

Return a list of results by applying a query string to a context.

Parameters:
  • root (object) – The object to start the search at.
  • query (str) – The QPath query to process in the context of the given root.
Return list:

The results.

uitools.qpath.qpath_iter(node_iter, query, globals=None)[source]

Project Versions

Previous topic

Trampoline to Main Thread

This Page