]> git.sesse.net Git - vlc/commitdiff
lua: qt4: Fixing dropdown update function.
authorHugo Beauzée-Luyssen <beauze.h@gmail.com>
Thu, 7 Jul 2011 10:26:25 +0000 (12:26 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 7 Jul 2011 10:49:44 +0000 (12:49 +0200)
This closes #5000

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/dialogs/extensions.cpp

index a0640b627016140018ea4d978ce41fa8f007dcd1..e639c0d1689bec84a023bb31cb306c49f78231ae 100644 (file)
@@ -619,19 +619,19 @@ QWidget* ExtensionDialog::UpdateWidget( extension_widget_t *p_widget )
 
         case EXTENSION_WIDGET_DROPDOWN:
             comboBox = static_cast< QComboBox* >( p_widget->p_sys_intf );
-            comboBox->clear();
+            // method widget:clear()
+            if ( p_widget->p_values == NULL )
+            {
+                comboBox->clear();
+                return comboBox;
+            }
+            // method widget:addvalue()
             for( p_value = p_widget->p_values;
                  p_value != NULL;
                  p_value = p_value->p_next )
             {
-                comboBox->addItem( qfu( p_value->psz_text ), p_value->i_id );
-            }
-            /* Set current item */
-            if( p_widget->psz_text )
-            {
-                int idx = comboBox->findText( qfu( p_widget->psz_text ) );
-                if( idx >= 0 )
-                    comboBox->setCurrentIndex( idx );
+                if ( comboBox->findText( qfu( p_value->psz_text ) ) < 0 )
+                    comboBox->addItem( qfu( p_value->psz_text ), p_value->i_id );
             }
             return comboBox;