Reputation: 12016
I have the latest Qt, also, I'm trying out QtWebKit.experimental
, so, not to use it is not a limitation. I want to be able to select text from my WebView
, or even, be able to capture those events, anyway, a standard WebView
like the following is not allowing me to select text from it, I try to, but no selection happens, what should I do to have a selectable WebView
?
import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
import QtWebKit 3.0
import QtWebKit.experimental 1.0
ApplicationWindow {
flags: Qt.FramelessWindowHint
width: 500
height: 500
x: (Screen.width - width) / 2
y: (Screen.height - height) / 2
color: "transparent"
WebView {
objectName: "html"
anchors.fill: parent
experimental.transparentBackground: true
focus: true
Keys.onEscapePressed: Qt.quit()
}
}
NOTICE: I'm manipulating the elements outside the QML file, for example, I'm loading HTML content in the WebView
through loadHtml
.
Upvotes: 1
Views: 1543
Reputation: 879
from reading this (src : QML WebView Element Qt 4.8)
User Interaction and Navigation
By default, certain mouse and touch events are delivered to other items in preference to the Web content. For example, when a scrolling view is created by placing a WebView in a Flickable, move events are delivered to the Flickable so that the user can scroll the page. This prevents the user from accidentally selecting text in a Web page instead of scrolling.
The pressGrabTime
property defines the time the user must touch or press a mouse button over the WebView
before the Web content will receive the move events it needs to select text and images.
When this item has keyboard focus, all keyboard input will be sent directly to the Web page within.
Qt 5.x doesn't have the WebView::pressGrabTime
and as I read and watched some Qt developper days videos talking about the changes of QtWebEngine and that in future releases of Qt, webkit will be replaced by Google's Chromium web engine ...
Upvotes: 2