How to show tooltip for a widget from code
-
wrote on 18 Oct 2011, 12:13 last edited by
Hello all,
I want to show tooltip for QLineEdit from a code as a hint for a user that there (in lineEdit) is something wrong.
But I cannot find how to do it. I want to ask if it is possible to show tooltip by the code?Thank in advance,
Jarda -
wrote on 18 Oct 2011, 12:23 last edited by
Try this:
@QToolTip::showText( widget->mapToGlobal( QPoint( 0, 0 ) ), errorString );@ -
wrote on 18 Oct 2011, 12:32 last edited by
Thanks very much p-himik. That is exactly what I needed.
-
wrote on 19 Oct 2011, 05:29 last edited by
This will show toolTip only if you hold your mouse cursor on this widget for a while. Jarda wants to show it on demand from his code.
-
wrote on 19 Oct 2011, 11:53 last edited by
My bad, as the tittle say "how to show tooltip for a widget from code", but what jarda wants is to "trigger" the show tooltip..
-
wrote on 19 Oct 2011, 13:13 last edited by
Trigger as in "show", yes. Your code does not trigger nor show, it only sets.
-
wrote on 19 Oct 2011, 13:15 last edited by
[quote author="Andre" date="1319030027"]Trigger as in "show", yes. Your code does not trigger nor show, it only sets. [/quote]
I said My Bad, I'm sure you get things wrong too
5/8