Web Analytics Made Easy - Statcounter
Skip to content

Class SBGUIToolTip#

ClassList > SBGUIToolTip

The SBGUIToolTip class provides a custom tooltip widget with rich-text and clickable link support.

  • #include "SBGUIToolTip.hpp"

Inherits the following classes: QWidget

Public Types#

Type Name
typedef std::function< void(const QString &href)> LinkHandler
Type for a global link handler (receives the full href, e.g. "action://UUID" or "https://...").
typedef std::function< void(const QString &href)> LinkHoverHandler

Public Functions#

Type Name
SBGUIToolTip (QWidget * parent=nullptr)
QLabel * getLabel () const
Access internal label (useful if you also show manual tooltips).
void setHtml (QString htmlOrPlain)
void showAt (const QPoint & globalAnchor)

Public Static Functions#

Type Name
void activateLink (const QString & href)
void hoverLink (const QString & href)
void installFor (QWidget * target)
void installFor (QApplication * app)
void setGlobalLinkHandler (LinkHandler handler)
Sets a global link handler used by tooltips installed via installFor(&app).
void setGlobalLinkHoverHandler (LinkHoverHandler handler)
void setUseOverrideCursorOnLinks (bool enable)
Enables/disables using an override cursor (PointingHand) when hovering links.

Protected Functions#

Type Name
void enterEvent (QEnterEvent * e) override
bool eventFilter (QObject * obj, QEvent * event) override
void leaveEvent (QEvent * e) override
void paintEvent (QPaintEvent * e) override

Public Types Documentation#

typedef LinkHandler#

Type for a global link handler (receives the full href, e.g. "action://UUID" or "https://...").

using SBGUIToolTip::LinkHandler =  std::function<void(const QString& href)>;


typedef LinkHoverHandler#

using SBGUIToolTip::LinkHoverHandler =  std::function<void(const QString& href)>;

Public Functions Documentation#

function SBGUIToolTip#

explicit SBGUIToolTip::SBGUIToolTip (
    QWidget * parent=nullptr
) 

function getLabel#

Access internal label (useful if you also show manual tooltips).

QLabel * SBGUIToolTip::getLabel () const


function setHtml#

void SBGUIToolTip::setHtml (
    QString htmlOrPlain
) 

function showAt#

void SBGUIToolTip::showAt (
    const QPoint & globalAnchor
) 

Public Static Functions Documentation#

static void SBGUIToolTip::activateLink (
    const QString & href
) 

static void SBGUIToolTip::hoverLink (
    const QString & href
) 

function installFor [1/2]#

static void SBGUIToolTip::installFor (
    QWidget * target
) 

function installFor [2/2]#

static void SBGUIToolTip::installFor (
    QApplication * app
) 

function setGlobalLinkHandler#

Sets a global link handler used by tooltips installed via installFor(&app).

static void SBGUIToolTip::setGlobalLinkHandler (
    LinkHandler handler
) 

If set, every link click in any tooltip calls this callback. You can route "action://..." here. If unset, http(s) links will open with QDesktopServices.


function setGlobalLinkHoverHandler#

static void SBGUIToolTip::setGlobalLinkHoverHandler (
    LinkHoverHandler handler
) 

Enables/disables using an override cursor (PointingHand) when hovering links.

static void SBGUIToolTip::setUseOverrideCursorOnLinks (
    bool enable
) 

Recommended 'true' on Windows so links in QMenu/QMenuBar/QToolBar show the correct cursor.


Protected Functions Documentation#

function enterEvent#

void SBGUIToolTip::enterEvent (
    QEnterEvent * e
) override

function eventFilter#

bool SBGUIToolTip::eventFilter (
    QObject * obj,
    QEvent * event
) override

function leaveEvent#

void SBGUIToolTip::leaveEvent (
    QEvent * e
) override

function paintEvent#

void SBGUIToolTip::paintEvent (
    QPaintEvent * e
) override