summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_view_qt.h
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2020-07-29 15:30:44 +0200
committerMichal Klocek <michal.klocek@qt.io>2020-08-12 15:57:59 +0200
commit0dca1220141c1aa0ce983e27f1f09425f47f062d (patch)
tree7ed5a37e17589daeda3e164042a435efc38dac89 /src/core/web_contents_view_qt.h
parentc2b43bc93d81ed2e768501e680430a1df22166b6 (diff)
Merge all webenginecontextmenudata wrappers into one class
Introduce new class qwebenginecontextmenurequest in core which merges: * qquickwebenginecontextmenurequest * qwebenginecontextmenudata * implictly shared webenginecontextdata Unfortunately new class has to be QObject, since we want to reuse it qml. Q_GADGET can be used only as a value type, however we need to know if request is accepted or not in qml, therefore it must be passed as pointer. Since we use QObject now, class is no longer implicitly shared, however we only allocate request once and reuse the object for every new request (it is still copied in qml just to keep it aligned with other request handlers) [ChangleLog] QWebEngineContextMenuRequest is replacement for QWebEngineContextMenuData Change-Id: Ib387ec2065361a4bacc20675ca7352ab75a0e436 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/web_contents_view_qt.h')
-rw-r--r--src/core/web_contents_view_qt.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h
index 3dcb648bf..218bebf13 100644
--- a/src/core/web_contents_view_qt.h
+++ b/src/core/web_contents_view_qt.h
@@ -45,6 +45,8 @@
#include "api/qtwebenginecoreglobal_p.h"
+QT_FORWARD_DECLARE_CLASS(QWebEngineContextMenuRequest)
+
namespace content {
class WebContents;
}
@@ -59,12 +61,7 @@ class WebContentsViewQt
public:
static inline WebContentsViewQt *from(WebContentsView *view) { return static_cast<WebContentsViewQt*>(view); }
- WebContentsViewQt(content::WebContents* webContents)
- : m_webContents(webContents)
- , m_client(nullptr)
- , m_factoryClient(nullptr)
- { }
-
+ WebContentsViewQt(content::WebContents* webContents);
void setFactoryClient(WebContentsAdapterClient* client);
void setClient(WebContentsAdapterClient* client);
WebContentsAdapterClient *client() { return m_client; }
@@ -129,9 +126,14 @@ public:
void TakeFocus(bool reverse) override;
private:
+ static void update(QWebEngineContextMenuRequest *request,
+ const content::ContextMenuParams &params, bool spellcheckEnabled);
+
+private:
content::WebContents *m_webContents;
WebContentsAdapterClient *m_client;
WebContentsAdapterClient *m_factoryClient;
+ std::unique_ptr<QWebEngineContextMenuRequest> m_contextMenuRequest;
};
} // namespace QtWebEngineCore