src/hbcore/gui/hbtoolbutton.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
   246            if(!q->isCheckable()){
   246            if(!q->isCheckable()){
   247                 data->frameGraphicsName = QLatin1String("qtg_fr_popup_grid_pressed");
   247                 data->frameGraphicsName = QLatin1String("qtg_fr_popup_grid_pressed");
   248             } else {
   248             } else {
   249                 data->frameGraphicsName = QLatin1String("qtg_fr_tb_ext");
   249                 data->frameGraphicsName = QLatin1String("qtg_fr_tb_ext");
   250             }
   250             }
       
   251         } else {
       
   252             data->frameGraphicsName = QLatin1String("");
   251         }
   253         }
   252     data->frameType = HbFrameDrawer::NinePieces;
   254     data->frameType = HbFrameDrawer::NinePieces;
   253     return;
   255     return;
   254     }
   256     }
   255 
   257 
   345 
   347 
   346 }
   348 }
   347 void HbToolButtonPrivate::iconPrimitiveData(HbStyleIconPrimitiveData *data)
   349 void HbToolButtonPrivate::iconPrimitiveData(HbStyleIconPrimitiveData *data)
   348 {
   350 {
   349     Q_Q(HbToolButton);
   351     Q_Q(HbToolButton);
   350     if (q->action())
   352     if (q->action()) {
   351         data->icon = q->action()->icon();
   353         data->icon = q->action()->icon();
   352 
   354     } else if(action){
       
   355         data->icon = action->icon();
       
   356     }
   353     data->iconMode = HbStylePrivate::iconMode(data->state);
   357     data->iconMode = HbStylePrivate::iconMode(data->state);
   354     data->iconState = HbStylePrivate::iconState(data->state);
   358     data->iconState = HbStylePrivate::iconState(data->state);
   355     return;
   359     return;
   356 }
   360 }
   357 void HbToolButtonPrivate::textPrimitiveData(HbStyleTextPrimitiveData *data)
   361 void HbToolButtonPrivate::textPrimitiveData(HbStyleTextPrimitiveData *data)
   358 {
   362 {
   359     Q_Q(HbToolButton);
   363     if(action) {
   360     if (q->action())
   364         data->text = action->text();
   361         data->text = q->action()->text();
   365     }
   362     return;
       
   363 }
   366 }
   364 
   367 
   365 QSizeF HbToolButtonPrivate::getMinimumSize()
   368 QSizeF HbToolButtonPrivate::getMinimumSize()
   366 {
   369 {
   367     Q_Q(HbToolButton);
   370     Q_Q(HbToolButton);
   631 }
   634 }
   632 
   635 
   633 /*!
   636 /*!
   634     \reimp
   637     \reimp
   635  */
   638  */
       
   639 void HbToolButton::checkStateSet()
       
   640 {
       
   641     Q_D(HbToolButton);
       
   642     if (d->checked || (d->checkable && d->down)) {
       
   643         setProperty( "state", "latched" );
       
   644     } else if (d->down) {
       
   645         setProperty( "state", "pressed" );
       
   646     } else {
       
   647         setProperty( "state", "normal" );
       
   648     }
       
   649 }
       
   650 
       
   651 /*!
       
   652     \reimp
       
   653  */
   636 bool HbToolButton::sceneEvent(QEvent *event)
   654 bool HbToolButton::sceneEvent(QEvent *event)
   637 {
   655 {
   638     if (event->type() == QEvent::GraphicsSceneHelp) {
   656     if (event->type() == QEvent::GraphicsSceneHelp) {
   639         Q_D(HbToolButton);
   657         Q_D(HbToolButton);
   640         // Check whether toolbutton is inside a toolbar.
   658         // Check whether toolbutton is inside a toolbar.