src/hbcore/gui/hbscrollarea.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbcore/gui/hbscrollarea.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/gui/hbscrollarea.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -33,6 +33,7 @@
 #include "hbglobal_p.h"
 #include <hbtapgesture.h>
 #include <hbnamespace_p.h>
+#include <QGraphicsSceneResizeEvent>
 
 #include <QGesture>
 
@@ -543,6 +544,8 @@
             d->adjustContent();
         else
             d->_q_hideScrollBars();
+        //need to invalidate the whole region as we apply clipping
+        prepareGeometryChange();
     }
 
     return HbWidget::itemChange(change, value);
@@ -763,7 +766,17 @@
     Q_UNUSED(obj);
     Q_D(HbScrollArea);
     if (event && event->type() == QEvent::GraphicsSceneResize) {
-        if (isVisible()) {            
+        //If layoutdirection is from right to left, we expand the contentwidget to the left
+        //instead of the right
+        if (layoutDirection() == Qt::RightToLeft) {
+            QGraphicsSceneResizeEvent *resizeEvent = static_cast<QGraphicsSceneResizeEvent*>(event);
+            if (resizeEvent) {
+                qreal xChange = resizeEvent->newSize().width() - resizeEvent->oldSize().width();
+                qreal newXPos = d->mContents->pos().x() - xChange;
+                d->mContents->setPos(newXPos, d->mContents->pos().y());
+            }
+        }
+        if (isVisible()) {
             d->adjustContent();
         }