How to show tooltip for a widget from code
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,
@QToolTip::showText( widget->mapToGlobal( QPoint( 0, 0 ) ), errorString );@
Thanks very much p-himik. That is exactly what I needed.
I think that the correct way is using this:
@setToolTip( const QString & )@
@QString tooltip="Wrong text near: .."
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.
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..
Trigger as in "show", yes. Your code does not trigger nor show, it only sets.
[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