Skip to content

Class UrlUtils

ClassList > UrlUtils

Inherits the following classes: QObject

Public Functions

Type Name
UrlUtils (QObject * parent=nullptr)

Public Static Functions

Type Name
Q_INVOKABLE QString createActionUrl (const QString & scheme, const QString & type, const QVariantMap & details)
Q_INVOKABLE QUrl fromString (const QString & url)
Returns a URL from a url with logic to handle local paths.
Q_INVOKABLE QVariantMap getActionDetails (const QString & url)
Q_INVOKABLE bool isRelativeOrFileUrl (const QString & url)
Q_INVOKABLE QString toLocalFile (const QString & url)
Returns a URL from a url with logic to presence or absence offile:// .
Q_INVOKABLE QString urlDetail (const QString & url, const QString & detail)

Public Functions Documentation

function UrlUtils

explicit UrlUtils::UrlUtils (
    QObject * parent=nullptr
) 

Public Static Functions Documentation

function createActionUrl

static Q_INVOKABLE QString UrlUtils::createActionUrl (
    const QString & scheme,
    const QString & type,
    const QVariantMap & details
) 

Returns a QField action url string.

Parameters:

  • scheme the action scheme, a qfield value will return a "qfield://" scheme an https value will return an "https://qfield.org" scheme and domain name
  • type the action type (local or cloud)
  • details the action details transformed into URL query parameters

function fromString

Returns a URL from a url with logic to handle local paths.

static Q_INVOKABLE QUrl UrlUtils::fromString (
    const QString & url
) 

function getActionDetails

static Q_INVOKABLE QVariantMap UrlUtils::getActionDetails (
    const QString & url
) 

Returns QField action details extracted from a compatible url.


function isRelativeOrFileUrl

static Q_INVOKABLE bool UrlUtils::isRelativeOrFileUrl (
    const QString & url
) 

Checks whether the provided string is a relative url (has no protocol or starts with file://).


function toLocalFile

Returns a URL from a url with logic to presence or absence offile:// .

static Q_INVOKABLE QString UrlUtils::toLocalFile (
    const QString & url
) 

function urlDetail

static Q_INVOKABLE QString UrlUtils::urlDetail (
    const QString & url,
    const QString & detail
) 

Returns a detail from an url. The possible components are: * "scheme", e.g. https * "authority", e.g. qfield.org * "path", e.g. /my/home.html * "fileName", e.g. file.zip * "query", e.g. param=true&other_parem=0



The documentation for this class was generated from the following file src/core/utils/urlutils.h