A request for showing a HTML5 form validation message to the user. 更多...
import 语句: | import QtWebEngine 1.5 |
Since: | QtWebEngine 1.4 |
A FormValidationMessageRequest is passed as an argument of the WebEngineView::formValidationMessageRequested signal. It is generated when the handling of the validation message is requested.
The accepted property of the request indicates whether the request is handled by the user code or the default message should be displayed.
The following code uses a custom message to handle the request:
WebEngineView { // ... onFormValidationMessageRequested: function(request) { request.accepted = true; switch (request.type) { case FormValidationMessageRequest.Show: validationMessage.text = request.text; validationMessage.x = request.x; validationMessage.y = request.y validationMessage.visible = true; break; case FormValidationMessageRequest.Move: break; case FormValidationMessageRequest.Hide: validationMessage.visible = false; break; } } // ... }
Indicates whether the form validation request has been accepted by the signal handler.
If the property is
false
after any signal handlers for WebEngineView::validationMessageRequested have been executed, a default file validation message will be shown. To prevent this, set
request.accepted
to
true
.
默认为
false
.
An anchor of an element in the viewport for which the form validation message should be displayed.
The subtext of the form validation message.
The text of the form validation message.
The type of the form validation message request.
常量 | 描述 |
---|---|
ValidationMessageRequest.Show
|
The form validation message should be shown. |
ValidationMessageRequest.Hide
|
The form validation message should be hidden. |
ValidationMessageRequest.Move
|
The form validation message should be moved. |