From 7d545f6bb6c4bf698410fe4b8f8628cd9715ab0b Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@qt.io>
Date: Wed, 28 Feb 2018 15:38:23 +0100
Subject: [PATCH] Replace deprecated Q_FLAGS macro
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Q_FLAGS is deprecated, and is replaced by the more powerful Q_FLAG macro.

Anyhow, Q_FLAG and Q_FLAGS only makes sense if used inside
a QObject or Q_GADGET. The patch therefore makes QWebEngineContextMenuData
a Q_GADGET.

Change-Id: Icccb373846a645272a7bf29397b930ae80be9b85
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Valentin Fokin <fokinv@inf.u-szeged.hu>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 src/webengine/api/qquickwebenginecontextmenurequest_p.h | 5 ++---
 src/webengine/api/qquickwebengineview_p.h               | 3 +--
 src/webenginewidgets/api/qwebenginecontextmenudata.h    | 6 ++++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/webengine/api/qquickwebenginecontextmenurequest_p.h b/src/webengine/api/qquickwebenginecontextmenurequest_p.h
index d8da35c66..245955788 100644
--- a/src/webengine/api/qquickwebenginecontextmenurequest_p.h
+++ b/src/webengine/api/qquickwebenginecontextmenurequest_p.h
@@ -89,7 +89,7 @@ public:
         MediaCanRotate = 0x200,
     };
     Q_DECLARE_FLAGS(MediaFlags, MediaFlag)
-
+    Q_FLAG(MediaFlags)
 
     // Must match QWebEngineCore::WebEngineContextMenuData::EditFlags:
     enum EditFlag {
@@ -104,6 +104,7 @@ public:
         CanEditRichly = 0x100,
     };
     Q_DECLARE_FLAGS(EditFlags, EditFlag)
+    Q_FLAG(EditFlags)
 
     Q_PROPERTY(int x READ x CONSTANT FINAL)
     Q_PROPERTY(int y READ y CONSTANT FINAL)
@@ -139,8 +140,6 @@ private:
     QQuickWebEngineContextMenuRequest(const QtWebEngineCore::WebEngineContextMenuData &data, QObject *parent = nullptr);
     QScopedPointer<QtWebEngineCore::WebEngineContextMenuData> m_data;
     bool m_accepted;
-    Q_FLAGS(MediaFlags)
-    Q_FLAGS(EditFlags)
     friend class QQuickWebEngineView;
     friend class QQuickWebEngineViewPrivate;
     Q_DISABLE_COPY(QQuickWebEngineContextMenuRequest)
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 76b5c2be9..ffa468eff 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -134,8 +134,6 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
     Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport NOTIFY testSupportChanged FINAL)
 #endif
 
-    Q_FLAGS(FindFlags);
-
 public:
     QQuickWebEngineView(QQuickItem *parent = 0);
     ~QQuickWebEngineView();
@@ -296,6 +294,7 @@ public:
         FindCaseSensitively = 2,
     };
     Q_DECLARE_FLAGS(FindFlags, FindFlag)
+    Q_FLAG(FindFlags)
 
     // must match QPageSize::PageSizeId
     enum PrintedPageSizeId {
diff --git a/src/webenginewidgets/api/qwebenginecontextmenudata.h b/src/webenginewidgets/api/qwebenginecontextmenudata.h
index 7c33ee270..24fbd5c09 100644
--- a/src/webenginewidgets/api/qwebenginecontextmenudata.h
+++ b/src/webenginewidgets/api/qwebenginecontextmenudata.h
@@ -52,6 +52,8 @@ class WebEngineContextMenuData;
 QT_BEGIN_NAMESPACE
 
 class QWEBENGINEWIDGETS_EXPORT QWebEngineContextMenuData {
+    Q_GADGET
+
 public:
     QWebEngineContextMenuData();
     QWebEngineContextMenuData(const QWebEngineContextMenuData &other);
@@ -82,6 +84,7 @@ public:
         MediaCanRotate = 0x200,
     };
     Q_DECLARE_FLAGS(MediaFlags, MediaFlag)
+    Q_FLAG(MediaFlags)
 
     // Must match QWebEngineCore::WebEngineContextMenuData::EditFlags:
     enum EditFlag {
@@ -96,6 +99,7 @@ public:
         CanEditRichly = 0x100,
     };
     Q_DECLARE_FLAGS(EditFlags, EditFlag)
+    Q_FLAG(EditFlags)
 
     bool isValid() const;
 
@@ -116,8 +120,6 @@ private:
     typedef QtWebEngineCore::WebEngineContextMenuData QWebEngineContextDataPrivate;
     QWebEngineContextMenuData &operator=(const QWebEngineContextDataPrivate &priv);
     const QWebEngineContextDataPrivate *d;
-    Q_FLAGS(MediaFlags)
-    Q_FLAGS(EditFlags)
 
     friend class QWebEnginePagePrivate;
     friend class QWebEnginePage;
-- 
GitLab