[Qt-interest] tooltips

phil prentice philp.cheer at talktalk.net
Tue Oct 26 16:04:04 CEST 2010


After further investigation I realised that I was getting setStatusTip() 
confused with setToolTip().  Sorry for wasting peoples time.  I also realised 
that if wanted to display the tooltips in a different widget rather then as a 
balloon that I could I assume use an eventfilter() to achieve this by using 
the event filter to catch the helpEvents and redisplaying them in the widget.  
At the moment I will see how I get on with the balloons.

Thanks
Phil

On Tuesday 26 October 2010 12:21, phil prentice wrote:
> Hi
>   My application uses the status bar(by default) to display tooltips.  I
> would very much like to be able to display the tooltips somewhere
> differently e.g maybe in widget (text entry or whatever).  I looked at the
> tooltips example and thought that perhaps I could over-ride the application
> event handler and do something with that i.e.
>
> bool VIwindow::event(QEvent *event) // virtual
> {
>   if (event->type() == QEvent::ToolTip)
>   {
>     QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
>     /*
>     int index = itemAt(helpEvent->pos());
>     if (index != -1)
>       QToolTip::showText(helpEvent->globalPos(),
> shapeItems[index].toolTip()); else
>       QToolTip::showText(helpEvent->globalPos(), "");
>       */
>       qDebug("XXXX");
>   }
>   return QWidget::event(event);
> }
>
> I presume that I would have to search every widget in the application
> (using childAt())??? to locate the appropriate widget and grab the tooltip?
> This could be quite slow??? I have several hundred widgets in my
> application. Is this a feasable idea???
>
>  Alternatively I guess that I could sub-class all of the standard widgets
> in my application and override the event class for that widget to handle
> its objects tooltips? Could be a lot of work?
>
> Is there a better way to achieve what I would like to do?
>
> Thanks again
> Any help appreciated
> Phil
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list