src/hbcore/gui/hbtoolbar.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbcore/gui/hbtoolbar.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/gui/hbtoolbar.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -37,6 +37,7 @@
 #include "hbactionmanager_p.h"
 #include "hbmainwindow_p.h"
 #include "hbcolorscheme.h"
+#include "hbevent.h"
 
 #include <hbwidgetfeedback.h>
 
@@ -463,6 +464,14 @@
     if (event->type() == QEvent::LayoutDirectionChange) {
         d->updateToolBarExtensions();
         d->updateButtonsLayoutDirection();
+    } else if (event->type() == HbEvent::ThemeChanged) {        
+        // forward change event to toolbuttons
+        if (d->moreExtensionButton) {
+            d->moreExtensionButton->event(event);
+        }
+        foreach(HbToolButton *button, d->mToolButtons) {
+            button->event(event);
+        }
     }
 
     QGraphicsWidget::changeEvent(event);
@@ -475,7 +484,7 @@
 {
     Q_D(HbToolBar);
     HbWidget::resizeEvent(event);
-    if (isVisible()) {
+    if (d->polished && isVisible()) {
         d->updateToolBarForSizeChange();
     }
 }
@@ -543,7 +552,12 @@
 void HbToolBar::polish(HbStyleParameters &params)
 {
     Q_D(HbToolBar);
-    if (d->mDoLayoutPending && isVisible()) {
+    bool resize = d->mDialogToolBar || testAttribute(Qt::WA_Resized) ||
+                  !parentItem() || (parentLayoutItem() && !parentLayoutItem()->isLayout())
+                  || (parentLayoutItem() && parentLayoutItem()->isLayout() && static_cast<QGraphicsLayout*>(parentLayoutItem())->isActivated())
+                  || d->polished;
+    if (d->mDoLayoutPending && isVisible() && resize) {
+        d->initialButtonsPolish = false;
         d->doLayout();
     }
     HbWidget::polish(params);