TooltipRequest QML Type

A request for showing a tooltip to the user. More...

Import Statement: import QtWebEngine
Since: QtWebEngine 1.10

Properties

Detailed Description

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;
    }
    // ...
}

Property Documentation

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.

The default is false.


[read-only] text : bool

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


[read-only] type : enumeration

The type of the tooltip request.

ConstantDescription
TooltipRequest.ShowThe tooltip should be shown.
TooltipRequest.HideThe tooltip should be hidden.

[read-only] x : int

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


[read-only] y : int

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


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.