blob: 473463fa3900f98f80671dfb10eb306a71d6219b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickwebenginetouchhandle_p.h"
#include "qquickwebenginetouchhandleprovider_p_p.h"
#include "web_contents_adapter_client.h"
#include <QtQuick/qquickitem.h>
QT_BEGIN_NAMESPACE
QQuickWebEngineTouchHandle::QQuickWebEngineTouchHandle() : QObject(nullptr), m_hasImage(false) { }
void QQuickWebEngineTouchHandle::setBounds(const QRect &bounds)
{
m_item->setX(bounds.x());
m_item->setY(bounds.y());
m_item->setWidth(bounds.width());
m_item->setHeight(bounds.height());
}
void QQuickWebEngineTouchHandle::setOpacity(float opacity)
{
m_item->setOpacity(opacity);
}
void QQuickWebEngineTouchHandle::setImage(int orientation)
{
if (m_hasImage) {
QUrl url = QQuickWebEngineTouchHandleProvider::url(orientation);
m_item->setProperty("source", url);
}
}
void QQuickWebEngineTouchHandle::setVisible(bool visible)
{
m_item->setVisible(visible);
}
void QQuickWebEngineTouchHandle::setItem(QQuickItem *item, bool hasImage)
{
m_hasImage = hasImage;
m_item.reset(item);
}
QT_END_NAMESPACE
|