src/hbcore/gui/hbscrollarea.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    31 #include <hbwidgetfeedback.h>
    31 #include <hbwidgetfeedback.h>
    32 #include <hbevent.h>
    32 #include <hbevent.h>
    33 #include "hbglobal_p.h"
    33 #include "hbglobal_p.h"
    34 #include <hbtapgesture.h>
    34 #include <hbtapgesture.h>
    35 #include <hbnamespace_p.h>
    35 #include <hbnamespace_p.h>
       
    36 #include <QGraphicsSceneResizeEvent>
    36 
    37 
    37 #include <QGesture>
    38 #include <QGesture>
    38 
    39 
    39 #include <QDebug>
    40 #include <QDebug>
    40 
    41 
   541     if (change == QGraphicsItem::ItemVisibleHasChanged && d->mContents) {
   542     if (change == QGraphicsItem::ItemVisibleHasChanged && d->mContents) {
   542         if (value.toBool() == true)
   543         if (value.toBool() == true)
   543             d->adjustContent();
   544             d->adjustContent();
   544         else
   545         else
   545             d->_q_hideScrollBars();
   546             d->_q_hideScrollBars();
       
   547         //need to invalidate the whole region as we apply clipping
       
   548         prepareGeometryChange();
   546     }
   549     }
   547 
   550 
   548     return HbWidget::itemChange(change, value);
   551     return HbWidget::itemChange(change, value);
   549 }
   552 }
   550 
   553 
   761 bool HbScrollArea::eventFilter(QObject *obj, QEvent *event)
   764 bool HbScrollArea::eventFilter(QObject *obj, QEvent *event)
   762 {
   765 {
   763     Q_UNUSED(obj);
   766     Q_UNUSED(obj);
   764     Q_D(HbScrollArea);
   767     Q_D(HbScrollArea);
   765     if (event && event->type() == QEvent::GraphicsSceneResize) {
   768     if (event && event->type() == QEvent::GraphicsSceneResize) {
   766         if (isVisible()) {            
   769         //If layoutdirection is from right to left, we expand the contentwidget to the left
       
   770         //instead of the right
       
   771         if (layoutDirection() == Qt::RightToLeft) {
       
   772             QGraphicsSceneResizeEvent *resizeEvent = static_cast<QGraphicsSceneResizeEvent*>(event);
       
   773             if (resizeEvent) {
       
   774                 qreal xChange = resizeEvent->newSize().width() - resizeEvent->oldSize().width();
       
   775                 qreal newXPos = d->mContents->pos().x() - xChange;
       
   776                 d->mContents->setPos(newXPos, d->mContents->pos().y());
       
   777             }
       
   778         }
       
   779         if (isVisible()) {
   767             d->adjustContent();
   780             d->adjustContent();
   768         }
   781         }
   769 
   782 
   770         if (d->mAbleToScrollX && d->mHorizontalScrollBar->isVisible()) {
   783         if (d->mAbleToScrollX && d->mHorizontalScrollBar->isVisible()) {
   771             d->updateScrollBar(Qt::Horizontal);
   784             d->updateScrollBar(Qt::Horizontal);