src/hbcore/gui/hbtoolbar_p.cpp
changeset 30 80e4d18b72f5
parent 23 e6ad4ef83b23
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    41 
    41 
    42 #include <QGraphicsLinearLayout>
    42 #include <QGraphicsLinearLayout>
    43 #include <QGraphicsSceneResizeEvent>
    43 #include <QGraphicsSceneResizeEvent>
    44 #include <QWidget> // for QWIDGETSIZE_MAX
    44 #include <QWidget> // for QWIDGETSIZE_MAX
    45 #include <QActionEvent>
    45 #include <QActionEvent>
       
    46 #include <QMetaMethod>
    46 #include <QDebug>
    47 #include <QDebug>
    47 
    48 
    48 #ifdef HB_EFFECTS
    49 #ifdef HB_EFFECTS
    49 #include "hbeffectinternal_p.h"
    50 #include "hbeffectinternal_p.h"
    50 #define HB_TOOLBAR_ITEM_TYPE "HB_TOOLBAR"
    51 #define HB_TOOLBAR_ITEM_TYPE "HB_TOOLBAR"
    72         moreExtensionButton(0),
    73         moreExtensionButton(0),
    73         mDialogToolBar(false),
    74         mDialogToolBar(false),
    74         mDoLayoutPending(true),
    75         mDoLayoutPending(true),
    75         mOrientationEffectsRunning(false),
    76         mOrientationEffectsRunning(false),
    76         mSuppressNextAppearEffect(false),
    77         mSuppressNextAppearEffect(false),
    77         mAppearedOnce(false)
    78         mAppearedOnce(false),
       
    79         initialButtonsPolish(true)
    78 {
    80 {
    79 }
    81 }
    80 
    82 
    81 HbToolBarPrivate::~HbToolBarPrivate()
    83 HbToolBarPrivate::~HbToolBarPrivate()
    82 {
    84 {
   579         HbToolBarExtensionPrivate::d_ptr(moreExtension)->doLayout();
   581         HbToolBarExtensionPrivate::d_ptr(moreExtension)->doLayout();
   580     }    
   582     }    
   581     updateButtons(maxToolBarButtons);        
   583     updateButtons(maxToolBarButtons);        
   582     q->setLayout(mLayout);
   584     q->setLayout(mLayout);
   583     q->layout()->setMinimumSize(minimumToolButtonSize);
   585     q->layout()->setMinimumSize(minimumToolButtonSize);
       
   586     //This needs to be done when toolbar is not in a dialog and being added first time to view.
       
   587     //Since toolbar needs to make a decision of having a more button or not based on the no of actions and
       
   588     //its width. Width is not set correctly till hbscreen layout is activated.HbScreen layout is activated before
       
   589     //the paint but its too late for toolbar since all the polish handling is done beforei.e toolbuttons layout is not
       
   590     //activated before the paint
       
   591     if (initialButtonsPolish && !mDialogToolBar && q->scene()) {
       
   592         int slotIndex = q->scene()->metaObject()->indexOfSlot("_q_polishItems()");
       
   593         QMetaMethod method = q->scene()->metaObject()->method(slotIndex);
       
   594         method.invoke(q->scene());
       
   595         for (int i = 0; i < visibleItemsCount; i++) {
       
   596             HbToolButton *button = mVisibleToolButtons.at(i);
       
   597             if (button && button->layout() && !button->layout()->isActivated())
       
   598                 button->layout()->activate();
       
   599         }
       
   600         q->layout()->activate();
       
   601     }
       
   602     initialButtonsPolish = false;
   584     if (delayedStartEffects && hasEffects && !mSuppressNextAppearEffect) {
   603     if (delayedStartEffects && hasEffects && !mSuppressNextAppearEffect) {
   585         startAppearEffect();
   604         startAppearEffect();
   586         delayedStartEffects = false;
   605         delayedStartEffects = false;
   587     }
   606     }
   588 }
   607 }