Qt3ToQt4 How to convert custom tool tip to an event filter

From Qt Wiki
Revision as of 17:09, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to convert Qt 3 custom tool tip to Qt 4 event filter

QToolTip no longer supports inheritance. To customize tooltip behavior on widgets, intercept QHelpEvents in the widget’s event() function. Here is how to use an event filter rather than a class formerly deriving from QToolTip.

Derive from QObject instead QToolTip

Change
to

Declare the eventFilter rather than maybeTip.

Change maybeTip
to

Convert the maybeTip() implementation to eventFilter()

Install event filter where custom tool tip class was used.

Change creation of custom tool tip
to installing the event filter.

Categories: