disable overshooting during scrolling for performance; hide messages when scrolling
authorchristian <pulvermacher@gmx.de>
Sun, 29 Jan 2012 18:51:10 +0000 (19:51 +0100)
committerchristian <pulvermacher@gmx.de>
Sun, 29 Jan 2012 18:51:10 +0000 (19:51 +0100)
src/scrollarea.h

index 1505b3b..6e525f1 100644 (file)
@@ -45,6 +45,13 @@ public:
         message_timer.setInterval(2500);
         connect(&message_timer, SIGNAL(timeout()),
                 &message, SLOT(hide()));
+
+#ifdef Q_WS_MAEMO_5
+        // disable overshooting because it somehow causes repaint events for the whole widget (slow)
+        QAbstractKineticScroller *scroller = property("kineticScroller").value<QAbstractKineticScroller *>();
+        if (scroller)
+            scroller->setOvershootPolicy(QAbstractKineticScroller::OvershootAlwaysOff);
+#endif
     }
 
     void showMessage(const QString &s) {
@@ -59,13 +66,8 @@ protected:
     }
     virtual void scrollContentsBy(int dx, int dy) {
         QScrollArea::scrollContentsBy(dx, dy);
-        if(widget()) {
-            const QRegion visible_region_new = widget()->visibleRegion();
-            const QRegion visible_region_old = visible_region_new.translated(-dx, -dy);
-
-            //now update only the region that became visible
-            widget()->update(visible_region_new - visible_region_old);
-        }
+        if(widget())
+            message.hide(); //overlay-widget slows down scrolling
     }
 private:
     QLabel message;