Skip to content

MkPropertyTable

Base classes

Name Children Inherits
MkTable
mknodes.basenodes.mktable
Class representing a formatted table.

⋔ Inheritance diagram

graph TD
  1473367167264["prettyqtmarkdown.MkPropertyTable"]
  1473287562688["mktable.MkTable"]
  1473287594896["mkbasetable.MkBaseTable"]
  1473287555856["mkcontainer.MkContainer"]
  1473287579280["mknode.MkNode"]
  1473287420192["node.Node"]
  140713234304496["builtins.object"]
  1473287562688 --> 1473367167264
  1473287594896 --> 1473287562688
  1473287555856 --> 1473287594896
  1473287579280 --> 1473287555856
  1473287420192 --> 1473287579280
  140713234304496 --> 1473287420192

🛈 DocStrings

Bases: MkTable

A table containing info about Qt properties.

Source code in prettyqt\prettyqtmarkdown\mkpropertytable.py
class MkPropertyTable(mknodes.MkTable):
    """A table containing info about Qt properties."""

    def __init__(
        self,
        qobject: type[core.QObject],
        user_prop_name: str | None = None,
        header: str = "",
    ):
        lines = []
        headers = ["Qt Property", "Type", "Doc"]
        properties = core.MetaObject(qobject.staticMetaObject).get_properties()
        doc_dict = core.Property.get_doc_dict(qobject)
        for prop in properties:
            property_name = f"`{prop.get_name()}`"
            if prop.get_name() == user_prop_name:
                property_name += " *(User property)*"
            # if (flag := prop.get_enumerator()):
            meta_type = prop.get_meta_type()
            label = (meta_type.get_name() or "").rstrip("*")
            doc = doc_dict.get(prop.get_name(), "")
            # mark = "x" if prop.get_name() == user_prop_name else ""
            sections = [property_name, f"**{label}**", doc]
            lines.append(sections)
        super().__init__(columns=headers, data=list(zip(*lines)), header=header)