Toolbox Qt
Loading...
Searching...
No Matches
tbq::RichLink Class Reference

Display a link with a custom text. More...

Public Member Functions

 RichLink ()
 Create empty rich link object.
 
 RichLink (const QUrl &link, const QString &display=QString())
 Create a RichLink object.
 
void setLink (const QUrl &link)
 Set URL lin to use.
 
void setDisplayText (const QString &display)
 Set text to display for the link.
 
bool isValid () const
 Use to verify rich link validity.
 
const QUrl & getUrl () const
 Get URL used in the link.
 
const QString & getTextDisplayed () const
 Get displayed text of the link.
 
QString toHtml () const
 Convert rich link to html string that can be used (like in QLabel for example)
 

Detailed Description

Display a link with a custom text.

Include with:

#include "toolboxqt/core/richlink.h"

Constructor & Destructor Documentation

◆ RichLink() [1/2]

tbq::RichLink::RichLink ( )
default

Create empty rich link object.

Calling isValid() on it will return false.

See also
isValid()
setLink(), setDisplayText()

◆ RichLink() [2/2]

tbq::RichLink::RichLink ( const QUrl & link,
const QString & display = QString() )
explicit

Create a RichLink object.

Parameters
[in]linkURL to used as a link
[in]displayText to display
See also
toHtml()
isValid()
setLink(), setDisplayText()

Member Function Documentation

◆ setLink()

void tbq::RichLink::setLink ( const QUrl & link)

Set URL lin to use.

Parameters
[in]linkURL to used as a link.
See also
setDisplayText()

◆ setDisplayText()

void tbq::RichLink::setDisplayText ( const QString & display)

Set text to display for the link.

Parameters
[in]displayText to display
See also
setLink()

◆ isValid()

bool tbq::RichLink::isValid ( ) const

Use to verify rich link validity.

Rich link is considered valid is URL is valid.

Returns
Returns true if rich link is valid

◆ getUrl()

const QUrl & tbq::RichLink::getUrl ( ) const

Get URL used in the link.

Returns
Returns reference to URL link

◆ getTextDisplayed()

const QString & tbq::RichLink::getTextDisplayed ( ) const

Get displayed text of the link.

Returns
Returns reference to displayed text.

◆ toHtml()

QString tbq::RichLink::toHtml ( ) const

Convert rich link to html string that can be used (like in QLabel for example)

Returns
Returns formatted HTML rich link.
If no display text has been set, the link will be displayed "as is".

The documentation for this class was generated from the following files: