src/hbwidgets/widgets/hbcombodropdown_p.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 3 11d3954df52a
--- a/src/hbwidgets/widgets/hbcombodropdown_p.cpp	Mon May 03 12:48:33 2010 +0300
+++ b/src/hbwidgets/widgets/hbcombodropdown_p.cpp	Fri May 14 16:09:54 2010 +0300
@@ -30,9 +30,9 @@
 
 #ifdef HB_GESTURE_FW
 #include <hbtapgesture.h>
+#include <hbpangesture.h>
 #endif
 
-
 HbComboDropDown::HbComboDropDown( HbComboBoxPrivate *comboBoxPrivate, QGraphicsItem *parent )
         :HbWidget( parent ),
          mList( 0 ),
@@ -40,14 +40,14 @@
          vkbOpened( false ),
          backgroundPressed( false )
 {
-	setBackgroundItem( HbStyle::P_ComboBoxPopup_background );
+    setBackgroundItem( HbStyle::P_ComboBoxPopup_background );
     #if QT_VERSION >= 0x040600
         //this is to keep the focus in the previous widget.
         setFlag( QGraphicsItem::ItemIsPanel, true );
         setActive( false );
     #endif
-        //setFlag(QGraphicsItem::ItemIsPanel);
-        //setPanelModality(PanelModal);
+    //setFlag(QGraphicsItem::ItemIsPanel);
+    //setPanelModality(PanelModal);
 }
 
 HbComboDropDown::~HbComboDropDown( )
@@ -61,7 +61,7 @@
    mList->setLongPressEnabled(false);
    HbComboListViewItem *protoType = new HbComboListViewItem(this);
    mList->setItemPrototype( protoType );
-   HbStyle::setItemName( mList , "list" );
+   HbStyle::setItemName( mList, "list" );
    mList->setUniformItemSizes( true );
    mList->setSelectionMode( HbAbstractItemView::SingleSelection );
 }
@@ -98,7 +98,7 @@
         case QEvent::GraphicsSceneMouseRelease:
             {
                 if( !( this->isUnderMouse( ) ) && backgroundPressed ) {
-                    HbWidgetFeedback::triggered(this, Hb::InstantPopupClosed);
+                    HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed );
                     setVisible( false );
                     backgroundPressed = false;
                     accepted = true;
@@ -107,8 +107,14 @@
             break;
         case QEvent::Gesture:
             {
-                if(!this->isUnderMouse()) {
-                    accepted = true;
+                if( !this->isUnderMouse() ) {
+                    //if its a pan gesture then don't accept the event so that list can be scrolled
+                    //even if mouse is outside drop down area
+                    if(QGestureEvent *gestureEvent = static_cast<QGestureEvent *>( event ) ) {
+                        if( !qobject_cast<HbPanGesture *>( gestureEvent->gesture( Qt::PanGesture ) ) ) {
+                            accepted = true;
+                        }
+                    }
                 }
             }
             break;