src/hbwidgets/widgets/hbcombobox.cpp
changeset 28 b7da29130b0e
parent 21 4633027730f5
--- a/src/hbwidgets/widgets/hbcombobox.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbwidgets/widgets/hbcombobox.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -31,6 +31,7 @@
 #include <hbtextitem.h>
 #include <hbstyleoptioncombobox_p.h>
 #include <hbnamespace_p.h>
+#include <hbmainwindow.h>
 #include <QStandardItemModel>
 #include <QGraphicsScene>
 #include <QDebug>
@@ -1053,6 +1054,41 @@
 /*!
     \reimp
  */
+void HbComboBox::polish( HbStyleParameters& params )
+{
+    Q_D(HbComboBox);
+    params.addParameter( "max-rows-in-dropdown" );
+    HbWidget::polish(params);
+
+    //read the maximum rows in drop down for different orientation from css
+    if (isVisible()) {
+        if( mainWindow( )->orientation( ) == Qt::Horizontal ) {
+            if( d->mDropDownRowsInLandscape == -1 ) {
+                d->mDropDownRowsInLandscape = params.value( "max-rows-in-dropdown" ).toInt( );
+                if( d->mDropDown && d->mDropDown->isVisible() ) {
+                    //if drop dow is visible in one mode and then orientation is changed then
+                    //drop down was not resized properly since positionDropDown is getting called
+                    //before polish(). Hence forcing to position drop down again.
+                    d->positionDropDown();
+                }
+            }
+        } else if( mainWindow( )->orientation( ) == Qt::Vertical ) {
+            if( d->mDropDownRowsInPortrait == -1 ) {
+                d->mDropDownRowsInPortrait = params.value( "max-rows-in-dropdown" ).toInt( );
+                if( d->mDropDown && d->mDropDown->isVisible() ) {
+                    //if drop dow is visible in one mode and then orientation is changed then
+                    //drop down was not resized properly since positionDropDown is getting called
+                    //before polish(). Hence forcing to position drop down again.
+                    d->positionDropDown();
+                }
+            }
+        }
+    }
+}
+
+/*!
+    \reimp
+ */
 QVariant HbComboBox::itemChange( GraphicsItemChange change, const QVariant & value )
 {
     Q_D( HbComboBox );
@@ -1083,7 +1119,6 @@
     HbWidget::changeEvent( event );
 }
 
-
 // End of file