1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Added more methods to QmlWebHitTest

This commit is contained in:
Anmol Gautam 2018-06-24 00:15:18 +05:30
parent 236732d95b
commit c8a1bad5af
2 changed files with 75 additions and 1 deletions

View File

@ -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 * @return String representing the tag name of the element
*/ */
QString QmlWebHitTestResult::tagName() const QString QmlWebHitTestResult::tagName() const
{ {
return m_webHitTestResult.tagName(); 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();
}

View File

@ -37,6 +37,13 @@ public:
Q_INVOKABLE bool mediaPaused() const; Q_INVOKABLE bool mediaPaused() const;
Q_INVOKABLE bool mediaMuted() const; Q_INVOKABLE bool mediaMuted() const;
Q_INVOKABLE QString tagName() 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: private:
WebHitTestResult m_webHitTestResult; WebHitTestResult m_webHitTestResult;