src/hbwidgets/widgets/hbcheckbox.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
   124 */
   124 */
   125 void HbCheckBoxPrivate::createPrimitives( )
   125 void HbCheckBoxPrivate::createPrimitives( )
   126 {
   126 {
   127     Q_Q( HbCheckBox );
   127     Q_Q( HbCheckBox );
   128     if( !mTouchArea ) {
   128     if( !mTouchArea ) {
   129         mTouchArea = q->style( )->createPrimitive( HbStyle::P_CheckBox_toucharea, q );
   129         mTouchArea = HbStylePrivate::createPrimitive( HbStylePrivate::P_CheckBox_toucharea, q );
   130         if( QGraphicsObject *ta = qgraphicsitem_cast<QGraphicsObject*>( mTouchArea ) ) {
   130         if( QGraphicsObject *ta = qgraphicsitem_cast<QGraphicsObject*>( mTouchArea ) ) {
   131             ta->grabGesture( Qt::TapGesture );
   131             ta->grabGesture( Qt::TapGesture );
   132         }
   132         }
   133     }
   133     }
   134     if ( !mTextItem ) {
   134     if ( !mTextItem ) {
   135         mTextItem = q->style( )->createPrimitive( HbStyle::P_CheckBox_text, q );
   135         mTextItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_CheckBox_text, q );
   136         }
   136         }
   137     if ( !mIconItem ) {
   137     if ( !mIconItem ) {
   138         mIconItem = q->style( )->createPrimitive( HbStyle::P_CheckBox_icon, q );
   138         mIconItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_CheckBox_icon, q );
   139     }
   139     }
   140 }
   140 }
   141 
   141 
   142 /*!
   142 /*!
   143     @beta
   143     @beta
   251         d->mText = text;
   251         d->mText = text;
   252         //updatePrimitives();
   252         //updatePrimitives();
   253         if( d->mTextItem ){
   253         if( d->mTextItem ){
   254             HbStyleOptionCheckBox checkBoxOption;
   254             HbStyleOptionCheckBox checkBoxOption;
   255             initStyleOption( &checkBoxOption );
   255             initStyleOption( &checkBoxOption );
   256             style( )->updatePrimitive( d->mTextItem, HbStyle::P_CheckBox_text, &checkBoxOption );
   256             HbStylePrivate::updatePrimitive( d->mTextItem, HbStylePrivate::P_CheckBox_text, &checkBoxOption );
   257         }
   257         }
   258     }    
   258     }    
   259 }
   259 }
   260 
   260 
   261 /*!
   261 /*!
   318 QGraphicsItem *HbCheckBox::primitive( HbStyle::Primitive primitive ) const
   318 QGraphicsItem *HbCheckBox::primitive( HbStyle::Primitive primitive ) const
   319 {
   319 {
   320     Q_D( const HbCheckBox );
   320     Q_D( const HbCheckBox );
   321 
   321 
   322     switch ( primitive ) {
   322     switch ( primitive ) {
   323         case HbStyle::P_CheckBox_text:
   323         case HbStylePrivate::P_CheckBox_text:
   324             return d->mTextItem;
   324             return d->mTextItem;
   325         case HbStyle::P_CheckBox_toucharea:
   325         case HbStylePrivate::P_CheckBox_toucharea:
   326             return d->mTouchArea;
   326             return d->mTouchArea;
   327         case HbStyle::P_CheckBox_icon:
   327         case HbStylePrivate::P_CheckBox_icon:
   328             return d->mIconItem;
   328             return d->mIconItem;
   329         default:
   329         default:
   330             return 0;
   330             return 0;
   331     }
   331     }
   332 }
   332 }
   367 
   367 
   368     HbStyleOptionCheckBox checkBoxOption;
   368     HbStyleOptionCheckBox checkBoxOption;
   369     initStyleOption( &checkBoxOption );
   369     initStyleOption( &checkBoxOption );
   370 
   370 
   371     if ( d->mTextItem ) {
   371     if ( d->mTextItem ) {
   372         style( )->updatePrimitive( d->mTextItem, HbStyle::P_CheckBox_text, &checkBoxOption );
   372         HbStylePrivate::updatePrimitive( d->mTextItem, HbStylePrivate::P_CheckBox_text, &checkBoxOption );
   373     }
   373     }
   374     if ( d->mIconItem ) {
   374     if ( d->mIconItem ) {
   375         style( )->updatePrimitive( d->mIconItem, HbStyle::P_CheckBox_icon, &checkBoxOption );
   375         HbStylePrivate::updatePrimitive( d->mIconItem, HbStylePrivate::P_CheckBox_icon, &checkBoxOption );
   376     }
   376     }
   377     if (d->mTouchArea) {
   377     if (d->mTouchArea) {
   378         style( )->updatePrimitive( d->mTouchArea, HbStyle::P_CheckBox_toucharea, &checkBoxOption );
   378         HbStylePrivate::updatePrimitive( d->mTouchArea, HbStylePrivate::P_CheckBox_toucharea, &checkBoxOption );
   379     }
   379     }
   380 }
   380 }
   381 
   381 
   382 /*!
   382 /*!
   383     Initializes the style for check box with the \a option passed.
   383     Initializes the style for check box with the \a option passed.