Class SBGUIHtmlFilter#
SBGUIHtmlFilter Lightweight, application-wide HTML link router for QLabel, QTextBrowser, and QTextEdit.More...
#include "SBGUIHtmlFilter.hpp"
Classes#
| Type | Name |
|---|---|
| class | EventFilter |
Public Types#
| Type | Name |
|---|---|
| typedef std::function< void(const QString &href)> | LinkHandler |
| typedef std::function< void(const QString &href)> | LinkHoverHandler |
Public Static Functions#
| Type | Name |
|---|---|
| void | activateLink (const QString & href) Query whether override cursor mode is enabled. |
| void | enableAutoWire (bool on=true) Auto-wire ALL QLabel, QTextBrowser, and QTextEdit widgets in the app. |
| void | hoverLink (const QString & href) |
| void | install (QApplication * app=nullptr) Install once; safe to call multiple times. |
| QString | makeActionLink (const SBUUID & uuid, const QString & displayName) Convenience helpers to build links. |
| QString | makePrompLink (const SBUUID & uuid, const QString & displayName="Ask SAMSON AI") |
| QString | makePrompLink (const QString & prompt, const QString & displayName="Ask SAMSON AI") |
| QString | makeUrlLink (const QUrl & url, const QString & displayName, const QString & utm_content, const QString & utm_source=QStringLiteral("SAMSON")) |
| void | setHoverHandler (LinkHoverHandler handler) |
| void | setLinkHandler (LinkHandler handler) Set global handlers. |
| void | wireLabel (QLabel * label) Wire a single QLabel explicitly. |
| void | wireTextBrowser (QTextBrowser * browser) Wire a single QTextBrowser explicitly. |
| void | wireTextEdit (QTextEdit * edit) Wire a single QTextEdit explicitly (adds a viewport event filter). |
Detailed Description#
Features
* Routes <a href="...">...</a> to global click/hover handlers
* Auto-wires all QLabel/QTextBrowser/QTextEdit (optional), or wire individually
* Optional global pointing-hand cursor on link hover
Notes * Per-widget opt-out: setProperty("sb_skip_autolink", true) * For QTextEdit, installs a viewport event filter and uses anchorAt() for hover/click.
Public Types Documentation#
typedef LinkHandler#
typedef LinkHoverHandler#
Public Static Functions Documentation#
function activateLink#
Query whether override cursor mode is enabled.
Convenience helpers to invoke handlers manually.
function enableAutoWire#
Auto-wire ALL QLabel, QTextBrowser, and QTextEdit widgets in the app.
function hoverLink#
function install#
Install once; safe to call multiple times.
function makeActionLink#
Convenience helpers to build links.
function makePrompLink [1/2]#
static QString SBGUIHtmlFilter::makePrompLink (
const SBUUID & uuid,
const QString & displayName="Ask SAMSON AI"
)
function makePrompLink [2/2]#
static QString SBGUIHtmlFilter::makePrompLink (
const QString & prompt,
const QString & displayName="Ask SAMSON AI"
)
function makeUrlLink#
static QString SBGUIHtmlFilter::makeUrlLink (
const QUrl & url,
const QString & displayName,
const QString & utm_content,
const QString & utm_source=QStringLiteral("SAMSON")
)
function setHoverHandler#
function setLinkHandler#
Set global handlers.
function wireLabel#
Wire a single QLabel explicitly.
function wireTextBrowser#
Wire a single QTextBrowser explicitly.
function wireTextEdit#
Wire a single QTextEdit explicitly (adds a viewport event filter).