summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-31 12:15:30 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-31 12:15:30 (GMT)
commit642a9d6051d5f42dd8dd1205d2b19887e659decf (patch)
treefbc39df5c561a48af5a643d8a3009aa585dab4f9
parentfa5bb7d57500501213a8ff504066ebad73efdcd7 (diff)
Look at to using QWebEngineContextMenuData
-rw-r--r--webengineviewer/src/webhittestresult.cpp35
-rw-r--r--webengineviewer/src/webhittestresult.h6
2 files changed, 41 insertions, 0 deletions
diff --git a/webengineviewer/src/webhittestresult.cpp b/webengineviewer/src/webhittestresult.cpp
index 100c53f..2b4f95e 100644
--- a/webengineviewer/src/webhittestresult.cpp
+++ b/webengineviewer/src/webhittestresult.cpp
@@ -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;
diff --git a/webengineviewer/src/webhittestresult.h b/webengineviewer/src/webhittestresult.h
index 4f76f6b..a4d7e78 100644
--- a/webengineviewer/src/webhittestresult.h
+++ b/webengineviewer/src/webhittestresult.h
@@ -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;