src/hbwidgets/widgets/hbpushbutton.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
6:c3690ec91ef8 7:923ff622b8b9
   415         // updatePrimitives();
   415         // updatePrimitives();
   416         if( d->additionalTextItem ) {
   416         if( d->additionalTextItem ) {
   417             HbStyleOptionPushButton buttonOption;
   417             HbStyleOptionPushButton buttonOption;
   418             initStyleOption( &buttonOption );
   418             initStyleOption( &buttonOption );
   419             style( )->updatePrimitive( d->additionalTextItem, HbStyle::P_PushButton_additionaltext, &buttonOption);
   419             style( )->updatePrimitive( d->additionalTextItem, HbStyle::P_PushButton_additionaltext, &buttonOption);
       
   420             if ( isEnabled() ) {
       
   421                 setProperty("state", "normal");
       
   422             }
   420         }
   423         }
   421         if( doPolish ) {
   424         if( doPolish ) {
   422             repolish();
   425             repolish();
   423         }
   426         }
   424     }
   427     }
   447 void HbPushButton::setIcon( const HbIcon &icon )
   450 void HbPushButton::setIcon( const HbIcon &icon )
   448 {
   451 {
   449     Q_D(HbPushButton);
   452     Q_D(HbPushButton);
   450 
   453 
   451     if ( d->icon != icon ) {
   454     if ( d->icon != icon ) {
   452         bool doPolish = icon.isNull( ) || d->icon.isNull();
   455         //checking for d->polished to avoid extra polish loop
       
   456         bool doPolish = (icon.isNull( ) || d->icon.isNull()) && d->polished;
   453         d->icon = icon;
   457         d->icon = icon;
   454         d->createPrimitives( );
   458         d->createPrimitives( );
   455         //updatePrimitives();
   459         //updatePrimitives();
   456         if( d->iconItem ) {
   460         if( d->iconItem ) {
   457             HbStyleOptionPushButton buttonOption;
   461             HbStyleOptionPushButton buttonOption;
   461                 setProperty("state", "normal");
   465                 setProperty("state", "normal");
   462             } 
   466             } 
   463 
   467 
   464         }
   468         }
   465         if( doPolish ) {
   469         if( doPolish ) {
   466             //Instead of posting an event we are directly sending polish and layout request
   470             repolish();
   467             //event because during runtime if icon is set for the first time some
       
   468             //flickering was coming. That was coming because icon was getting painted
       
   469             //before polish.
       
   470             QEvent* polishEvent = new QEvent( QEvent::Polish );
       
   471             QCoreApplication::sendEvent(this, polishEvent);
       
   472             QApplication::sendPostedEvents(this, QEvent::LayoutRequest);
       
   473         }
   471         }
   474     }
   472     }
   475 }
   473 }
   476 
   474 
   477 /*!
   475 /*!