QToolTip::showText disappears after mouse relese



  • Inside a mousePressEvent I do

    QToolTip::showText(evt->globalPos(), "Test", this, rect(), 1000);
    

    But the tooltip disappears after releasing the mouse button.



  • @BentF7 said:

    Inside a mousePressEvent I do

    QToolTip::showText(evt->globalPos(), "Test", this, rect(), 1000);
    

    But the tooltip disappears after releasing the mouse button.

    Are you sure it disappears right after releasing the mouse button and not after 1second?



  • @the_ Yes, I am. If I don't release the mousebutton it disappears after 1 second.


  • Qt Champions 2016

    Hi
    It seems to be an effect of calling it from mousePress.
    As doc says , normally you would intercept QEvent::ToolTip and
    there show call QToolTip::showText

    bool widget::event(QEvent* event) {
    if (event->type() == QEvent::ToolTip) {
    QHelpEvent* helpEvent = static_cast<QHelpEvent*>(event);
    ..


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.