Skip to content

Commit

Permalink
Link Qt base class objects to Qt c++ doc pages
Browse files Browse the repository at this point in the history
We use the c++ qt docs, because the PyQt docs don't have any real
useful detail.

Fixes #175
  • Loading branch information
nyalldawson committed Sep 11, 2024
1 parent 2e16026 commit 5e4698b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
version_list = ("master", current_stable, current_ltr)

graphviz_output_format = "svg"
qt_docs_url_base = cfg["qt_docs_url_base"]

url = cfg["pyqgis_url"]
if not url.endswith("/"):
Expand Down
4 changes: 4 additions & 0 deletions inheritance_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ def generate_dot(
if any(n.endswith(f".{name}") for n in self.class_names):
this_node_attrs["fillcolor"] = '"#e7f2fa"'

if fullname.startswith("PyQt"):
this_node_attrs["URL"] = f'"{env.config.qt_docs_url_base}{name.lower()}.html"'
this_node_attrs["target"] = '"_top"'
if fullname in urls:
this_node_attrs["URL"] = '"%s"' % urls[fullname]
this_node_attrs["target"] = '"_top"'
Expand Down Expand Up @@ -550,5 +553,6 @@ def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value("inheritance_graph_attrs", {}, "")
app.add_config_value("inheritance_node_attrs", {}, "")
app.add_config_value("inheritance_edge_attrs", {}, "")
app.add_config_value("qt_docs_url_base", "", "")
app.add_config_value("inheritance_alias", {}, "")
return {"version": sphinx.__display_version__, "parallel_read_safe": True}
1 change: 1 addition & 0 deletions pyqgis_conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pyqgis_url: https://qgis.org/pyqgis
current_stable: '3.38'
current_ltr: '3.34'

qt_docs_url_base: https://doc.qt.io/qt-5/

skipped:
- PyProviderMetadata
Expand Down
8 changes: 7 additions & 1 deletion scripts/make_api_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,15 @@ def export_bases(_b):
for _base in _b.__bases__:
if _base.__name__ in ("wrapper", "simplewrapper", "object"):
continue

if re.match(r"^Q(?!gs)", _base.__name__):
doc_link = f'{cfg["qt_docs_url_base"]}{_base.__name__.lower()}.html'
else:
doc_link = f"{_base.__name__}.html"

res += make_table_row(
[
f"`{_base.__name__} <{_base.__name__}.html>`_",
f"`{_base.__name__} <{doc_link}>`_",
extract_summary(_base.__doc__),
]
)
Expand Down

0 comments on commit 5e4698b

Please sign in to comment.