[Interest] suppressing tooltips of all widgets

Frank Rueter | OHUfx frank at ohufx.com
Thu Jan 12 01:35:55 CET 2017


Thanks guys, works perfectly.

Since my app will run inside of another host application I just need to 
make sure to install the event to QApplication.instance()
in my main widget's enterEvent and uninstall it again in the leaveEvent 
to avoid processing the host application's events.
But that should be ok, right?!

Thanks again!
frank


On 12/01/17 1:13 PM, william.crocker at analog.com wrote:
> On 01/11/2017 06:37 PM, Frank Rueter | OHUfx wrote:
>> Thanks Giuseppe,
>> I will check out both those options and report back.
>>
>> On 12/01/17 12:15 PM, Giuseppe D'Angelo wrote:
>>> Il 12/01/2017 00:02, Frank Rueter | OHUfx ha scritto:
>>>> Is there any way to intercept a any tool tip even from anywhere in 
>>>> the app?
>>> Install a global event filter on QApplication, and filter out all
>>> QEvent::ToolTip events? (Never tried myself, so take it with a grain of
>>> salt.)
>>>
>
> Yes. That is how I have been doing it for years.
>
> class GlobalEventFilter : public QObject {
>     Q_OBJECT
>     typedef QObject BaseClass;
>   public:
>     GlobalEventFilter( QObject *parent ) : BaseClass(parent) { }
>   protected:
>     bool eventFilter(QObject*,QEvent*);
> };
>
> bool
> GlobalEventFilter::eventFilter( QObject *op, QEvent *ep ) {
>     if( ep->type() == QEvent::ToolTip && !CommandLineArg::s_DoToolTips )
>         return true;    // Filter out.
>     return BaseClass::eventFilter(op,ep);
> }
>
> ...
> GlobalEventFilter *mp = new GlobalEventFilter(s_QtApp);
> my_qt_app->installEventFilter(mp);
> ...
>
> Bill
>
>>> Another option: install a QProxyStyle and return a wait period for
>>> showing tooltips ridiculously high (INT_MAX).
>>>
>>> HTH,
>>>
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list