28 #include <hblistview.h> |
28 #include <hblistview.h> |
29 #include <hbwidgetfeedback.h> |
29 #include <hbwidgetfeedback.h> |
30 |
30 |
31 #ifdef HB_GESTURE_FW |
31 #ifdef HB_GESTURE_FW |
32 #include <hbtapgesture.h> |
32 #include <hbtapgesture.h> |
|
33 #include <hbpangesture.h> |
33 #endif |
34 #endif |
34 |
|
35 |
35 |
36 HbComboDropDown::HbComboDropDown( HbComboBoxPrivate *comboBoxPrivate, QGraphicsItem *parent ) |
36 HbComboDropDown::HbComboDropDown( HbComboBoxPrivate *comboBoxPrivate, QGraphicsItem *parent ) |
37 :HbWidget( parent ), |
37 :HbWidget( parent ), |
38 mList( 0 ), |
38 mList( 0 ), |
39 comboPrivate( comboBoxPrivate ), |
39 comboPrivate( comboBoxPrivate ), |
40 vkbOpened( false ), |
40 vkbOpened( false ), |
41 backgroundPressed( false ) |
41 backgroundPressed( false ) |
42 { |
42 { |
43 setBackgroundItem( HbStyle::P_ComboBoxPopup_background ); |
43 setBackgroundItem( HbStyle::P_ComboBoxPopup_background ); |
44 #if QT_VERSION >= 0x040600 |
44 #if QT_VERSION >= 0x040600 |
45 //this is to keep the focus in the previous widget. |
45 //this is to keep the focus in the previous widget. |
46 setFlag( QGraphicsItem::ItemIsPanel, true ); |
46 setFlag( QGraphicsItem::ItemIsPanel, true ); |
47 setActive( false ); |
47 setActive( false ); |
48 #endif |
48 #endif |
49 //setFlag(QGraphicsItem::ItemIsPanel); |
49 //setFlag(QGraphicsItem::ItemIsPanel); |
50 //setPanelModality(PanelModal); |
50 //setPanelModality(PanelModal); |
51 } |
51 } |
52 |
52 |
53 HbComboDropDown::~HbComboDropDown( ) |
53 HbComboDropDown::~HbComboDropDown( ) |
54 { |
54 { |
55 |
55 |
59 { |
59 { |
60 mList = new HbListView( this ); |
60 mList = new HbListView( this ); |
61 mList->setLongPressEnabled(false); |
61 mList->setLongPressEnabled(false); |
62 HbComboListViewItem *protoType = new HbComboListViewItem(this); |
62 HbComboListViewItem *protoType = new HbComboListViewItem(this); |
63 mList->setItemPrototype( protoType ); |
63 mList->setItemPrototype( protoType ); |
64 HbStyle::setItemName( mList , "list" ); |
64 HbStyle::setItemName( mList, "list" ); |
65 mList->setUniformItemSizes( true ); |
65 mList->setUniformItemSizes( true ); |
66 mList->setSelectionMode( HbAbstractItemView::SingleSelection ); |
66 mList->setSelectionMode( HbAbstractItemView::SingleSelection ); |
67 } |
67 } |
68 |
68 |
69 void HbComboDropDown::keypadOpened( ) |
69 void HbComboDropDown::keypadOpened( ) |
96 } |
96 } |
97 break; |
97 break; |
98 case QEvent::GraphicsSceneMouseRelease: |
98 case QEvent::GraphicsSceneMouseRelease: |
99 { |
99 { |
100 if( !( this->isUnderMouse( ) ) && backgroundPressed ) { |
100 if( !( this->isUnderMouse( ) ) && backgroundPressed ) { |
101 HbWidgetFeedback::triggered(this, Hb::InstantPopupClosed); |
101 HbWidgetFeedback::triggered( this, Hb::InstantPopupClosed ); |
102 setVisible( false ); |
102 setVisible( false ); |
103 backgroundPressed = false; |
103 backgroundPressed = false; |
104 accepted = true; |
104 accepted = true; |
105 } |
105 } |
106 } |
106 } |
107 break; |
107 break; |
108 case QEvent::Gesture: |
108 case QEvent::Gesture: |
109 { |
109 { |
110 if(!this->isUnderMouse()) { |
110 if( !this->isUnderMouse() ) { |
111 accepted = true; |
111 //if its a pan gesture then don't accept the event so that list can be scrolled |
|
112 //even if mouse is outside drop down area |
|
113 if(QGestureEvent *gestureEvent = static_cast<QGestureEvent *>( event ) ) { |
|
114 if( !qobject_cast<HbPanGesture *>( gestureEvent->gesture( Qt::PanGesture ) ) ) { |
|
115 accepted = true; |
|
116 } |
|
117 } |
112 } |
118 } |
113 } |
119 } |
114 break; |
120 break; |
115 default: |
121 default: |
116 break; |
122 break; |