summaryrefslogtreecommitdiffstats
path: root/lib/quick
diff options
context:
space:
mode:
Diffstat (limited to 'lib/quick')
-rw-r--r--lib/quick/plugin.cpp64
-rw-r--r--lib/quick/qmldir3
-rw-r--r--lib/quick/qquickwebcontentsview.cpp164
-rw-r--r--lib/quick/qquickwebcontentsview_p.h91
-rw-r--r--lib/quick/qquickwebcontentsview_p_p.h67
-rw-r--r--lib/quick/quick.pro28
-rw-r--r--lib/quick/render_widget_host_view_qt_delegate_quick.cpp163
-rw-r--r--lib/quick/render_widget_host_view_qt_delegate_quick.h100
8 files changed, 680 insertions, 0 deletions
diff --git a/lib/quick/plugin.cpp b/lib/quick/plugin.cpp
new file mode 100644
index 000000000..b2e332c91
--- /dev/null
+++ b/lib/quick/plugin.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+
+#include "qquickwebcontentsview_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QtWebEnginePlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine"));
+ Q_UNUSED(uri);
+
+ qmlRegisterType<QQuickWebContentsView>(uri, 1, 0, "WebContentsView");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
diff --git a/lib/quick/qmldir b/lib/quick/qmldir
new file mode 100644
index 000000000..e24f55ed9
--- /dev/null
+++ b/lib/quick/qmldir
@@ -0,0 +1,3 @@
+module QtWebEngine
+plugin qtwebengineplugin
+typeinfo plugins.qmltypes
diff --git a/lib/quick/qquickwebcontentsview.cpp b/lib/quick/qquickwebcontentsview.cpp
new file mode 100644
index 000000000..34107adc5
--- /dev/null
+++ b/lib/quick/qquickwebcontentsview.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickwebcontentsview_p.h"
+#include "qquickwebcontentsview_p_p.h"
+
+#include "web_contents_adapter.h"
+#include "render_widget_host_view_qt_delegate_quick.h"
+
+#include <QUrl>
+
+
+QQuickWebContentsViewPrivate::QQuickWebContentsViewPrivate()
+ : adapter(new WebContentsAdapter(this))
+{
+}
+
+RenderWidgetHostViewQtDelegate *QQuickWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *rwhv)
+{
+ Q_Q(QQuickWebContentsView);
+ // Parent the RWHVQtDelegate directly, this might have to be changed to handle popups and fullscreen.
+ RenderWidgetHostViewQtDelegateQuick *viewDelegate = new RenderWidgetHostViewQtDelegateQuick(q);
+ viewDelegate->resetView(rwhv);
+ viewDelegate->setSize(QSizeF(q->width(), q->height()));
+ return viewDelegate;
+}
+
+void QQuickWebContentsViewPrivate::titleChanged(const QString &title)
+{
+ Q_Q(QQuickWebContentsView);
+ Q_UNUSED(title);
+ Q_EMIT q->titleChanged();
+}
+
+void QQuickWebContentsViewPrivate::urlChanged(const QUrl &url)
+{
+ Q_Q(QQuickWebContentsView);
+ Q_UNUSED(url);
+ Q_EMIT q->urlChanged();
+}
+
+void QQuickWebContentsViewPrivate::loadingStateChanged()
+{
+ Q_Q(QQuickWebContentsView);
+ Q_EMIT q->loadingStateChanged();
+}
+
+QQuickWebContentsView::QQuickWebContentsView()
+ : d_ptr(new QQuickWebContentsViewPrivate)
+{
+ d_ptr->q_ptr = this;
+}
+
+QQuickWebContentsView::~QQuickWebContentsView()
+{
+}
+
+QUrl QQuickWebContentsView::url() const
+{
+ Q_D(const QQuickWebContentsView);
+ return d->adapter->activeUrl();
+}
+
+void QQuickWebContentsView::setUrl(const QUrl& url)
+{
+ Q_D(QQuickWebContentsView);
+ d->adapter->load(url);
+}
+
+void QQuickWebContentsView::goBack()
+{
+ Q_D(QQuickWebContentsView);
+ d->adapter->navigateHistory(-1);
+}
+
+void QQuickWebContentsView::goForward()
+{
+ Q_D(QQuickWebContentsView);
+ d->adapter->navigateHistory(1);
+}
+
+void QQuickWebContentsView::reload()
+{
+ Q_D(QQuickWebContentsView);
+ d->adapter->reload();
+}
+
+void QQuickWebContentsView::stop()
+{
+ Q_D(QQuickWebContentsView);
+ d->adapter->stop();
+}
+
+bool QQuickWebContentsView::isLoading() const
+{
+ Q_D(const QQuickWebContentsView);
+ return d->adapter->isLoading();
+}
+
+QString QQuickWebContentsView::title() const
+{
+ Q_D(const QQuickWebContentsView);
+ return d->adapter->pageTitle();
+}
+
+bool QQuickWebContentsView::canGoBack() const
+{
+ Q_D(const QQuickWebContentsView);
+ return d->adapter->canGoBack();
+}
+
+bool QQuickWebContentsView::canGoForward() const
+{
+ Q_D(const QQuickWebContentsView);
+ return d->adapter->canGoForward();
+}
+
+void QQuickWebContentsView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+
+ Q_FOREACH(QQuickItem *child, childItems()) {
+ Q_ASSERT(qobject_cast<RenderWidgetHostViewQtDelegateQuick *>(child));
+ child->setSize(newGeometry.size());
+ }
+}
diff --git a/lib/quick/qquickwebcontentsview_p.h b/lib/quick/qquickwebcontentsview_p.h
new file mode 100644
index 000000000..61aca128e
--- /dev/null
+++ b/lib/quick/qquickwebcontentsview_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBCONTESTSVIEW_P_H
+#define QQUICKWEBCONTESTSVIEW_P_H
+
+#include <QQuickItem>
+#include <QScopedPointer>
+
+class QQuickWebContentsViewPrivate;
+
+class QQuickWebContentsView : public QQuickItem {
+ Q_OBJECT
+ Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
+ Q_PROPERTY(bool loading READ isLoading NOTIFY loadingStateChanged)
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY loadingStateChanged)
+ Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY loadingStateChanged)
+
+public:
+ QQuickWebContentsView();
+ ~QQuickWebContentsView();
+
+ QUrl url() const;
+ void setUrl(const QUrl&);
+ bool isLoading() const;
+ QString title() const;
+ bool canGoBack() const;
+ bool canGoForward() const;
+
+public Q_SLOTS:
+ void goBack();
+ void goForward();
+ void reload();
+ void stop();
+
+Q_SIGNALS:
+ void titleChanged();
+ void urlChanged();
+ void loadingStateChanged();
+
+protected:
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+
+private:
+ Q_DECLARE_PRIVATE(QQuickWebContentsView)
+ // Hides QObject::d_ptr allowing us to use the convenience macros.
+ QScopedPointer<QQuickWebContentsViewPrivate> d_ptr;
+};
+
+QML_DECLARE_TYPE(QQuickWebContentsView)
+
+#endif // QQUICKWEBCONTESTSVIEW_P_H
diff --git a/lib/quick/qquickwebcontentsview_p_p.h b/lib/quick/qquickwebcontentsview_p_p.h
new file mode 100644
index 000000000..6c9c32c46
--- /dev/null
+++ b/lib/quick/qquickwebcontentsview_p_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBCONTENTSVIEW_P_P_H
+#define QQUICKWEBCONTENTSVIEW_P_P_H
+
+#include "web_contents_adapter_client.h"
+
+#include <QScopedPointer>
+
+class QQuickWebContentsView;
+class WebContentsAdapter;
+
+class QQuickWebContentsViewPrivate : public WebContentsAdapterClient
+{
+ QQuickWebContentsView *q_ptr;
+ Q_DECLARE_PUBLIC(QQuickWebContentsView)
+public:
+ QQuickWebContentsViewPrivate();
+
+ virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt*) Q_DECL_OVERRIDE;
+ virtual void titleChanged(const QString&) Q_DECL_OVERRIDE;
+ virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE;
+ virtual void loadingStateChanged() Q_DECL_OVERRIDE;
+
+ QScopedPointer<WebContentsAdapter> adapter;
+};
+
+#endif // QQUICKWEBCONTENTSVIEW_P_P_H
diff --git a/lib/quick/quick.pro b/lib/quick/quick.pro
new file mode 100644
index 000000000..e2eec55dc
--- /dev/null
+++ b/lib/quick/quick.pro
@@ -0,0 +1,28 @@
+CXX_MODULE = qml
+TARGET = qtwebengineplugin
+TARGETPATH = QtWebEngine
+IMPORT_VERSION = 1.0
+
+QT += qml quick
+
+INCLUDEPATH += ../
+
+# FIXME: all this should eventually be turned into QT += webenginecore
+macx:LIBPATH = $$getOutDir()/$$getConfigDir()
+else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
+LIBS += -lQt5WebEngineCore -L$$LIBPATH
+QMAKE_RPATHDIR += $$LIBPATH
+
+#DESTDIR = $$LIBPATH
+
+SOURCES = \
+ qquickwebcontentsview.cpp \
+ plugin.cpp \
+ render_widget_host_view_qt_delegate_quick.cpp
+
+HEADERS = \
+ qquickwebcontentsview_p.h \
+ qquickwebcontentsview_p_p.h \
+ render_widget_host_view_qt_delegate_quick.h
+
+load(qml_plugin)
diff --git a/lib/quick/render_widget_host_view_qt_delegate_quick.cpp b/lib/quick/render_widget_host_view_qt_delegate_quick.cpp
new file mode 100644
index 000000000..d15bac21f
--- /dev/null
+++ b/lib/quick/render_widget_host_view_qt_delegate_quick.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "render_widget_host_view_qt_delegate_quick.h"
+
+#include <QQuickWindow>
+#include <QWindow>
+
+RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+ setAcceptedMouseButtons(Qt::AllButtons);
+}
+
+QRectF RenderWidgetHostViewQtDelegateQuick::screenRect() const
+{
+ QPointF pos = mapToScene(QPointF(0,0));
+ return QRectF(pos.x(), pos.y(), width(), height());
+}
+
+void RenderWidgetHostViewQtDelegateQuick::setKeyboardFocus()
+{
+ setFocus(true);
+}
+
+bool RenderWidgetHostViewQtDelegateQuick::hasKeyboardFocus()
+{
+ return hasFocus();
+}
+
+void RenderWidgetHostViewQtDelegateQuick::show()
+{
+ setVisible(true);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::hide()
+{
+ setVisible(false);
+}
+
+bool RenderWidgetHostViewQtDelegateQuick::isVisible() const
+{
+ return QQuickPaintedItem::isVisible();
+}
+
+QWindow* RenderWidgetHostViewQtDelegateQuick::window() const
+{
+ return QQuickPaintedItem::window();
+}
+
+void RenderWidgetHostViewQtDelegateQuick::update(const QRect& rect)
+{
+ polish();
+ QQuickPaintedItem::update(rect);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::paint(QPainter *painter)
+{
+ RenderWidgetHostViewQtDelegate::paint(painter, boundingRect());
+}
+
+void RenderWidgetHostViewQtDelegateQuick::updatePolish()
+{
+ // paint will be called from the scene graph thread and this doesn't play well
+ // with chromium's use of TLS while getting the backing store.
+ // updatePolish() should be called from the GUI thread right before the rendering thread starts.
+ fetchBackingStore();
+}
+
+void RenderWidgetHostViewQtDelegateQuick::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
+ notifyResize();
+}
+
+void RenderWidgetHostViewQtDelegateQuick::focusInEvent(QFocusEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::focusOutEvent(QFocusEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::mousePressEvent(QMouseEvent *event)
+{
+ setFocus(true);
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::mouseMoveEvent(QMouseEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::mouseReleaseEvent(QMouseEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::keyPressEvent(QKeyEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::keyReleaseEvent(QKeyEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::wheelEvent(QWheelEvent *event)
+{
+ forwardEvent(event);
+}
+
+void RenderWidgetHostViewQtDelegateQuick::touchEvent(QTouchEvent *event)
+{
+ forwardEvent(event);
+}
diff --git a/lib/quick/render_widget_host_view_qt_delegate_quick.h b/lib/quick/render_widget_host_view_qt_delegate_quick.h
new file mode 100644
index 000000000..38ddf0146
--- /dev/null
+++ b/lib/quick/render_widget_host_view_qt_delegate_quick.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICK_H
+#define RENDER_WIDGET_HOST_VIEW_QT_DELEGATE_QUICK_H
+
+// On Mac we need to reset this define in order to prevent definition
+// of "check" macros etc. The "check" macro collides with a member function name in QtQuick.
+// See AssertMacros.h in the Mac SDK.
+#include <QtGlobal> // We need this for the Q_OS_MAC define.
+#if defined(Q_OS_MAC)
+#undef __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES
+#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
+#endif
+
+#include "render_widget_host_view_qt_delegate.h"
+
+#include <QQuickPaintedItem>
+
+class BackingStoreQt;
+class QWindow;
+class QQuickItem;
+class QFocusEvent;
+class QMouseEvent;
+class QKeyEvent;
+class QWheelEvent;
+
+class RenderWidgetHostViewQtDelegateQuick : public QQuickPaintedItem, public RenderWidgetHostViewQtDelegate
+{
+ Q_OBJECT
+public:
+ RenderWidgetHostViewQtDelegateQuick(QQuickItem *parent);
+
+ virtual QRectF screenRect() const;
+ virtual void setKeyboardFocus();
+ virtual bool hasKeyboardFocus();
+ virtual void show();
+ virtual void hide();
+ virtual bool isVisible() const;
+ virtual QWindow* window() const;
+ virtual void update(const QRect& rect = QRect());
+
+ void paint(QPainter *painter);
+
+ void focusInEvent(QFocusEvent*);
+ void focusOutEvent(QFocusEvent*);
+ void mousePressEvent(QMouseEvent*);
+ void mouseMoveEvent(QMouseEvent*);
+ void mouseReleaseEvent(QMouseEvent*);
+ void mouseDoubleClickEvent(QMouseEvent*);
+ void keyPressEvent(QKeyEvent*);
+ void keyReleaseEvent(QKeyEvent*);
+ void wheelEvent(QWheelEvent*);
+ void touchEvent(QTouchEvent*);
+
+protected:
+ void updatePolish();
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+
+};
+
+#endif