Commit 642a9d60 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Look at to using QWebEngineContextMenuData

parent fa5bb7d5
......@@ -42,6 +42,19 @@ using namespace WebEngineViewer;
class WebEngineViewer::WebHitTestResultPrivate
{
public:
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
WebHitTestResultPrivate(const QWebEngineContextMenuData &data, const QPoint &pos = QPoint(), const QUrl &url = QUrl())
: mIsNull(true),
mIsContentEditable(false),
mIsContentSelected(false),
mMediaPaused(false),
mMediaMuted(false),
mPos(pos),
mPageUrl(url)
{
init(data);
}
#endif
WebHitTestResultPrivate(const QPoint &pos = QPoint(), const QUrl &url = QUrl(), const QVariant &result = QVariant())
: mIsNull(true),
mIsContentEditable(false),
......@@ -54,6 +67,10 @@ public:
init(result.toMap());
}
void init(const QVariantMap &map);
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
void init(const QWebEngineContextMenuData &data);
#endif
bool mIsNull;
QString mAlternateText;
......@@ -71,6 +88,15 @@ public:
QUrl mPageUrl;
};
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
void WebHitTestResultPrivate::init(const QWebEngineContextMenuData &data)
{
if (data.isValid()) {
//TODO
}
}
#endif
void WebHitTestResultPrivate::init(const QVariantMap &map)
{
if (map.isEmpty()) {
......@@ -104,6 +130,7 @@ void WebHitTestResultPrivate::init(const QVariantMap &map)
}
mIsNull = false;
}
WebHitTestResult::WebHitTestResult()
: d(new WebHitTestResultPrivate)
{
......@@ -121,6 +148,14 @@ WebHitTestResult::WebHitTestResult(const WebHitTestResult &other)
(*this) = other;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
WebHitTestResult::WebHitTestResult(const QPoint &pos, const QUrl &pageUrl, const QWebEngineContextMenuData &data)
: d(new WebHitTestResultPrivate(data, pos, pageUrl))
{
}
#endif
WebHitTestResult::~WebHitTestResult()
{
delete d;
......
......@@ -42,6 +42,9 @@
#include <QRect>
#include <QString>
#include <QVariant>
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
#include <QWebEngineContextMenuData>
#endif
namespace WebEngineViewer
{
......@@ -52,6 +55,9 @@ public:
WebHitTestResult();
WebHitTestResult(const QPoint &pos, const QUrl &pageUrl, const QVariant &result);
WebHitTestResult(const WebHitTestResult &other);
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
WebHitTestResult(const QPoint &pos, const QUrl &pageUrl, const QWebEngineContextMenuData &data);
#endif
~WebHitTestResult();
QString alternateText() const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment