src/hbwidgets/widgets/hbcombobox.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 28 b7da29130b0e
--- a/src/hbwidgets/widgets/hbcombobox.cpp	Tue Jul 06 14:36:53 2010 +0300
+++ b/src/hbwidgets/widgets/hbcombobox.cpp	Wed Aug 18 10:05:37 2010 +0300
@@ -161,11 +161,16 @@
 
     \property HbComboBox::items
 
-    It replaces the existing list with \a texts.
+    It replaces the existing list with \a texts. If \a texts passed is empty then this function 
+    clears the model and returns. 
+
+    \sa clear()
 */
 void HbComboBox::setItems( const QStringList &texts )
 {  
     if ( texts.isEmpty( ) ) {
+        //if string list passed is empty then clear the current items in combobox
+        clear();
         return;
     }
     QStandardItemModel* model = new QStandardItemModel( this );
@@ -487,8 +492,8 @@
                         d->mText.clear( );
                         HbStyleOptionComboBox comboBoxOption;
                         initStyleOption( &comboBoxOption );
-                        style( )->updatePrimitive(
-                            d->mTextItem, HbStyle::P_ComboBox_text, &comboBoxOption );
+                        HbStylePrivate::updatePrimitive(
+                            d->mTextItem, HbStylePrivate::P_ComboBox_text, &comboBoxOption );
                     }
                 }
                 d->mCurrentIndex = QModelIndex();
@@ -509,8 +514,8 @@
                         d->mText = d->mModel->data( d->mCurrentIndex ).toString( );
                         HbStyleOptionComboBox comboBoxOption;
                         initStyleOption( &comboBoxOption );
-                        style( )->updatePrimitive(
-                            d->mTextItem, HbStyle::P_ComboBox_text, &comboBoxOption);
+                        HbStylePrivate::updatePrimitive(
+                            d->mTextItem, HbStylePrivate::P_ComboBox_text, &comboBoxOption);
                     }
                 }
                 d->currentIndexChanged( d->mCurrentIndex );
@@ -579,13 +584,13 @@
     Q_D( const HbComboBox );
 
     switch( primitive ) {
-        case HbStyle::P_ComboBox_text:
+        case HbStylePrivate::P_ComboBox_text:
             return d->mTextItem;
-        case HbStyle::P_ComboBox_background:
+        case HbStylePrivate::P_ComboBox_background:
             return d->mBackgroundItem;
-        case HbStyle::P_ComboBox_button:
+        case HbStylePrivate::P_ComboBox_button:
             return d->mButton;
-        case HbStyle::P_ComboBoxButton_toucharea:
+        case HbStylePrivate::P_ComboBoxButton_toucharea:
             return d->mButtonTouchAreaItem;
         default:
             return 0;
@@ -614,10 +619,10 @@
         styleOption.state |= QStyle::State_Sunken;
     }
     if ( d->mBackgroundItem ) {
-        style( )->updatePrimitive( 
-            d->mBackgroundItem, HbStyle::P_ComboBox_background, &styleOption );
-        style( )->updatePrimitive( 
-            d->mButton, HbStyle::P_ComboBox_button, &styleOption );
+        HbStylePrivate::updatePrimitive( 
+            d->mBackgroundItem, HbStylePrivate::P_ComboBox_background, &styleOption );
+        HbStylePrivate::updatePrimitive( 
+            d->mButton, HbStylePrivate::P_ComboBox_button, &styleOption );
     }
 }
 
@@ -641,7 +646,7 @@
                 d->mText.clear( );
                 HbStyleOptionComboBox comboBoxOption;
                 initStyleOption( &comboBoxOption );
-                style( )->updatePrimitive( d->mTextItem, HbStyle::P_ComboBox_text, &comboBoxOption );
+                HbStylePrivate::updatePrimitive( d->mTextItem, HbStylePrivate::P_ComboBox_text, &comboBoxOption );
             }
         }
     }
@@ -987,8 +992,8 @@
                         d->mText = text ;
                         HbStyleOptionComboBox comboBoxOption;
                         initStyleOption( &comboBoxOption );
-                        style( )->updatePrimitive(
-                            d->mTextItem, HbStyle::P_ComboBox_text, &comboBoxOption );
+                        HbStylePrivate::updatePrimitive(
+                            d->mTextItem, HbStylePrivate::P_ComboBox_text, &comboBoxOption );
                     }
                 }
             }