radioapp/radiowidgets/src/radiostripbase.cpp
changeset 16 f54ebcfc1b80
parent 14 63aabac4416d
child 19 afea38384506
equal deleted inserted replaced
14:63aabac4416d 16:f54ebcfc1b80
    37     mSpacing( 0 ),
    37     mSpacing( 0 ),
    38     mItemPoolParent( new QGraphicsWidget( NULL ) ),
    38     mItemPoolParent( new QGraphicsWidget( NULL ) ),
    39     mCurrentIndex( 0 ),
    39     mCurrentIndex( 0 ),
    40     mPressedIndex( 0 ),
    40     mPressedIndex( 0 ),
    41     mStripLength( 0 ),
    41     mStripLength( 0 ),
    42     mContentsLength( 0 ),
    42     mContentsLength( 0 )
    43     mBackgroundImage( 0 )
       
    44 {
    43 {
    45     setClampingStyle( HbScrollArea::NoClamping );
    44     setClampingStyle( HbScrollArea::NoClamping );
    46     setScrollDirections( Qt::Horizontal );
    45     setScrollDirections( Qt::Horizontal );
    47     setFlag( QGraphicsItem::ItemClipsChildrenToShape, true );
    46     setFlag( QGraphicsItem::ItemClipsChildrenToShape, true );
    48     setContentWidget( mStripContainer );
    47     setContentWidget( mStripContainer );
    67 }
    66 }
    68 
    67 
    69 /*!
    68 /*!
    70  *
    69  *
    71  */
    70  */
    72 void RadioStripBase::setBackground( const HbIcon& background )
       
    73 {
       
    74     // Create background image for the entire widget
       
    75     mBackground = background;
       
    76     if ( !mBackgroundImage ) {
       
    77         mBackgroundImage = new QGraphicsPixmapItem( this );
       
    78     }
       
    79     mBackgroundImage->setPixmap( mBackground.pixmap() );
       
    80     mBackgroundImage->setOffset( QPointF( 0.0, 0.0 ) );
       
    81     mBackgroundImage->setZValue( -10.0 );
       
    82 }
       
    83 
       
    84 /*!
       
    85  *
       
    86  */
       
    87 HbIcon RadioStripBase::background() const
       
    88 {
       
    89     return mBackground;
       
    90 }
       
    91 
       
    92 /*!
       
    93  *
       
    94  */
       
    95 void RadioStripBase::setAutoScrollTime( const int time )
    71 void RadioStripBase::setAutoScrollTime( const int time )
    96 {
    72 {
    97     mAutoScrollTime = time;
    73     mAutoScrollTime = time;
    98 }
    74 }
    99 
    75 
   216 /*!
   192 /*!
   217  * \reimp
   193  * \reimp
   218  */
   194  */
   219 void RadioStripBase::resizeEvent( QGraphicsSceneResizeEvent* event )
   195 void RadioStripBase::resizeEvent( QGraphicsSceneResizeEvent* event )
   220 {
   196 {
   221     if ( mBackgroundImage ) {
   197     Q_UNUSED( event );
   222         QPixmap background = mBackgroundImage->pixmap().scaledToWidth( event->newSize().width() );
       
   223         mBackgroundImage->setPixmap( background );
       
   224     }
       
   225     populateAndLayout();
   198     populateAndLayout();
   226 }
   199 }
   227 
   200 
   228 /*!
   201 /*!
   229  * \reimp
   202  * \reimp