src/hbwidgets/widgets/hbpushbutton.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
--- a/src/hbwidgets/widgets/hbpushbutton.cpp	Wed Jun 23 18:33:25 2010 +0300
+++ b/src/hbwidgets/widgets/hbpushbutton.cpp	Tue Jul 06 14:36:53 2010 +0300
@@ -417,6 +417,9 @@
             HbStyleOptionPushButton buttonOption;
             initStyleOption( &buttonOption );
             style( )->updatePrimitive( d->additionalTextItem, HbStyle::P_PushButton_additionaltext, &buttonOption);
+            if ( isEnabled() ) {
+                setProperty("state", "normal");
+            }
         }
         if( doPolish ) {
             repolish();
@@ -449,7 +452,8 @@
     Q_D(HbPushButton);
 
     if ( d->icon != icon ) {
-        bool doPolish = icon.isNull( ) || d->icon.isNull();
+        //checking for d->polished to avoid extra polish loop
+        bool doPolish = (icon.isNull( ) || d->icon.isNull()) && d->polished;
         d->icon = icon;
         d->createPrimitives( );
         //updatePrimitives();
@@ -463,13 +467,7 @@
 
         }
         if( doPolish ) {
-            //Instead of posting an event we are directly sending polish and layout request
-            //event because during runtime if icon is set for the first time some
-            //flickering was coming. That was coming because icon was getting painted
-            //before polish.
-            QEvent* polishEvent = new QEvent( QEvent::Polish );
-            QCoreApplication::sendEvent(this, polishEvent);
-            QApplication::sendPostedEvents(this, QEvent::LayoutRequest);
+            repolish();
         }
     }
 }