Falkon Develop
Cross-platform Qt-based web browser
qmlwebhittestresult.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2018 Anmol Gautam <tarptaeya@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#pragma once
19
20#include "webhittestresult.h"
21#include <QObject>
22
26class QmlWebHitTestResult : public QObject
27{
28 Q_OBJECT
32 Q_PROPERTY(QString tagName READ tagName CONSTANT)
36 Q_PROPERTY(QString baseUrl READ baseUrl CONSTANT)
40 Q_PROPERTY(QString linkTitle READ linkTitle CONSTANT)
44 Q_PROPERTY(QString linkUrl READ linkUrl CONSTANT)
48 Q_PROPERTY(QString imageUrl READ imageUrl CONSTANT)
52 Q_PROPERTY(QString mediaUrl READ mediaUrl CONSTANT)
56 Q_PROPERTY(QPoint pos READ pos CONSTANT)
60 Q_PROPERTY(QPointF viewportPos READ viewportPos CONSTANT)
61public:
62 explicit QmlWebHitTestResult(const WebHitTestResult &webHitTestResult, QObject *parent = nullptr);
67 Q_INVOKABLE bool isImage() const;
72 Q_INVOKABLE bool isContentEditable() const;
77 Q_INVOKABLE bool isContentSelected() const;
82 Q_INVOKABLE bool isNull() const;
87 Q_INVOKABLE bool isLink() const;
92 Q_INVOKABLE bool isMedia() const;
97 Q_INVOKABLE bool mediaPaused() const;
102 Q_INVOKABLE bool mediaMuted() const;
103 QString tagName() const;
104 QString baseUrl() const;
105 QString linkTitle() const;
106 QString linkUrl() const;
107 QString imageUrl() const;
108 QString mediaUrl() const;
109 QPoint pos() const;
110 QPointF viewportPos() const;
111
112private:
113 WebHitTestResult m_webHitTestResult;
114};
The class exposing result of WebHitTest to QML.
QString imageUrl
Gets the url of image on which the context menu is requested.
Q_INVOKABLE bool mediaPaused() const
Checks if the context menu requested on media element is paused.
Q_INVOKABLE bool isLink() const
Checks if the context menu is requested on a link.
QmlWebHitTestResult(const WebHitTestResult &webHitTestResult, QObject *parent=nullptr)
QString linkUrl
Gets the link url on which the context menu is requested.
QString baseUrl
Gets the base url on which the context menu is requested.
QString linkTitle
Gets the link title on which the context menu is requested.
Q_INVOKABLE bool isNull() const
Checks if the context menu is requested on null element.
Q_INVOKABLE bool isMedia() const
Checks if the context menu is requested on a media element.
QPointF viewportPos
Gets the viewport position at which the context menu is requested.
QPoint pos
Gets the position at which the context menu is requested.
QString tagName
Gets the tagName of the element on which the context menu is requested.
Q_INVOKABLE bool isImage() const
Checks if the context menu is requested on image.
Q_INVOKABLE bool mediaMuted() const
Checks if the context menu requested on media element is muted.
QString mediaUrl
Gets the url of media on which the context menu is requested.
Q_INVOKABLE bool isContentEditable() const
Checks if the context menu is requested on editable content.
Q_INVOKABLE bool isContentSelected() const
Checks if the context menu is requested on the selected content.