Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Tooltip fall asleep delay for QGraphicsItem



  • Hi all,

    the current behaviour for Qt 5.11.2 when moving the mouse cursor over a QGraphicsItem with a tooltip is, that the tooltip is only shown for some seconds.

    I want to remove this "fall asleep" behaviour. The tooltip should hide itself like on a normal QLabel, when the mouse leaves the object.

    I tried to solve it over the setStyle method for the QGraphicsScene:

    class MyStyle : public QProxyStyle
    {
    public:
        int styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override {
            if (hint == SH_ToolTip_FallAsleepDelay)
                return -1; //0 and 30000 doesn't work either
            return QProxyStyle::styleHint(hint, option, widget, returnData);
        }
    };
    

    I tried to override the helpEvent of QGraphicsScene to show the tooltips on my own, but the tooltip event is forwarded to the internal "tooltip-show-method" before the helpEvent is called.

    Does anyone have another idea how to prevent the fall asleep behaviour?



  • I had an own implementation of showing the Tooltips in hoverEnter .. now I'm using the default tooltip method and this one works like expected.


Log in to reply