Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
4.6.3, 4.7.4
-
None
-
Tested on Mac OS X 10.5.8.
-
5e8e04a29ff15e8b329c758f2ea62b8e6feb70f9
Description
In Qt/Cocoa tracking area's are constantly removed and recreated/readded, which is terribly slow and unnecessary when NSTrackingInVisibleRect is used as option (it will ignore the NSTrackingArea rect in favour of the NSView visibleRect). Here's a proper implementation of updateTrackingAreas:
- (void)updateTrackingAreas { if (!qwidget) return; // [NSView addTrackingArea] is slow, so bail out early if we can: if (NSIsEmptyRect([self visibleRect])) return; QMacCocoaAutoReleasePool pool; if ([[self trackingAreas] count] > 0) return; // Ideally, we shouldn't have NSTrackingMouseMoved events included below, it should // only be turned on if mouseTracking, hover is on or a tool tip is set. // Unfortunately, Qt will send "tooltip" events on mouse moves, so we need to // turn it on in ALL case. That means EVERY QCocoaView gets to pay the cost of // mouse moves delivered to it (Apple recommends keeping it OFF because there // is a performance hit). So it goes. NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp | NSTrackingInVisibleRect | NSTrackingMouseMoved; NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:NSMakeRect(0, 0, 1, 1) options:trackingOptions owner:self userInfo:nil]; [self addTrackingArea:ta]; [ta release]; }
Attachments
For Gerrit Dashboard: QTBUG-21944 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
109501,2 | OS X: Do not re-create tracking areas over and over again | 5.5 | qt/qtbase | Status: MERGED | +2 | 0 |