[Interest] suppressing tooltips of all widgets

Frank Rueter | OHUfx frank at ohufx.com
Thu Jan 12 02:05:10 CET 2017


oops I was too trigger happy.
Installing the event filter on the top level widget triggers the filter 
_after_ the tooltips were shown for some reason.
Only when I install it on the QApplication instance do I get a chance to 
filter before the default event.

Oh well, back to using enter and leave events to install and remove the 
filter I guess.

On 12/01/17 1:43 PM, Frank Rueter | OHUfx wrote:
> DOH, ignore that last bit.
> I wrongly assumed that I need to install event filters to QApplication 
> instances when in fact I can install them to any QObject.
> So there is no need to mess with enter and leave events.
> Nice
>
> On 12/01/17 1:35 PM, Frank Rueter | OHUfx wrote:
>> 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
>>
>> _______________________________________________
>> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170112/8d082e3c/attachment.html>


More information about the Interest mailing list