src/hbcore/gui/hbcontentwidget.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 7 923ff622b8b9
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    40   switch effects and other features.
    40   switch effects and other features.
    41 
    41 
    42   \internal
    42   \internal
    43 */
    43 */
    44 
    44 
    45 HbContentWidget::HbContentWidget(HbMainWindow *mainWindow,QGraphicsItem *parent /*= 0*/):
    45 HbContentWidget::HbContentWidget(HbMainWindow *mainWindow, QGraphicsItem *parent /*= 0*/):
    46     HbStackedWidget(parent),
    46     HbStackedWidget(parent),
    47     mViewSwitchRunning(false),
    47     mViewSwitchRunning(false),
    48     mTargetView(0),
    48     mTargetView(0),
    49     mHidingView(0),
    49     mHidingView(0),
    50     mMainWindow(mainWindow)
    50     mMainWindow(mainWindow)
    53 
    53 
    54 QSizeF HbContentWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
    54 QSizeF HbContentWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
    55 {
    55 {
    56     Q_UNUSED(constraint);
    56     Q_UNUSED(constraint);
    57 
    57 
    58     QSizeF size;    
    58     QSizeF size;
    59 
    59 
    60     switch (which) {
    60     switch (which) {
    61     case Qt::MinimumSize:
    61     case Qt::MinimumSize:
    62         size = QSizeF(0, 0);
    62         size = QSizeF(0, 0);
    63         break;
    63         break;
    64     
    64 
    65     case Qt::PreferredSize:
    65     case Qt::PreferredSize: {
    66     {
       
    67         HbDeviceProfile profile(HbDeviceProfile::profile(this));
    66         HbDeviceProfile profile(HbDeviceProfile::profile(this));
    68         size = profile.logicalSize();
    67         size = profile.logicalSize();
    69         if (!size.isValid()) {
    68         if (!size.isValid()) {
    70             size = QSizeF(1000, 1000);
    69             size = QSizeF(1000, 1000);
    71         }
    70         }
   198     // messed up state in mainwindow, the stack widget, etc. due to events coming during
   197     // messed up state in mainwindow, the stack widget, etc. due to events coming during
   199     // the view switch animation.
   198     // the view switch animation.
   200     // 2nd param (hideOld): We still want to see the old view (normally setCurrentWidget would hide it).
   199     // 2nd param (hideOld): We still want to see the old view (normally setCurrentWidget would hide it).
   201     // 3rd param (showNew): The new view is not yet needed (the effect will take care of making it visible).
   200     // 3rd param (showNew): The new view is not yet needed (the effect will take care of making it visible).
   202     setCurrentWidget(mTargetView, false, false);
   201     setCurrentWidget(mTargetView, false, false);
   203     
   202 
   204     mHidingView = viewToHide;
   203     mHidingView = viewToHide;
   205     mViewSwitchFlags = flags;
   204     mViewSwitchFlags = flags;
   206 
   205 
   207     QGraphicsWidget *effectTarget = getEffectTarget(viewToHide, flags);
   206     QGraphicsWidget *effectTarget = getEffectTarget(viewToHide, flags);
   208     if (effectTarget) {
   207     if (effectTarget) {
   209         mMainWindow->setInteractive(false); // disable input while the effects are running
   208         mMainWindow->setInteractive(false); // disable input while the effects are running
   210         QString event = getEffectEvent("hide", flags, viewToHide, mTargetView);
   209         QString event = getEffectEvent("hide", flags, viewToHide, mTargetView);
   211         HbEffectInternal::EffectFlags effectFlags = 
   210         HbEffectInternal::EffectFlags effectFlags =
   212             HbEffectInternal::ClearEffectWhenFinished // the effect must not be persistent
   211             HbEffectInternal::ClearEffectWhenFinished // the effect must not be persistent
   213             | HbEffectInternal::HideRegItemBeforeClearingEffect; // to prevent unlikely, but possible flicker
   212             | HbEffectInternal::HideRegItemBeforeClearingEffect; // to prevent unlikely, but possible flicker
   214         HbEffectInternal::start(viewToHide, effectTarget, effectFlags,
   213         HbEffectInternal::start(viewToHide, effectTarget, effectFlags,
   215                                 "HB_view", event, this, "hideEffectFinished");
   214                                 "HB_view", event, this, "hideEffectFinished");
   216         if (!(flags & Hb::ViewSwitchSequential)) {
   215         if (!(flags & Hb::ViewSwitchSequential)) {