src/hbwidgets/widgets/hbcombobox.cpp
changeset 28 b7da29130b0e
parent 21 4633027730f5
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    29 #include <hblistview.h>
    29 #include <hblistview.h>
    30 #include <hbtoucharea.h>
    30 #include <hbtoucharea.h>
    31 #include <hbtextitem.h>
    31 #include <hbtextitem.h>
    32 #include <hbstyleoptioncombobox_p.h>
    32 #include <hbstyleoptioncombobox_p.h>
    33 #include <hbnamespace_p.h>
    33 #include <hbnamespace_p.h>
       
    34 #include <hbmainwindow.h>
    34 #include <QStandardItemModel>
    35 #include <QStandardItemModel>
    35 #include <QGraphicsScene>
    36 #include <QGraphicsScene>
    36 #include <QDebug>
    37 #include <QDebug>
    37 
    38 
    38 #include <hbtapgesture.h>
    39 #include <hbtapgesture.h>
  1051 }
  1052 }
  1052 
  1053 
  1053 /*!
  1054 /*!
  1054     \reimp
  1055     \reimp
  1055  */
  1056  */
       
  1057 void HbComboBox::polish( HbStyleParameters& params )
       
  1058 {
       
  1059     Q_D(HbComboBox);
       
  1060     params.addParameter( "max-rows-in-dropdown" );
       
  1061     HbWidget::polish(params);
       
  1062 
       
  1063     //read the maximum rows in drop down for different orientation from css
       
  1064     if (isVisible()) {
       
  1065         if( mainWindow( )->orientation( ) == Qt::Horizontal ) {
       
  1066             if( d->mDropDownRowsInLandscape == -1 ) {
       
  1067                 d->mDropDownRowsInLandscape = params.value( "max-rows-in-dropdown" ).toInt( );
       
  1068                 if( d->mDropDown && d->mDropDown->isVisible() ) {
       
  1069                     //if drop dow is visible in one mode and then orientation is changed then
       
  1070                     //drop down was not resized properly since positionDropDown is getting called
       
  1071                     //before polish(). Hence forcing to position drop down again.
       
  1072                     d->positionDropDown();
       
  1073                 }
       
  1074             }
       
  1075         } else if( mainWindow( )->orientation( ) == Qt::Vertical ) {
       
  1076             if( d->mDropDownRowsInPortrait == -1 ) {
       
  1077                 d->mDropDownRowsInPortrait = params.value( "max-rows-in-dropdown" ).toInt( );
       
  1078                 if( d->mDropDown && d->mDropDown->isVisible() ) {
       
  1079                     //if drop dow is visible in one mode and then orientation is changed then
       
  1080                     //drop down was not resized properly since positionDropDown is getting called
       
  1081                     //before polish(). Hence forcing to position drop down again.
       
  1082                     d->positionDropDown();
       
  1083                 }
       
  1084             }
       
  1085         }
       
  1086     }
       
  1087 }
       
  1088 
       
  1089 /*!
       
  1090     \reimp
       
  1091  */
  1056 QVariant HbComboBox::itemChange( GraphicsItemChange change, const QVariant & value )
  1092 QVariant HbComboBox::itemChange( GraphicsItemChange change, const QVariant & value )
  1057 {
  1093 {
  1058     Q_D( HbComboBox );
  1094     Q_D( HbComboBox );
  1059     switch( change ) {
  1095     switch( change ) {
  1060         case QGraphicsItem::ItemScenePositionHasChanged:
  1096         case QGraphicsItem::ItemScenePositionHasChanged:
  1081             break;
  1117             break;
  1082     }
  1118     }
  1083     HbWidget::changeEvent( event );
  1119     HbWidget::changeEvent( event );
  1084 }
  1120 }
  1085 
  1121 
  1086 
       
  1087 // End of file
  1122 // End of file
  1088 
  1123 
  1089 
  1124