src/hbwidgets/widgets/hbcombodropdown_p.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    32 
    32 
    33 #include <hbtapgesture.h>
    33 #include <hbtapgesture.h>
    34 #include <hbpangesture.h>
    34 #include <hbpangesture.h>
    35 #include <QGestureEvent>
    35 #include <QGestureEvent>
    36 #include <QGraphicsSceneMouseEvent>
    36 #include <QGraphicsSceneMouseEvent>
       
    37 
       
    38 #include <hbeffect.h>
    37 
    39 
    38 class HbComboDropDownPrivate : public HbWidgetPrivate
    40 class HbComboDropDownPrivate : public HbWidgetPrivate
    39 {
    41 {
    40 };
    42 };
    41 HbComboDropDown::HbComboDropDown( HbComboBoxPrivate *comboBoxPrivate, QGraphicsItem *parent )
    43 HbComboDropDown::HbComboDropDown( HbComboBoxPrivate *comboBoxPrivate, QGraphicsItem *parent )
    78 {
    80 {
    79     vkbOpened = false;
    81     vkbOpened = false;
    80     comboPrivate->vkbClosed( );
    82     comboPrivate->vkbClosed( );
    81 }
    83 }
    82 
    84 
       
    85 #ifdef HB_EFFECTS
       
    86 void HbComboDropDown::dismissEffectFinished( HbEffect::EffectStatus status )
       
    87 {
       
    88     Q_UNUSED( status );
       
    89 
       
    90     setVisible( false );
       
    91 }
       
    92 #endif
       
    93 
    83 bool HbComboDropDown::eventFilter( QObject *obj, QEvent *event )
    94 bool HbComboDropDown::eventFilter( QObject *obj, QEvent *event )
    84 {
    95 {
    85     Q_UNUSED( obj );
    96     Q_UNUSED( obj );
    86     bool accepted = false;
    97     bool accepted = false;
    87 
    98 
    98                         HbTapGesture *tapGesture = qobject_cast<HbTapGesture *>(gestureEvent->gesture(Qt::TapGesture));
   109                         HbTapGesture *tapGesture = qobject_cast<HbTapGesture *>(gestureEvent->gesture(Qt::TapGesture));
    99                         if( tapGesture && tapGesture->state() == Qt::GestureStarted ) {
   110                         if( tapGesture && tapGesture->state() == Qt::GestureStarted ) {
   100                             if( !vkbOpened ) {
   111                             if( !vkbOpened ) {
   101                                 //if vkb is not opened and dropdown is not clicked then dismiss drop down
   112                                 //if vkb is not opened and dropdown is not clicked then dismiss drop down
   102                                 if( !( this->isUnderMouse( ) ) ) {
   113                                 if( !( this->isUnderMouse( ) ) ) {
       
   114                                     
   103                                     HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
   115                                     HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
   104                                     setVisible( false );
   116                                     comboPrivate->showDismissEffect( );
   105                                     comboPrivate->q_ptr->setProperty("state","normal");
   117                                     comboPrivate->q_ptr->setProperty("state","normal");
   106                                     backgroundPressed = true;
   118                                     backgroundPressed = true;
   107                                     accepted = true;
   119                                     accepted = true;
   108                                 }
   120                                 }
   109                             } else {
   121                             } else {
   119                                         QRectF vkbArea = vkbWidget->mapToScene( tmp ).boundingRect( );
   131                                         QRectF vkbArea = vkbWidget->mapToScene( tmp ).boundingRect( );
   120                                         //QGraphicsSceneMouseEvent *mouseEvent = 
   132                                         //QGraphicsSceneMouseEvent *mouseEvent = 
   121                                         //    static_cast< QGraphicsSceneMouseEvent * >( event );
   133                                         //    static_cast< QGraphicsSceneMouseEvent * >( event );
   122                                         if( !( this->isUnderMouse( ) ) &&
   134                                         if( !( this->isUnderMouse( ) ) &&
   123                                             !vkbArea.contains( /*mouseEvent->scenePos( )*/ tapGesture->sceneStartPos() ) ) {
   135                                             !vkbArea.contains( /*mouseEvent->scenePos( )*/ tapGesture->sceneStartPos() ) ) {
       
   136                                             comboPrivate->showDismissEffect( );
   124                                             HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
   137                                             HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
   125                                             setVisible( false );
       
   126                                             comboPrivate->q_ptr->setProperty( "state", "normal" );
   138                                             comboPrivate->q_ptr->setProperty( "state", "normal" );
   127                                             backgroundPressed = true;
   139                                             backgroundPressed = true;
   128                                             accepted = true;
   140                                             accepted = true;
   129                                         }
   141                                         }
   130                                     }
   142                                     }