summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoaview_mac.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-12-09 14:30:10 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-12-09 14:49:12 (GMT)
commit445f8bbd9709b712fa253fe1833bbf9416429603 (patch)
treeca8f0d1a4e0eae20a109a689bb803af53ebebe9f /src/gui/kernel/qcocoaview_mac.mm
parentfc73e6e67b4048a7fa79d041ee609bea508aff07 (diff)
downloadQt-445f8bbd9709b712fa253fe1833bbf9416429603.zip
Qt-445f8bbd9709b712fa253fe1833bbf9416429603.tar.gz
Qt-445f8bbd9709b712fa253fe1833bbf9416429603.tar.bz2
Cocoa: scrolling viewports containing many widgets is slow
One of the reasons is that [NSView resetCursorRects] is called for each view, also the ones not actually visible. And the function is slow. This patch does an early check, and bails out if this is the case. Reviewed-by: Prasanth
Diffstat (limited to 'src/gui/kernel/qcocoaview_mac.mm')
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 1039a75..311cf24 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -227,6 +227,10 @@ extern "C" {
- (void)resetCursorRects
{
+ // [NSView addCursorRect] is slow, so bail out early if we can:
+ if (NSIsEmptyRect([self visibleRect]))
+ return;
+
QWidget *cursorWidget = qwidget;
if (cursorWidget->testAttribute(Qt::WA_TransparentForMouseEvents))