• OctoMY API
  • OctoMY API Reference
  • C++ Classes
  • OctoMY
  • HelpWidgetImageProvider
  • HelpWidgetImageProvider Class

    Runtime widget-screenshot provider for the help browser (in-app-docs-decoupling §RS-2 / §RS-3). More...

    Header: #include <HelpWidgetImageProvider>

    Detailed Description

    Resolves "widget:<id>?mode=<m>&size=<wxh>&dpr=<n>" URLs into QImages. Two-tier cache:

    - memory tier: QCache<QString, QImage>, capacity default 32 entries. Hot path: every page load triggers a fetch. - disk tier: QStandardPaths::CacheLocation/octomy/help-widgets/ <app-version>/<key>.png — survives app restarts; app-version segment makes upgrade auto-invalidation cheap (OS cache eviction handles old versions).

    Cache key tuple is "<id>|<mode>|<wxh>|<dpr>" — no theme component, since captures use a fixed neutral documentation style per §RS-3.

    The actual widget render is delegated through an injected RenderFn so this class can live in libhelp without depending on libcatalog (libcatalog already depends on libhelp; the inverse would be circular). HelpActivity wires the concrete renderer that calls WidgetScreenshotService::captureWidget(...) with CaptureOptions::inMemory = true.

    Failure modes (no render function set, render function returned null, malformed URL) produce a styled placeholder image rather than a null QImage so QTextBrowser layout doesn't collapse around the missing reference. Each failure category is logged once per id per session.