src/hbwidgets/widgets/hbcombobox_p.cpp
changeset 7 923ff622b8b9
parent 6 c3690ec91ef8
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
6:c3690ec91ef8 7:923ff622b8b9
    36 #include <hbgraphicsscene.h>
    36 #include <hbgraphicsscene.h>
    37 
    37 
    38 #include <QSortFilterProxyModel>
    38 #include <QSortFilterProxyModel>
    39 #include <QCompleter>
    39 #include <QCompleter>
    40 #include <QItemSelectionModel>
    40 #include <QItemSelectionModel>
       
    41 #include <QApplication>
       
    42 
    41 
    43 
    42 #ifdef HB_EFFECTS
    44 #ifdef HB_EFFECTS
    43 #include <hbeffect.h>
    45 #include <hbeffect.h>
    44 #include "hbeffectinternal_p.h"
    46 #include "hbeffectinternal_p.h"
    45 #define HB_DROPD0WN_ITEM_TYPE "HB_DROPDOWN"
    47 #define HB_DROPD0WN_ITEM_TYPE "HB_DROPDOWN"
   105 
   107 
   106     mButton = q->style( )->createPrimitive( HbStyle::P_ComboBox_button, q );
   108     mButton = q->style( )->createPrimitive( HbStyle::P_ComboBox_button, q );
   107     HbStyle::setItemName( mButton, "combobox_button" );
   109     HbStyle::setItemName( mButton, "combobox_button" );
   108 
   110 
   109     mButtonTouchAreaItem = q->style( )->createPrimitive( HbStyle::P_ComboBoxButton_toucharea, q );
   111     mButtonTouchAreaItem = q->style( )->createPrimitive( HbStyle::P_ComboBoxButton_toucharea, q );
   110     static_cast<HbTouchArea*>( mButtonTouchAreaItem )->installEventFilter( q );
       
   111     q->setHandlesChildEvents( true );
       
   112 
   112 
   113     static_cast<HbTouchArea*>( mButtonTouchAreaItem )->grabGesture( Qt::TapGesture );
   113     static_cast<HbTouchArea*>( mButtonTouchAreaItem )->grabGesture( Qt::TapGesture );
   114 }
   114 }
   115 
   115 
   116 void HbComboBoxPrivate::touchAreaPressEvent( )
   116 void HbComboBoxPrivate::touchAreaPressEvent( )
   146         if( !mDropDown->mList ) {
   146         if( !mDropDown->mList ) {
   147             mDropDown->createList( );
   147             mDropDown->createList( );
   148             mDropDown->mList->setModel( mModel );
   148             mDropDown->mList->setModel( mModel );
   149             q->connect( mDropDown->mList, SIGNAL( activated( QModelIndex ) ), q,
   149             q->connect( mDropDown->mList, SIGNAL( activated( QModelIndex ) ), q,
   150                 SLOT( _q_textChanged( QModelIndex ) ) );
   150                 SLOT( _q_textChanged( QModelIndex ) ) );
       
   151             //send layout request so that geometries of list view item are updated
       
   152             //and proper height is fetched in calculateListItemHeight
       
   153             QEvent layoutEvent(QEvent::LayoutRequest);
       
   154             QApplication::sendEvent(mDropDown->mList->contentWidget(), &layoutEvent);
   151         }
   155         }
   152         if ( mCurrentIndex.isValid( ) ) {
   156         if ( mCurrentIndex.isValid( ) ) {
   153             if( mDropDown->mList->model( ) != mModel ) {
   157             if( mDropDown->mList->model( ) != mModel ) {
   154                 mDropDown->mList->setModel( mModel );
   158                 mDropDown->mList->setModel( mModel );
   155             }
   159             }