src/hbcore/gui/hbtoolbar.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    35 #include "hbwidget_p.h"
    35 #include "hbwidget_p.h"
    36 #include "hbinstance.h"
    36 #include "hbinstance.h"
    37 #include "hbactionmanager_p.h"
    37 #include "hbactionmanager_p.h"
    38 #include "hbmainwindow_p.h"
    38 #include "hbmainwindow_p.h"
    39 #include "hbcolorscheme.h"
    39 #include "hbcolorscheme.h"
       
    40 #include "hbevent.h"
    40 
    41 
    41 #include <hbwidgetfeedback.h>
    42 #include <hbwidgetfeedback.h>
    42 
    43 
    43 #include <QGraphicsLinearLayout>
    44 #include <QGraphicsLinearLayout>
    44 #include <QGraphicsSceneResizeEvent>
    45 #include <QGraphicsSceneResizeEvent>
   461 {
   462 {
   462     Q_D(HbToolBar);
   463     Q_D(HbToolBar);
   463     if (event->type() == QEvent::LayoutDirectionChange) {
   464     if (event->type() == QEvent::LayoutDirectionChange) {
   464         d->updateToolBarExtensions();
   465         d->updateToolBarExtensions();
   465         d->updateButtonsLayoutDirection();
   466         d->updateButtonsLayoutDirection();
       
   467     } else if (event->type() == HbEvent::ThemeChanged) {        
       
   468         // forward change event to toolbuttons
       
   469         if (d->moreExtensionButton) {
       
   470             d->moreExtensionButton->event(event);
       
   471         }
       
   472         foreach(HbToolButton *button, d->mToolButtons) {
       
   473             button->event(event);
       
   474         }
   466     }
   475     }
   467 
   476 
   468     QGraphicsWidget::changeEvent(event);
   477     QGraphicsWidget::changeEvent(event);
   469 }
   478 }
   470 
   479 
   473  */
   482  */
   474 void HbToolBar::resizeEvent(QGraphicsSceneResizeEvent *event)
   483 void HbToolBar::resizeEvent(QGraphicsSceneResizeEvent *event)
   475 {
   484 {
   476     Q_D(HbToolBar);
   485     Q_D(HbToolBar);
   477     HbWidget::resizeEvent(event);
   486     HbWidget::resizeEvent(event);
   478     if (isVisible()) {
   487     if (d->polished && isVisible()) {
   479         d->updateToolBarForSizeChange();
   488         d->updateToolBarForSizeChange();
   480     }
   489     }
   481 }
   490 }
   482 
   491 
   483 /*!
   492 /*!
   541     \reimp
   550     \reimp
   542  */
   551  */
   543 void HbToolBar::polish(HbStyleParameters &params)
   552 void HbToolBar::polish(HbStyleParameters &params)
   544 {
   553 {
   545     Q_D(HbToolBar);
   554     Q_D(HbToolBar);
   546     if (d->mDoLayoutPending && isVisible()) {
   555     bool resize = d->mDialogToolBar || testAttribute(Qt::WA_Resized) ||
       
   556                   !parentItem() || (parentLayoutItem() && !parentLayoutItem()->isLayout())
       
   557                   || (parentLayoutItem() && parentLayoutItem()->isLayout() && static_cast<QGraphicsLayout*>(parentLayoutItem())->isActivated())
       
   558                   || d->polished;
       
   559     if (d->mDoLayoutPending && isVisible() && resize) {
       
   560         d->initialButtonsPolish = false;
   547         d->doLayout();
   561         d->doLayout();
   548     }
   562     }
   549     HbWidget::polish(params);
   563     HbWidget::polish(params);
   550 }
   564 }
   551 
   565