TooltipRequest QML Type

A request for showing a tooltip to the user. 更多...

import 语句: import QtWebEngine
Since: QtWebEngine 1.10

特性

详细描述

A TooltipRequest is a request object that is passed as a parameter of the WebEngineView::tooltipRequested signal. Use the onTooltipRequested signal handler to handle requests for custom tooltip menus at specific positions.

The accepted property of the request indicates whether the request is handled by the user code or the default tooltip should be displayed.

The following code uses a custom tooltip to handle the request:

WebEngineView {
    // ...
    onTooltipRequested: function(request) {
        if (request.type == TooltipRequest.Show) {
            tooltip.visible = true;
            tooltip.x = request.x;
            tooltip.y = request.y;
            tooltip.text = request.text;
        } else {
            tooltip.visible = false;
        }
        request.accepted = true;
    }
    // ...
}
					

特性文档编制

accepted : bool

Indicates whether the tooltip request has been accepted by the signal handler.

If the property is false after any signal handlers for WebEngineView::tooltipRequested have been executed, a default tooltip will be shown. To prevent this, set request.accepted to true .

默认为 false .

text : bool [read-only]

The text of the tooltip. It contains an empty string when the tooltip should be hidden.

type : enumeration [read-only]

The type of the tooltip request.

常量 描述
TooltipRequest.Show The tooltip should be shown.
TooltipRequest.Hide The tooltip should be hidden.

x : int [read-only]

The x coordinate of the top-left corner of the requested tooltip.

y : int [read-only]

The y coordinate of the top-left corner of the requested tooltip.