diff --git a/src/lib/plugins/qml/api/menus/qmlwebhittestresult.cpp b/src/lib/plugins/qml/api/menus/qmlwebhittestresult.cpp index 8771cb390..8f319b330 100644 --- a/src/lib/plugins/qml/api/menus/qmlwebhittestresult.cpp +++ b/src/lib/plugins/qml/api/menus/qmlwebhittestresult.cpp @@ -98,10 +98,77 @@ bool QmlWebHitTestResult::mediaMuted() const } /** - * @brief Gets the tagName of the element on which the contex menu is requested. + * @brief Gets the tagName of the element on which the context menu is requested. * @return String representing the tag name of the element */ QString QmlWebHitTestResult::tagName() const { return m_webHitTestResult.tagName(); } + +/** + * @brief Gets the base url on which the context menu is requested. + * @return String representing the base url + */ +QString QmlWebHitTestResult::baseUrl() const +{ + QUrl base = m_webHitTestResult.baseUrl(); + return QString::fromUtf8(base.toEncoded()); +} + +/** + * @brief Gets the link title on which the context menu is requested. + * @return String representing the link title + */ +QString QmlWebHitTestResult::linkTitle() const +{ + return m_webHitTestResult.linkTitle(); +} + +/** + * @brief Gets the link url on which the context menu is requested. + * @return String representing the link url + */ +QString QmlWebHitTestResult::linkUrl() const +{ + QUrl link = m_webHitTestResult.linkUrl(); + return QString::fromUtf8(link.toEncoded()); +} + +/** + * @brief Gets the url of image on which the context menu is requested. + * @return String representing the image url + */ +QString QmlWebHitTestResult::imageUrl() const +{ + QUrl image = m_webHitTestResult.imageUrl(); + return QString::fromUtf8(image.toEncoded()); +} + +/** + * @brief Gets the url of media on which the context menu is requested. + * @return String representing the media url + */ +QString QmlWebHitTestResult::mediaUrl() const +{ + QUrl media = m_webHitTestResult.mediaUrl(); + return QString::fromUtf8(media.toEncoded()); +} + +/** + * @brief Gets the position at which the context menu is requested. + * @return QPoint representing the position + */ +QPoint QmlWebHitTestResult::pos() const +{ + return m_webHitTestResult.pos(); +} + +/** + * @brief Gets the viewport position at which the context menu is requested. + * @return QPoint representing the viewport position + */ +QPointF QmlWebHitTestResult::viewportPos() const +{ + return m_webHitTestResult.viewportPos(); +} diff --git a/src/lib/plugins/qml/api/menus/qmlwebhittestresult.h b/src/lib/plugins/qml/api/menus/qmlwebhittestresult.h index c9eef3d19..c8d171f27 100644 --- a/src/lib/plugins/qml/api/menus/qmlwebhittestresult.h +++ b/src/lib/plugins/qml/api/menus/qmlwebhittestresult.h @@ -37,6 +37,13 @@ public: Q_INVOKABLE bool mediaPaused() const; Q_INVOKABLE bool mediaMuted() const; Q_INVOKABLE QString tagName() const; + Q_INVOKABLE QString baseUrl() const; + Q_INVOKABLE QString linkTitle() const; + Q_INVOKABLE QString linkUrl() const; + Q_INVOKABLE QString imageUrl() const; + Q_INVOKABLE QString mediaUrl() const; + Q_INVOKABLE QPoint pos() const; + Q_INVOKABLE QPointF viewportPos() const; private: WebHitTestResult m_webHitTestResult;