ganeswidgets/src/hgcontainer.cpp
changeset 14 645b870db620
parent 12 6c0ec0ccd2d4
child 17 a10844a9914d
equal deleted inserted replaced
12:6c0ec0ccd2d4 14:645b870db620
   454 
   454 
   455 void HgContainer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
   455 void HgContainer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
   456 {
   456 {
   457     Q_UNUSED(option)
   457     Q_UNUSED(option)
   458     Q_UNUSED(widget)
   458     Q_UNUSED(widget)
   459 
   459     
   460     // update spring position at paint if needed,
   460     // update spring position at paint if needed,
   461     // this is hack for scrollbar, since dragging it
   461     // this is hack for scrollbar, since dragging it
   462     // causes also paint events in here
   462     // causes also paint events in here
   463     if (mSpring.updatePositionIfNeeded())
   463     if (mSpring.updatePositionIfNeeded())
   464     {
   464     {
   467         emit scrollPositionChanged(pos, true);
   467         emit scrollPositionChanged(pos, true);
   468     }
   468     }
   469 
   469 
   470     QPainter::RenderHints hints = painter->renderHints();
   470     QPainter::RenderHints hints = painter->renderHints();
   471     painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
   471     painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
   472 
       
   473 
   472 
   474     // interpolate spring velocity towards zero, this is done
   473     // interpolate spring velocity towards zero, this is done
   475     // so that spring velocity for rendering doesn't drop directly to
   474     // so that spring velocity for rendering doesn't drop directly to
   476     // zero when dragging starts
   475     // zero when dragging starts
   477     qreal springVel = mSpring.velocity().x();
   476     qreal springVel = mSpring.velocity().x();
   552 
   551 
   553 void HgContainer::init(Qt::Orientation scrollDirection)
   552 void HgContainer::init(Qt::Orientation scrollDirection)
   554 {
   553 {
   555     FUNC_LOG;
   554     FUNC_LOG;
   556 
   555 
       
   556     setFlag( QGraphicsItem::ItemClipsToShape, true );    
       
   557     
   557     mRenderer = createRenderer(scrollDirection);
   558     mRenderer = createRenderer(scrollDirection);
   558     mOrientation = scrollDirection;
   559     mOrientation = scrollDirection;
   559 
   560 
   560     mQuadRenderer = mRenderer->getRenderer();
   561     mQuadRenderer = mRenderer->getRenderer();
   561 
   562 
   696             {
   697             {
   697             case Qt::GestureStarted:
   698             case Qt::GestureStarted:
   698                 {
   699                 {
   699                 if (mRenderer->coverflowModeEnabled() || !mSpring.isActive()) {
   700                 if (mRenderer->coverflowModeEnabled() || !mSpring.isActive()) {
   700                     mIgnoreGestureAction = false;
   701                     mIgnoreGestureAction = false;
   701 
   702                     
   702                     if (mHandleLongPress) {
   703                     if (mHandleLongPress) {
   703                         if (mRenderer->coverflowModeEnabled()) {
   704                         if (mRenderer->coverflowModeEnabled()) {
   704                             // in coverflow mode we react to longtap only if animation is not on and
   705                             // in coverflow mode we react to longtap only if animation is not on and
   705                             // center item is tapped.
   706                             // center item is tapped.
   706                             int temp = 0;
   707                             int temp = 0;